Jump to content
  • 0

class attributes


krw

Question

if I hav an object drawn without class attributes and later I want to change ti to have all class attributes (class line weight, color, thickness, etc.) it would be nice if there were a button on the attributes palette to say "all class attributes" (or something) so that I don't have to go change each attribute (weight, color, thickness, etc). In other words I want to condense the 5 steps into one. I don't want to take away the 5 attributes already there. Just add a button so that if I know I want an object to have all the preset class attributes I can easily apply them to the object. Is there a shortcut for this already?

I don't always get the prompt "do you want to apply all of the class attributes?" when I change an object from one class to another.

Link to comment

6 answers to this question

Recommended Posts

  • 0

KRW, go into the class setup matrix and double click on the class you want to apply. Make sure all the attributes are set as you want them to be. Make sure the "use at creation" button is checked. Click OK. Go back and select your object, and in the OI palette change it to the class (via the pulldown menu) you wish. You may get a dialog asking if VW's should apply the attributes. If you click "always" you will not see this dialog again until you quit the program and ten restart it. If you simply click "yes" you should see the dialog every time. Hope that helps!

Peter Cipes

Link to comment
  • 0

Agian this is a Workaround, and reduces the flexiablity of the initial suggestion.

if you only want all attributes by class for the ocassional object, there still is no simple way to achive this.

the idea is great

if the same checkbox could be used to turn all class attributes off as well.

Link to comment
  • 0

Try that, I don't have run a good trial of it, but he seems to work OK... but I don't guaranty anything.

You are able to send object to other layers or classes, and choose if you want to apply the new class attributes. By "Follow" I mean that you will end up on the layer and class you have selected: Is easy to see if on the options you select "see only".

I'm using different versions set up as a right click (as a plug in), and so far he don't seem to have bugs: but let me know, and I will try to fix them.

code:

{///////////////////////////////////////////////////////////////

LayerClassT

By: <kiwi Dec 2003>

Built with Dialog Builder 4 © 2001 Nemetschek North America.

///////////////////////////////////////////////////////////////}

PROCEDURE LayerClassT;

{$debug}

VAR

dlogID,dlogResult,nl,nc,i : INTEGER;

dialogIsOK,rsrcOK,dupl,go,dumm,OK : BOOLEAN;

h,ho: HANDLE;

Layerr,classr,currentL,currentC,clas: STRING;

Layers,Classes: DYNARRAY OF STRING;

Attb: ARRAY [1..5] OF BOOLEAN;

{ dialog related subroutines }

{ Dialog definition function subroutine }

FUNCTION Define_LayerClassT : INTEGER;

VAR

dialogID : INTEGER;

BEGIN

dialogID := CreateLayout('Layer/Class Transfer',True,'OK','Cancel');

CreatePulldownMenu(dialogID,10,25);

CreatePulldownMenu(dialogID,20,25);

CreateGroupBox(dialogID,50,'Class Attributes Options',True);

CreateCheckBox(dialogID,30,'Follow objects');

CreateCheckBox(dialogID,40,'duplicate objects');

CreateCheckBox(dialogID,51,'Fill Collor by Class');

CreateCheckBox(dialogID,52,'Fill Patern by Class');

CreateCheckBox(dialogID,53,'Pen Color by Class');

CreateCheckBox(dialogID,54,'Pen Weight by Class');

CreateCheckBox(dialogID,55,'Line Style by Class');

CreateCheckBox(dialogID,56,'All Attributes');

SetFirstLayoutItem(dialogID,10);

SetBelowItem(dialogID,10,20,0,0);

SetBelowItem(dialogID,20,30,0,0);

SetBelowItem(dialogID,30,40,0,0);

SetBelowItem(dialogID,40,50,0,0);

SetBelowItem(dialogID,50,56,0,0);

SetFirstGroupItem(dialogID,50,51);

SetBelowItem(dialogID,51,52,0,0);

SetBelowItem(dialogID,52,53,0,0);

SetBelowItem(dialogID,53,54,0,0);

SetBelowItem(dialogID,54,55,0,0);

SetHelpString(1,'Accepts dialog data.');

SetHelpString(2,'Cancels operation without changes.');

SetHelpString(10,'Slect a layer to transfer your selected object');

SetHelpString(20,'Select the class you want your object transfer to.');

SetHelpString(30,'Go to the selected option with the actual visibility settings');

SetHelpString(40,'Select to duplicate your selected object');

Define_LayerClassT := dialogID;

END;

{ get Layer names to dinarray Layers }

Procedure GetLayers;

BEGIN

nl:=NumLayers;

AlLOCATE Layers[1..nl];

h:=FLayer;

For i:=1 TO nl DO BEGIN

Layers
:=GetLNAME(h);

h:=NextLAyer(h);

END;

END;

{ get Class names to dinarray Classes }

Procedure GetClasses;

BEGIN

nc:=ClassNum;

AlLOCATE Classes[1..nc];

For i:=1 TO nc DO BEGIN

Classes
:=ClassList(i);

END;

END;

{ Change each obj settings }

Procedure ChangeObject(ho:HANDLE);

VAR

Fp,Ls,Lw: INTEGER;

Pcr,Pcg,Pcb,Ffr,Ffg,Ffb: LONGINT;

BEGIN

GetPenFore(ho,Pcr,Pcg,Pcb);

GetFillFore(ho,Ffr,Ffg,Ffb);

Fp:=GetFPat(ho);

Ls:=GetLs(ho);

Lw:=GetLw(ho);

h:=GetLayerByName(layerr);

SetClass(ho,classr);

dumm:=SetParent(ho,h);

IF Attb[1] THEN SetFillColorByClass(ho)

ELSE SetFillFore(ho,Ffr,Ffg,Ffb);

IF Attb[2] THEN SetFPatByClass(ho)

ELSE SetFPat(ho,fp);

IF Attb[3] THEN SetPenColorByClass(ho)

ELSE SetPenFore(ho,Pcr,Pcg,Pcb);

IF Attb[4] THEN SetLwByClass(ho)

ELSE SetLW(ho,Lw);

IF Attb[5] THEN SetLSByClass(ho)

ELSE SetLs(ho,Ls);

END;

{ Dialog driver function subroutine }

PROCEDURE Drive_LayerClassT(VAR item:LONGINT; data:LONGINT);

BEGIN

CASE item OF

SetupDialogC:BEGIN

GetLayers;

h:=ActLayer;

CurrentL:=GetLNAme(h);

FOR i:=1 to nl DO BEGIN

InsertChoice(10,i,Layers
);

IF Layers
=CurrentL THEN SELChoice(10,i,true);

END;

GetClasses;

CurrentC:=ActiveClass;

For i:=1 TO nc DO BEGIN

InsertChoice(20,i,Classes
);

IF ClassList(i)=CurrentC THEN BEGIN

SELChoice(20,i,true);

END;

END;

OK:=TRUE;

END;

1:BEGIN

GetSelChoice(20,0,i,Classr);

GetSelChoice(10,0,i,Layerr);

dupl:=ItemSel(40);

go:=ItemSel(30);

Attb[1]:=ItemSel(51);

Attb[2]:=ItemSel(52);

Attb[3]:=ItemSel(53);

Attb[4]:=ItemSel(54);

Attb[5]:=ItemSel(55);

END;

56:BEGIN

IF ItemSel(56) THEN BEGIN

SetItem(51,True);

SetItem(52,True);

SetItem(53,True);

SetItem(54,True);

SetItem(55,True);

END;

END;

END;

END;

{ main body of script }

BEGIN

dlogID := Define_LayerClassT;

dialogIsOK := VerifyLayout(dlogID);

IF dialogIsOK THEN BEGIN

dlogResult := RunLayoutDialog(dlogID,Drive_LayerClassT);

END;

IF dupl THEN duplicate(0,0);

IF OK THEN ForEachObject(ChangeObject,SEL=true);

IF go THEN BEGIN

NameClass(Classr);

Layer(layerr);

END

ELSE BEGIN

Layer(CurrentL);

NameClass(CurrentC);

END;

END;

Run(LayerClassT);
[/code]

Link to comment
  • 0

A user post report a bug affecting similar script running under Windows. I found a problem on the indexing for the pul down menus (the fist value need to be 0 and not 1): as result you can not see the layers or classes to make a choice.

To fix the issue replace:

Line 127 with:

InsertChoice(10,i-1,Layers);

Line 134 with:

InsertChoice(20,i-1,Classes);

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
Answer this question...

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