Auto draw line between two objects

Auto draw line between two objects

Anonymous
Not applicable
5,507 Views
7 Replies
Message 1 of 8

Auto draw line between two objects

Anonymous
Not applicable

Hi.

 

Trying to figure out if there is a function/command that draw a straight line from object A, then goes down 90 degrees and continue to the end point of Object B. I want this to happen with only two clicks.

 

See picture.

 

 

0 Likes
Accepted solutions (1)
5,508 Views
7 Replies
Replies (7)
Message 2 of 8

j.palmeL29YX
Mentor
Mentor
Accepted solution

AFAIK not with the core commands of AutoCAD. But some lines LISP will do the job - see screencast.

https://autode.sk/2rgZmSo

 

And here the LISP code (quick and dirty):

(defun c:jagline (/ p1 p2 p3 p4)
  (setq    p1 (getpoint "\nFrom: ")
    p2 (getpoint "\nTo: ")
    p3 (list (/ (+ (car p1) (car p2)) 2.0) (cadr p1))
    p4 (list (/ (+ (car p1) (car p2)) 2.0) (cadr p2))
  )
  (command "_line" p1 p3 p4 p2 "")
  (princ)
)

Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 3 of 8

Kent1Cooper
Consultant
Consultant

Two things:

 

That looks more like a Polyline, given its width.  Is that what you want to draw, rather than Lines?

 

It seems to me you would need more than two clicks.  The suggestion from @j.palmeL29YX would put the vertical leg halfway  horizontally between the two picked points, but the image has it at a very different position.  Do you need a third pick for the position of the vertical leg?

Kent Cooper, AIA
0 Likes
Message 4 of 8

j.palmeL29YX
Mentor
Mentor

@Kent1Cooperschrieb:  Do you need a third pick for the position of the vertical leg?

Of course: if the position of the vertical line is restricted than a third information (third pickpoint)  is urgently necessary.
And to substitute the line command by the pline command is not a problem.

 

cadder

Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 5 of 8

Anonymous
Not applicable

Hi, is it possible to have something similar but with polyline?

0 Likes
Message 6 of 8

j.palmeL29YX
Mentor
Mentor

@Anonymousschrieb:

Hi, is it possible to have something similar but with polyline?


In the LISP code you have to add only a "p". Change the

(command "_line" ...)

to

(command "_pline" ...)

 

cadder

Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 7 of 8

vmiguel.patron21
Explorer
Explorer

Hello, I'm new to this Lisp thing in AutoCad but I have a question

What if instead of 4 points I only require 3 with a fillet on the 3rd point?

 

 

0 Likes
Message 8 of 8

j.palmeL29YX
Mentor
Mentor

Something like this: 

 

 

(defun c:jagline (/ p1 p2 p3 radius)
  (setq radius (getdist "\nRadius: "))
  (setq	p1 (getpoint "\nFrom: ")
	p2 (getpoint "\nTo: ")
	p3 (list (car p2) (cadr p1))
  )
  (command "_pline" p1 p3 p2 "")
  (command "fillet" "_P" "_L" "_R" radius)
  (princ)
)

 

Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes