Hi guys
I'm newbie in CATIA Automation but I try to create some script/ macro to allows me to Export files from Active Window. I found some script for Export PDF/ DXF but this is not working as desired. Macro should let user choose directory where files should be exported (from Browse For Folder dialog box) and export the PDF/ DXF of active drawing in CATIA.
I have no Idea how to handel with this but I'm trying to "bound" few macros that I found on Google:
Sub CATMain()
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 = &H1
Dim objShellApp
Dim objFolder
Dim objFldrItem
Dim objPath
Set objShellApp = CreateObject("Shell.Application")
Set objFolder = objShellApp.BrowseForFolder(WINDOW_HANDLE, strTitle, NO_OPTIONS)
'~ If IsNoData(objFolder) Then
'~ WScript.Echo "You choose to cancel. This will stop this script."
'~ Wscript.Quit
'~ Else
'~ Set objFldrItem = objFolder.Self
'~ objPath = objFldrItem.Path
BrowseForFolderDialogBox = objPath
Set objShellApp = Nothing
Set objFolder = Nothing
Set objFldrItem = Nothing
'~ End If
Dim Doc As Document
Set Doc = CATIA.ActiveDocument
Doc.ExportData objPath & "\PDF\" & objFile.FileName & ".pdf", "pdf"
Doc.ExportData objPath & "\DXF\" & objFile.FileName & ".dxf", "dxf"
Set specsAndGeomWindow = CATIA.ActiveWindow
specsAndGeomWindow.Close
End Sub
Could someone help me on this?
I'm newbie in CATIA Automation but I try to create some script/ macro to allows me to Export files from Active Window. I found some script for Export PDF/ DXF but this is not working as desired. Macro should let user choose directory where files should be exported (from Browse For Folder dialog box) and export the PDF/ DXF of active drawing in CATIA.
I have no Idea how to handel with this but I'm trying to "bound" few macros that I found on Google:
Sub CATMain()
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 = &H1
Dim objShellApp
Dim objFolder
Dim objFldrItem
Dim objPath
Set objShellApp = CreateObject("Shell.Application")
Set objFolder = objShellApp.BrowseForFolder(WINDOW_HANDLE, strTitle, NO_OPTIONS)
'~ If IsNoData(objFolder) Then
'~ WScript.Echo "You choose to cancel. This will stop this script."
'~ Wscript.Quit
'~ Else
'~ Set objFldrItem = objFolder.Self
'~ objPath = objFldrItem.Path
BrowseForFolderDialogBox = objPath
Set objShellApp = Nothing
Set objFolder = Nothing
Set objFldrItem = Nothing
'~ End If
Dim Doc As Document
Set Doc = CATIA.ActiveDocument
Doc.ExportData objPath & "\PDF\" & objFile.FileName & ".pdf", "pdf"
Doc.ExportData objPath & "\DXF\" & objFile.FileName & ".dxf", "dxf"
Set specsAndGeomWindow = CATIA.ActiveWindow
specsAndGeomWindow.Close
End Sub
Could someone help me on this?