Distance between holes С#

Distance between holes С#

mr.ilya-gudkov
Explorer Explorer
384 Views
3 Replies
Message 1 of 4

Distance between holes С#

mr.ilya-gudkov
Explorer
Explorer

Hello. Could you help me please, how can i define the distance between two holes with C#?

0 Likes
385 Views
3 Replies
Replies (3)
Message 2 of 4

Michael.Navara
Advisor
Advisor

What do you mean "distance"? Minimal distance of axes (non parallel), minimal distance of side faces,  distance of center points, ...

Message 3 of 4

mr.ilya-gudkov
Explorer
Explorer

I mean this. I gues it is the  distanse of center points.

корп.png

 

0 Likes
Message 4 of 4

Michael.Navara
Advisor
Advisor

In this case is the best solution to measure distance between hole center points. Here is small (incomplete) example

 

 

HoleFeature singleHole1;
HoleFeature singleHole2;
HoleFeature multiHole;
HoleFeature holeByWorkPoint1;

Point centerPoint1;
Point centerPoint2;

//Two independent hole features
centerPoint1 = (singleHole1.HoleCenterPoints[1] as SketchPoint).Geometry3d;
centerPoint2 = (singleHole2.HoleCenterPoints[1] as SketchPoint).Geometry3d;

//Two holes in one feature
centerPoint1 = (multiHole.HoleCenterPoints[1] as SketchPoint).Geometry3d;
centerPoint2 = (multiHole.HoleCenterPoints[2] as SketchPoint).Geometry3d;

//Hole created by WorkPoint and axis
centerPoint1 = (holeByWorkPoint1.HoleCenterPoints[1] as WorkPoint).Point;

//Distance of holes
double distance = centerPoint1.DistanceTo(centerPoint2);