Line between arches

Line between arches

carlos_m_gil_p
Advocate Advocate
445 Views
5 Replies
Message 1 of 6

Line between arches

carlos_m_gil_p
Advocate
Advocate

Hello boys how are you.
I wanted to ask for your help.
I need to draw a line of 18 m from the tip of two arcs that join, passing through their intersection. (This length can be variable, but I can modify it later in the lisp or I don't know, if the option is given at once)
But I don't know how to work intersections.
If you can help me, I appreciate it.
I'm going to attach a dwg file so you can see how I do it manually.
In advance, thank you very much.


AutoCAD 2026
Visual Studio Code 1.99.3
AutoCAD AutoLISP Extension 1.6.3
Windows 10 (64 bits)

0 Likes
446 Views
5 Replies
Replies (5)
Message 2 of 6

Kent1Cooper
Consultant
Consultant

Something like this [minimally tested]....

 

(defun C:WHATEVER (/ arcss obj1 obj2 int int1 int2 intA)
  (if
    (and
      (setq arcss (ssget '((0 . "ARC"))))
      (= (sslength arcss) 2)
      (setq
        obj1 (vlax-ename->vla-object (ssname arcss 0))
        obj2 (vlax-ename->vla-object (ssname arcss 1))
        int (vlax-invoke obj1 'IntersectWith obj2 acExtendNone); they intersect
      ); setq
    ); and
    (progn ; then
      (setq
        ints (vlax-invoke obj1 'IntersectWith obj2 acExtendBoth); include other intersection
        int1 (list (nth 0 ints) (nth 1 ints) (nth 2 ints))
        int2 (list (nth 3 ints) (nth 4 ints) (nth 5 ints))
        intA (if (equal int int1 1e-4) int2 int1)
      ); setq
      (command "_.line" "_non" int "_non" (polar int (angle int intA) 18) "")
    ); progn
  ); if
  (prin1)
)

 

It might be worth adding a check that, as selected, the two Arcs intersect only once.  If they already intersect twice, the int variable will be six numbers, not just the three needed to use it as a point.  And/or that the extend-both intersection check does, in fact, find two intersections [i.e. they don't just touch tangentially].

Kent Cooper, AIA
Message 3 of 6

komondormrex
Mentor
Mentor

hey there,

or this

(defun c:Line_18_arc_intersect (/ arc_1 arc_2 common_point angle_)
  (setq arc_1 (vlax-ename->vla-object (car (entsel "\n1st arc: ")))
	arc_2 (vlax-ename->vla-object (car (entsel "\n2nd arc: ")))
	common_point (cond
			 ((equal (vlax-get arc_1 'startpoint) (vlax-get arc_2 'startpoint) 1e-4) (vlax-get arc_1 'startpoint))
			 ((equal (vlax-get arc_1 'startpoint) (vlax-get arc_2 'endpoint) 1e-4) (vlax-get arc_1 'startpoint))
			 ((equal (vlax-get arc_1 'endpoint) (vlax-get arc_2 'startpoint) 1e-4) (vlax-get arc_1 'endpoint))
			 ((equal (vlax-get arc_1 'endpoint) (vlax-get arc_2 'endpoint) 1e-4) (vlax-get arc_1 'endpoint))
		     )
	angle_ (angle common_point (inters (vlax-get arc_1 'center) (vlax-get arc_2 'center) common_point
					   (polar common_point (+ (* 0.5 pi) (angle (vlax-get arc_1 'center) (vlax-get arc_2 'center))) 1) nil
				   )
	       ) 
  )
  (vla-addline (vla-get-block (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object))))
 		(vlax-3d-point common_point)
 		(vlax-3d-point (polar common_point angle_ 18))
 )
  (princ)
)
Message 4 of 6

carlos_m_gil_p
Advocate
Advocate

Hello guys, how have you been?
As always, thank you very much for your help.

Both work very well so far.

But I wanted to know if there is the possibility of modifying it, I want to select all the arcs and where there is a union of the two arc tips, create the line automatically.
This in order not to be selecting only two arcs.
And thus speed up the work, sorry for the inconvenience but I had not thought about that.

@Kent1Cooper I'm going to try to see what you tell me about the control, because the lines will always be drawn towards the outside.
I'm going to mount another file in which another case arose at this time that I was testing it.
In this second case, you would have to draw the line on a bisector between the two arcs.
In the file that I am going to attach you can see the entire process that I do and a broader view of how it looks at the end.
Thank you again for the help you give me.


AutoCAD 2026
Visual Studio Code 1.99.3
AutoCAD AutoLISP Extension 1.6.3
Windows 10 (64 bits)

0 Likes
Message 5 of 6

Kent1Cooper
Consultant
Consultant

[You could save yourself a step in your manual process, by Trimming away the smaller inside part of the Circle, so you draw the Line from P0 to the midpoint of the longer outer Arc.  Then you wouldn't need to Move the Line to P0 before Lengthening it.]

Kent Cooper, AIA
0 Likes
Message 6 of 6

carlos_m_gil_p
Advocate
Advocate

Hello @Kent1Cooper how are you.
Thanks for your idea.
Although it is still a lot of work, because it is something very repetitive and I have to do it many times.
That's why I was looking for the help of some lisp and not take so long doing all the steps.
But I can't think of how.
Well, if you can help me, I would appreciate it with all my heart.
Beforehand thank you very much.


AutoCAD 2026
Visual Studio Code 1.99.3
AutoCAD AutoLISP Extension 1.6.3
Windows 10 (64 bits)

0 Likes