Solid Body "Made Components" Align with UCS

Solid Body "Made Components" Align with UCS

Anonymous
Not applicable
947 Views
4 Replies
Message 1 of 5

Solid Body "Made Components" Align with UCS

Anonymous
Not applicable

Hi,

 

I'm currently using the "Make components" feature to convert solid bodies into parts. This works great, but we use this method to construct angular roof structures, and after the parts have been made the parts have angular relationships to the .ipt files UCS co-ordinates. It would be very useful if I could align the longest edge of the part (Which is a timber truss) with the x axis in the model space and "lay" the plank flat on the X-Y plane.

 

Is this possible?

 

Thanks

 

GavoGarmo

0 Likes
Accepted solutions (1)
948 Views
4 Replies
Replies (4)
Message 2 of 5

philippe.leefsma
Alumni
Alumni

Hi

 

There are several ways you could achieve that, depending on what you are looking for exactly.

 

One approach is to apply a MoveFeature to the solid body in order to transform it. You will have to create the correct transformation matrix. In that scenario "Matrix.SetToAlignCoordinateSystems" is probably the easiest way to go.

 

You can also derive parts using a "DerivedPartComponents.CreateTransformDef" to create a transformed derived part and use the same matrix method.

 

Or you can copy and transform an existing body using "TransientBRep.Copy" and "TransientBRep.Transform" and create a "NonParametricBaseFeature".

 

I hope it helps.

 

Regards,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 5

Anonymous
Not applicable

Thank you very much for the reply.

 

The API side of things is still a little outside of my skill set, but I'm endevouring to learn.

 

For this system to work would I have to know the angles involved our would it be possible to write an all purpose code that would align any part regardless of it's starting orientation?

 

 

Thanks again

 

GavoGarmo

0 Likes
Message 4 of 5

philippe.leefsma
Alumni
Alumni
Accepted solution

You could write an all purpose code. Take a look at "Matrix.SetToAlignCoordinateSystems" method in the help files, it takes as input 3 "From" vectors and 3 "To" vectors. Your code will have to specify which vectors you want to align with the other and the method will produce the corresponding transformation matrix you need to apply to the body.

 

Regards,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 5 of 5

Anonymous
Not applicable

That's fantastic. Thank you very much for your help. I'll investigate the help files now.

 

GavoGarmo

0 Likes