几何尺寸与公差论坛

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

【转帖】macro for adding custom property

[复制链接]
发表于 2009-4-12 21:36:39 | 显示全部楼层 |阅读模式
macro for adding custom property
does anyone know how to write a macro that can add the following custom property to a drawing.
drawing - text - $prp:"sw-file name"
template size - text - $prp:"sw-template size(template size)"
sheet size - text - $prp:"sw-sheet scale"
current sheet - text - $prp:"sw-current sheet"
total sheets - text - $prp:"sw-total sheets" - total sheet
thanks
sub main()
dim swapp as sldworks.sldworks
dim swmodel as sldworks.modeldoc2
dim swcustpropmgr as sldworks.custompropertymanager
dim retval as boolean
set swapp = application.sldworks
set swmodel = swapp.activedoc
set swcustpropmgr = swmodel.extension.custompropertymanager("")
retval = swcustpropmgr.add2("drawing", swcustominfotext, "$prp:""sw-file name""")
retval = swcustpropmgr.add2("template size", swcustominfotext, "$prp:""sw-template size(template size)""")
retval = swcustpropmgr.add2("sheet size", swcustominfotext, "$prp:""sw-sheet scale""")
retval = swcustpropmgr.add2("current sheet", swcustominfotext, "$prp:""sw-current sheet""")
retval = swcustpropmgr.add2("total sheets", swcustominfotext, "$prp:""sw-total sheets""")
end sub
edited: 02/20/2009 at 02:24 am by ivana kolin
ivana's example will work spot on for the active document. if you want to do it for many files you can use
answer thanks, this will save me a ton time!
on a similar note, is it possible to populate $prp:"sw-title" with a custom property?
quick
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-1-11 10:37 , Processed in 0.038520 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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