Catia macro to automate drawing sheet numbers
Catia macro to automate drawing sheet numbers
(OP)
I'm trying to write a macro which automates the sheet numbers on my drawings. For example sheet 2 of 3.
I have found a code which works to print this information in the sheet background although I cannot find a way to update these numbers if a sheet is later added or deleted. At the moment if I run the macro again it simply prints the new numbers on top of the previous (so you can see both).
I'm trying to find a way that the existing text box can be either updated or deleted by the macro when an update is needed.
Hope this makes sense! Any help would be greatly appreciated.
I have found a code which works to print this information in the sheet background although I cannot find a way to update these numbers if a sheet is later added or deleted. At the moment if I run the macro again it simply prints the new numbers on top of the previous (so you can see both).
I'm trying to find a way that the existing text box can be either updated or deleted by the macro when an update is needed.
Hope this makes sense! Any help would be greatly appreciated.





RE: Catia macro to automate drawing sheet numbers
RE: Catia macro to automate drawing sheet numbers
then go to each sheet, and add the number.
try this:
CODE -->
Dim MyDoc As Document Dim MyDrawingDoc As DrawingDocument Set MyDrawingDoc = CATIA.ActiveDocument Dim DrwDocument As DrawingDocument Dim DrwSheets As drawingSheets Dim DrwSheet As drawingSheet Dim DrwView As DrawingView Dim DrwTexts As DrawingTexts Dim Text As DrawingText Dim Fact As Factory2D Dim Point As Point2D Dim Line As Line2D Dim Cicle As Circle2D Dim Selection As Selection Dim GeomElems As GeometricElements For Each DrwSheet In MyDrawingDoc.Sheets Dim sheet As Integer Dim sheet_count As Integer sheet = sheet + 1 sheet_count = MyDrawingDoc.Sheets.Count 'Insert sheet number Set MyText1 = MyDrawingViews.ActiveView.Texts.Add(("Sheet " & sheet & " / " & sheet_count), 100, 14.5) MyText1.WrappingWidth = 23 MyText1.SetFontSize 0, 0, 1.8 nextTiago Figueiredo
Tooling Engineer
Youtube channel:
https://www.youtube.com/channel/UC1qdlBeJJEgMgpPLV...