getpoint modification

getpoint modification

Anonymous
Not applicable
1,001 Views
2 Replies
Message 1 of 3

getpoint modification

Anonymous
Not applicable

Hi Team,

 

Could any one help me on the below lisp, here in the step i want to specify n number of points in this  "(setq p1 (getpoint "\nSpecify the point A: "))".

 

(defun c:pcline ( / 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!

0 Likes
Accepted solutions (1)
1,002 Views
2 Replies
Replies (2)
Message 2 of 3

john.uhden
Mentor
Mentor

I don't see how it fits with your program, but do you mean like 10 points (p1 through p10 and "A" through "J") depending on the value of n?

John F. Uhden

0 Likes
Message 3 of 3

Anonymous
Not applicable
Accepted solution

Sorry John,

 

It's was duplicated, I got solution from Beekee.

 

Thank you.

0 Likes