
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Team,
Could anyone help me on this step, I want to specify n number of points, here is the step need to change "(setq p1 (getpoint "\nSpecify the point A: "))".
(defun c:cbline ( / en ex e1 e2 el p1 q1 p2 q2 pe ps la)
(if (and (setq *c2p-en* (cond ((car (entsel (strcat "\nSelect axis polyline " (if *c2p-en* " <last>" ": ")))))
(*c2p-en*)))
(= "LWPOLYLINE" (cdr (assoc 0 (entget *c2p-en*))))
(setq p1 (getpoint "\nSpecify the point A: "))
(setq p1 (trans p1 1 0))
(setq q1 (vlax-curve-getClosestPointTo *c2p-en* p1))
(setq p2 (getpoint "\nSpecify the point B: "))
(setq p2 (trans p2 1 0))
(setq q2 (vlax-curve-getClosestPointTo *c2p-en* p2))
(setq ps (vlax-curve-getStartPoint *c2p-en*))
(setq pe (vlax-curve-getEndPoint *c2p-en*))
)
(progn
(setq la "test")
(command ".-LAYER" "_New" la "_Color" 2 la "")
(setq en (entmakex (append (entget *c2p-en*)
(list (cons 8 la)))))
(setq el (entlast))
(and (not (equal q1 pe 1e-6))
(not (equal q1 ps 1e-6))
(vl-cmdf "_.BREAK" en "_none" (trans q1 0 1) "_none" (trans q1 0 1))
(not (equal el (entlast)))
(setq ex (entlast))
)
(if (equal q2 (vlax-curve-getClosestPointTo en q2) 1e-6)
(if ex (entdel ex))
(progn
(entdel en)
(setq en ex)))
(setq ex nil
el (entlast))
(and (not (equal q2 pe 1e-6))
(not (equal q2 ps 1e-6))
(vl-cmdf "_.BREAK" en "_none" (trans q2 0 1) "_none" (trans q2 0 1))
(not (equal el (entlast)))
(setq ex (entlast))
)
(if (and (or (equal q1 (vlax-curve-getStartPoint en) 1e-6)
(equal q1 (vlax-curve-getEndPoint en) 1e-6))
(or (equal q2 (vlax-curve-getStartPoint en) 1e-6)
(equal q2 (vlax-curve-getEndPoint en) 1e-6)))
(if ex (entdel ex))
(progn
(entdel en)
(setq en ex)))
(setq e1 (entmakex (list (cons 0 "LINE") (cons 10 p1) (cons 11 q1) (cons 8 la)))
e2 (entmakex (list (cons 0 "LINE") (cons 10 p2) (cons 11 q2) (cons 8 la))))
(initcommandversion)
(command "_.JOIN" e1 en e2 "")
))
(princ)
)
Thank you!
Solved! Go to Solution.