![]() |
【转帖】macro for adding custom property
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 |
所有的时间均为北京时间。 现在的时间是 05:34 AM. |