static AcGePoint3dArray getControlPts(AcDbObjectId objId) { AcTransaction *pTrans = actrTransactionManager->startTransaction(); if (0 == pTrans) return NULL; AcDbObject *pObj; if (Acad::eOk != pTrans->getObject(pObj,objId,AcDb::kForRead)) return NULL; Chimney *chim = Chimney::cast(pObj); AcGePoint3dArray pts = chim->getControlPoint(); actrTransactionManager->endTransaction(); return pts; }
static void QTagGEDrawed(const AcDbObjectId& chimId) { AcTransaction *pTrans = actrTransactionManager->startTransaction(); if ( 0 == pTrans ) return; AcDbObject *pObj; if (Acad::eOk != pTrans->getObject(pObj,chimId,AcDb::kForRead)) return; Chimney *pChim = Chimney::cast(pObj); if ( 0 == pChim) { actrTransactionManager->abortTransaction(); return; } AcGePoint3dArray ctlPts = pChim->getControlPoint(); AcDbObjectId fanId; if(!DrawHelper::GetHostGE(chimId,fanId)) return; if (Acad::eOk != pTrans->getObject(pObj,fanId,AcDb::kForRead)) return; LocalFan *pFan = LocalFan::cast(pObj); if ( 0 == pFan) { actrTransactionManager->abortTransaction(); return; } AcGePoint3d insertPt = pFan->getInsertPt(); actrTransactionManager->endTransaction(); AcDbObjectIdArray QTags; DrawHelper::GetTagGEById2( chimId, _T( "QTagGE" ), QTags ); if (!QTags.isEmpty()) { ArxEntityHelper::EraseObjects( QTags, true ); } CString inQStr,outQStr; DataHelper::GetPropertyData(chimId,_T("入口风量(m3/s)"),inQStr); DataHelper::GetPropertyData(chimId,_T("出口风量(m3/s)"),outQStr); CString way; DataHelper::GetPropertyData(fanId,_T("工作方式"),way); if(way.IsEmpty() || inQStr.IsEmpty() || outQStr.IsEmpty()) return; QTagGE *pInQTag,*pOutQTag; if( _T("压入式") == way ) { pInQTag = new QTagGE(ctlPts[0],_tstof(inQStr)); if( pInQTag == 0 ) return; pOutQTag = new QTagGE(ctlPts[ctlPts.length()-1],_tstof(outQStr)); if( pOutQTag == 0 ) return; } if( _T("抽出式") == way ) { pOutQTag = new QTagGE(ctlPts[0],_tstof(outQStr)); if( pOutQTag == 0 ) return; pInQTag = new QTagGE(ctlPts[ctlPts.length()-1],_tstof(inQStr)); if( pInQTag == 0 ) return; } pOutQTag->setRelatedGE( chimId ); // 关联风筒 pInQTag->setRelatedGE( chimId ); // 关联风筒 // 初始化并提交到数据库 if( !ArxUtilHelper::PostToModelSpace( pOutQTag ) ) delete pOutQTag; if( !ArxUtilHelper::PostToModelSpace( pInQTag ) ) delete pInQTag; }