;;;程序加了详细的注释,下面的例子是生成一个平行于x轴的圆柱体 (vl-load-com) ;_加载vl ;;;师兄 QQ 361865648 2009/2 (defun c:test (/ acadapp doc mspace ucss ort xvec yvec newucs mat cyl) (setq acadapp (vlax-get-acad-object)) ;_acad程序 (setq doc (vla-get-ActiveDocument acadapp)) ;_活动文档 (setq mspace (vla-get-ModelSpace doc)) ;_模型空间 (setq ucss (vla-get-UserCoordinateSystems doc)) ;_用户坐标系统 (setq org (vlax-3d-point '(0 0 0))) ;_坐标中心 (setq xvec (vlax-3d-point '(0 0 1))) ;_x方向 (setq yvec (vlax-3d-point '(0 1 0))) ;_y方向 (setq newucs (vla-add ucss org xvec yvec "Myucs")) ;_新建坐标系 ;(vla-put-ActiveUCS doc newucs) (setq mat (vla-GetUCSMatrix newucs)) ;_新坐标系变换矩阵 (setq cyl (vla-AddCylinder mspace org 10 15)) ;_生成圆柱体 (vla-TransformBy cyl mat) ;_变换到新坐标系 (princ)(princ);_静默退出 ) |