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
Your code is working as I was expexting...
Thank you for your reply...
Alan SANTOS....
RE: CATIA Macro to Export a PDF
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 ,