为什么???为什么???
<p>我加载的线行在打开CAD的第一个文档视里起作用。。。如果新建一个一个文档(文档)就不起作用了</p><p></p><p></p><p>源码附上。。。大家帮帮</p><p>//CON1LINE 是我自己做的线形。。。</p><p>acdbHostApplicationServices()->workingDatabase()->loadLineTypeFile("CON1LINE","acadiso.lin");<br/> <br/> AcDbLayerTable *pLayerTbl;<br/> acdbHostApplicationServices()->workingDatabase()<br/> ->getSymbolTable(pLayerTbl, AcDb::kForWrite);<br/> if (!pLayerTbl->has("ASDK_TESTLAYER")) {<br/> AcDbLayerTableRecord *pLayerTblRcd<br/> = new AcDbLayerTableRecord;<br/> pLayerTblRcd->setName("ASDK_TESTLAYER");<br/> pLayerTblRcd->setIsFrozen(0);// layer to THAWED<br/> pLayerTblRcd->setIsOff(0); // layer to ON<br/> pLayerTblRcd->setVPDFLT(0); // viewport default<br/> pLayerTblRcd->setIsLocked(0);// un-locked<br/> <br/> AcCmColor color;<br/> color.setColorIndex(1); // set color to red<br/> pLayerTblRcd->setColor(color);<br/> <br/> // For linetype, we need to provide the object ID of<br/> // the linetype record for the linetype we want to<br/> // use. First, we need to get the object ID.<br/> //<br/> AcDbLinetypeTable *pLinetypeTbl;<br/> AcDbObjectId ltId;<br/> acdbHostApplicationServices()->workingDatabase()<br/> ->getSymbolTable(pLinetypeTbl, AcDb::kForRead);<br/> if ((pLinetypeTbl->getAt("CON1LINE", ltId))<br/> != Acad::eOk)<br/> {<br/> acutPrintf("\nUnable to find DASHED"<br/> " linetype. Using CONTINUOUS");<br/> <br/> // CONTINUOUS is in every drawing, so use it.<br/> //<br/> pLinetypeTbl->getAt("CONTINUOUS", ltId);<br/> }<br/> pLinetypeTbl->close();<br/> <br/> pLayerTblRcd->setLinetypeObjectId(ltId);<br/> pLayerTbl->add(pLayerTblRcd);<br/> pLayerTblRcd->close();<br/> pLayerTbl->close();<br/> } else {<br/> pLayerTbl->close();<br/> acutPrintf("\nlayer already exists");</p> <p>起码基本功不扎实,除了“CONTINUOUS”,其他线型是不会自动加载到每一个新建的文档中的。</p><p>将你上面的程序写到一个过程中,再在On_kLoadDwgMsg中调用。。。</p> acdbHostApplicationServices()->workingDatabase()当前工作的文档数据库 acdbHostApplicationServices()->workingDatabase()指当前工作的文档数据库 这几天有点忙。。。感谢明经的兄弟了。。。我试试先。。。我原来是自学VC的。。。学ARX还没都久。。。。我资料也不多。。。望大家都都回答我这个菜鸟的问题。。。。哈哈。。。感谢了。。。
页:
[1]