我加载的线行在打开CAD的第一个文档视里起作用。。。如果新建一个一个文档(文档)就不起作用了 源码附上。。。大家帮帮 //CON1LINE 是我自己做的线形。。。 acdbHostApplicationServices()->workingDatabase()->loadLineTypeFile("CON1LINE","acadiso.lin"); AcDbLayerTable *pLayerTbl; acdbHostApplicationServices()->workingDatabase() ->getSymbolTable(pLayerTbl, AcDb::kForWrite); if (!pLayerTbl->has("ASDK_TESTLAYER")) { AcDbLayerTableRecord *pLayerTblRcd = new AcDbLayerTableRecord; pLayerTblRcd->setName("ASDK_TESTLAYER"); pLayerTblRcd->setIsFrozen(0);// layer to THAWED pLayerTblRcd->setIsOff(0); // layer to ON pLayerTblRcd->setVPDFLT(0); // viewport default pLayerTblRcd->setIsLocked(0);// un-locked AcCmColor color; color.setColorIndex(1); // set color to red pLayerTblRcd->setColor(color); // For linetype, we need to provide the object ID of // the linetype record for the linetype we want to // use. First, we need to get the object ID. // AcDbLinetypeTable *pLinetypeTbl; AcDbObjectId ltId; acdbHostApplicationServices()->workingDatabase() ->getSymbolTable(pLinetypeTbl, AcDb::kForRead); if ((pLinetypeTbl->getAt("CON1LINE", ltId)) != Acad::eOk) { acutPrintf("\nUnable to find DASHED" " linetype. Using CONTINUOUS"); // CONTINUOUS is in every drawing, so use it. // pLinetypeTbl->getAt("CONTINUOUS", ltId); } pLinetypeTbl->close(); pLayerTblRcd->setLinetypeObjectId(ltId); pLayerTbl->add(pLayerTblRcd); pLayerTblRcd->close(); pLayerTbl->close(); } else { pLayerTbl->close(); acutPrintf("\nlayer already exists"); |