Using findBRepByUsingPoint

pludikar
Collaborator

Using findBRepByUsingPoint

pludikar
Collaborator
Collaborator

Hi,

 

I'm trying to use the findBRepByUsingPoint method found in component:

 

if I have a face entity:

 

face.assemblyContext.component.findBRepByUsingPoint(face.pointOnFace, adsk.fusion.BRepEntityTypes.BRepFaceEntityType)  >>  returns an objectCollection

 

but 

face.assemblyContext.component.findBRepByUsingPoint(face.pointOnFace, adsk.fusion.BRepEntityTypes.BRepFaceEntityType).count returns 0 - meaning it hasn't found anything.

 

I would have expected it to return count of 1.

 

 

Am I missing something?

 

Peter

I'm not an expert, but I know enough to be very, very dangerous.

Life long R&D Engineer (retired after 30+ years in Military Communications, Aerospace Robotics and Transport Automation).
0 Likes
Reply
261 Views
1 Reply
Reply (1)

pludikar
Collaborator
Collaborator

I think pressing the send button, is cathartic, makes me relax and when I'm relaxed I come up with solutions.

 

The issue is, and this seems to be the way F360 works, is when working and modifying Occurrences, you MUST be working with the NativeObject.  I had assumed that you had to be working with the Occurrence and, because everything is in same world coordinate space, and the occurrences would take care of the rest - Not so!!

 

face.assemblyContext.component.findBRepByUsingPoint(face.pointOnFace, adsk.fusion.BRepEntityTypes.BRepFaceEntityType)  >>  returns an objectCollection
face.assemblyContext.component.findBRepByUsingPoint(face.pointOnFace, adsk.fusion.BRepEntityTypes.BRepFaceEntityType).count returns 0

 

The component referred to by: 

face.assemblyContext.component

 is actually in the nativeObject space.  So 

face.pointOnFace

the resulting coordinates are in the wrong place

 

The solution:

 

face.nativeObject.pointOnFace

and now

 

face.assemblyContext.component.findBRepByUsingPoint(face.nativeObject.pointOnFace, adsk.fusion.BRepEntityTypes.BRepFaceEntityType).count >> returns 1

Hope that helps anyone else who has come across the same issue

 

Peter

I'm not an expert, but I know enough to be very, very dangerous.

Life long R&D Engineer (retired after 30+ years in Military Communications, Aerospace Robotics and Transport Automation).
1 Like