Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations JAE 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
Joined
Jan 12, 2023
Messages
11
Location
SG
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

 
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
 
It perfectly works. Thank you very much 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

Back
Top