先执行主程序SL
defun c:sl () (vl-load-com) (setq ent (car (entsel "pick up the object"))) (setq entv (vlax-ename->vla-object ent)) (vla-getboundingbox entv 'pt1 'pt2) (setq h (abs (- (last (vlax-safearray->list pt1));获取圆柱体的高 (last (vlax-safearray->list pt2)) ) ) ) (setq z (last (vlax-safearray->list pt2)));获取底圆的中心z坐标
(setq sl (/ h 10));将高分为10等份 (setq sec (ssadd)); (setq i 0)
(repeat 11 (setq dh (+ z (* i sl))) ;获取每个截圆的z坐标 (setq zp (list 0 0 dh)) ;获取每个截圆的中心坐标zp (command "section" ent "" "xy" "" zp) :将上面的坐标zp用在获取截圆上 (command "bl") ;对它执行上面的子程序bl,这步改为(setq ee (bl zp)),好像还是不对 (setq sec (ssadd (entlast) sec)) ;将得到的新各个截面的轮廓线收入一个集合中 (setq i (1+ i)) )
(command "surftab1" 500 "") ;改变系统变量surftab1成500
(setq i 0) (repeat 10 (setq f (entget (ssname sec 0))) ;从上面得到的集合中取出第一个截面新轮廓 (setq g (entget (ssname sec 1))) ;从上面得到的集合中取出下一个截面新轮廓 (command "rulesurf" f g ) ;将它们联成一曲面 (setq i (1+ i)) ) (princ) )
这是执行时 command history.里显示的内容:
Command: SL pick up the objectsection Select objects: 1 found Select objects: Specify first point on Section plane by [Object/Zaxis/View/XY/YZ/ZX/3points] <3points>: xy Specify a point on the XY-plane <0,0,0>: Command: Command: ; error: bad function: (0 0 5.70287)
提示错误在(setq ee (bl zp)),这一步的zp.
非常感谢!