cancel
Showing results for 
Search instead for 
Did you mean: 

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

Genius
Genius

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

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

Phenom
Phenom

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?

Genius
Genius
(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?

Genius
Genius

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?

Genius
Genius

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