LISP TO DRAW LINES FROM POINT TO POINT NEED IT TO AUTO JOIN TO NEXT POINT

LISP TO DRAW LINES FROM POINT TO POINT NEED IT TO AUTO JOIN TO NEXT POINT

jlicerioAQQLC
Contributor Contributor
1,975 Views
35 Replies
Message 1 of 36

LISP TO DRAW LINES FROM POINT TO POINT NEED IT TO AUTO JOIN TO NEXT POINT

jlicerioAQQLC
Contributor
Contributor

; lisp to draw hor lines plus 45's between 2 points
; By BIGAL Jan 2012
(defun c:1()
(vl-load-com)
(setq pt1 (getpoint "\npick 1st point on terminal bar"))
(setq pt2 (getpoint "\npick 2nd point "))
; ang2 is horiz lines ang3 is 45 lines
(setq ang1 (angle pt1 pt2))
(setq ang2 0.0)(setq ang3 (* 0.5 pi))
(setq pt3 (polar pt1 ang2 20.0))
(setq pt4 (polar pt2 ang3 20.0))
(setq pt5 (inters pt1 pt3 pt2 pt4 nil))
(command "pline" pt1 pt5 pt2 "")
)
(princ)

0 Likes
Accepted solutions (2)
1,976 Views
35 Replies
Replies (35)
Message 2 of 36

jlicerioAQQLC
Contributor
Contributor

; lisp to draw hor lines plus 45's between 2 points
; By BIGAL Jan 2012
(defun c:4 ()
(setq pt1 (getpoint "\npick 1st point on terminal bar"))
(setq pt2 (getpoint "\npick 2nd point "))
(setq pt3 (getpoint "\npick 3rd point "))
; ang2 is horiz lines ang3 is 45 lines
(setq ang1 (angle pt1 pt2))
(setq ang4 (angle pt2 pt3))
(cond
((> ang1 4.412388)(setq ang2 0.0)(setq ang3 (* 0.5 pi)))
((> ang1 pi)(setq ang2 pi)(setq ang3 (* 0.5 pi)))
((> ang1 (/ pi 2.0))(setq ang2 PI)(setq ang3 (* 0.5 pi)))
((> ang1 0.0)(setq ang2 0.0)(setq ang3 (* 0.5 pi)))
;((> ang4 4.412388)(setq ang5 0.0)(setq ang6 (* 0.5 pi)))
;((> ang4 pi)(setq ang5 pi)(setq ang6 (* 0.5 pi)))
;((> ang4 (/ pi 2.0))(setq ang5 PI)(setq ang6 (* 0.5 pi)))
;((> ang4 0.0)(setq ang5 0.0)(setq ang6 (* 0.5 pi)))
)
(setq pt9 (polar pt1 ang3 20.0))
(setq pt4 (polar pt2 ang2 20.0))
(setq pt5 (inters pt1 pt9 pt2 pt4 nil))
(setq pt6 (polar pt2 ang2 20.0))
(setq pt7 (polar pt3 ang3 20.0))
(setq pt8 (inters pt2 pt6 pt3 pt7 nil))
(command "pline" pt1 pt5 pt8 pt3 "")
;(command "pline" pt2 pt8 pt3 "")
)
(princ)

0 Likes
Message 3 of 36

pendean
Community Legend
Community Legend
Sort of like FILLET or CHAMFER commands can create?
and what length are the 45s? And are they all the same length everywhere?

Can you share screenshots of BEFORE and AFTER?
0 Likes
Message 4 of 36

jlicerioAQQLC
Contributor
Contributor
Trying to make a line that is continuous from point to point it is for wire from block to block.
0 Likes
Message 5 of 36

jlicerioAQQLC
Contributor
Contributor

jlicerioAQQLC_0-1663956830163.png

 

0 Likes
Message 6 of 36

jlicerioAQQLC
Contributor
Contributor

I use it here but I have to join the lines every time want to make something that automatically joins after each point.

 

0 Likes
Message 7 of 36

jlicerioAQQLC
Contributor
Contributor

x.png

 this is the way it works at the moment all separate lisp code .

0 Likes
Message 8 of 36

jlicerioAQQLC
Contributor
Contributor

these are the different scrips I'm using .

0 Likes
Message 9 of 36

jlicerioAQQLC
Contributor
Contributor
They all pertain to the image defun 1 2 3 4 ll above.
0 Likes
Message 10 of 36

Kent1Cooper
Consultant
Consultant

It's not clear to me what you're asking.  One thing I notice, though:


....
; ang2 is horiz lines ang3 is 45 lines
....

.... (setq ang3 (* 0.5 pi)))

....


(* 0.5 pi) in radians is 90°, not 45°.  Should it be (* pi 0.25) and (* pi 0.75) and (* pi 1.25) and (* pi 1.75) in the different conditions?

Kent Cooper, AIA
Message 11 of 36

pendean
Community Legend
Community Legend

@jlicerioAQQLC wrote:

 

 this is the way it works at the moment all separate lisp code .


Forgive me, but both of your images are not really BEFORE/AFTER, could you try again by editing manually if needed to show what you want vs. what you are stuck with today

 

jlicerioAQQLC_0-1663956830163.pngx.png

0 Likes
Message 12 of 36

jlicerioAQQLC
Contributor
Contributor

What I'm trying to get is a lisp code that is continuous pline this one I'm using only goes from point a to point b and then I have to make a new line.

jlicerioAQQLC_0-1663958651146.png

 

 

0 Likes
Message 13 of 36

jlicerioAQQLC
Contributor
Contributor


These are 3 separate plines that were made with the script. Im trying to make it one pline from block to block that can continue.

0 Likes
Message 14 of 36

jlicerioAQQLC
Contributor
Contributor

jlicerioAQQLC_0-1663958855743.png

Had to join it manualy here.

0 Likes
Message 15 of 36

pendean
Community Legend
Community Legend
May I ask why you don't just use PLINE command (aka no LISP) if that is all you wish to create?
Or is there supposed to be 45degree chamfered corners when there is no block either (and you need the lisp to figure out if there is a block or not)?

TIA
0 Likes
Message 16 of 36

jlicerioAQQLC
Contributor
Contributor

jlicerioAQQLC_0-1663959423468.png

this is the feature I'm trying to obtain. But I want to add more customization.

0 Likes
Message 17 of 36

jlicerioAQQLC
Contributor
Contributor

I also want to also add a number sequencer with in the command. 

 

(defun C:SEQ (/ Inc_Num Att_Name Pre)
(vl-load-com)
(setq Att_Name (getstring "\nInput Tag Name: "))
(setq Inc_Num (getint "\nInput Starting Number: "))
(while (setq BLK (entget (car(entsel "\nSelect Attribute/Block: "))))
(progn
(setq Data (cdr (assoc -1 BLK)))
(setq obj (vlax-ename->vla-object Data))
(foreach att (vlax-invoke Obj 'GetAttributes)
(if (= (vla-get-Tagstring att) Att_Name)
(progn
(setq Pre (vla-get-Textstring att))
(setq New_Inp (strcat Pre (rtos Inc_Num 2 0)))
(vla-put-Textstring att New_Inp)
)
);if
);foreach
(setq Inc_Num (+ Inc_Num 1))
);progn
)
(princ)
)

0 Likes
Message 18 of 36

ronjonp
Advisor
Advisor

@jlicerioAQQLC You could use a hatch mask (color 255,255,255) or wipeout in your blocks so no need for trimming.

0 Likes
Message 19 of 36

jlicerioAQQLC
Contributor
Contributor

The aesthetics isn't a big problem it is that the line has to be joined to get the length of the wire.

0 Likes
Message 20 of 36

ronjonp
Advisor
Advisor

@jlicerioAQQLC wrote:

The aesthetics isn't a big problem it is that the line has to be joined to get the length of the wire.


As mentioned before, why not use  a polyline ? Code is not needed.

 

Maybe THIS can help you with your attribute numbering.

0 Likes