CharlesD Posted May 31, 2016 Share Posted May 31, 2016 So I'm trying to create a script for myself to prep newly acquired symbols to my drafting standards. I've hit a couple of stumbling blocks with the script I've cobbled together from examples on this forum. 1. I want the script act only on selected symbols. Currently it acts on any symbol in the file. 2. I want to build all of my prep steps as separate functions. And then call them in the main procedure individually, so I can tweak and build on this script easily as future needs demand. 3. My object attributes thing works okay, but the intention is to only set the fill color by class IF the color is white. If the color is anything but white, I want the discrete color to remain. I suspect currently my script isn't evaluating each object within the symbol, as it should be. 4. My Locus function isn't working as intended. I want to first open the selected symbol and delete any instance of a locus. Then I want to insert a new locus at 0,0 on class "Symbol-Locus" inside the geometry of the symbol. Currently it just puts it in the drawing at origin. Any help here would be greatly appreciated! Thank you! PROCEDURE LightSymbolMaintenance; CONST X0 = 0; Y0 = 0; VAR I :Integer; ClassName :String; r,g,b :Longint; function AttByClass(H :Handle) :Boolean; { Set all object attributes by class, unless the fill color is not white. } Begin SetPenColorByClass(H); SetOpacityByClass(H); SetLSByClass(H); SetLWByClass(H); SetOpacityByClass(H); SetTextStyleByClass(H); SetFPatByClass(H); GetFillBack(H,r,g,b); Message(r,g,b); {Test to see what color this thing is seeing} if (r <> 255) & (g <> 255) & (b <> 255) then begin SetFillColorByClass(H); end; End; { SetAttByClass } function InsertLocus(H :Handle) :Boolean; {Delete any existing locus, insert a new locus on layer "Locus" at origin} Begin Locus(X0,Y0); End; BEGIN { Change all objects in Symbol Defs to accept colour attributes "By Class" } ForEachObjectInList(AttByClass, 0, 2, FSymDef); ForEachObjectInList(InsertLocus, 0, 2, FSymDef); SysBeep; { sound off when done } END; Run(LightSymbolMaintenance); Quote Link to comment
Patrick Winkler Posted June 1, 2016 Share Posted June 1, 2016 (edited) Hi Charles, 1. you can get the selected Sym-Instaces by the criterium: ((T=SYMBOL) & (SEL=TRUE)) then you have to get the Sym-Definitions from the Instances. You should use a set to store because you don't need any definition more than once in the list. 3. I'm pretty sure that GetFillBack() returns a 16Bit RGB Value. white = (65535, 65535, 65535) 4. Try it with vs.SetParent (locus, handle_of_the_symdefini) Edited June 1, 2016 by Patrick Winkler 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.