新手求教!自定义函数怎么添加
static void Create3dSolid_AddBox(void){
// Add your code for command Create3dSolid._AddBox here
AcDb3dSolid *pSolid = new AcDb3dSolid();
Acad::ErrorStatus es = pSolid->createBox(40, 50, 30);
if (es != Acad::eOk)
{
acedAlert(_T("创建长方体失败!"));
delete pSolid;
return;
}
//使用几何变换矩阵移动长方体
AcGeMatrix3d xform;
AcGeVector3d vec(100, 100, 100);
xform.setToTranslation(vec);
pSolid->transformBy(xform);
//将长方体添加到模型空间
PostToModelSpace(pSolid);
PostToModelSpace(pSolid);这个自定义函数应该怎么添加/?
//对象添加到模型空间
Acad::ErrorStatus PostToModelSpace( AcDbEntity* pEnt)
{
Acad::ErrorStatus es;
AcDbObjectId entId;
AcDbBlockTable *pBlockTable;
es = acdbHostApplicationServices()->workingDatabase()
->getBlockTable(pBlockTable, AcDb::kForRead);
if (es != Acad::eOk)
{
pBlockTable->close();
pEnt->close();
return es;
}
AcDbBlockTableRecord *pBlockTableRecord;
es = pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord,AcDb::kForWrite);
if (es != Acad::eOk)
{
pBlockTable->close();
pBlockTableRecord->close();
pEnt->close();
return es;
}
es = pBlockTableRecord->appendAcDbEntity(entId, pEnt);
pBlockTable->close();
pBlockTableRecord->close();
pEnt->close();
return es;
}
Gu_xl 发表于 2013-9-30 16:58 static/image/common/back.gif
//对象添加到模型空间
Acad::ErrorStatus PostToModelSpace( AcDbEntity* pEnt)
{
我是小菜鸟一只,不知道这个自定义函数应该加在哪。。。。 丢人了。。。好最简单的问题让我整的这么复杂。。谢谢了问题已解决
页:
[1]