×
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

CATIA VBA how to apply GetTechnologicalObject method to many products

CATIA VBA how to apply GetTechnologicalObject method to many products

CATIA VBA how to apply GetTechnologicalObject method to many products

(OP)
Hello,
I need to find the mass and the center of gravity of some bunch of products in an assembly. The code below works for only one product. How do I get the inertia properties of several products at the same time?that is, how to create an object that contains several products to which I can apply the method GetTechnologicalObject.
'--------------------------------------------
Dim catia As Object
Set catia = GetObject(, "CATIA.Application")

Dim productDocument1 As Document
Dim Selection1 As selection
Set productDocument1 = catia.ActiveDocument
Set Selection1 = productDocument1.selection
Set product1 = productDocument1.Product
Set products1 = product1.Products
Set product2 = products1.Item("myproduct")

Dim oInertia As AnyObject
Set oInertia = product2.GetTechnologicalObject("Inertia")

Dim dMass As Double
dMass = oInertia.Mass

Dim dCoordinates(2)
oInertia.GetCOGPosition dCoordinates
MsgBox product2.Name & ": Mass = " & CStr(dMass) & ", Center of gravity : X = " & CStr(dCoordinates(0)) & ", Y = " + CStr(dCoordinates(1)) & ", Z = " + CStr(dCoordinates(2))
'---------------------------------------------
thank you for your help

RE: CATIA VBA how to apply GetTechnologicalObject method to many products

(OP)
Thank you Fernando for your response.
I don't really understand/know what is a list of products? because what I needed to do is apply at once the gettechnologicalobject to many products( and not to only one) to find the mass of one configuration.(My assembly contains several products that sometimes overlap and depending on the configuration I want, I need to deactivate certain products to get one configuration. There are about 2000 configurations)I tried to apply the gettechnologicalobject method to a selection containing many products but in vain.
Howsoever, I found another way to do what I want to do with my code:

http://www.eng-tips.com/viewthread.cfm?qid=427843

RE: CATIA VBA how to apply GetTechnologicalObject method to many products

Getting the mass of one configuration is completely something else...I understand now what you are trying to do and it make sense the other thread (by the way, you can deactivate those products in same way, search all products from your list, select them all (or one by one), deactivate).

Another question is: did you checked if all parts have correct density/mass? This will influence your configuration CoG for sure...

If you are using a PDM system it should be there a way to open only a configuration, so you will not need that macro to deactivate certain products and loose time...

I see you are in aeronautics, maybe you have sheet metal parts inside products, I know for example in Airbus you have also the unfolded body inside the part, take care about those, mass for them will be also take in consideration....

Regards
Fernando

https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU

RE: CATIA VBA how to apply GetTechnologicalObject method to many products

(OP)
Thank you Fernando.
I will investigate and tell you later in this thread.

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