请问这个从飞诗网盘下的多重偏移LSP 为什么不能用?有好心人帮忙看看吗?
源址:http://fstl.ys168.com/谢谢了
;;多重偏移
(defun c:m_offset (/ m_offset:dcl:show d dis ldcl r opt rt ss)
(setq ss (ssget))
(or ss (fsxm-silenceexit))
(setq opt (getpoint "\n指定偏移方向:"))
(or opt (fsxm-silenceexit))
;;对话框
(setq ldcl
'("mro"
(:DIALOG
(INITIAL_FOCUS "angs")
(LABEL "飞诗CAD - 多重偏移")
(:BOXED_COLUMN
(LABEL "距离列表(,号分隔支持表达式)")
(:EDIT_BOX (ALLOW_ACCEPT TRUE) (KEY "dis"))
"spacer;"
)
(:BOXED_COLUMN
(LABEL "模式")
(WIDTH 15)
(:RADIO_BUTTON
(KEY "moda")
(LABEL "相对起始(&F)")
(VALUE "1")
)
(:RADIO_BUTTON (KEY "modr") (LABEL "相对上次(&L)"))
)
"ok_cancel;"
)
)
)
(defun m_offset:dcl:show ()
(foreach v (vlax-ldata-get "fsxm" "m_offset")
(set_tile (car v) (cdr v))
)
)
(setq rt (fsxm-ldcl ldcl "m_offset"))
(or rt (fsxm-silenceexit))
(vlax-ldata-put "fsxm" "m_offset" rt)
(setvar "cmdecho" 0)
(or cal (command ".cal" 0))
;;距离列表
(setq dis (cdr (assoc "dis" rt)))
(setq dis (fsxm-replace (vl-string-trim "," dis) " " ""))
(setq dis (mapcar 'cal (fsxm-split dis ",")))
(or (apply 'and dis)
(progn (fstl_msgbox "出错了" "距离列表错误!" 16)
(fsxm-silenceexit)
)
)
;;相对上次
(if (= (cdr (assoc "modr" rt)) "1")
(setq d 0
dis (mapcar '(lambda (r) (setq d (+ r d)))
dis
)
)
)
;;offset
(vla-StartUndoMark *doc*)
(foreach ent (fsxm-ss->enlist ss)
(foreach d dis (command ".offset" d ent opt ""))
)
(vla-EndUndoMark *doc*)
(princ)
)
同样。
文字递增也运行不了。
(defun c:TextCopy+ (/ *error* enp la n opt ss)
(princ "\n选择尾部为数字或字母的文字:")
(setq ss (ssget ":S" '((0 . "*text") (1 . "*@,*#"))))
(or ss (fsxm-silenceexit))
(sssetfirst nil ss)
(setq n (getreal "\n输入增量值<1>:"))
(or n (setq n 1))
;;增量复制
(defun CopyText+ (en n / new real s1 s2 s2+ str)
(setq str (fsxm-getendxf en 1))
(cond ((wcmatch str "*@")
(setq s1 (substr str 1 (1- (strlen str))))
(setq s2 (substr str (strlen str)))
(setq s2+ (+ n (ascii s2)))
(cond ((>= s2+ 123) (setq s2+ 97))
((>= s2+ 91) (setq s2+ 65))
)
(setq new (entmakex (entget en)))
(fsxm-setendxf new 1 (strcat s1 (chr s2+)))
new
)
((wcmatch str "*#")
(setq s1 "")
(while (not (numberp (vl-catch-all-apply 'read (list str))))
(setq s1 (strcat s1 (substr str 1 1)))
(setq str (substr str 2))
)
(setq real (fsxm-tostring (+ n (read str))))
(setq new (entmakex (entget en)))
(fsxm-setendxf new 1 (strcat s1 real))
new
)
(t (entmakex (entget en)))
)
)
(vla-StartUndoMark *doc*)
(setq opt (getpoint "\n指定基準點:"))
(or opt (fsxm-silenceexit))
(setvar "lastpoint" opt)
(defun *error* (msg) (mapcar 'entdel (fsxm-ss->enlist ss)))
(setvar "cmdecho" 0)
(while t
(setq la (entlast))
(foreach en (fsxm-ss->enlist ss) (CopyText+ en n))
(setq ss (fsxm-newselection la))
(setq opt (getvar "lastpoint"))
(command ".move" ss "" "non" "@" "\\")
(if (equal opt (getvar "lastpoint") 1e-8)
(exit)
)
)
(vla-EndUndoMark *doc*)
(princ)
) 你用飞诗工具箱没有?里面含飞诗的自定函数fsxm- 开头的 哦,这样,没有装哦,原来这样。
谢谢你!
那就不能单独用了 穿裤子当然不能出门工作了哈哈 有自定义函数的必须要穿底裤
页:
[1]