Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return the nearnest surface and edge from body against point 1

zhonyang

Structural
Jul 27, 2022
19
Dear all

This community is so great for rookie like me.

Have anyone ever tried to find the nearest face and edge from a body against a specific point?
I am looping through faces and edges and then measure the distance against point to find the nearest one, but it takes too much time.
is that possible to project the point to body and idenify the projection result belongs to which face?

Here is my current code.

Set oSel = oDoc.Selection
oSel.add(body1)
oSel.Search "Topology.face,sel"
x =20000
for i = 1 to oSel.count
Set referenceSurface = oSel.item(i).value
Set TheSPAWorkbench = CATIA.ActiveDocument.GetWorkbench("SPAWorkbench")
Set TheMeasurable = TheSPAWorkbench.GetMeasurable(referencepoint)
MinimumDistance = TheMeasurable.GetMinimumDistance(referencesurface)
if MinimumDistance < x then
x = MinimumDistance
Set referencesurfaceclosest = oSel.item(i).value
end if
next
 
Replies continue below

Recommended for you

There's no other way, but you can speed selection up by setting CATIA.HSOSynchronized = true
 
Last edited:

Part and Inventory Search

Sponsor