Jump to content
Developer Wiki and Function Reference Links ×

Need Help! with script to change class properties


Recommended Posts

I was wondering if there is a way to create a script that would change all class properties to no fill, set the all the classes to one color (RGB: 204, 204, 255) and all to one line weight (.15)

The biggest hang up I would think, would be having the script change everything inside of blocks without converting them to groups.

Any one even know where to begin with this?

Thanks so much,

J

Link to comment

J,

What you want is somewhat easy to do, especially changing the class attributes. Using the ForEachObject commands is a little tricky, but with a few examples, it's not all that hard. Remember to run this script on a COPY of your work. Going backwards in not as easy unless you don't use Class Attributes at all in your files.

Here's a quick and dirty script that makes the changes you outlined (I think) ....

PROCEDURE Homogenize;

VAR

???I :Integer;

???ClassName :String;

???function SetByClass(H :Handle) :Boolean;

???{ Set Fill Pattern, Pen Color, Line Style & Line Weight to be "ByClass". }

???Begin

??????SetFPatByClass(H);

??????SetPenColorByClass(H);

??????SetLSByClass(H);

??????SetLWByClass(H);

???End; { SetByClass }

BEGIN

???{ Change Attributes of all Classes to affect Fill Pattern, Line Style, Pen Color, and Line Weight. }

???for I := 1 to ClassNum do begin

??????ClassName := ClassList(I);

??????SetClFPat(ClassName, 0); { No Fill }

??????SetClLS(ClassName, 2); { Solid Foreground Pen }

??????SetClPenFore(ClassName, 52428, 52428, 65535); { Pen Color = RGB(255) x 257 }

??????SetClLW(ClassName, 6); { Line Weight in mils }

???end;??????{ for }

???{ if you need to change all objects to accept "Attributes By Class", then do the following... }

???ForEachObjectInLayer(SetByClass, 0, 2, 1); { all objects on all layers, active layer=0, 2, 0 }

???ForEachObjectInList(SetByClass, 0, 2, FSymDef); { all objects within symbol definitions }

???SysBeep; { sound when done }

END;

Run(Homogenize);

HTH,

Raymond

Link to comment
Right now I am doing everything manually and it does not change the color of items inside symbols when I edit the class properties.

If objects inside the symbols are not changing is because they are not using the class attributes. Edit the symbol and use the attribute palette to change each object's settings.

Link to comment
  • 3 weeks later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...