Jump to content
lubracali

[VBA/Autocad]The shortest distance between two lines

Recommended Posts

lubracali

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.

Share this post


Link to post
Share on other sites
Tharwat

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

Share this post


Link to post
Share on other sites
lubracali

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.

Share this post


Link to post
Share on other sites
lubracali

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.

Share this post


Link to post
Share on other sites
SLW210

I merged the threads. The responses involving LISP my help others so I will leave that.

Share this post


Link to post
Share on other sites
BIGAL

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×