wangdan 发表于 2003-6-2 14:38:00

下面程序是在wcs下生成回转体,但我想在其他ucs下生成,不知如何实现?请知教

下面程序是在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.set(0.,0.);
                pt.set(m_toolradius,m_toolradius);
                pt.set(m_toolradius,m_toollength);
                pt.set(0.,m_toollength);
                AcDbPolyline *poly=new AcDbPolyline;
                double bulge=22.5/180*pi;
                bulge=tan(bulge);
                for (int i=0;i<4;i++)
                        {poly->addVertexAt(i,pt,(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);
                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);
               
                }
页: [1]
查看完整版本: 下面程序是在wcs下生成回转体,但我想在其他ucs下生成,不知如何实现?请知教