# Layer number Position of a design layer and management SOLVED

## Recommended Posts

Hello everyone.

I am trying to do something that looks easy but I don´t find the right functions:  "To change the position of a design layer"

The initial situation is this one:

Design Layer          #

Design Layer A --> 1

Design Layer B --> 2

Design Layer D --> 3

I want the layers like this:

Design Layer          #

Design Layer A --> 1

Design Layer B --> 2

Design Layer C --> 3

Design Layer D --> 4

Must be not so difficult to insert a new in a position because I can do manually when I create a new layer.

I need to know how to get the number of the "Design Layer B" --> 2

And be able to create a new layer at the next number.

this are my options, and no one is useful to my eyes

vs.Layer("Design Layer B")

vs.CreateLayer('NEW Design Layer', 1)

vs.CreateLayer('NEW PRESENTATION Layer = LAYOUT', 2)

Any idea?

Edited by avictorgm

##### Link to post

The position of a new layer can be set by using the vs.HMoveBackward(h, toBack)

see also the post on Layer Stacking Order:

##### Link to post

Thanks Spaghetto,

It helps a lot!!!

##### Link to post

You can picture the Vectorworks document like an xml tree, where layers are parents of objects, if one of those objects is a group, it is a parent of its child objects, etc.

HMoveForwards/Backwards will move anything up and down the tree at its level, so moving layers changes the layer order and moving objects changes the stacking order within the layer.

VS doesn’t include a function for moving an object to a particular point in the list. If you want to insert a layer at a particular point, get a handle to the active layer, create the new layer, send it to the bottom, then start a while loop that moves the layer up until PrevObj(hNewLayer) (or NextObj() depending if you want above or below) = hActLayer.

• 2

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×

• KBASE