[讨论]:[0519]如何将此倾斜矩形绘制程序简化?
本帖最后由 作者 于 2006-5-19 20:16:02 编辑 <br /><br /> <P>[讨论]:如何将此倾斜矩形绘制程序简化?</P><P>小弟练习将绘制矩形可以使用倾斜角度方式绘出,<BR>但个人认为程序应该可以简化,<BR>因此放上来请各位高手指点<BR>烦请各位可以提供宝贵的意见~<BR>谢谢~</P>
<P>(defun c:test ()<BR>(setq pt1 (getpoint "\n 长度方向基点:") )<BR>(setq pt2 (getpoint pt1 "\n 长度方向终点:") )<BR>(setq pt3 (getpoint pt2 "\n 宽度方向:") )<BR>(setq ofs (getdist pt2 "\n 宽度距离:") )<BR>(command "_.line" pt1 pt2 "")<BR>(setq en1 (entlast))<BR>(setq ob1 (entget en1))<BR>(command "_.offset" ofs en1 pt3 "" )<BR>(setq en2 (entlast))<BR>(setq ob2 (entget en2))<BR>(command "_.line" (cdr (assoc 10 ob1)) (cdr (assoc 10 ob2) ) "")<BR>(setq en3 (entlast))<BR>(command "_.line" (cdr (assoc 11 ob1)) (cdr (assoc 11 ob2) ) "")<BR>(setq en4 (entlast))</P>
<P>(setq ss (ssadd)) <BR>(ssadd en1 ss)<BR>(ssadd en2 ss)<BR>(ssadd en3 ss)<BR>(ssadd en4 ss)<BR>(setq i 0)</P>
<P> (while (< i (sslength ss))<BR> (setq ssa-ent (ssname ss i))<BR> (setq ent-p (cdr (assoc 0 (entget ssa-ent))))<BR> (if (not (null ent-p)) ;判断原图元是否已串入多义线<BR> (if (or (= ent-p "LWPOLYLINE") (= ent-p "POLYLINE"))<BR> ;判断原图元属性<BR> (command "pedit" ssa-ent "j" ss "" "")<BR> (command "pedit" ssa-ent "y" "j" ss "" "")<BR> )<BR> )<BR> (setq i (1+ i))<BR> )<BR>)<BR></P> vken7az2p发表于2006-5-19 18:37:00static/image/common/back.gif回复:(vken7az2p):如何将此倾斜矩形绘制程序简化?
:如何将此倾斜矩形绘制程序简化?
小弟练习将绘制矩形可以使用倾斜角度方式绘出,但个人认为程序应该可以简化,因此放上
第一个问题,,,程序名c;box,,,你使用过没有?<BR> <P>谢谢 <A name=14236><FONT color=#000066><B>xxsheng</B></FONT></A> 兄的指教</P>
<P>立刻改进~</P>
(defun c:test ()
(setq pt1 (getpoint "\n 长度方向基点:"))
(setq pt2 (getpoint pt1 "\n 长度方向终点:"))
(setq pt3 (getdist pt2 "\n 宽度尺寸:"))
(setq pt4 (polar pt2 (+ (angle pt1 pt2) (/ pi 2)) pt3))
(setq pt5 (polar pt1 (+ (angle pt1 pt2) (/ pi 2)) pt3))
(command "pline" pt1 pt2 pt4 pt5 "c")
(princ)
)
改成根据对角点坐标绘制倾斜矩形更好 只要用的时候感觉舒服就是好程序 小弟跟着学习了,多谢各位! ZZXXQQ 发表于 2006-5-21 08:45
感谢分享,很简洁
页:
[1]