马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
http://www.xdcad.net/forum/showt ... y=&pagenumber=2
最初由 真龙天子 发布
[B]能否请gysjy再进一步开发一下,使之能沿splline或者pline线(不一定封闭)所形成的边界剪裁,鼠标点线的左边即剪掉与线相交实体的左边部分,鼠标点线的右边即剪掉与线相交实体的右边部分.这样就可以适应各种剪裁需要了,不知能否达到? [/B]
命令名:qtrim
使用时,将拾取框指向直线或多义线,则偏向拾取框一侧的图元被自动剪除。得到一种特殊效果。
- [FONT=courier new]
- (defun to(n)
- (cdr (assoc n (entget sn)))
- )
- (defun MODES (a)
- (setq MLST '())
- (repeat (length a)
- (setq MLST (append MLST (list (list (car a) (getvar (car a))))))
- (setq a (cdr a))
- )
- )
- (defun MODER ()
- (repeat (length MLST)
- (setvar (caar MLST) (cadar MLST))
- (setq MLST (cdr MLST))
- )
- )
- (princ "\n界线剪切,命令名: qtrim。GYSJY, 2007.8.21")
- (defun c:qtrim(/ sn p0 p1 p2 s1 s2 lst)
- (command "undo" "g")
- (modes '("cmdecho" "osmode" "pickbox" "APERTURE" ))
- (setvar "cmdecho" 0)
- (setvar "osmode" 0)
- (setvar "pickbox" 5)
- (setvar "APERTURE" 5)
- (graphscr)
- (while (setq sn (entsel "\n选择界线:"))
- (setq p0 (cadr sn) sn (car sn))
- (if (or (= (to 0) "LINE")(= (to 0) "LWPOLYLINE"))
- (progn
- (command "offset" "0.1" sn p0 "")
- (setq s1 sn sn (entlast))
- (cond
- ((= "LINE" (to 0))
- (setq p1 (to 10) p2 (to 11) lst (list p1 p2))
- (command "trim" s1 "" "f" p1 p2 "" "")
- (if (setq s2 (ssget "f" lst))(command "erase" s2 ""))
- (command "erase" sn "")
- )
- ((= "LWPOLYLINE" (to 0))
- (plpoint)
- (repeat 5
- (command "trim" s1 "" "f" (foreach n lst (command n) "" ) "")
- )
- (if (setq s2 (ssget "f" lst))(command "erase" s2 ""))
- )
- (t
-
- )
- )
- )
- (princ "\n>>>界线类型应为:LINE / LWPOLYLINE")
- )
- )
- (moder)
- (command "undo" "e")
- (princ)
- )
- (defun plpoint(/ en n ei );;求得PLINE线的各个顶点;
- (setq en (entget sn)
- n 0 lst '()
- )
- (while (/= (setq ei (nth n en)) nil)
- (if (= (car ei) 10)
- (setq lst (cons (cdr ei) lst))
- )
- (setq n (1+ n))
- )
- (setq lst (reverse lst)); lst (cons (last lst) lst))
- (if (= (to 70) 1)(setq lst (cons (last lst) lst)))
- (princ)
- )
- [/FONT]
|