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: 

Calculating Geometric Center and Creating Axis in Autodesk Inventor

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
jzarczynski
367 Views, 4 Replies

Calculating Geometric Center and Creating Axis in Autodesk Inventor

Hello,

 

I am looking to determine the geometric center of a given assembly (Cartesian coordinates of the main assembly) and automate the process using VBA or C#. Additionally, I would like to create an axis that passes through the calculated point and is normal to the XZ plane.

 

Below you can see how I accomplished this manually. However, I would like to streamline the process and automate it. At this stage I am wondering which tools/iProperties could be use to achive that goal (any ideas ?) 

 

geocenter.png

 

Additionally, I would like to create an axis that passes through the calculated point and is normal to the XZ plane.

 

Could you kindly suggest which variables in Autodesk Inventor could be utilised to accomplish the task? Is it possible to achieve this using VBA or C#?

 

Any guidance or assistance you can provide would be greatly appreciated.

 

Best regards,

Jaromir

Tags (2)
4 REPLIES 4
Message 2 of 5
Cadkunde.nl
in reply to: jzarczynski

I guess you can find 'center of gravity' and place new workplanes with an x/y/z offset from the origin planes.

 

But I would definitely do it in the model, not on drawing: You want to use the origins to constrain as well.

For that you might want the Y offset in your example sometimes on 4,67 instead of 29,67.

 

Is it that you get a lot of steps from suppliers with badly placed origins?

You make drawings from models you recieve?

Or are the origin planes not in center because of skeleton modelling?

Depending on the background and the scope my answer may vary.

 

The feature I would use for this is 'move bodies' (Inventor --> 3D Model ribbon --> Modify panel --> Expand down --> Move bodies)

This is how I clean up models from suppliers with badly placed origins for in the library folder. You can even rotate.

Origins are in center of model that way. engineers have an easier time constraining.

 

That could be automated, but it would be to center of gravity, and it depends if you just have a few models or you need to batch hundreds.

Message 3 of 5
jzarczynski
in reply to: Cadkunde.nl

Hello,

 

@Cadkunde.nl  thank you for your suggestion. My objective nonetheless  is considerably more intricate. In a nutshell, I need to rotate the model around an axis that passes through the geometric centre and is normal to the XZ plane. The entire process must be fully automated.

 

I believe I've identified a potential solution. It is indeed possible to obtain the "reach" of the assembly model by utilizing the RangeBox property within the ComponentDefinition object:

 

 

oAssemblyDoc = ThisDoc.Document

oBox = oAssemblyDoc.ComponentDefinition.RangeBox

oMinPoint = oBox.MinPoint
oMaxPoint = oBox.MaxPoint

Messagebox.Show("Minimum point coordinates:" & vbCrLf & _
           "X: " & oMinPoint.X & vbCrLf & _
           "Y: " & oMinPoint.Y & vbCrLf & _
           "Z: " & oMinPoint.Z & vbCrLf & vbCrLf & _
           "Maximum point coordinates:" & vbCrLf & _
           "X: " & oMaxPoint.X & vbCrLf & _
           "Y: " & oMaxPoint.Y & vbCrLf & _
           "Z: " & oMaxPoint.Z)

 

However, the dimensions seem to be in centimetres rather than millimetres. Despite this discrepancy, the document settings are correctly set to millimetres and have no idea how to fix this (beside multiplying the values 🙂 )

 

J.

Message 4 of 5
Cadkunde.nl
in reply to: jzarczynski

Dim uom As UnitsOfMeasure = oDoc.UnitsOfMeasure
Dim dblOffset As Double = uom.ConvertUnits(oMinPoint, "cm", "mm")

 "cm" is the base unit type for length units in Inventor

Message 5 of 5
jzarczynski
in reply to: jzarczynski

If anyone else is looking to tackle a similar issue

oAssemblyDoc.ComponentDefinition.RangeBox

 
..has a property "Center" 😉

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report