Objectarx(求助)
<p>请教各位大虾:我是新手,在调试中出现以下错误,但是不知如何解决。所对应的程序是在教程上拷贝过来的!我用的是VC6.0和ObjectArx2002。</p><p>代码如下:</p><p>AcDbObjectId CCreateEnt::CreatePolygon(AcGePoint2d ptCenter, int number, double radius, double rotation, double width)<br/>{<br/> AcGePoint2dArray points; <br/> double angle=*CCalculation::PI()/(double)number; <br/> for (int i = 0; i < number; i++) <br/> {<br/> AcGePoint2d pt; <br/> pt.x = ptCenter.x + radius * cos(i * angle); <br/> pt.y = ptCenter.y + radius * sin(i * angle); <br/> points.append(pt); <br/> }<br/> AcDbObjectId polyId = CCreateEnt::CreatePolyline(points, width); <br/> <br/> // 将其闭合 <br/> AcDbEntity *pEnt; <br/> acdbOpenAcDbEntity(pEnt, polyId, AcDb::kForWrite); <br/> AcDbPolyline *pPoly=AcDbPolyline::cast(pEnt); <br/> if (pPoly!= NULL) <br/> { <br/> pPoly->setClosed(Adesk::kTrue); <br/> } <br/> pEnt->close(); <br/> CModifyEnt::Rotate(polyId, ptCenter, rotation); <br/> 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 '->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> function XML() {} 1,注意把包含的目录加上
2,把实体关闭不必那么麻烦
AcDbEntity *pEnt;
if ( Acad::eOk != acdbOpenAcDbEntity(pEnt, polyId, AcDb::kForWrite) )
return;
pEnt->setClosed(TRUE)//我不记得具体的方法是什么,你自己去查查看
pEnt->close();
//之后的代码自己加!
头文件都没include进来,程序怎么识别啊?
页:
[1]