Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I would like to ask everyone
This LISP can offset all polylines
You can also select only the arc offset after blasting
Is it possible not to explode on the polyline, only the arc is offset
(defun C:TEST ( / curve ent holdcmd holdosmode jang n pt pt1 pt2 ss tmp x)
(defun LEN (CURVE / TLEN)
(setq TLEN (vlax-curve-getdistatparam
CURVE
(vlax-curve-getendparam CURVE)
)
)
)
(command "_.UNDO" "BE")
(if (null tee_dist)
(setq tee_dist 0.2)
) ;_set global variable
(setq HOLDOSMODE (getvar "OSMODE"))
(setq HOLDCMD (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(setvar "OSMODE" 0)
(if (setq ss (ssget '((0 . "*LWPOLYLINE,CIRCLE,ARC"))))
(progn
(setq n 0)
(initget 2)
(if (setq tmp
(getdist
(strcat "\noffset distance): <"
(rtos tee_dist 2)
">"
)
)
)
(setq tee_dist tmp)
) ;_last value
(repeat (sslength ss)
(setq ent (ssname ss n)
n (1+ n)
)
(setq CURVE (vlax-ename->vla-object ENT)
x (vlax-curve-getParamAtDist curve (/ (len curve) 3.33))
pt (vlax-curve-getPointAtParam curve x)
);_Get the points and parameters of the specified distance value on the line
(setq JANG (angle '(0 0 0) (vlax-curve-getfirstderiv CURVE X)))
(setq PT1 (polar PT (+ JANG (* 0.5 pi)) 0.00000001))
(setq PT2 (polar PT (- JANG (* 0.5 pi)) 0.00000001))
(command "layer" "m" "make up" "c" 1 "make up" "")
;;(command "_.OFFSET" (abs tee_dist) ENT PT1 "")
(command "_.OFFSET" "L" "C" (abs tee_dist) ENT PT1 "")
(if (or (and (> tee_dist 0) (> (LEN CURVE) (LEN (entlast))))
(and (< tee_dist 0) (< (LEN CURVE) (LEN (entlast))))
)
(progn
(entdel (entlast))
(command "_.OFFSET" (abs tee_dist) ENT PT2 "")
)
)
)
)
)
(setvar "OSMODE" HOLDOSMODE)
(setvar "CMDECHO" HOLDCMD)
(command "_.UNDO" "E")
(princ)
)
Solved! Go to Solution.