Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Solid Body "Made Components" Align with UCS

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
GavoGarmo
696 Views, 4 Replies

Solid Body "Made Components" Align with UCS

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

4 REPLIES 4
Message 2 of 5

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

Message 3 of 5

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

Message 4 of 5

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

Message 5 of 5

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

 

GavoGarmo

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report