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?
'*********************************************************************
'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?
RE: Relation to center of mass?