初学者写的两个实现函数,请教问题出在哪里.
<p>我是ARX初学者,用于做毕业论文,写了两个小函数,但尝试编译的时候,没有达到预期的效果,请高手指点,谢谢!</p><p>函数一:</p><p>函数的期望实现目标:新建一个图层,并同时确实线型和图层颜色。</p><p>void CreateNewLayer(const ACHAR* pNewLayerName,const ACHAR* pLinetypeName,int colorNo)<br/>{<br/> AcDbDatabase *pCurDb;<br/> AcDbLayerTable *pLayerTable;<br/> pCurDb=acdbHostApplicationServices()->workingDatabase();<br/> pCurDb->getLayerTable(pLayerTable,AcDb::kForWrite);<br/> if (pLayerTable->has(pNewLayerName))<br/> {<br/> pLayerTable->close();<br/> return ;<br/> }<br/> AcDbLayerTableRecord *pLayerTblRecord = new AcDbLayerTableRecord;<br/> pLayerTblRecord->setName(pNewLayerName);</p><p> AcCmColor color;<br/> color.setColorIndex(colorNo); <br/> pLayerTblRecord->setColor(color);</p><p> AcDbLinetypeTable *pLinetypeTbl;<br/> pCurDb->getLinetypeTable(pLinetypeTbl,AcDb::kForWrite);<br/> AcDbObjectId ltypeObjId;<br/> pLinetypeTbl->getAt(pLinetypeName,ltypeObjId);<br/> pLayerTblRecord->setLinetypeObjectId(ltypeObjId);<br/> pLayerTable->add(pLayerTblRecord);</p><p> pLinetypeTbl->close();<br/> pLayerTable->close();<br/> pLayerTblRecord->close();<br/> return ;<br/> <br/>} </p><p>函数二:</p><p>函数的期望实现目标:将图层转换到期望的图层再进行绘图编辑。</p><p>void CCreateEnt::ChangeLayer(const ACHAR* LayerName)<br/>{<br/> AcDbLayerTable *pLayerTbl;<br/> acdbHostApplicationServices()->workingDatabase()<br/> ->getLayerTable(pLayerTbl, AcDb::kForRead);<br/> //是否已经包含指定的层表记录<br/> if (pLayerTbl->has(LayerName))<br/> {<br/> pLayerTbl->close();<br/> return;<br/> }<br/> <br/> AcDbLayerTableRecord *pLayerTblRcd;<br/> pLayerTbl->getAt(LayerName,pLayerTblRcd,AcDb::kForWrite);<br/> //acdbHostApplicationServices()->workingDatabase()->setClayer(layerTblRcdId);</p><p> pLayerTbl->close();<br/> pLayerTblRcd->close();<br/> return;<br/>}</p><p></p><p>请大侠指教一下问题出在哪里,谢谢!!</p><p><br/></p> 自己已经解决
页:
[1]