The Hamma Posted November 4, 2010 Share Posted November 4, 2010 I have written a script to change the lineweights of objects in a drawing based on there existing lineweight and it works fine in a layer but I can not get it to work in a symbol. Does anyone know what I could do to make this work. One Idea I have is to cut the objects out of the symbol and place them on a layer make the change and then put them back in the symbol but I do not know how do do this in a script. my script is below. Procedure Lineweight; Label 100, 101, 102, 103, 104, 105, 106; VAR H1 : HANDLE; P1,P2 : real; Begin; DSelectAll; SelectObj(INSYMBOL & INOBJECT & INVIEWPORT & (LW=7)); DSelectObj(INSYMBOL & INVIEWPORT & (T=TEXT)); H1:= FSActLayer; 100:SetLW(H1,3); H1:=NextSObj(H1); if H1<>Nil then goto 100; DSelectAll; SelectObj(INSYMBOL & INOBJECT & INVIEWPORT & (LW=10)); DSelectObj(INSYMBOL & INVIEWPORT & (T=TEXT)); H1:= FSActLayer; 101:SetLW(H1,4); if H1<>Nil then goto 101; DSelectAll; SelectObj(INSYMBOL & INOBJECT & INVIEWPORT & (LW=14)); DSelectObj(INSYMBOL & INVIEWPORT & (T=TEXT)); H1:= FSActLayer; 102:SetLW(H1,6); H1:=NextSObj(H1); if H1<>Nil then goto 102; DSelectAll; SelectObj(INSYMBOL & INOBJECT & INVIEWPORT & (LW=20)); DSelectObj(INSYMBOL & INVIEWPORT & (T=TEXT)); H1:= FSActLayer; 103:SetLW(H1,8); H1:=NextSObj(H1); if H1<>Nil then goto 103; DSelectAll; SelectObj(INSYMBOL & INOBJECT & INVIEWPORT & (LW=28)); DSelectObj(INSYMBOL & INVIEWPORT & (T=TEXT)); H1:= FSActLayer; 104:SetLW(H1,11); H1:=NextSObj(H1); if H1<>Nil then goto 104; DSelectAll; SelectObj(INSYMBOL & INOBJECT & INVIEWPORT & (LW=39)); DSelectObj(INSYMBOL & INVIEWPORT & (T=TEXT)); H1:= FSActLayer; 105:SetLW(H1,12); H1:=NextSObj(H1); if H1<>Nil then goto 105; End; Run (Lineweight); Quote Link to comment
Miguel Barrera Posted November 4, 2010 Share Posted November 4, 2010 Are you trying to change the lineweights in the document or just the active layer? Using ForEachObject would be a better approach since symbols cannot be selected based on the lineweight. By definition, symbols are container objects that do not have a lineweight and act more like an image. Quote Link to comment
The Hamma Posted November 4, 2010 Author Share Posted November 4, 2010 Yes all lineweights in a document is my goal. Quote Link to comment
The Hamma Posted November 4, 2010 Author Share Posted November 4, 2010 Since I did not need to keep the symbols as symbols I was able to convert them to groups and then my revised script worked for the entire drawing. Thanks for the input. PROCEDURE SelectedObjLineWeight; Var cw:integer; FUNCTION explodeob(h:HANDLE) :BOOLEAN; BEGIN SymbolToGroup(h,2); END; FUNCTION edObject(h:HANDLE) :BOOLEAN; BEGIN cw:=GetLW(h); if cw = 1 then SetLW(h, 8); if cw = 7 then SetLW(h, 4); if cw = 10 then SetLW(h, 6); if cw = 14 then SetLW(h, 8); if cw = 20 then SetLW(h, 11); if cw = 28 then SetLW(h, 12); if cw = 39 then SetLW(h, 15); END; BEGIN DSelectAll; SelectObj(INSYMBOL & INVIEWPORT & (T=Symbol)); ForEachObjectInLayer(explodeob, 2, 2,1); ForEachObjectInLayer(edObject, 0, 2,1); END; Run(SelectedObjLineWeight); Quote Link to comment
maarten. Posted November 5, 2010 Share Posted November 5, 2010 You can leave this line out cause the selection status isn't important. DSelectAll; SelectObj(INSYMBOL & INVIEWPORT & (T=Symbol)); Why don't you use ForEachObject like Miguel suggested? That way you don't need to convert your symbols to groups... Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.