×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

CATIA Macro to Export a PDF

CATIA Macro to Export a PDF

CATIA Macro to Export a PDF

(OP)


Guys,

I was asked to develop a Catia macro that will export a PDF from a CATDrawing in a specific network folder. At this moment I got it with a simple command in VBS as shown below but I still have some open with the naming convention.

---------------------------------------
Language="VBSCRIPT"

Sub CATMain()

Set drawingDocument1 = CATIA.ActiveDocument

drawingDocument1.ExportData "D:\users\wc389\Desktop\OUTTest\ "& CATIA.ActiveDocument.name &".pdf", "pdf"

End Sub
-------------------------------------

When I run the macro, it creates a PDF file with the complete file name, including the “CATDrawing” extension as name. For example, if I have an active drawing with the Part Number 12345.CATDrawing, it will create a PDF named as 123.CatDrawing.PDF.

Instead that, I need to read some title block parameter to follow as naming convention, for example the Drawing Number and Drawing Revision to naming by this way: 12345_rev01.pdf.
Some one knows how can I close this point?

RE: CATIA Macro to Export a PDF

CODE -->

Sub Pdf()

Set drawingDocument1 = CATIA.ActiveDocument

Dim sName As String
sName = Left(CATIA.ActiveDocument.Name, InStr(1, CATIA.ActiveDocument.Name, ".CATDrawing") - 1)
 
Dim oParameters As Parameters
Set oParameters = drawingDocument1.Parameters

Set oPar = oParameters.Item("Rev#") '<--Parameter Name

drawingDocument1.ExportData "C:\Alex\ " & sName & "_" & oPar.Value & ".pdf", "pdf"

End Sub 

______

Alex ,

RE: CATIA Macro to Export a PDF

(OP)
Hello Alex,

Your code is working as I was expexting...

Thank you for your reply...

Alan SANTOS....

RE: CATIA Macro to Export a PDF

may i suggest that you modify it so that it saves catdrawing and pdf into same dir.

RE: CATIA Macro to Export a PDF

CODE -->

Sub Pdf()

Set drawingDocument1 = CATIA.ActiveDocument

Dim sName As String
sName = Left(CATIA.ActiveDocument.Name, InStr(1, CATIA.ActiveDocument.Name, ".CATDrawing") - 1)
 
Dim oParameters As Parameters
Set oParameters = drawingDocument1.Parameters

Set oPar = oParameters.Item("Rev#") '<--Parameter Name

Dim sPath As String
sPath = CATIA.ActiveDocument.Path & "\" & sName & "_" & oPar.Value & ".pdf"

drawingDocument1.ExportData sPath, "pdf"

End Sub 

______

Alex ,

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources