![]() |
【转帖】getting the name of a breakline
getting the name of a breakline
i'm trying to write a macro that identifies the internal name for drawing objects (currently breaklines) i can't seem to get a handle on anything that will tell me what the selected breakline's name is. here is the current code (originally recorded as a macro and you can clearly see that swx knows what it's name is when it recorded the macro in sub main) i'm running the identify subroutine with a breakline selected. i've tried casting it as a feature and an annotation but that gives me a type mismatch. any ideas? dim swapp as sldworks.sldworks dim part as modeldoc2 dim selmgr as selectionmgr dim boolstatus as boolean dim longstatus as long, longwarnings as long dim feature as feature sub main() set swapp = application.sldworks set part = swapp.activedoc set selmgr = part.selectionmanager swapp.activedoc.activeview.framestate = 1 boolstatus = part.extension.selectbyid2("break line17", "breakline", 0, 0, 0, false, 0, nothing, 0) boolstatus = part.extension.selectbyid2("break line8", "breakline", 0, 0, 0, true, 0, nothing, 0) part.editdelete end sub sub identify() dim swbreak as breakline dim annotation as annotation set swapp = application.sldworks set part = swapp.activedoc set selmgr = part.selectionmanager set swbreak= selmgr.getselectedobject6(1, 0) set annotation = ofeature debug.print swbreak.name end sub quick |
所有的时间均为北京时间。 现在的时间是 07:22 AM. |