- 积分
- 1865
- 明经币
- 个
- 注册时间
- 2002-12-4
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
在acadiso.lin 中定义有mylinetype,
在层中设定线型,使用AcDb2dPolyline()绘制二维多义线,但线型并没有按照指定的线型绘制线条,是否是在绘制前没有加载线型所致?线型又怎样加载呢?
先用createnewlayer() 并高定当前层,再画线:pNewPline = new AcDb2dPolyline( AcDb::k2dSimplePoly,parr,0,Adesk::kFalse,0.2*kk,0.2*kk,NULL);
在层中高定线型:
void createNewlayer(char *layer,Adesk::UInt16 colorIndex,char* linetype) { AcDbLayerTable *pLayerTable; AcDbObjectId layerId; acdbHostApplicationServices()->workingDatabase() ->getSymbolTable(pLayerTable,AcDb::kForWrite); if(!pLayerTable->has(layer)){ AcDbLayerTableRecord *pLayerTableRecord=new AcDbLayerTableRecord; pLayerTableRecord->setName(layer); pLayerTableRecord->setIsFrozen(0);//解冻层 pLayerTableRecord->setIsOff(0);//打开层 pLayerTableRecord->setVPDFLT(0);//视区为可见 pLayerTableRecord->setIsLocked(0);//解锁层 ///////////////////////////////// AcCmColor color; color.setColorIndex(colorIndex); pLayerTableRecord->setColor(color); /////////////////////////////////////////// AcDbLinetypeTable *pLineTypeTbl; AcDbObjectId ltId; acdbHostApplicationServices()->workingDatabase() ->getSymbolTable(pLineTypeTbl,AcDb::kForRead); if((pLineTypeTbl->getAt(linetype,ltId))!=Acad::eOk) { pLineTypeTbl->getAt("CONTINUOUS",ltId); } pLineTypeTbl->close();
pLayerTableRecord->setLinetypeObjectId(ltId); pLayerTable->add(pLayerTableRecord); pLayerTable->close(); pLayerTableRecord->close(); } else{ pLayerTable->close(); } }
|
|