![]() |
【转帖】line name
line name
how can i retrieve the line name that is created below. l2 = part.createline2(0, 0, 0, 0.05, 0, 0) ' create line and also how can i change its name late. regards, aqeel ahmed aqeel.ahmed@live.com l2 would be a pointer to a linesegment object not a string name. lines do not have names to change thanx sir, but when u right click on line segment it shows u an attribute as the "selected entity(line name)" how can we change that name or how can v get that attribute. regards, option explicit sub main() dim swapp as sldworks.sldworks dim swmodel as sldworks.modeldoc2 dim swsketchtext as sldworks.sketchtext dim swsketchsegment as sldworks.sketchsegment dim swselmgr as sldworks.selectionmgr dim vid as variant dim sname as string ' connect to solidworks set swapp = application.sldworks ' get active document set swmodel = swapp.activedoc set swselmgr = swmodel.selectionmanager if swselmgr.getselectedobjectcount = 0 then msgbox "select line" else select case swselmgr.getselectedobjecttype3(1, -1) case swselsketchsegs set swsketchsegment = swselmgr.getselectedobject6(1, -1) select case swsketchsegment.gettype case swsketchline sname = "line" case swsketcharc case swsketchellipse case swsketchspline case swsketchtext case swsketchparabola end select vid = swsketchsegment.getid sname = sname & vid(1) msgbox sname swmodel.clearselection2 true bret = swmodel.extension.selectbyid2(sname, "sketchsegment", 0, 0, 0, false, -1, nothing, 0) end select end if end sub again it is not a name it is just a persistent id and cannot be changed. as shown in the example above that name is just the id prepended with a string. the only persistent ids you can change are that of imported body edges. it is the text which you see when you right clickt a line, or in selection box, or can use with selectbyid2. and you can't change it. thanx guys i got the way to keep the name with me for all time so that when ever i want to get any line segment with my own name i can. may b that will help u . i am keeping the line index(pointer to line in my xml fine with my own name so ) when ever i need e.g line1 that i have saved as horizontal line tage i just get it and it give me the pointer to exact the same line where i want to do some more customizations. but, if u think there are other nice and short ways plz let me know. regards, aqeel quick |
所有的时间均为北京时间。 现在的时间是 05:46 PM. |