- UID
- 209413
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2005-1-7
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2005-1-7 22:15:59
|
显示全部楼层
非常感谢!
最初由 binbin 发布
[B]程序没问题,就是不可调试,可能是工程设置有误 [/B]
非常感谢您的帮忙,嗯。程序没有问题啊。我也觉的是,不过工程也没有问题,因为我这里可以调试,编译,就是运行命令的时候说什么内部错误,eWasOpenForWrite,。。。
工程里面就这2个函数,呵呵。看来是我这个autocad2002 D版有问题了。谢了!明天我换个机器看看。
再次感谢。
而且那么请看如下代码:
void arx93()
{
double d1,d2,d3,d4,d,l1,l2,fillet_r,n;
d1=50;
d2=70;
d3=110;
d4=90;
d=8;
l1=110;
l2=20;
fillet_r=2;
n=6;
double af=(2*3.14)/n, chamfer_d=2;
AcGePoint2dArray pt2d;
pt2d.setLogicalLength(10);
pt2d[0].set(-0.5*d1,0);
pt2d[1].set(-0.5*d1,l1-chamfer_d);
pt2d[2].set(-0.5*d1-chamfer_d,l1);
pt2d[3].set(-0.5*d2+chamfer_d,l1);
pt2d[4].set(-0.5*d2,l1-chamfer_d);
pt2d[5].set(-0.5*d2,l2+fillet_r);
pt2d[6].set(-0.5*d2-fillet_r, l2);
pt2d[7].set(-0.5*d3+chamfer_d,l2);
pt2d[8].set(-0.5*d3,l2-chamfer_d);
pt2d[9].set(-0.5*d3,0);
AcGeVector3d normal(0,0,1);
AcDbPolyline *poly=new AcDbPolyline;
for(int i=0; i<10; i++) {
poly->addVertexAt(i,pt2d,0,0,0);
}
poly->setClosed(Adesk::kTrue);
poly->setNormal(normal);
AcDbVoidPtrArray lines, regions;
lines.append((void*)poly);
AcDbRegion::createFromCurves(lines,regions);
AcDbRegion* pRegion=AcDbRegion::cast((AcRxObject*)regions[0]);
pRegion->close();
AcDb3dSolid *p3dObj=new AcDb3dSolid;
AcGePoint3d axisPoint(0,0,0);
AcGeVector3d axisDir(0,1,0);
if(Acad::eOk==p3dObj->revolve(pRegion,axisPoint,axisDir,2*3.14))
AddEntityToDbs(p3dObj);
AcGeMatrix3d mat;
AcGeVector3d x(1,0,0),y(0,0,1),z(0,1,0);
AcGePoint3d moveBy;
moveBy.y=0.5*l2;
moveBy.x=0.5*d4*cos(af*1);
moveBy.z=0.5*d4*sin(af*1);
AcDb3dSolid *p3dObj1=new AcDb3dSolid;
p3dObj1->createFrustum(l2,0.5*d,0.5*d,0.5*d);
mat.setCoordSystem(moveBy,x,y,z);
p3dObj1->transformBy(mat);
AddEntityToDbs(p3dObj1);
//if(p3dObj->booleanOper(AcDb::kBoolUnite ,p3dObj1)==Acad::eGeneralModelingFailure)
// ads_printf("\n建模失败\n");
p3dObj1->close();
//上面这个布尔操作一运行就出错!!奇怪啊。按理这2个实体是可以进行布尔并运算的,因为我手动用autocad的union命令都可以将他们2个unite。这是为什么?程序中实现就出错呢?出错信息也是“内部错误,...ewasopenforwrite"多谢
//代码有点繁琐,但是前面的数字那些不用管,逻辑肯定没有问题~~如果注释掉布尔运算的那行代码,那么程序会正确的产生2个实体。
delete poly;
delete pRegion;
} |
|