本文整理汇总了C++中AcDbLayerTable::downgradeOpen方法的典型用法代码示例。如果您正苦于以下问题:C++ AcDbLayerTable::downgradeOpen方法的具体用法?C++ AcDbLayerTable::downgradeOpen怎么用?C++ AcDbLayerTable::downgradeOpen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcDbLayerTable
的用法示例。
在下文中一共展示了AcDbLayerTable::downgradeOpen方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddEntityToLayer
// This command demonstrates the use of kCleanup / kReuse flags
void AddEntityToLayer (AsdkHlrCollector &collector, ACHAR *layerName) {
//----- Check layer
if ( layerName != NULL && *layerName != ACRX_T('\0') ) {
AcDbDatabase *pDb =acdbHostApplicationServices ()->workingDatabase () ;
AcDbLayerTable *pLayerTable ;
pDb->getLayerTable (pLayerTable, AcDb::kForRead) ;
if ( !pLayerTable->has (layerName) ) {
AcDbLayerTableRecord *pLayerRecord =new AcDbLayerTableRecord ;
pLayerRecord->setName (layerName) ;
pLayerTable->upgradeOpen () ;
pLayerTable->add (pLayerRecord) ;
pLayerTable->downgradeOpen () ;
pLayerRecord->close () ;
pLayerTable->close () ;
applyCurDwgLayerTableChanges () ;
} else {
pLayerTable->close () ;
}
} else {
layerName =NULL ;
}
//----- Assign color to the resulting entities
//----- red for visible edges
//----- blue for non-visible edges
//----- yellow for internal edges
int n =collector.mOutputData.logicalLength () ;
for ( int i =0 ; i < n ; i++ ) {
AsdkHlrData *p =collector.mOutputData [i] ;
AcDbEntity *pEnt =p->getResultEntity () ;
AsdkHlrData::Visibility vis =p->getVisibility () ;
if ( vis == AsdkHlrData::kVisible ) {
pEnt->setColorIndex (1) ; //----- Read
} else if ( vis == AsdkHlrData::kInternallyHidden ) {
if ( p->getHlrVisibility () == AsdkHlrData::kVisible )
pEnt->setColorIndex (2) ; //----- Yellow
else
pEnt->setColorIndex (3) ; //----- Green
} else {
pEnt->setColorIndex (5) ; //----- Blue
}
if ( layerName != NULL )
pEnt->setLayer (layerName) ;
AcDbObjectId id ;
if ( postToDatabase (NULL, pEnt, id) != Acad::eOk ) {
acutPrintf (_T("Failed to add entity to current space.\n")) ;
break ;
}
//----- Entity originator path for block reference entities
AcDbObjectIdArray ids =p->getObjectIds () ;
if ( ids.logicalLength () > 0 ) {
acutPrintf (ACRX_T("\n%ld, "), pEnt->objectId ().asOldId ()) ;
for ( int j =0 ; j < ids.logicalLength () ; j++ ) {
acutPrintf (ACRX_T("%ld, "), ids.at (j).asOldId ()) ;
}
}
pEnt->close () ;
}
}