Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drafting; inserting "PAGE # OF #" and date printed in a footer 2

Status
Not open for further replies.

norkamus

Aerospace
May 15, 2012
76
CA
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
 
Replies continue below

Recommended for you

Hey,

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
 
Ok, That will allow me to add text to a background- on a case by case basis. I wasn't clear enough (sorry).
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
 
Hi,


Code:
' ==============================================================
' 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

Regards
Fernando
 
I hate when I cannot edit my own post...I forgot to add the date.....

Code:
' ==============================================================
' 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

Regards
Fernando
 
Thank you thank you thank you!

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
 
Some details for what you want? Meaning font type, size (or if you want to input them from an input box)...

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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top