Drafting; inserting "PAGE # OF #" and date printed in a footer
Drafting; inserting "PAGE # OF #" and date printed in a footer
(OP)
Hello. I am a new user to CATIA V5 R20. I have a lot of experience with NX6 and Autodesk Inventor. CATIA has proven to be the most backwards, difficult software I have ever experienced.
That said, I have to plough on. I would like to know how I would insert "PAGE # OF #" and the print date at the bottom of a drawing. I would like it to be part of the background, somehow using parameters if possible. This will be a template for future use.
Please be clear and descriptive. I am familiar with VB, but not extensively. "Read the online help" won't help too much. I have tried and tried and can find nothing on this subject. (Online help often comes up fruitless)
Thank you,
Nick
That said, I have to plough on. I would like to know how I would insert "PAGE # OF #" and the print date at the bottom of a drawing. I would like it to be part of the background, somehow using parameters if possible. This will be a template for future use.
Please be clear and descriptive. I am familiar with VB, but not extensively. "Read the online help" won't help too much. I have tried and tried and can find nothing on this subject. (Online help often comes up fruitless)
Thank you,
Nick





RE: Drafting; inserting "PAGE # OF #" and date printed in a footer
so first thing you need to make sure you are in the CATIA drafting window, make sure you all ready have your title block selected.
go in to the drop down window Edit,
select Sheet Background,
then dubble click on the area you want to edit if there is text all ready there, or add text by clicking on the text tool.
then once compleat exit the sheet background by going back to Edit and clicking on sheet view
that should do it
Ethan
RE: Drafting; inserting "PAGE # OF #" and date printed in a footer
What I am looking for is some sort variable or something that will print out the page number and the total number of pages in the document.
eg:
If I have a drawing that has one sheet, the text at the bottom will automatically show "page 1 of 1"
If I add two more sheets to said document, the text will say "page 1 of 3" on sheet one, "page 2 of 3" on page two and so on.
Any other software is capable of this. There has to be a way. It's got to be automatic. I am trying to eliminate redundant behaviour and quicken my workflow.
Nick
RE: Drafting; inserting "PAGE # OF #" and date printed in a footer
[code CATScript]
' ==============================================================
' Purpose: CATScript will count sheets in an active CATDrawing and write names to them as "counter index/total number"
' Usage: 1 - A CATDrawing must be active
' 2 - Run macro
' Author: ferdo (Disclaimer: You use this code at your own risk)
' ===============================================================
Language="VBSCRIPT"
Sub CATMain()
'get the current date
Set objFSO = CreateObject("Scripting.FileSystemObject")
strNewName = objFSO.GetBaseName(objFile) & _
Year(Now) & "-" & _
Right("0" & Month(Now), 2) & "-" & _
Right("0" & Day(Now), 2) '& _
Set drawingDocument1 = CATIA.ActiveDocument
j=drawingDocument1.Sheets.count 'counting sheets numbers for total number
Dim oDoc As DrawingDocument
Dim oBackGround As DrawingView
Dim oFrontView As DrawingView
Dim oText As DrawingText
Set oDoc = CATIA.ActiveDocument
Set drawingSheets1 = drawingDocument1.Sheets
For i = 1 To drawingDocument1.Sheets.Count 'creating sheets index
Set oSheet = drawingDocument1.Sheets.Item(i)
oSheet.Activate 'activate corresponding index sheet to write on it
Set oBackGround = oDoc.Sheets.ActiveSheet.Views.Item("Background View") 'select Background View
Set oText = oBackGround.Texts.Add("Sheet" & i & " / " & "Sheet" & j, 0, 0) 'write Sheet index / Total number at position x=0 , y = 0
Next
End Sub
[/code]
Regards
Fernando
RE: Drafting; inserting "PAGE # OF #" and date printed in a footer
[code CATScript]
' ==============================================================
' Purpose: CATScript will count sheets in an active CATDrawing and writee names to them as "counter index/total number"
' Usage: 1 - A CATDrawing must be active
' 2 - Run macro
' Author: ferdo (Disclaimer: You use this code at your own risk)
' ===============================================================
Language="VBSCRIPT"
Sub CATMain()
'get the current date
Set objFSO = CreateObject("Scripting.FileSystemObject")
strNewName = objFSO.GetBaseName(objFile) & _
Year(Now) & "-" & _
Right("0" & Month(Now), 2) & "-" & _
Right("0" & Day(Now), 2) '& _
Set drawingDocument1 = CATIA.ActiveDocument
j=drawingDocument1.Sheets.count ''counting sheets numbers for total number
Dim oDoc As DrawingDocument
Dim oBackGround As DrawingView
Dim oFrontView As DrawingView
Dim oText As DrawingText
Set oDoc = CATIA.ActiveDocument
Set drawingSheets1 = drawingDocument1.Sheets
For i = 1 To drawingDocument1.Sheets.Count 'creating sheets index
Set oSheet = drawingDocument1.Sheets.Item(i)
oSheet.Activate 'activate corresponding index sheet to write on it
Set oBackGround = oDoc.Sheets.ActiveSheet.Views.Item("Background View") 'select Background View
Set oText = oBackGround.Texts.Add("Sheet" & i & " / " & "Sheet" & j & " - " & strNewName, 0, 0) 'write Sheet index / Total number at position x=0 , y = 0
Next
End Sub
[/code]
Regards
Fernando
RE: Drafting; inserting "PAGE # OF #" and date printed in a footer
That codes works perfectly. I tweaked it a bit for taste.
Fernando, would you be able to help me out with setting the font type and size as well as the text objects' anchor point (via code)?
I might wanna build other macros for other stuff- I'm re-learning the syntax after years of being away.
Cheers,
Nick
Light structural commercial aircraft parts
APM Consortium Inc.
Cambridge Ontario, Canada
RE: Drafting; inserting "PAGE # OF #" and date printed in a footer
Anchor point...hmmm...I never thought of that, should be possible...or you want to change the text position maybe (not x = o , y = 0) ?
If you want to find more about CATIA programming check FAQ of this forum.
Regards
Fernando
https://picasaweb.google.com/102257836106335725208