|
place a workpoint at the cog
i got this sub from the web and it works great
my questions is: each time i change the model and rerun the macro, is there a way to replace the workpoint in a new location instead of creating a new workpoint each time i run it
thx, chris
sub main()
set swapp = application.sldworks
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
end sub
solidworks 2007 (office pro.) sp5.0
testing solidworks 2009 (pro) sp0.0
dell precision t3400
2 cpu (8500) 3.16 ghz, 3.25 gb of ram
window xp pro sp2
nvidia fx 570 6.14.11.6262
by workpoint i presume you mean the point in the sketch, therefore not create another sketch.
you will have to traverse the assembly (take a look at my
sorry i cannot provide a macro to do this as i'm rather busy right now. |
|