Jump to content
Developer Wiki and Function Reference Links ×

Script to Create a new layer?


MaxStudio

Recommended Posts

I'm not sure how you want your script to run, interactively or not, but it's not hard to cobble one together.

The VS procedure Layer() will create a new design layer.

Layer('New Layer Name');

The VS function CreateLayer() will create a new layer and returns a handle to the new layer, which can be ignored if you only want to create them.

LayerHandle := Layer('Another Layer Name', 1);?????????{ 1 = Design Layer / 2 = Sheet Layer }

Each new layer you create will be on top of all other layers visually, so you may want to create new layers in the reverse order you want them displayed in the layer pop-up menu.

Raymond

Link to comment

yeah I'm trying to make a script that allows a user to create a new floor.... and gives them all the layers they need in the order that they need to be in. It will work sort of like what the program does all ready if you use 'Create Standard Viewport'. Except the viewport will not be setup. unless you know of anyone who has experience doing that too.. I once messed around with the actual program itself to get the 'Standard Viewports' to do what i wanted but I don't know if that is a good idea or just over complicated.

Link to comment

Just a couple of clarifications on what Raymond said.

Layer is used not just to create a new design layer, but also to change the active layer. If the name you pass already exists, it just changes the layer. It if does not exist, it creates a new layer and makes it active.

The last example should be

Layer := CreateLayer('Another Layer Name',1); (instead of Layer).

In the Vectorscript Function Reference, set it to View by Class and scroll down to Layer to see all of the functions you can use to set the layer scale, stacking order, Layer Z height, etc.

Pat

Link to comment

ok i got this working but, i want the user to be able to type the name of the layer they want is it possible for that?

VAR

s:string;

H1:handle;

Begin

s:= 'Hello';

H1 := CreateLayer(s,'RC Shade'', 1);

End;

Run(program)

I get an error it doesn't like reading the 's' variable. it seems to only want 1 string and 1 integer.

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