.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Measure perpendicular distance between 2 polylines

2 REPLIES 2
Reply
Message 1 of 3
fieldguy
2911 Views, 2 Replies

Measure perpendicular distance between 2 polylines

I need the perpendicular distance between 2 polylines.  If I was doing this manually, I would draw a line perp from 1 side and extend it to the other side, check it's length, and delete it.  These are pipeline r/w's that quite often have variable width, and are not always parallel.

 

I am asking the user to select the pline 1st (GetEntity) to get some object data.  Then I prompt for a point on the pline where a block will be placed. The block contains an attribute definition for the width.  I check to make sure the point is on the pline.  I was hoping I could get the user to select a point on the opposite side and force that to be perp.  That would give me the width but it doesn't work.  I have looked at GetFirstDerivative and rotate that 90 but the examples I found use a certain length.  The perp length is what I need to determine.  I need some hints please!

2 REPLIES 2
Message 2 of 3
g_k50
in reply to: fieldguy

The distance between P(x1, y1, z1) and P2(x2, y2, z2) is equal to the square root of [(x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2)]

 

 

Message 3 of 3
_gile
in reply to: fieldguy

Hi,

 

Look at the Curve.GetClosestPointTo() method.

Select a polyline (pl1) and a point on the other one (pt on pl2), then:

 

pt.DistanceTo(pl1.GetclosestPointTo (pt, false));

 

The distance is measured perpendicular to pl2 (and pl1 if they're parralel).



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost