Jump to content

[VBA/Autocad]The shortest distance between two lines


lubracali

Recommended Posts

I'm trying to figure out how to find the nearest point of a line to another line, but I can not find the right approach.

 

The lines do not intersect, but at a point are very close.

I should write something to tell me the coordinates of this point.

 

The two lines are drawn in 3D and are skew.

 

I need some ideas on how to tackle the problem.

Link to comment
Share on other sites

Hope this help you out with what you looking forward .

 

(vl-load-com)
(setq ss (vlax-ename->vla-object (setq e (car (entsel "\n Select First Line :")))))
(setq ss1 (vlax-ename->vla-object (setq e1 (car (entsel "\n Select Second Line :")))))
(setq pt (vlax-curve-getClosestPointTo ss (cdr (assoc 10 (entget e1)))))

 

Tharwat

Link to comment
Share on other sites

I think I had two windows open on the forum I posted by mistake on both, this is the right place, my request is for vba and not for lisp.

I apologize now in the other post.

 

We can continue here.

Link to comment
Share on other sites

I apologize for posting in wrong section.

 

My question is about VBA and do not lisp.

 

I thank those who answered me, I will try also to learn lisp.

 

Maybe a moderator can close?

 

I apologize again.

Link to comment
Share on other sites

Maybe a help drew an arc that crosses a pline and work out its intersection point

 

ThisDrawing.Utility.GetEntity oPoly, snapPt, vbCr & "Select polyline :"

Set arcobj = ThisDrawing.ModelSpace.AddArc(vertPt, cRad, endang, startang)

retval2 = arcobj.IntersectWith(oPoly, acExtendOtherEntity)

 

there is 4 different intersectwith options check help

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...