本文整理汇总了C++中AcDbEntity::color方法的典型用法代码示例。如果您正苦于以下问题:C++ AcDbEntity::color方法的具体用法?C++ AcDbEntity::color怎么用?C++ AcDbEntity::color使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcDbEntity
的用法示例。
在下文中一共展示了AcDbEntity::color方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: asdktest5
void asdktest5 () {
//----- Select the entities
ads_name ss, en ;
if ( acedSSGet (NULL, NULL, NULL, NULL, ss) != RTNORM )
return ;
//----- Append entity IDs to the collector
long n ;
AcDbObjectId id ;
AsdkHlrCollector collector ;
acedSSLength (ss, &n) ;
for ( int i =0 ; i < n ; i++ ) {
acedSSName (ss, i, en) ;
acdbGetObjectId (id, en) ;
collector.addEntity (id) ;
}
acedSSFree (ss) ;
//----- Display a dialog box to select HLR controls, the user wants to apply to the HLR engine
AfxSetResourceHandle (_hdllInstance) ;
CControlsDlg dlg ;
dlg.mnControls =kProject | kEntity | kBlock | kHonorInternals ;
if ( dlg.DoModal () != IDOK ) {
AfxSetResourceHandle (acedGetAcadResourceInstance ()) ;
return ;
}
AfxSetResourceHandle (acedGetAcadResourceInstance ()) ;
int control =dlg.mnControls ;
acutPrintf (ACRX_T("\nAbout to call hidden Line calculation")) ;
acutPrintf (ACRX_T("\nCalling with %d Entities"), collector.getInputEntityIds ().logicalLength ()) ;
acutPrintf (ACRX_T("\nkProject %s "), control & kProject ? ACRX_T("On") : ACRX_T("Off")) ;
acutPrintf (ACRX_T("\nkShowAll %s "), control & kShowAll ? ACRX_T("On") : ACRX_T("Off")) ;
acutPrintf (ACRX_T("\nkEntity %s "), control & kEntity ? ACRX_T("On") : ACRX_T("Off")) ;
acutPrintf (ACRX_T("\nkBlock %s "), control & kBlock ? ACRX_T("On") : ACRX_T("Off")) ;
acutPrintf (ACRX_T("\nkSubentity %s "), control & kSubentity ? ACRX_T("On") : ACRX_T("Off")) ;
acutPrintf (ACRX_T("\nkHideTangents %s "), control & kHideTangents ? ACRX_T("On") : ACRX_T("Off")) ;
acutPrintf (ACRX_T("\nkCleanup %s "), control & kCleanup ? ACRX_T("On") : ACRX_T("Off")) ;
acutPrintf (ACRX_T("\nkIsolines %s "), control & kIsolines ? ACRX_T("On") : ACRX_T("Off")) ;
acutPrintf (ACRX_T("\nkUnite %s "), control & kUnite ? ACRX_T("On") : ACRX_T("Off")) ;
acutPrintf (ACRX_T("\nkReuse %s "), control & kReuse ? ACRX_T("On") : ACRX_T("Off")) ;
acutPrintf (ACRX_T("\nkProgress %s "), control & kProgress ? ACRX_T("On") : ACRX_T("Off")) ;
acutPrintf (ACRX_T("\nkHandlePoints %s "), control & kHandlePoints ? ACRX_T("On") : ACRX_T("Off")) ;
acutPrintf (ACRX_T("\nkHonorInternals %s "), control & kHonorInternals ? ACRX_T("On") : ACRX_T("Off")) ;
acutPrintf (ACRX_T("\nkMeshSilhouettes %s "), control & kMeshSilhouettes ? ACRX_T("On") : ACRX_T("Off")) ;
//----- Ask for virtual viewport settings
AcDbViewport *pVp =NULL ;
if ( !pickViewport (pVp) )
return ;
//----- Process hidden line removal
AsdkHlrEngine hlr (pVp, control) ;
hlr.run (collector) ;
delete pVp ;
//----- The following code will collect the color of the originator entity of an edge
//----- and will assign it to the resulting entity.
actrTransactionManager->startTransaction () ;
int nOutput =collector.mOutputData.logicalLength () ;
acutPrintf (ACRX_T("\nHlr returned %d curves"), nOutput) ;
for ( int j =0 ; j < nOutput ; j++ ) {
AsdkHlrData *pResult =collector.mOutputData [j] ;
AcDbEntity *pResultEntity =pResult->getResultEntity () ;
AcDbObjectId id ;
if ( postToDatabase (NULL, pResultEntity, id) != Acad::eOk ) {
acutPrintf (_T("Failed to add entity to current space.\n")) ;
break ;
}
actrTransactionManager->getObject ((AcDbObject *&)pResultEntity, id, AcDb::kForWrite) ;
AcDbObjectIdArray ids =pResult->getObjectIds () ;
int last =ids.logicalLength () - 1 ;
AcCmColor color ;
AcDbObjectId layerId ;
color.setColorIndex (0) ;
while ( last >= 0 && color.colorIndex () == 0 ) {
AcDbObjectId innerId =ids.at (last) ;
AcDbObject *pObj ;
actrTransactionManager->getObject (pObj, innerId, AcDb::kForRead) ;
AcDbEntity *pEnt =AcDbEntity::cast (pObj) ;
color =pEnt->color () ;
layerId =pEnt->layerId () ;
last-- ;
}
if ( layerId != AcDbObjectId::kNull ) {
pResultEntity->setColor (color) ;
pResultEntity->setLayer (layerId) ;
} else {
AcDbEntity *pEnt =pResult->getEntity () ;
if ( pEnt != NULL ) {
pResultEntity->setColor (pEnt->color ()) ;
pResultEntity->setLayer (pEnt->layer ()) ;
}
}
pResultEntity->close () ;
//.........这里部分代码省略.........