几何尺寸与公差论坛

 找回密码
 注册
查看: 639|回复: 0

【转帖】place a workpoint at the cog

[复制链接]
发表于 2009-4-13 13:29:08 | 显示全部楼层 |阅读模式
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.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-23 04:21 , Processed in 0.033642 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表