Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Relation to center of mass?

Status
Not open for further replies.

alolesen

Mechanical
Jul 21, 2005
88
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.
 
Replies continue below

Recommended for you

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

 
Opps - you would have to add that recalculate upon rebuild.
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor