×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Getting CofG of parts using different origin via VBA

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?

RE: Getting CofG of parts using different origin via VBA

Hi,

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

(OP)
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?

RE: Getting CofG of parts using different origin via VBA

(OP)
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!?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources