Calculating Geometric Center and Creating Axis in Autodesk Inventor

Calculating Geometric Center and Creating Axis in Autodesk Inventor

jzarczynski
Advocate Advocate
980 Views
4 Replies
Message 1 of 5

Calculating Geometric Center and Creating Axis in Autodesk Inventor

jzarczynski
Advocate
Advocate

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

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

Cadkunde.nl
Collaborator
Collaborator

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.

0 Likes
Message 3 of 5

jzarczynski
Advocate
Advocate

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.

0 Likes
Message 4 of 5

Cadkunde.nl
Collaborator
Collaborator
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

0 Likes
Message 5 of 5

jzarczynski
Advocate
Advocate
Accepted solution

If anyone else is looking to tackle a similar issue

oAssemblyDoc.ComponentDefinition.RangeBox

 
..has a property "Center" 😉

0 Likes