我希望做个一个插件,先选择多段线,在选择方向,就可以把多段线范围内,该方向的线全部减掉。我自己做出来的是2点多段线的,想请教各位大神,如果多段线是多节点多段线,应该怎么做。
- (defun err1 (msg)
- (command)
- (setvar "OSMODE" osmode_bak)
- (setvar "CMDECHO" cmdecho_bak)
- (command "_.undo" "_end");;定义撤销结束处
- (setq *error* olderr)
- (princ)
- )
- (defun c:tt(/ )
- (command "_.undo" "_begin");;定义撤销开始处
- (setq olderr *error*
- *error* err1
- );定义错误函数
- (setq osmode_bak (getvar "OSMODE"));;记录当前捕捉设置
- (setq cmdecho_bak (getvar "CMDECHO"));;记录当前回显设置
- (setvar "OSMODE" 0)
- (setvar "CMDECHO" 0)
- (setq rongcha 0.1);设置容差
- (setq ss (ssget ":E:S" '((0 . "*LINE"))))
- (setq en (ssname ss 0))
- (setq p1 (getpoint "\n剪切方向"));用户坐标
- (command "OFFSET" rongcha en p1 "")
- (setq e1 (entlast))
- (setq pt1 (vlax-curve-getstartpoint e1))
- (setq pt2 (vlax-curve-getendpoint e1))
- (entdel e1)
- (setq pt1 (trans pt1 0 1)
- pt2 (trans pt2 0 1)
- );转为用户坐标
- (command "_trim" en "" "F" pt1 pt2 "")
- (setvar "OSMODE" osmode_bak)
- (setvar "CMDECHO" cmdecho_bak)
- (command "_.undo" "_end");;定义撤销结束处
- (princ)
- )
|