Getting CofG of parts using different origin via VBA
Getting CofG of parts using different origin via VBA
(OP)
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?
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?





RE: Getting CofG of parts using different origin via VBA
Your need to work with that axis system as reference (get CoG coordinates respective to this reference). I believe there are some examples in documentation (I didn't checked).
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
RE: Getting CofG of parts using different origin via VBA
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?
RE: Getting CofG of parts using different origin via VBA
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!?