精华内容
下载资源
问答
  • occ

    2017-08-18 11:17:09
     pBufferHandler->configOutBuffer(getNodeId(), BID_OCC_OUT_OCC, eDPETHMAP_PIPE_NODEID_WMF);  pBufferHandler->configOutBuffer(getNodeId(), BID_OCC_OUT_NOC, eDPETHMAP_PIPE_NODEID_WMF);  // pass ...
    /**=======================================================flm0====================================================================*/
    
    MBOOL
    OCCNode::
    onInit()
    {
        VSDOF_INIT_LOG("+");
        VSDOF_INIT_LOG("-");
        return MTRUE;
    }


    MBOOL
    OCCNode::
    onThreadStart()
    {
        VSDOF_INIT_LOG("+");
        CAM_TRACE_NAME("OCCNode::onThreadStart");
        // OCC HAL initialization
        mpOCCHAL = OCC_HAL::createInstance();
        VSDOF_INIT_LOG("-");


        return MTRUE;
    }


    MBOOL
    OCCNode::
    onData(DataID data, DepthMapRequestPtr& pRequest)
    {
        MBOOL bRet = MTRUE;
        VSDOF_LOGD("+, DataID=%d reqId=%d", data, pRequest->getRequestNo());


        switch(data)
        {
            case P2A_TO_OCC_MY_S:
                mMYSReqIDQueue.enque(pRequest->getRequestNo());
                break;
            case N3D_TO_OCC_LDC:
                mLDCReqIDQueue.enque(pRequest->getRequestNo());
                break;
            case DPE_TO_OCC_MVSV_DMP_CFM:
                VSDOF_PRFLOG("+ : reqID=%d size=%d", pRequest->getRequestNo(), mJobQueue.size());
                mJobQueue.enque(pRequest);
                break;
            default:
                MY_LOGW("Unrecongnized DataID=%d", data);
                bRet = MFALSE;
                break;
        }


        TRACE_FUNC_EXIT();
        return bRet;
    }


    MBOOL
    OCCNode::
    onThreadLoop()
    {
        MUINT32 iLDCReadyReqID, iMYSReadyReqID;
        DepthMapRequestPtr pRequest;


        if( !waitAllQueue() )
        {
            return MFALSE;
        }
        // get request
        if( !mJobQueue.deque(pRequest) )
        {
            MY_LOGE("mJobQueue.deque() failed");
            return MFALSE;
        }
        // get LDC request id
        if( !mLDCReqIDQueue.deque(iLDCReadyReqID) )
        {
            MY_LOGE("mLDCReqIDQueue.deque() failed");
            return MFALSE;
        }
        // get MYS request id
        if(!mMYSReqIDQueue.deque(iMYSReadyReqID) )
        {
            MY_LOGE("mMYSReqIDQueue.deque() failed");
            return MFALSE;
        }


        MUINT32 iReqNo = pRequest->getRequestNo();


        if(iReqNo != iLDCReadyReqID || iReqNo != iMYSReadyReqID)
        {
            MY_LOGE("The deque request is not consistent. iReqNo=%d  iLDCReadyReqID=%d iMYSReadyReqID=%d", iReqNo, iLDCReadyReqID, iMYSReadyReqID);
            return MFALSE;
        }


        CAM_TRACE_NAME("OCCNode::onThreadLoop");
        // mark on-going-request start
        this->incExtThreadDependency();
        VSDOF_LOGD("OCC threadloop start, reqID=%d", iReqNo);


        sp<BaseBufferHandler> pBufferHandler = pRequest->getBufferHandler();
        OCC_HAL_PARAMS occInputParams;
        OCC_HAL_OUTPUT occOutputParams;
        // prepare in/out params
        MBOOL bRet = prepareOCCParams(pRequest, occInputParams, occOutputParams);
        if(!bRet)
        {
            MY_LOGE("reqID=%d OCC ALGO stopped because of the enque parameter error.", iReqNo);
            goto lbExit;
        }
    //OCC algorithm start
        VSDOF_PRFLOG("OCC ALGO start, reqID=%d", pRequest->getRequestNo());
        // timer
        pRequest->mTimer.startOCC();
        CAM_TRACE_BEGIN("OCCNode::OCCHALRun");
        bRet = mpOCCHAL->OCCHALRun(occInputParams, occOutputParams);//call algorithm
        CAM_TRACE_END();
        // timer
        pRequest->mTimer.stopOCC();
    //OCC algorithm end
        VSDOF_PRFTIME_LOG("OCC ALGO end, reqID=%d, exec-time=%d msec",
                    pRequest->getRequestNo(), pRequest->mTimer.getElapsedOCC());




            // config output to WMF node
            pBufferHandler->configOutBuffer(getNodeId(), BID_P2A_OUT_MY_S, eDPETHMAP_PIPE_NODEID_WMF);
            pBufferHandler->configOutBuffer(getNodeId(), BID_OCC_OUT_OCC,  eDPETHMAP_PIPE_NODEID_WMF);
            pBufferHandler->configOutBuffer(getNodeId(), BID_OCC_OUT_NOC,  eDPETHMAP_PIPE_NODEID_WMF);
            // pass data
            handleDataAndDump(OCC_TO_WMF_OMYSN, pRequest);//2 yuv files


        // launch onProcessDone
        pBufferHandler->onProcessDone(getNodeId());//release res
        // mark on-going-request end
        this->decExtThreadDependency();


        return MTRUE;
    }


    /**======================================================flm1======================================================================================================*/


    main_log.3:01-01 00:24:23.634904   645  4704 D DepthMapPipe/OCCNode: [onInit][VSDOF_INIT] 88: +
    main_log.3:01-01 00:24:23.634927   645  4704 D DepthMapPipe/OCCNode: [onInit][VSDOF_INIT] 89: -
    main_log.3:01-01 00:24:23.638305   645  4741 D DepthMapPipe/OCCNode: [onThreadStart][VSDOF_INIT] 106: +
    main_log.3:01-01 00:24:23.653643   645  4741 D DepthMapPipe/OCCNode: [onThreadStart][VSDOF_INIT] 110: -
    main_log.3:01-01 00:24:24.239736   645  4727 D DepthMapPipe/OCCNode: [onData]131: +, DataID=22 reqId=0
    main_log.3:01-01 00:24:24.297629   645  4744 D DepthMapPipe/OCCNode: [onData]131: +, DataID=6 reqId=0
    main_log.3:01-01 00:24:24.363367   645  4750 D DepthMapPipe/OCCNode: [onData]131: +, DataID=8 reqId=0
    main_log.3:01-01 00:24:24.363406   645  4750 D DepthMapPipe/OCCNode: [onData][VSDOF_Profile] 142: + : reqID=0 size=0
    main_log.3:01-01 00:24:24.363519   645  4741 D DepthMapPipe/OCCNode: [onThreadLoop]196: OCC threadloop start, reqID=0
    main_log.3:01-01 00:24:24.363811   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]Input::
    main_log.3:01-01 00:24:24.363851   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]=======================:param.imgBuf_MV_Y
    main_log.3:01-01 00:24:24.363883   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff size=544x144
    main_log.3:01-01 00:24:24.363911   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff plane count=3
    main_log.3:01-01 00:24:24.363937   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff format=32315659
    main_log.3:01-01 00:24:24.363972   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff getImgBitsPerPixel=12
    main_log.3:01-01 00:24:24.364000   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]=======================
    main_log.3:01-01 00:24:24.364030   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]=======================:param.imgBuf_SV_Y
    main_log.3:01-01 00:24:24.364061   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff size=544x144
    main_log.3:01-01 00:24:24.364149   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff plane count=3
    main_log.3:01-01 00:24:24.364182   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff format=32315659
    main_log.3:01-01 00:24:24.364228   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff getImgBitsPerPixel=12
    main_log.3:01-01 00:24:24.364266   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]=======================
    main_log.3:01-01 00:24:24.364297   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]=======================:param.imgBuf_DMP_L
    main_log.3:01-01 00:24:24.364337   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff size=544x144
    main_log.3:01-01 00:24:24.364365   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff plane count=1
    main_log.3:01-01 00:24:24.364402   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff format=20363159
    main_log.3:01-01 00:24:24.364435   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff getImgBitsPerPixel=16
    main_log.3:01-01 00:24:24.364474   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]=======================
    main_log.3:01-01 00:24:24.364504   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]=======================:param.imgBuf_DMP_R
    main_log.3:01-01 00:24:24.364531   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff size=544x144
    main_log.3:01-01 00:24:24.364557   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff plane count=1
    main_log.3:01-01 00:24:24.364593   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff format=20363159
    main_log.3:01-01 00:24:24.364623   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff getImgBitsPerPixel=16
    main_log.3:01-01 00:24:24.364652   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]=======================
    main_log.3:01-01 00:24:24.364682   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]=======================:param.imageMain1Bayer
    main_log.3:01-01 00:24:24.364711   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff size=240x136
    main_log.3:01-01 00:24:24.364737   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff plane count=3
    main_log.3:01-01 00:24:24.364762   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff format=32315659
    main_log.3:01-01 00:24:24.364791   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff getImgBitsPerPixel=12
    main_log.3:01-01 00:24:24.364816   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]=======================
    main_log.3:01-01 00:24:24.364839   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]Output::
    main_log.3:01-01 00:24:24.364867   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]=======================:param.occMap
    main_log.3:01-01 00:24:24.364895   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff size=240x136
    main_log.3:01-01 00:24:24.364924   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff plane count=1
    main_log.3:01-01 00:24:24.364949   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff format=20203859
    main_log.3:01-01 00:24:24.364977   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff getImgBitsPerPixel=8
    main_log.3:01-01 00:24:24.365005   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]=======================
    main_log.3:01-01 00:24:24.365055   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]=======================:param.nocMap
    main_log.3:01-01 00:24:24.365119   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff size=240x136
    main_log.3:01-01 00:24:24.365147   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff plane count=1
    main_log.3:01-01 00:24:24.365699   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff format=20203859
    main_log.3:01-01 00:24:24.365747   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff getImgBitsPerPixel=8
    main_log.3:01-01 00:24:24.365885   645  4741 D DepthMapPipe/OCCNode: [debugOCCParams]=======================
    main_log.3:01-01 00:24:24.365956   645  4741 D DepthMapPipe/OCCNode: [onThreadLoop][VSDOF_Profile] 209: OCC ALGO start, reqID=0
    main_log.3:01-01 00:24:24.375407   645  4741 D DepthMapPipe/OCCNode: [onThreadLoop][VSDOF_Profile] 218: OCC ALGO end, reqID=0, exec-time=9 msec
    main_log.3:01-01 00:24:24.375639   645  4741 D DepthMapPipe/Utils: [onDump]OCCNode onDump reqID=0 dataid=9(OCC_TO_WMF_OMYSN)
    main_log.3:01-01 00:24:24.375684   645  4741 D DepthMapPipe/Utils: [onDump]289: makePath: /sdcard/vsdof/pv_vr/Rear/0/OCCNode
    main_log.3:01-01 00:24:24.377354   645  4741 D DepthMapPipe/Utils: [onDump]331: saveToFile: /sdcard/vsdof/pv_vr/Rear/0/OCCNode/BID_OCC_OUT_OCC_240x136.yuv
    main_log.3:01-01 00:24:24.378363   645  4741 D DepthMapPipe/Utils: [onDump]331: saveToFile: /sdcard/vsdof/pv_vr/Rear/0/OCCNode/BID_OCC_OUT_NOC_240x136.yuv
    main_log.4:01-01 00:15:36.282425   645  4023 D DepthMapPipe/OCCNode: [onInit][VSDOF_INIT] 88: +
    main_log.4:01-01 00:15:36.282458   645  4023 D DepthMapPipe/OCCNode: [onInit][VSDOF_INIT] 89: -
    main_log.4:01-01 00:15:36.284035   645  4067 D DepthMapPipe/OCCNode: [onThreadStart][VSDOF_INIT] 106: +
    main_log.4:01-01 00:15:36.299217   645  4067 D DepthMapPipe/OCCNode: [onThreadStart][VSDOF_INIT] 110: -
    main_log.4:01-01 00:15:36.936039   645  4046 D DepthMapPipe/OCCNode: [onData]131: +, DataID=22 reqId=0
    main_log.4:01-01 00:15:37.015225   645  4064 D DepthMapPipe/OCCNode: [onData]131: +, DataID=6 reqId=0
    main_log.4:01-01 00:15:37.106392   645  4068 D DepthMapPipe/OCCNode: [onData]131: +, DataID=8 reqId=0
    main_log.4:01-01 00:15:37.106429   645  4068 D DepthMapPipe/OCCNode: [onData][VSDOF_Profile] 142: + : reqID=0 size=0
    main_log.4:01-01 00:15:37.108705   645  4067 D DepthMapPipe/OCCNode: [onThreadLoop]196: OCC threadloop start, reqID=0
    main_log.4:01-01 00:15:37.109017   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]Input::
    main_log.4:01-01 00:15:37.109049   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]=======================:param.imgBuf_MV_Y
    main_log.4:01-01 00:15:37.109136   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff size=544x144
    main_log.4:01-01 00:15:37.109171   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff plane count=3
    main_log.4:01-01 00:15:37.109200   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff format=32315659
    main_log.4:01-01 00:15:37.109239   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff getImgBitsPerPixel=12
    main_log.4:01-01 00:15:37.109270   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]=======================
    main_log.4:01-01 00:15:37.109300   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]=======================:param.imgBuf_SV_Y
    main_log.4:01-01 00:15:37.109329   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff size=544x144
    main_log.4:01-01 00:15:37.109356   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff plane count=3
    main_log.4:01-01 00:15:37.109382   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff format=32315659
    main_log.4:01-01 00:15:37.109413   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff getImgBitsPerPixel=12
    main_log.4:01-01 00:15:37.109440   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]=======================
    main_log.4:01-01 00:15:37.109471   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]=======================:param.imgBuf_DMP_L
    main_log.4:01-01 00:15:37.109501   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff size=544x144
    main_log.4:01-01 00:15:37.109528   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff plane count=1
    main_log.4:01-01 00:15:37.109558   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff format=20363159
    main_log.4:01-01 00:15:37.109590   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff getImgBitsPerPixel=16
    main_log.4:01-01 00:15:37.109618   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]=======================
    main_log.4:01-01 00:15:37.109650   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]=======================:param.imgBuf_DMP_R
    main_log.4:01-01 00:15:37.109689   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff size=544x144
    main_log.4:01-01 00:15:37.109727   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff plane count=1
    main_log.4:01-01 00:15:37.109764   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff format=20363159
    main_log.4:01-01 00:15:37.109805   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff getImgBitsPerPixel=16
    main_log.4:01-01 00:15:37.109835   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]=======================
    main_log.4:01-01 00:15:37.109875   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]=======================:param.imageMain1Bayer
    main_log.4:01-01 00:15:37.109918   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff size=240x136
    main_log.4:01-01 00:15:37.109950   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff plane count=3
    main_log.4:01-01 00:15:37.109978   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff format=32315659
    main_log.4:01-01 00:15:37.110009   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff getImgBitsPerPixel=12
    main_log.4:01-01 00:15:37.110037   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]=======================
    main_log.4:01-01 00:15:37.110080   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]Output::
    main_log.4:01-01 00:15:37.110110   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]=======================:param.occMap
    main_log.4:01-01 00:15:37.110138   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff size=240x136
    main_log.4:01-01 00:15:37.110166   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff plane count=1
    main_log.4:01-01 00:15:37.110207   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff format=20203859
    main_log.4:01-01 00:15:37.110239   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff getImgBitsPerPixel=8
    main_log.4:01-01 00:15:37.110266   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]=======================
    main_log.4:01-01 00:15:37.110294   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]=======================:param.nocMap
    main_log.4:01-01 00:15:37.110338   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff size=240x136
    main_log.4:01-01 00:15:37.110384   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff plane count=1
    main_log.4:01-01 00:15:37.110427   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff format=20203859
    main_log.4:01-01 00:15:37.110475   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]imageBuff getImgBitsPerPixel=8
    main_log.4:01-01 00:15:37.110508   645  4067 D DepthMapPipe/OCCNode: [debugOCCParams]=======================
    main_log.4:01-01 00:15:37.110552   645  4067 D DepthMapPipe/OCCNode: [onThreadLoop][VSDOF_Profile] 209: OCC ALGO start, reqID=0
    main_log.4:01-01 00:15:37.119799   645  4067 D DepthMapPipe/OCCNode: [onThreadLoop][VSDOF_Profile] 218: OCC ALGO end, reqID=0, exec-time=9 msec
    main_log.4:01-01 00:15:37.120008   645  4067 D DepthMapPipe/Utils: [onDump]OCCNode onDump reqID=0 dataid=9(OCC_TO_WMF_OMYSN)
    main_log.4:01-01 00:15:37.120059   645  4067 D DepthMapPipe/Utils: [onDump]289: makePath: /sdcard/vsdof/pv_vr/Rear/0/OCCNode
    main_log.4:01-01 00:15:37.121515   645  4067 D DepthMapPipe/Utils: [onDump]331: saveToFile: /sdcard/vsdof/pv_vr/Rear/0/OCCNode/BID_OCC_OUT_OCC_240x136.yuv
    main_log.4:01-01 00:15:37.122426   645  4067 D DepthMapPipe/Utils: [onDump]331: saveToFile: /sdcard/vsdof/pv_vr/Rear/0/OCCNode/BID_OCC_OUT_NOC_240x136.yuv


    /*==============================================================flm2==========================================*/
    展开全文
  • occ类说明,介绍了常用的几何建模使用类,并有具体实例
  • pythonocc实例

    2019-01-06 12:58:40
    该实例为pythonocc库的实例,可以帮助你快速熟悉pythonocc库函数的使用,从而快速打造自己的cad软件
  • 1212OCC-源码

    2021-02-16 18:27:45
    1212OCC
  • 一些与pythonocc相关的代码段,示例,jupter笔记本等。 要求 : pythonocc-core 7.4.1 conda install -c conda-forge pythonocc-core=7.4.1 jupyter,如果要测试jupyter笔记本以及pythreejs。 仓库结构: 资源...
  • /usr/bin/env python#-*- coding:utf-8 -*-##Copyright 2009-2015 Thomas Paviot (tpaviot@gmail.com)####This file is part of pythonOCC.####pythonOCC is free software: you can redistribute it and/or modif.....

    #!/usr/bin/env python#-*- coding:utf-8 -*-

    ##Copyright 2009-2015 Thomas Paviot (tpaviot@gmail.com)####This file is part of pythonOCC.####pythonOCC is free software: you can redistribute it and/or modify##it under the terms of the GNU Lesser General Public License as published by##the Free Software Foundation, either version 3 of the License, or##(at your option) any later version.####pythonOCC is distributed in the hope that it will be useful,##but WITHOUT ANY WARRANTY; without even the implied warranty of##MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the##GNU Lesser General Public License for more details.####You should have received a copy of the GNU Lesser General Public License##along with pythonOCC. If not, see .

    importmathfrom OCC.gp importgp_Pnt, gp_OX, gp_Vec, gp_Trsf, gp_DZ, gp_Ax2, gp_Ax3, gp_Pnt2d, gp_Dir2d, gp_Ax2dfrom OCC.GC importGC_MakeArcOfCircle, GC_MakeSegmentfrom OCC.GCE2d importGCE2d_MakeSegmentfrom OCC.Geom importGeom_Plane, Geom_CylindricalSurface, Handle_Geom_Plane, Handle_Geom_Surfacefrom OCC.Geom2d importGeom2d_Ellipse, Geom2d_TrimmedCurve, Handle_Geom2d_Ellipse, Handle_Geom2d_Curvefrom OCC.BRepBuilderAPI importBRepBuilderAPI_MakeEdge, BRepBuilderAPI_MakeWire, BRepBuilderAPI_MakeFace, \

    BRepBuilderAPI_Transformfrom OCC.BRepPrimAPI importBRepPrimAPI_MakePrism, BRepPrimAPI_MakeCylinderfrom OCC.BRepFilletAPI importBRepFilletAPI_MakeFilletfrom OCC.BRepAlgoAPI importBRepAlgoAPI_Fusefrom OCC.BRepOffsetAPI importBRepOffsetAPI_MakeThickSolid, BRepOffsetAPI_ThruSectionsfrom OCC.BRepLib importbreplibfrom OCC.BRep importBRep_Tool_Surface, BRep_Builderfrom OCC.TopoDS importtopods, TopoDS_Edge, TopoDS_Compoundfrom OCC.TopExp importTopExp_Explorerfrom OCC.TopAbs importTopAbs_EDGE, TopAbs_FACEfrom OCC.TopTools importTopTools_ListOfShapefrom OCC.Display.SimpleGui import *

    defface_is_plane(face):"""判断 TopoDS_Shape 是不是 plane"""hs=BRep_Tool_Surface(face)

    downcast_result=Handle_Geom_Plane.DownCast(hs)#不能通过Handle_Geom_Plane转换的不是平面

    return notdowncast_result.IsNull()defgeom_plane_from_face(aFace):"""通过 planar surface 得到 geometric plane"""

    returnHandle_Geom_Plane.DownCast(BRep_Tool_Surface(aFace)).GetObject()

    height= 70width= 50thickness= 30

    if 1:#准备用来创建 瓶身 的点

    aPnt1 = gp_Pnt(-width / 2.0, 0, 0)

    aPnt2= gp_Pnt(-width / 2.0, -thickness / 4.0, 0)

    aPnt3= gp_Pnt(0, -thickness / 2.0, 0)

    aPnt4= gp_Pnt(width / 2.0, -thickness / 4.0, 0)

    aPnt5= gp_Pnt(width / 2.0, 0, 0)#瓶底断面线段和圆弧

    aArcOfCircle =GC_MakeArcOfCircle(aPnt2, aPnt3, aPnt4)

    aSegment1=GC_MakeSegment(aPnt1, aPnt2)

    aSegment2=GC_MakeSegment(aPnt4, aPnt5)#除了下面的方法, 也可以不用上面的segment,而通过点直接创建线段edges

    aEdge1 =BRepBuilderAPI_MakeEdge(aSegment1.Value())

    aEdge2=BRepBuilderAPI_MakeEdge(aArcOfCircle.Value())

    aEdge3=BRepBuilderAPI_MakeEdge(aSegment2.Value())#通过edges 创建 wire

    aWire =BRepBuilderAPI_MakeWire(aEdge1.Edge(), aEdge2.Edge(), aEdge3.Edge())#得到X轴的便捷方式

    xAxis =gp_OX()#设置镜像轴

    aTrsf =gp_Trsf()

    aTrsf.SetMirror(xAxis)#应用镜像变换

    aBRespTrsf =BRepBuilderAPI_Transform(aWire.Wire(), aTrsf)#得到镜像 shape

    aMirroredShape =aBRespTrsf.Shape()#通过通用shape得到 wire

    aMirroredWire =topods.Wire(aMirroredShape)#组合两个wire

    mkWire =BRepBuilderAPI_MakeWire()

    mkWire.Add(aWire.Wire())

    mkWire.Add(aMirroredWire)

    myWireProfile=mkWire.Wire()#创建用于体拉伸 sweep 的面

    myFaceProfile =BRepBuilderAPI_MakeFace(myWireProfile)#我们把面沿Z轴拉伸到指定高度

    aPrismVec =gp_Vec(0, 0, height)

    myBody=BRepPrimAPI_MakePrism(myFaceProfile.Face(), aPrismVec)#通过explorer对所有边加倒角

    mkFillet =BRepFilletAPI_MakeFillet(myBody.Shape())

    anEdgeExplorer=TopExp_Explorer(myBody.Shape(), TopAbs_EDGE)whileanEdgeExplorer.More():

    anEdge=topods.Edge(anEdgeExplorer.Current())

    mkFillet.Add(thickness/ 12.0, anEdge)

    anEdgeExplorer.Next()

    myBody=mkFillet#创建瓶颈

    neckLocation =gp_Pnt(0, 0, height)

    neckAxis=gp_DZ()

    neckAx2=gp_Ax2(neckLocation, neckAxis)

    myNeckRadius= thickness / 4.0myNeckHeight= height / 10.0mkCylinder=BRepPrimAPI_MakeCylinder(neckAx2, myNeckRadius, myNeckHeight)

    myBody=BRepAlgoAPI_Fuse(myBody.Shape(), mkCylinder.Shape())#下面找到Z最高的面, 并将它移除

    faceToRemove =None

    zMax= -1

    #遍历所有的面, 查找Z最高的面

    aFaceExplorer =TopExp_Explorer(myBody.Shape(), TopAbs_FACE)whileaFaceExplorer.More():

    aFace=topods.Face(aFaceExplorer.Current())ifface_is_plane(aFace):

    aPlane=geom_plane_from_face(aFace)

    aPnt=aPlane.Location()

    aZ=aPnt.Z()if aZ >zMax:

    zMax=aZ

    faceToRemove=aFace

    aFaceExplorer.Next()

    facesToRemove=TopTools_ListOfShape()

    facesToRemove.Append(faceToRemove)

    myBody= BRepOffsetAPI_MakeThickSolid(myBody.Shape(), facesToRemove, -thickness / 50.0, 0.001)#建立需要创建螺纹的瓶颈表面

    neckAx2_Ax3 =gp_Ax3(neckLocation, gp_DZ())

    aCyl1= Geom_CylindricalSurface(neckAx2_Ax3, myNeckRadius * 0.99)

    aCyl2= Geom_CylindricalSurface(neckAx2_Ax3, myNeckRadius * 1.05)#建立创建螺纹的曲线

    aPnt = gp_Pnt2d(2.0 * math.pi, myNeckHeight / 2.0)

    aDir= gp_Dir2d(2.0 * math.pi, myNeckHeight / 4.0)

    anAx2d=gp_Ax2d(aPnt, aDir)

    aMajor= 2.0 *math.pi

    aMinor= myNeckHeight / 5.0anEllipse1=Geom2d_Ellipse(anAx2d, aMajor, aMinor)

    anEllipse2= Geom2d_Ellipse(anAx2d, aMajor, aMinor / 8.0)

    anArc1=Geom2d_TrimmedCurve(Handle_Geom2d_Ellipse(anEllipse1), 0, math.pi)

    anArc2=Geom2d_TrimmedCurve(Handle_Geom2d_Ellipse(anEllipse2), 0, math.pi)

    anEllipsePnt1=anEllipse1.Value(0)

    anEllipsePnt2=anEllipse1.Value(math.pi)

    aSegment=GCE2d_MakeSegment(anEllipsePnt1, anEllipsePnt2)#构建用于螺纹的边和环

    anEdge1OnSurf1 =BRepBuilderAPI_MakeEdge(Handle_Geom2d_Curve(anArc1), Handle_Geom_Surface(aCyl1))

    anEdge2OnSurf1=BRepBuilderAPI_MakeEdge(aSegment.Value(), Handle_Geom_Surface(aCyl1))

    anEdge1OnSurf2=BRepBuilderAPI_MakeEdge(Handle_Geom2d_Curve(anArc2), Handle_Geom_Surface(aCyl2))

    anEdge2OnSurf2=BRepBuilderAPI_MakeEdge(aSegment.Value(), Handle_Geom_Surface(aCyl2))

    threadingWire1=BRepBuilderAPI_MakeWire(anEdge1OnSurf1.Edge(), anEdge2OnSurf1.Edge())

    threadingWire2=BRepBuilderAPI_MakeWire(anEdge1OnSurf2.Edge(), anEdge2OnSurf2.Edge())#计算边和环的三维表现

    breplib.BuildCurves3d(threadingWire1.Shape())

    breplib.BuildCurves3d(threadingWire2.Shape())#创建螺纹的表面

    aTool =BRepOffsetAPI_ThruSections(True)

    aTool.AddWire(threadingWire1.Wire())

    aTool.AddWire(threadingWire2.Wire())

    aTool.CheckCompatibility(False)

    myThreading=aTool.Shape()#构建组合结果

    aRes =TopoDS_Compound()

    aBuilder=BRep_Builder()

    aBuilder.MakeCompound(aRes)

    aBuilder.Add(aRes, myBody.Shape())

    aBuilder.Add(aRes, myThreading)

    display, start_display, add_menu, add_function_to_menu=init_display()

    display.DisplayColoredShape(aRes)

    start_display()

    展开全文
  • pythonOCC

    2020-12-08 15:47:46
    condainstall-cdlr-scpythonocc-core 配置pythonOCC之后,安装pyqt5要进入虚拟环境安装才行 先激活虚拟环境:conda activate pythonocct 安装:pyqt5pip install pyqt5
    # first create an environment
    conda create --name=pyoccenv python=3.7
    source activate pyoccenv
    conda install -c conda-forge pythonocc-core=7.4.1
    

    conda install -c dlr-sc pythonocc-core

    配置pythonOCC之后,安装相关模块需要进入虚拟环境安装才行,比如

    1. 先激活虚拟环境:conda activate pythonocct
    2. 安装:pyqt5pip install pyqt5
    展开全文
  • pythonocc-core About pythonocc provides 3D modeling and dataexchange features. It is intended to CAD/PDM/PLM and BIM related development. Latest release : pythonocc-core 7.5.1 (march 2021) Features ...
  • pythonocc的BRepPrimAPI在OCC.Core.BRepPrimAPI里

    pythonocc的BRepPrimAPI在OCC.Core.BRepPrimAPI里

    展开全文
  • PythonOCC的安装

    2019-04-04 13:08:05
    PythonOCC是 tpaviot 利用python封装OpenCASCADE的社区版本而成的开源CAD库,为广大python用户操纵CAD带来了极大的便利。
  • OCC安装手册

    2014-12-20 08:37:03
    occ安装用文档参考,适合visual 2010后版本
  • OCC学习资料

    2012-10-18 20:28:37
    OCC的参考文档cdl,介绍occ的基本框架和occ的语言结构,初学者可以看看
  • pythonocc自定义对话框

    2018-12-09 19:49:10
    使用pythonocc为库,以pyqt中的qtdesigner为工具设计一个自定义对话框。 实现了点击 一个点弹出自定义对话框
  • pythonocc character

    2021-10-13 14:13:05
    from OCC.Core.Addons import text_to_brep, Font_FontAspect_Bold, Font_FA_Regular from OCC.Core.BRepAdaptor import BRepAdaptor_Surface from OCC.Core.TopExp import TopExp_Explorer from OCC.Core.TopAbs ...
  • R2012b代码Occ_Aware 该代码基于论文“具有时空一致性的基于遮挡感知片段的跟踪”。 如果您发现我们的论文有用,请考虑引用我们的论文: @article {sun2016occlusion, title = {具有时空一致性的基于遮挡感知片段的...
  • opencascade OCC中文帮助文档
  • OCC控制台程序.docx

    2021-03-13 15:43:14
    OCC创建一个控制台程序
  • building_pythonocc 一堆脚本来与伟大的pythonocc源代码相处(在linux64系统上测试) 1.设定 在build_scripts/installation_settings.sh将工作目录和路径设置为swig3。 以我为例,用swig2构建pythonocc失败了! ...
  • wuqiaoboostpfc_occ_OCC_boost单周期_boost控制_无桥boostpfcocc_无桥.zip
  • from OCC.Core.BRepOffset import BRepOffset_Skin 我发现一个规律,某个类在pythonocc的哪个库的规律,这个类的库名是这个类的类名的下划线的前面的单词。比如说A_B类,那就从pythonocc的A库中import,比如说...
  • OCC Debugger-crx插件

    2021-03-25 19:59:18
    语言:English (United States) 添加一些功能来调试OCC 适用于开发人员的简单OCC(Oracle Commerce云)调试器。 包括以下功能:-Cookies调试-主题调试-旋转器调试-用于敲除检查的Devtools面板-敲除数据序列化
  • wuqiaoboostpfc_occ_OCC_boost单周期_boost控制_无桥boostpfcocc_无桥_源码.zip
  • 这里返回总目录>>返回总目录core_classic_occ_bottle.py本例从https://github.com/tpaviot/pythonocc-demos搬运而来运行版本:0.18.2在其余版本运行不保证正确先上结果图代码部分import mathfrom OCC.Core.gp import...
  • OCC 宣传手册

    2013-01-23 22:36:18
    OCC操作自动化中心,侧重操作审计的硬件产品,可以记录出用户的个中操作不错,录像回放
  • OCC的下载与安装简介

    2020-10-18 14:09:55
    OCC 的官网 http://www.opencascade.org/getocc/download/loadocc/上下载 OpenCASCADE651.zip,大约 67M。Open CASCADE Technology 6.5.1 can be installed with binaries pre-compiled by Visual C++ 8.0 using...
  • occ-debugger-源码

    2021-05-15 13:32:55
    OCC调试器-Chrome扩展程序 一个扩展,可帮助occ开发人员调试平台。 用法 下载最新版本的zip文件,将其解压缩。 访问chrome://extensions ,启用开发人员模式并通过“ Load unpacked文件”按钮Load unpacked提取的...
  • anaconda安装pythonocc

    2020-07-08 09:12:22
    打开anaconda prompt, 输入命令conda install -c tpaviot -c conda-forge -c dlr-sc -c oce -c pythonocc pythonocc-core,这条命令在我的电脑上可以行得通。tpaviot是conda的channel。官网上的命令( conda install...
  • mineflayer-occ-bot-源码

    2021-03-20 09:27:42
    mineflayer-occ-bot
  • pythonOCC也就是opencascade的python封装版本 1.所需材料 anaconda Anaconda指的是一个开源的Python发行版本,其包含了conda、Python等180多个科学包及其依赖项。 使用anaconda配置环境,则可以免去相当多的...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 7,380
精华内容 2,952
关键字:

OCC