Jump to content
Developer Wiki and Function Reference Links ×

Use Class Attributes


shorter

Recommended Posts

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

Link to comment

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);

Link to comment

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);

Link to comment

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...