ericjhberg Posted January 9, 2018 Share Posted January 9, 2018 I have over 1000 different plant symbols in a drawing. The 2D components of these symbols are all very basic circles with black outlines and different color fills...that's it. One object...a circle. Since I stupidly did not Make All Attributes By Class when I created these symbols originally, I am now trying to find a fast way of changing the pen color of every single plant object in the drawing without having to change them each individually. This seems like something for either marionette or a custom script. Can someone please advise? I would love the help. Thanks. Quote Link to comment
Pat Stanford Posted January 9, 2018 Share Posted January 9, 2018 Do you want them to be set as ByClass? Or do you just want to manually change them all to something other than black? Do you have other symbols in the drawing that you don't want to change? Is there something about these plant symbols (Name, attached record, all in a single symbol folder, etc.) that could be used to identify these plant symbols versus other symbols in the drawing? If we can identify the symbols it is a pretty simple script to make the change. Quote Link to comment
markdd Posted January 9, 2018 Share Posted January 9, 2018 A little while back I had a very similar question. I asked here and Raymond Mullin wrote me a script. Basically it sets all objects in the file including those within symbols to a "by class" setting. I've attached it. Try with a sample file of course to be sure its what you want!! By Class.vwx Quote Link to comment
ericjhberg Posted January 9, 2018 Author Share Posted January 9, 2018 (edited) See below Edited January 9, 2018 by ericjhberg Quote Link to comment
ericjhberg Posted January 9, 2018 Author Share Posted January 9, 2018 40 minutes ago, Pat Stanford said: Do you want them to be set as ByClass? Or do you just want to manually change them all to something other than black? No, not by class, just another color. 40 minutes ago, Pat Stanford said: Do you have other symbols in the drawing that you don't want to change? Nope, no other symbols. This is a library file I am just trying to clean up. Thanks for the quick reply! Quote Link to comment
Pat Stanford Posted January 9, 2018 Share Posted January 9, 2018 Try this. Just change the values for the RGB in the SetPenFore line to the color you need. Procedure Change_Pen_Color; Var H1:Handle; N1:Integer; Procedure Process(Hd:Handle); Begin SetPenFore(FInSymDef(Hd),000,65000,000); N1:=N1+1; End; Begin N1:=0; H1:=FSymDef; While H1<>Nil do Begin Process(H1); H1:=NextSymDef(H1); End; RedrawAll; Message(Date(2,2),' ',N1,' Symbol Definitions Processed'); End; Run(Change_Pen_Color); Quote Link to comment
ericjhberg Posted January 9, 2018 Author Share Posted January 9, 2018 (edited) Hmm, I don't think it worked. I'm not that familiar with scripts. The desired RGB file is 65535, 65535, 65535 I've attached the file in question. You'll notice that I've manually adjusted the first few to the desired Magenta color, but when I run the script, it doesn't appear to work? Thanks again! _PCLD Generic Plants.vwx Edited January 9, 2018 by ericjhberg Quote Link to comment
Pat Stanford Posted January 10, 2018 Share Posted January 10, 2018 Eric, Eric, Eric, It doesn't work because you lied to me ;-) You said it was a symbol with a single circle. It is not. It is a hybrid symbol with a Plant object in the profile group. The symbol that is used for the plant consists of a circle plus 2 crossed lines. And the symbols are all in symbol folders. Also, the RGB of the magenta color is 65535, 0, 65535. 65535,65535,65535 is solid white. 0,0,0 is solid black. I will see what I can do to update the script tomorrow or Thursday. Quote Link to comment
Pat Stanford Posted January 10, 2018 Share Posted January 10, 2018 OK. Try this. On the 60 symbol sample file it takes about 10 seconds to run on my machine, so be patient when running on a big file. I had to use a resource list to be able to handle symbols inside symbol folders. Procedure Process_Resource_List; {January 10, 2018} {© 2018, Pat Stanford pat@coviana.com} {Licensed under the GNU Lesser General Public License} {Uses a Resource List to process every symbol definition in a file to change the pen fore color} {Change the RGB values in the SetPenFore line as appropriate} Var H1:Handle; N1,N2:Integer; S1,S2:String; L1,L2,RList:LongINt; Procedure Process(Hd:Handle); Var Hd1,Hd2,Hd3,Hd4:Handle; Begin Hd4:=FInSymDef(Hd); Hd3:=GetCustomObjectProfileGroup(Hd4); Hd2:=FInGroup(Hd3); Hd1:=FInGroup(Hd2); SetPenFore(Hd1,65535,000,65535); ResetObject(Hd1); ResetObject(Hd2); ResetObject(Hd3); ResetObject(Hd4); ResetObject(Hd); ResetBBox(Hd); N1:=N1+1; End; Begin N1:=0; RList:=BuildResourceList(16,0,'',L1); L2:=1; While L2 <= L1 do Begin H1:=GetResourceFromList(RList,L2); Process(H1); L2:=L2+1; End; RedrawAll; Message(Date(1,2),' ',N1,' Symbol Definitions Processed'); End; Run(Process_Resource_List); Quote Link to comment
ericjhberg Posted January 10, 2018 Author Share Posted January 10, 2018 That's awesome!!! It works beautifully and in seconds. Thanks @Pat Stanfordfor saving us hours of manual time! 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.