ADD PERPENDICULARS

Hello,
I have 1 segment A and 1 line B
How to make perpendiculars from segment A end points to line B - red lines. I need VBA code.
Why I need. Because so i find the closest endpoint A to line B. Then segment A will be extended from closest endpoint to intersect with line B
Any idea how to find the intersection coordinates X, Y of the continuation of segment A with line B would be gratefully received.
Greetings!

  • If B is a line segment
    1. determine the angle of inclination B
    2. Temporarily rotate A+B so that B becomes vertical
    3. draw a horizontal line through the desired points
    you have the coordinates of the point (x1,y1), and the second coordinate along the X axis is the position of B(xB,y1)
    same for the second perpendicular
    (x2,y2) & (xB,y2)
    4. rotate A+B + 2*(perpendiculars) to a negative rotation angle

  • You may already know this, but...

    Both of the tasks you describe - drawing the perpendicular lines and extending one line to intersect with another - can be done directly using Dynamic guides and object snaps.