How do I create a text frame that automatically retrieves the number of layers?

Hello 

I'm trying to create a text frame in the drawings on CATIA that automatically displays the number of existing layers in the file. I tried to bind the text to a parameter that retrieves this data, but I can't seem to set it up. 

Anyone know how to do it, or should it go through a macro instead?

Thank you in advance.

Hello.

It would be better to go through a macro (not my field) it avoids always using the same CATdrawing (starting model).

Otherwise to implement manually:

You need to create a "String" parameter

Associate this "fx"  parameter with a formula on the layer's alias.

create a text box that is "linked to the attribute" (the "string" parameter).

RQ: the text will only be updated after the layer name has been changed

"Property."

EDIT: I read too fast (understood the name of the layer) instead of the number of layers.

Dixit: (I tried to bind the text to a parameter that retrieves this data, but I can't get it in place). 

How do you retrieve the number of layers of a CATDrawing in a parameter??

Apart from macro I don't see how you do it?

Hello

Here's a macro that counts the view layers and the detail layers

The number of layers of the views is assigned to a user parameter named "nb_calques" which is of type integer
 

Sub Nb_CalqueDeVues()

' définition des variables
Dim i As Integer
Dim nb_CV As Integer ' nombre de calques de vues

'
    With CATIA.ActiveDocument.Sheets
        nb_CV = 0
        ' boucle sur tous les calques du fichier
        For i = 1 To .Count
            ' verifie si le _
                calque est un calque de vue ou de détail
            If .Item(i).IsDetail = False Then
                nb_CV = nb_CV + 1
            End If
        Next
        
    MsgBox .Count & " calques au total." & Chr(10) & Chr(10) & nb_CV & _
    " calques de vues" & Chr(10) & .Count - nb_CV & " calques de détails"

End With

' affecte le nombre de calque de vues au parametre du drawing
CATIA.ActiveDocument.Parameters.Item("nb_calques").Value = nb_CV

End Sub

 

All that's left to do is create your text and link it to your parameter

of course restart the macro whenever necessary

PS: the macro displays a dialog box that is only there to show "the number of layers" is a bit blurry to know exactly what we are talking about.

Hello 

Thank you both for your answers. Finally I had to use vince.roullier's macro, thank you for your help!