×
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

Relation to center of mass?

Relation to center of mass?

Relation to center of mass?

(OP)
Is it possible to create a relation between a sketch entity, like a point, and the center of mass of a body? I woild like to locate a feature relative to the center of mass and have it update when I rebuild.

RE: Relation to center of mass?

Their is a macro that place a 3D point at the Cg FAQ559-356 and you can rerun this when the model changes.  Here is the macro rewritten for 2005

'*********************************************************************
'This macro creates a 3D-sketch point.  It also names the 3D-sketch Center of Gravity (COG),
'date (dd.mm.yyyy), and time (hh:mm:ss).
'
'This macro works in SWx 2005
'*********************************************************************

Dim swApp As Object
Dim ModelDoc As Object
Dim Point As Object
Dim Sketch As Object
Dim status As Long

Sub main()

    Set swApp = CreateObject("SldWorks.Application")
    Set ModelDoc = swApp.ActiveDoc
    MassProp = ModelDoc.GetMassProperties2(status)
    ModelDoc.Insert3DSketch2 (True)
    Set Sketch = ModelDoc.GetActiveSketch2
    ModelDoc.SetAddToDB (True)
    Set Point = ModelDoc.CreatePoint2(MassProp(0), MassProp(1), MassProp(2))
    ModelDoc.SetAddToDB (False)
    ModelDoc.Insert3DSketch2 (True)
    Sketch.Name = "COG " & Format$(Now, "dd.mm.yyyy hh:mm:ss")
    ModelDoc.EditRebuild
    
Set swApp = Application.SldWorks
End Sub

Best Regards,

Heckler
Sr. Mechanical Engineer
SW2005 SP 4.0 & Pro/E 2001
Dell Precision 370
P4 3.6 GHz, 1GB RAM
XP Pro SP2.0
NIVIDA Quadro FX 1400
      o
  _`\(,_
(_)/ (_)

"There is no trouble so great or grave that cannot be much diminished by a nice cup of tea"  Bernard-Paul Heroux
 

RE: Relation to center of mass?

Opps - you would have to add that recalculate upon rebuild.

RE: Relation to center of mass?

(OP)
Thanks, this is helpful but not exactly what I am looking for. What I would really like to do is to stick one point permanently onto the center of mass, rather than create a new point everytime the center of mass moves.

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