本帖最后由 作者 于 2006-5-19 20:16:02 编辑
[讨论]:[0519]如何将此倾斜矩形绘制程序简化?
小弟练习将绘制矩形可以使用倾斜角度方式绘出, 但个人认为程序应该可以简化, 因此放上来请各位高手指点 烦请各位可以提供宝贵的意见~ 谢谢~
(defun c:test () (setq pt1 (getpoint "\n 长度方向基点:") ) (setq pt2 (getpoint pt1 "\n 长度方向终点:") ) (setq pt3 (getpoint pt2 "\n 宽度方向:") ) (setq ofs (getdist pt2 "\n 宽度距离:") ) (command "_.line" pt1 pt2 "") (setq en1 (entlast)) (setq ob1 (entget en1)) (command "_.offset" ofs en1 pt3 "" ) (setq en2 (entlast)) (setq ob2 (entget en2)) (command "_.line" (cdr (assoc 10 ob1)) (cdr (assoc 10 ob2) ) "") (setq en3 (entlast)) (command "_.line" (cdr (assoc 11 ob1)) (cdr (assoc 11 ob2) ) "") (setq en4 (entlast))
(setq ss (ssadd)) (ssadd en1 ss) (ssadd en2 ss) (ssadd en3 ss) (ssadd en4 ss) (setq i 0)
(while (< i (sslength ss)) (setq ssa-ent (ssname ss i)) (setq ent-p (cdr (assoc 0 (entget ssa-ent)))) (if (not (null ent-p)) ;判断原图元是否已串入多义线 (if (or (= ent-p "LWPOLYLINE") (= ent-p "POLYLINE")) ;判断原图元属性 (command "pedit" ssa-ent "j" ss "" "") (command "pedit" ssa-ent "y" "j" ss "" "") ) ) (setq i (1+ i)) ) )
|