I have a question about automatic properties in a 2D plane:
I would simply like to display the active page as well as the total number of pages in my drawing:
I proceeded as below: I have two automatic fields in my title block, the first is to know the active page number. I simply inserted the " Sheet Number" attribute link in the desired box:
Then, in a second field, I would like to have the total number of pages. There is indeed an attribute link with the total number of sheets:
The problem is that in this counter all the layers are taken into account, but I would like the " detail layer" to be excluded from this counter.
Do you know if this very special requette exists? Maybe you have another method to display the page counter on a title block?
On the other hand, to be able to exclude a leaf according to a specific criterion I think you will have to go through a macro. of the genre:
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swDraw As SldWorks.DrawingDoc
Dim swSheet As SldWorks.Sheet
Dim vSheetNames As Variant
Dim bRet As Boolean
Dim i As Long
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swDraw = swModel
Set swSheet = swDraw.GetCurrentSheet
vSheetNames = swDraw.GetSheetNames
For i = 0 To UBound(vSheetNames)
Debug.Print " SheetName[" & i & "] = " & vSheetNames(i)
If vSheetNames(i) = "LE NOM DE LA FEUILLE A NE PAS COMPTER" Then
swModel.AddCustomInfo2 "Total Sheets", swCustomInfoText, swModel.GetSheetCount - 1
End
End If
Next i
End Sub
The macro that is going well (normally): Private Sub CommandButtonValider_Click()
Dim Planche, SurPlanches
' determines the total number of plates SurPlanches = 0 For I = 1 TB CATIA. ActiveDocument.Sheets.Count If CATIA. ActiveDocument.Sheets.Item(I). IsDetail = False Then SurPlanches = SurPlanches + 1 End If Next
' Assigning the page number Board = 0 For I = 1 TB CATIA. ActiveDocument.Sheets.Count If CATIA. ActiveDocument.Sheets.Item(I). IsDetail = False Then Board = Board + 1 CATIA. ActiveDocument.Sheets.Item(I). Views.Item(2). Texts.GetItem(" PageNumber "). Text = Plate & " / " & SurPlanches
I'll let you get back in shape, I've removed everything that is useless, which explains why we're in a " private ", why there are " next " people who walk around...