Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

How can you get the bounding box of a component in an assembly?

I need to get the bounding box of a component in an assembly. 

 

Normally, I would use  UF_MODL_ask_bounding_box_exact  but won't work if I pass in a component.   I can get the Bodies from the components but this gives me their orginal location and not the location in the assembly context.

 

UF_MODL_ask_bounding_box_exact  seems to indicate I can get what I want if I have the right occurrence but I'm also not sure how tho get the right occurences.

 

The documentation isn't really clear. Can anyone point me in the right direction?

 

 

4 REPLIES
Solution
Solution
Accepted by topic author MarkBurhop
‎04-29-2016 08:37 AM

Re: How can you get the bounding box of a component in an assembly?

If you have a reference to the component and the prototype body, you can get the occurrence body with the .FindOccurrence method.

 

myOccBod = {component ref}.FindOccurrence({proto body})

Re: How can you get the bounding box of a component in an assembly?

(min_corner, directions, distances) = self.theUfSession.ModlGeneral.AskBoundingBoxExact(cubeid.Tag,0)

I used that for bounding boxes but I don't know if it will give you the original origin in an assembly

Re: How can you get the bounding box of a component in an assembly?

Hi Alex,

 

Yeah, that is esentially the same funciton I'm using in C++  just in python space. 

Re: How can you get the bounding box of a component in an assembly?

That was the answer! It seems so obvious now. Thanks @cowski1