|
下面程序是在wcs下生成回转体,但我想在其他ucs下生成,不知如何实现?请知教
double pi=3.1415926535897932384626433832795;
int isRadio;
AcGeVector3d normal(0.0,0.0,1.);
isRadio=GetCheckedRadioButton(IDC_RADIO_BALL,IDC_RADIO_FACE);
AcGePoint2dArray pt;
pt.setLogicalLength(4);
if(isRadio==IDC_RADIO_BALL)
{pt[0].set(0.,0.);
pt[1].set(m_toolradius,m_toolradius);
pt[2].set(m_toolradius,m_toollength);
pt[3].set(0.,m_toollength);
AcDbPolyline *poly=new AcDbPolyline;
double bulge=22.5/180*pi;
bulge=tan(bulge);
for (int i=0;iaddVertexAt(i,pt[i],(i==0)?bulge:0.0,0.0,0.0);
}
poly->setClosed(true);
poly->setNormal(normal);
AcDbVoidPtrArray line,region;
line.append((void *)poly);
AcDbRegion::createFromCurves(line,region);
AcDbRegion *pRegion=AcDbRegion::cast((AcRxObject *)region[0]);
AcDb3dSolid *p3d=new AcDb3dSolid;
AcGePoint3d axisPoint (0.,0.,0.);
AcGeVector3d axisDir(0.,1.,0.);
p3d->revolve(pRegion,axisPoint,axisDir,2*pi);
AcDbObjectId id;
AcGePoint3d origin(0,0,m_tooldistance);
AcGeMatrix3d mat;
AcGeVector3d x(1,0,0),y(0,0,1),z(0,-1,0);
mat.setCoordSystem(origin,x,y,z);
p3d->transformBy(mat);
postToDatabase(p3d,id);
delete pRegion;
acedCommand(RTSTR,"REDRAW",0);
} |
|