Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng 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

Status
Not open for further replies.

rookiezzz

Structural
Joined
Jul 27, 2022
Messages
25
Location
ES
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
 
There's no other way, but you can speed selection up by setting CATIA.HSOSynchronized = true
 
Last edited:
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top