Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Hello I am using macro from this th

Status
Not open for further replies.

Raul Berame

Automotive
Jan 12, 2023
11
Hello I am using macro from this thread for exporting PDF files from CATIA Drawing. Is it possible to modify code to automatically convert multiple sheets into 1 file?

Here's the code I used from this Fourum:

Sub CATMain()

'Retrive the active document

Dim Doc As Document
Set Doc = CATIA.ActiveDocument

'Test the document's type, if it is not a drawing document the macro stops
If TypeName(Doc) = "DrawingDocument" Then
Dim DocDocument As DrawingDocument
Set DocDocument = Doc
Else
MsgBox "This macro can be run with a drawing document only."
Exit Sub
End If

Const WINDOW_HANDLE = 0
Const NO_OPTIONS = 0
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder _
(WINDOW_HANDLE, "Select a folder:", NO_OPTIONS, "C:\Scripts")

Set objFolderItem = objFolder.Self
objPath = objFolderItem.Path

MsgBox objPath

Set objFolderItem = CreateObject("Scripting.FileSystemObject")

Dim ShortPartNo, strFolderPath
ShortPartNo = Left(Doc.Name, 8)
MsgBox ShortPartNo
strFolderPath = objPath &"\"& ShortPartNo & "\"
MsgBox strFolderPath
If Not objFolderItem.FolderExists(strFolderPath) Then
objFolderItem.CreateFolder(strFolderPath)
End If

Doc.ExportData strFolderPath & ShortPartNo& ".pdf", "pdf"

CATIA.DisplayFileAlerts = False

End Sub

 
Replies continue below

Recommended for you

Printing all the sheets as one single PDF file should be straightforward to do just by checking the Export settings in Tools / Options.
 
Thanks MarkAF! But may I know when exactly the OPTIONS found? Please advise. Thanks
 
Should be this (now that I'm back in front of my screen):
Tools > Options > General > Compatibility > Graphics Formats
Under the heading 'Export (Save As)' check the box "Save multisheet documents in a single vectorial file"
Then test and verify the result.

Cheers
Mark
 
Hello Raul Berame,
Does this macro save all the drawings opened in CATIA window into pdf or only active sheet it will save?

Thanks in advance
 
Yeah if I use PDF Batch utility, after Exporting to PDF line weights appear thicker. Is there any settings do I need to change in CATIA.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor