明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1380|回复: 0

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

[复制链接]
发表于 2003-6-2 14:38 | 显示全部楼层 |阅读模式
下面程序是在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;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[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);
               
                }
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-17 17:24 , Processed in 0.545627 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表