本帖最后由 尘缘一生 于 2023-12-6 01:06 编辑
修改自:高飞代码,
- ;;实体单向动态偏移---(一级)-----
- ;enam 实体名 dd 偏移距离
- ;修改自高飞源码
- ;三领集成 MODFY 尘缘一生 QQ 15290049
- (defun ddenofdis (enam dd / loop bb obj objlst objs parper p0 n space space1 tp curpnt perpnt f3 f8)
- (princ
- (slmsg
- "\n->移动偏移实体[改间距(TAB)/换色(C)/正交(F8)/扑捉(F3)](其余键-->定位确定)"
- "\n->簿笆熬簿龟砰[э丁禯(TAB)/传︹(C)/タユ(F8)/汲(F3)](ㄤ龄-->﹚絋﹚)"
- "\n->Move offset entity [Change Spacing(TAB)/Color Change(C)/Orth(F8)/Osnap (F3)] (other keys-->locate to determine)"
- )
- )
- (setq obj (en2obj enam) tp (dxf1 enam 0) loop t objs nil f8 (getvar "ORTHOMODE") f3 (getvar "OSMODE"))
- (while loop
- (setq bb (grread t 15 2))
- (setq p0 (cadr bb))
- (cond
- ((equal bb '(2 6));F3切换捕捉开关
- (cond
- ((and (< f3 16384) (/= f3 0))
- (setq f3 (+ f3 16384))
- (prompt (slmsg "\n <对象捕捉 关>" "\n <癸禜 闽>" "\n <OSnap Off>"))
- )
- ((or (= f3 0) (>= f3 16384))
- (setq f3 16383)
- (prompt (slmsg "\n <对象捕捉 开>" "\n <癸禜 秨>" "\n <OSnap On>"))
- )
- )
- (setvar "OSMODE" f3) (redraw)
- )
- ((equal bb '(2 15)) ;F8切换正交开关
- (if (= f8 0)
- (progn (setq f8 1) (prompt (slmsg "\n <正交 开>" "\n <タユ 秨>" "\n <Orth open>")))
- (progn (setq f8 0) (prompt (slmsg "\n <正交 关>" "\n <タユ 闽>" "\n <Orth off>")))
- )
- (setvar "ORTHOMODE" f8) (redraw)
- )
- ((= (car bb) 5)
- (and objs (mapcar 'vla-erase objs))
- (setq objs nil curpnt (trans p0 1 0))
- (setq perpnt (vlax-curve-getclosestpointto enam curpnt T))
- (if (setq parper (vlax-curve-getParamAtPoint enam perpnt))
- (progn
- (if (> (det perpnt (mapcar '+ (vlax-curve-getFirstDeriv enam parper) perpnt) curpnt) 0)
- (setq space1 (- dd))
- (setq space1 dd)
- )
- (if (or (= tp "LINE") (= tp "XLINE"))
- (setq space1 (- space1))
- )
- (setq space space1)
- (repeat (fix (/ (distance perpnt curpnt) (abs space)))
- (setq objlst (vl-catch-all-apply 'vla-offset (list obj space)))
- (setq space (+ space space1))
- (if (not (vl-catch-all-error-p objlst))
- (progn
- (setq objlst (vlax-safearray->list (vlax-variant-value objlst)))
- (setq objs (append objlst objs))
- )
- )
- )
- )
- )
- )
- ((member bb '((2 9))) ;;table 键
- (sldis (slmsg "偏移新间距:?" "熬簿穝丁禯:?" "Offset New Spacing") (slmsg "间距=" "丁禯=" "Spacing=") "0" "12")
- (setq dd sldis1 enam (entlast) obj (en2obj enam) objs nil)
- )
- ((member bb '((2 67) (2 99))) ;;C c 换色
- (repeat (setq n (length objs))
- (vla-put-color (nth (setq n (1- n)) objs) (atoi (slsjqs)))
- )
- (setq enam (entlast) obj (en2obj enam) objs nil)
- )
- ((or t (member (car bb) '(11 25)) (member bb '((2 13))) (= (car bb) 3));;右键 右键 回车
- (setq loop nil)
- )
- )
- )
- (princ)
- )
更新23,12,5
三领的世界:
链接:https://pan.baidu.com/s/1jnD-HBTYYXlMXMSLdJnGBg
提取码:2tin
|