×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

CATDrawing multiple file conversion

CATDrawing multiple file conversion

CATDrawing multiple file conversion

(OP)
I have been running into issues with the following CATScript wanting to open and export the same CATDrawing file twice. When this happens it will skip over other files in the folder. Any suggestions is greatly appreciated.

I would also like to have another input box that would allow me to put the converted files in a different folder.

Sub CatMain()
Dim fileSys
Dim filefolder as Object
Dim FolderPath as String
Dim Doc as Document
Dim drawingName as String
Dim IFile as File
Dim i as Integer

Set fileSys = CATIA.FileSystem
FolderPath = InputBox( "Enter a folder path:", "Folder path to convert the drawings" ,sDocPath & "Copy and paste file extension")

Set filefolder = FileSys.GetFolder(FolderPath)

'loop through all files in the folder
For i = 1 To filefolder.Files.Count
Set IFile = filefolder.Files.Item(i)

'open only CATDrawings in CATIA
If InStr(IFile.Name, ".CATDrawing") <> 0 Then
Set Doc = CATIA.Documents.Open(IFile.Path)
Set partDocument1 = CATIA.ActiveDocument

drawingName =len(CATIA.ActiveDocument.Name)
gl2Name =left( CATIA.ActiveDocument.Name,drawingName-11)

'msgbox part
PartDocument1.ExportData FolderPath &"\"& gl2Name, "gl2"

'close the open drawing document
CATIA.ActiveDocument.Close()

End If
Next
End Sub

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources