Location of reference shape

Hi, all

I'am trying to read STEP file using XDE.

First, I get all top-level shapes, and one of them is a reference of another assembly.
so , I iterate all components of this referred assembly. My problem is that the locations of these components are incorrect.
I've tried to affect all components with the location of reference shape, but it doesn't work!

Can anyone give me an idea?

thanks in advance!


Rob Bachrach's picture

You need to recursively combine the locations between your top level assembly and the locations on the references to the lower level assemblies to create a total transformation matrix for the final shape.

LIU's picture

Hi Rob,
Thanks a lot for your help!
I don't know how to combine the locations? Could you tell me which function in the TopLoc_Location class can do this? Thanks

Rob Bachrach's picture

I am unconfortable with the whole concept of locations. I work better with transformation matrices. So, if you have a location on your assembly (L1) and another as a reference to the subassembly (L2):

gp_Trsf X1 = L1.Transformation();
gp_Trsf X2 = L2.Transformation();

XTotal = X2*X1;
TopLoc_Location LTotal(XTotal);

It is possible that multiplying the locations directly would give the same result, but I have not tested this.


LIU's picture

Hi Rob
Your help is exactly what I need, thanks!
By the way, I have tested the function TopLoc_Location::Multiplied for combining the locations. Apparently it doesn't work.