Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting CofG of parts using different origin via VBA

Status
Not open for further replies.

CheeseMaker13

Aerospace
Sep 25, 2012
42
Right basically I currently have a set of parts that are modeled using a 'local' axis.

However, I need to use another point/origin (actually another axis) to actually calculate the CofG.

Manually I click on the Inertia tool, create a point using the calculated CofG location using 'Create Geometry' then measuring to the other origin for delta X, Y & Z.

Is there a way of doing this with VBA? The point that it needs to be measured from/to isn't in any of the parts.

Thoughts?
 
Replies continue below

Recommended for you

HI Mate,

I had a good search through the documentation and it doesn't seem to mention anything about automating the axis?

I need to achieve two things:

1. Create an axis based on values that I need to extract from the new 'origin' axis.
2. Use this created axis to do my measurements of CofG using 'Measure Item'.

Even doing it manually in Inertia using a new axis doesn't update the CofG, so I need to use 'Measure Item' instead of measure inertia.

Thoughts?
 
After having a crack at it i've managed to recreate the reference axis as "Created Axis" and managed to get the CofG calculation too using the following code:

Dim MyMeasure
Dim mycoord(2)

Set ref1 = oPart.CreateReferenceFromObject(oPart.MainBody)
Set MyWkBnch = CATIA.ActiveDocument.GetWorkbench("SPAWorkbench")
Set MyMeasure = MyWkBnch.GetMeasurable(ref1)
MyMeasure.GetCOG mycoord

Now how do I tell the MyMeasure to use the "Created Axis" to calculate the CofG!?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor