- UID
- 201739
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2004-12-11
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
下面是一个在直线端点加画箭头的lisp,是这样的情况,若将命令完整执行完,结束后不会更改原来的捕捉设置,若中途按Esc退出,则退出后捕捉设置不能还原到操作前的状态。
请问如何修改?请高人将安全改好后的代码贴出来,让我学习一下,本菜鸟感激不尽.
这是我的lisp:
(defun C:JT (/ LNENT LNAME PCKPT EPT EPT1 EPT2 ANG1 DD PT2 PW)
;draws an arrowhead on the end of a line
(setq XOSMODE (getvar "osmode"))
(setvar "osmode" 512)
;;snap nearest
(setq LNENT (entsel "Pick near end of line") ;select end of line
LNAME (car LNENT) ;extract entity name
PCKPT (cadr LNENT) ;extract selection point
EPT (osnap PCKPT "endp") ;set endpt of selected line
EPT1 (cdr (assoc 10 (entget LNAME))) ;extract start pt of line
EPT2 (cdr (assoc 11 (entget LNAME)))
;extract other endpt of line
) ;_ end of setq
(if (equal EPT EPT1) ;test desired endpt is same as start pnt
(setq ANG1 (angle EPT1 EPT2)) ;if it is set variable for line angle
(setq ANG1 (angle EPT2 EPT1))
;if not - line angle in other direction
) ;_ end of if
(setq PT2 (polar EPT ANG1 350))
;set arrowhead length, based on current dimscale
(setq PW 80) ;set arrowhead width
(setvar "osmode" 0)
(command "PLINE" EPT "W" "0" PW PT2 "") ;draw arrowhead
(setvar "OSMODE" XOSMODE)
) ;_ end of defun
(princ
) |
|