Cancel
Showing results for 
Search instead for 
Did you mean: 

List Elements in layer/group

Valued Contributor
Valued Contributor

Hi

 

I am a new user of FeMap. I am creating a fairly complex assembly model where I have seperated individual parts into layers and groups. 

 

I was wondering is there a way to list the number of elements/ nodes for each layer/group.

 

As an adhoc method I am doing the following:

 

View only one layer at a time -> List -> Model -> Elements -> Select all Elements -> Highlight

 

This gives the the number of elements in the layer. I was wondering if there is a command for doing this in one step for the entire model.

 

Thanks in advance.

 

Saptarshi

4 REPLIES

Re: List Elements in layer/group

Pioneer
Pioneer

Hi,

 

This API lists the number of elements for layers and groups.

 

-Kris

 

Sub Main
    Dim App As femap.model
    Set App = feFemap()

    Dim lay As femap.layer
    Set lay = App.feLayer

    Dim eleSet As femap.Set
    Set eleSet = App.feSet

    Dim gr As femap.Group
    Set gr =App.feGroup

    'List layers, number of elements
    While lay.Next
    	rc=eleSet.Clear 'empty set on each loop
	rc=eleSet.AddRule(lay.ID,FGD_CURVE_BYLAYER)
	App.feAppMessage(FCM_NORMAL,"Layer " +Str(lay.ID) + " elements: " +Str(eleSet.Count))
    Wend
 'List groups, number of elements
    While gr.Next
    	rc=gr.Get(gr.ID)
    	rc=eleSet.Clear 'empty set on each loop
    	rc=gr.GetList(FGR_ELEM,eleSet.ID)
	App.feAppMessage(FCM_NORMAL,"Group " +Str(gr.ID) + " elements: " +Str(eleSet.Count))
    Wend
    
End Sub

Re: List Elements in layer/group

Valued Contributor
Valued Contributor

Hi Kris,

 

I tried the code you provided. Unfortunately, the layers are listed but the elements are not listed. All layers report 0 elements.

 

eg:

Layer 1 elements: 0

Layer 2 elements: 0

Layer 3 elements: 0

Layer 4 elements: 0

 

Is there something else that I have to do before running the code. What I understood from the script, the eleset.count is not working correctly as it is returning a value of 0.

 

Regards,

 

Saptarshi

Re: List Elements in layer/group

Legend
Legend

Dear Saptarshi,

 

 

In the script provided by Kris one line should be changed:

rc=eleSet.AddRule(lay.ID,FGD_CURVE_BYLAYER)

On this:

 rc=eleSet.AddRule(lay.ID,FGD_ELEM_BYLAYER)

Because it requests curves in layers and you need elements.

 

Yarko

Re: List Elements in layer/group

Pioneer
Pioneer

Exactly! Sorry for the typo!

-Kris