查看单个帖子
旧 2009-04-13, 01:29 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】place a workpoint at the cog

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.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)