shorter Posted September 15, 2006 Share Posted September 15, 2006 There is a VS on NNA Support site, entitled 'Set Object to Class Attributes'. The script runs as follows: PROCEDURE UseClassAttribs; VAR h : HANDLE; BEGIN { get a handle to the object } h:= FSActLayer; { set the object to use the class settings for } { its display attributes } SetFillColorByClass(h); SetPenColorByClass(h); SetFPatByClass(h); SetLWByClass(h); SetLSByClass(h); END; Run(UseClassAttribs); Works fine for one object. I have been trying without success, to expand this to all objects in a file, irrespective of layer, class, group, symbol or PIO, ideally without having to select them first. Any suggestions gratefully received. Regards Steven Quote Link to comment
Ryan McCuaig Posted September 15, 2006 Share Posted September 15, 2006 Something like this should work on selected objects in the current layer. I like to confine any ForEachObject() operation so that I can see the result. In bigger files, you can cause havoc and not notice for a while if something happens to an invisible layer. But if you put (ALL) in place of ((SEL=TRUE) & (L=lname)) it should nail everything... might have trouble with things in groups. Hope this helps. PROCEDURE Main; VAR lname : STRING; i : INTEGER; PROCEDURE UseClassAttribs; VAR h : HANDLE; BEGIN h:= FSActLayer; { get a handle to the object } { set the object to use the class settings for } { its display attributes } SetFillColorByClass(h); SetPenColorByClass(h); SetFPatByClass(h); SetLWByClass(h); SetLSByClass(h); END; { PROCEDURE UseClassAttribs } BEGIN i := 0; lname := GetLName(ActLayer); ForEachObject(UseClassAttribs,((SEL=TRUE) & (L=lname))); AlertInform(Concat('UseClassAttrib applied to ',i,' objects'),'',TRUE); END; { PROCEDURE Main } Run(Main); Quote Link to comment
shorter Posted September 17, 2006 Author Share Posted September 17, 2006 Thanks, Ryan Gets stuck on Line #24: ForEachObject(UseClassAttribs,((SEL=TRUE) & (L=lname))); | { Error: Expected a procedure that accepts one handle argument. } Steven Quote Link to comment
Jonathan Pickup Posted September 17, 2006 Share Posted September 17, 2006 if you want to change the class on all object regardless of what type of object they are, then you'll have to test eash object to see what kind of object you have. for example if your handle is to a group, you'll want to go insude the group and check for the objects inside the group that are on the class you are looking for Quote Link to comment
Jonathan Pickup Posted September 17, 2006 Share Posted September 17, 2006 they way that your script is at the moment, nothing is selected. your selection code is in the procedure, you need it in the main body of the code Quote Link to comment
Jonathan Pickup Posted September 17, 2006 Share Posted September 17, 2006 PROCEDURE Main; VAR lname : STRING; i : INTEGER; PROCEDURE UseClassAttribs (h: HANDLE); BEGIN h:= FSActLayer; { get a handle to the object } { set the object to use the class settings for } { its display attributes } SetFillColorByClass(h); SetPenColorByClass(h); SetFPatByClass(h); SetLWByClass(h); SetLSByClass(h); END; { PROCEDURE UseClassAttribs } BEGIN i := 0; lname := GetLName(ActLayer); ForEachObject(UseClassAttribs,((SEL=TRUE) & (L=lname))); AlertInform(Concat('UseClassAttrib applied to ',i,' objects'),'',TRUE); END; { PROCEDURE Main } Run(Main); Quote Link to comment
Jonathan Pickup Posted September 17, 2006 Share Posted September 17, 2006 but for something like an extrude, you have to go inside the object and apply the class to the original 2D shape. 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.