×
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

API PROBLEM - HOW TO GET MASS PROPERTIES

API PROBLEM - HOW TO GET MASS PROPERTIES

API PROBLEM - HOW TO GET MASS PROPERTIES

(OP)
Hi all!
I hope you can help me about a problem on programming solidworks.I'm sorry if my english is not clear: i'm italian.
I need to retrieve the "center of mass" from a partdoc or a subassembly in an assembly document.
Possibilities are two:
1 - Select a component or a subassembly in an assembly document and retrieve center of mass and the mass.
2 - Select more than one part or subassembly and get the "common center of mass" of the objects.
I tried to use examples on the API-help of SW and on the solidworks site's but at least i was able to get the center of mass on selection of one component.The data i have retrieved are similar to those who are retrieved from the solidworks toolsmassprops, but it can be ok!
The problem is the multiple selection:i get points that are totally wrong.
I hope you understand and that someone can help me to solve this problem.
Thank you!Bye

RE: API PROBLEM - HOW TO GET MASS PROPERTIES

There is one way to get around this.  Make a loop that gets the centers of mass for the selected components one by one and then read them into an array.  From there you can easily calculate the center of mass of the group.  

RE: API PROBLEM - HOW TO GET MASS PROPERTIES

(OP)
Ok i've got the center of mass of all parts.Now how can i calculate the center of the group?

RE: API PROBLEM - HOW TO GET MASS PROPERTIES

XCG= SUM(xcg(i)*mass(i))/SUM(mass(i)
YCG= SUM(ycg(i)*mass(i))/SUM(mass(i)
ZCG= SUM(zcg(i)*mass(i))/SUM(mass(i)

But I'm getting the feeling that you're going in a hard way.

Regards

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