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