Jump to content
Developer Wiki and Function Reference Links ×

Changing Layers Name.


ALB

Recommended Posts

I have to change some layers name (eg. layers visibile) adding a prefix string.

This is my scipt:

Procedure prefix_layer_name;

VAR

stringa, nomelayer,nuovonome:STRING;

h:HANDLE;

visib:BOOLEAN;

BEGIN

stringa:=StrDialog('Prefix', 'AAAA001' );

h:=FLayer;

While h<>NIL DO BEGIN

IF GetLVis(h)=1 THEN BEGIN;

nomelayer:=GetLName(h);

nuovonome:=CONCAT(stringa,' ',nomelayer);

{ =====MISSING FUNCTION TO SET A NEW NAME======== }

END;

h:=NextLayer(h);

END;

END;

RUN (prefix_layer_name);

Best regards.

Link to comment

Thank you... but it doesn't work! It's just for objects.

In VS Function Reference I've found this:

Function GetName returns the object name of the referenced object. The function returns None if the object has no object name.

A handle to layer may not passed to this routine; to obtain a layer name, use GetLName.

...however SetLName(h,namelayer) doesn't exist!

Link to comment
GetName Doesn't work indeed, that's because the Layers aren't part of the NameList (and GetName use that list).

But SetName should work. Have you tried SetName? It works fine here...

Yes, you're right! Thank you very much!

My mistake was GetLVis(h)=1.

Possible values are:

Normal 0

Grayed 2

Invisible -1

This is my final script:

Procedure prefix_visible_layer_names;

VAR

stringa, layer_name,new_name:STRING;

h:HANDLE;

BEGIN

stringa:=StrDialog('Prefix string', '001.A' );

h:=FLayer;

While h<>NIL DO BEGIN

IF GetLVis(h)=0 THEN BEGIN;

layer_name:=GetLName(h);

new_name:=CONCAT(stringa,' ',layer_name);

SetName(h,new_name);

END;

h:=NextLayer(h);

END;

END;

RUN (prefix_visible_layer_names);

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