qszchew 发表于 2009-9-12 14:54:00

Objectarx(求助)

<p>请教各位大虾:我是新手,在调试中出现以下错误,但是不知如何解决。所对应的程序是在教程上拷贝过来的!我用的是VC6.0和ObjectArx2002。</p><p>代码如下:</p><p>AcDbObjectId CCreateEnt::CreatePolygon(AcGePoint2d ptCenter, int number, double radius, double rotation, double width)<br/>{<br/>&nbsp;AcGePoint2dArray points; <br/>&nbsp;double angle=*CCalculation::PI()/(double)number; <br/>&nbsp;for (int i = 0; i &lt; number; i++) <br/>&nbsp;{<br/>&nbsp;&nbsp;AcGePoint2d pt; <br/>&nbsp;&nbsp;pt.x = ptCenter.x + radius * cos(i * angle); <br/>&nbsp;&nbsp;pt.y = ptCenter.y + radius * sin(i * angle); <br/>&nbsp;&nbsp;points.append(pt); <br/>&nbsp;}<br/>&nbsp;AcDbObjectId polyId = CCreateEnt::CreatePolyline(points, width); <br/>&nbsp;<br/>&nbsp;// 将其闭合 <br/>&nbsp;AcDbEntity *pEnt; <br/>&nbsp;acdbOpenAcDbEntity(pEnt, polyId, AcDb::kForWrite); <br/>&nbsp;AcDbPolyline *pPoly=AcDbPolyline::cast(pEnt); <br/>&nbsp;if (pPoly!= NULL) <br/>&nbsp;{ <br/>&nbsp;&nbsp;pPoly-&gt;setClosed(Adesk::kTrue); <br/>&nbsp;} <br/>&nbsp;pEnt-&gt;close(); <br/>&nbsp;CModifyEnt::Rotate(polyId, ptCenter, rotation); <br/>&nbsp;return polyId; </p><p>}</p><p>错误如下:</p><p>D:\TEST\CreateEnts\CreateEnt.cpp(153) : error C2653: 'CCalculation' : is not a class or namespace name<br/>D:\TEST\CreateEnts\CreateEnt.cpp(153) : error C2065: 'PI' : undeclared identifier<br/>D:\TEST\CreateEnts\CreateEnt.cpp(153) : error C2100: illegal indirection<br/>D:\TEST\CreateEnts\CreateEnt.cpp(166) : error C2065: 'AcDbPolyline' : undeclared identifier<br/>D:\TEST\CreateEnts\CreateEnt.cpp(166) : error C2065: 'pPoly' : undeclared identifier<br/>D:\TEST\CreateEnts\CreateEnt.cpp(166) : error C2653: 'AcDbPolyline' : is not a class or namespace name<br/>D:\TEST\CreateEnts\CreateEnt.cpp(166) : error C2065: 'cast' : undeclared identifier<br/>D:\TEST\CreateEnts\CreateEnt.cpp(166) : error C2106: '=' : left operand must be l-value<br/>D:\TEST\CreateEnts\CreateEnt.cpp(169) : error C2227: left of '-&gt;setClosed' must point to class/struct/union<br/>D:\TEST\CreateEnts\CreateEnt.cpp(172) : error C2653: 'CModifyEnt' : is not a class or namespace name<br/>D:\TEST\CreateEnts\CreateEnt.cpp(172) : error C2065: 'Rotate' : undeclared identifier<br/>执行 cl.exe 时出错.</p>

wj_job 发表于 2009-9-13 05:31:00

function XML() {
   
}

luowy 发表于 2009-9-13 12:35:00

1,注意把包含的目录加上
2,把实体关闭不必那么麻烦

AcDbEntity *pEnt;
if ( Acad::eOk != acdbOpenAcDbEntity(pEnt, polyId, AcDb::kForWrite) )
return;
pEnt->setClosed(TRUE)//我不记得具体的方法是什么,你自己去查查看
pEnt->close();
//之后的代码自己加!

th_gsb 发表于 2009-9-15 16:45:00

头文件都没include进来,程序怎么识别啊?
页: [1]
查看完整版本: Objectarx(求助)