6 Replies Latest reply on Jul 18, 2014 1:41 AM by Sushil Chaskar

# getting minimum distance

Hi, can I get the miinimum distance between two curves or a curve and point using api..

• ###### Re: getting minimum distance

1) Create wire bodies from your curves: Curve::CreateWireBody.

2) Get edges from wire bodies: Body2::GetEdges. It will be only one edge per curve body

3) Call Modeler::FindTwoEdgeMaxDeviation to find min distance between edges.

______________________________________________

Regards, Artem Taturevych | Snr. Developer | IC3D ANZ

IC3DSteel – New Steel Solution for SolidWorks

LinkedIn - SolidWorks API Group

• ###### Re: getting minimum distance

Hi Artem,

but is it possible getting the minimun distance from a Edge and a SketcPoint, with the same way?

I have a rectangular face, and in this face there is a sketch with a point, you can calculate the point at which edge is more closer?

I enclose an example of model.

Thanks

Roberto

• ###### Re: getting minimum distance

Hi Roberto,

Hi, in this case I would just call the Edge::GetClosestPointOn and then calculate the distance via a formula

dist = SQRT((x1-x2)^2+(y1-y2)^2+(z1-z2)^2)

• ###### Re: getting minimum distance

Hi Artem,

I gave a look at the API by following your advice, what do you think of ModelDoc2 :: ClosestDistance.

It seems more complete, I'm wrong?

I'd like to know your expert opinion.

Thank you

Roberto

• ###### Re: getting minimum distance

Hi Roberto,

Yes, should be also fine. I missed this API.

Regards,

Artem

• ###### Re: getting minimum distance

Hi Artem,

Is it possible to get or select a sketch segment if I know the endpoints of the segment.  Actually what I want to do is to get the  point of minimum distance on next adjacent curve from a point on previous curve,  both being sketch segments..

Regards,

Sushil