Cancel
Showing results for 
Search instead for 
Did you mean: 

Move All Entities To Layer

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello All,

 

I have created an API that will move all entities in the model to a specified Layer.  This improves upon the functionality already present in the GUI ( Modify > Layer > ... ), now moving all entities at once.  This is similar to the "Renumber All" command.

 

The attached .txt file can be pasted entirely into the API pane within Femap, or it can be saved as a ".BAS" and dropped into your User Tools directory, to run.

 

First, a user is prompted to create a new layer or select an existing one.  With Femap v11.4, we have the ability to use the dialog below with the ".SelectIDWithNew" method.  This allows for selection of an existing layer or creation of a new layer all in the same location.

 

LayerDialog.png

 

For Femap versions previous to 11.4, the prompt below will amend the above.

 

move.png

 

There are some interesting API methods used such as creating multiple Objects when needed and looping through Femap Entity Types.

 

For example, the Model Info Tree shown below starts with:

 

Property 5            , Layer = 2

Load Definition 1, Layer = 3

 

After the script is run:

 

Property 5            , Layer = 50

Load Definition 1, Layer = 50

 

 

BEFORE:

 

start.png

 

AFTER:

 

end.png

 

To move Loads and Constraints to a layer involved a slightly different approach.  Femap Help Sections 5.13.2.6 "NextBCDef" and  5.41.2.6 "NextLoadDef" contain examples that were expanded upon to suit the needs of this particular API.

 

Ryan