Help with SaveAs script!!!!!!!
Help with SaveAs script!!!!!!!
(OP)
I have a SaveAs script that works. But Im having a hard time figuring out how to get it to loop through all the catia files to a folder?
Sub CATMain()
'Retrive the active document
Dim Doc As document
Set Doc = CATIA.Activedocument
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& ".stp", "stp"
End Sub
Sub CATMain()
'Retrive the active document
Dim Doc As document
Set Doc = CATIA.Activedocument
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& ".stp", "stp"
End Sub





RE: Help with SaveAs script!!!!!!!
Please use search function of this forum, I believe you can find an example. If I remember correctly, there is something also in CATIA_Portable_Script_Center
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: Help with SaveAs script!!!!!!!
CODE
indocti discant et ament meminisse periti