Macro to convert files (TIF or PDF)
Macro to convert files (TIF or PDF)
(OP)
We have legacy data of old Cadam (ccd) files that we would like to convert to TIF or PDF. Does anyone know of a macro or program available to mass convert these files?





RE: Macro to convert files (TIF or PDF)
Since you mentioned macro, I'm assuming that you meant V5. If that's the case, check this out:
http://2htts.com/CATBlog/index.php?itemid=9#more
---
Professional and reliable CAD design engineering services - Specializing in Catia V4, Catia V5, and CAD Translation. Catia V5 resources - CATBlog
RE: Macro to convert files (TIF or PDF)
Source: Microsoft VBScript error
Description: Expected end of statement
Statement: Dim specsAndGeomWindow1 As SpecsAndGeomWindow
Line: 11
Column:24
See the language reference guide or the V5 Automation APIs documentation.
Any suggestions on the error?
Thanks,
RE: Macro to convert files (TIF or PDF)
That macro was made for r12, running under Windows. Please try this old one (modified in a big hurry).
--------------------------------------
Language="VBSCRIPT"
Sub CATMain()
folderinput = InputBox ("Put your files here","Input","C:\temp\",2000,4000)
folderoutput = InputBox ("Take your files from here","Output","C:\tempout\",2000,4000)
Dim fs, f, f1, fc, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderinput)
Set fc = f.Files
For Each f1 in fc
Dim PartDocument1 As Document
Set documents1 = CATIA.Documents
Dim document1 As Document
INTRARE = folderinput & f1.name
Set PartDocument1 = CATIA.Documents.Open(INTRARE)
IESIRE = folderoutput & f1.name & ".pdf"
PartDocument1.ExportData IESIRE, "pdf"
s = s & f1.name
s = s & vbCrLf
CATIA.ActiveDocument.Close
Next
End Sub
----------------------------------------
Regards
Fernando
RE: Macro to convert files (TIF or PDF)
I forgot to mention that changing pdf extension with something else, its also possible to export stp, igs a.s.o.,depending on what you have in the input folder...
Regards
Fernando
RE: Macro to convert files (TIF or PDF)
Regards
Fernando
RE: Macro to convert files (TIF or PDF)
Source: Microsoft VBScript compilation error
Description: Expected end of statement
Statement: Dim PartDocument1 As Document
Line: 15
Column: 22
See the language reference guide or the V5 Automation APIs documentation.
RE: Macro to convert files (TIF or PDF)
RE: Macro to convert files (TIF or PDF)
It should work fine. It's calling the active document - not a particular file type.
---
Professional and reliable CAD design engineering services - Specializing in Catia V4, Catia V5, and CAD Translation. Catia V5 resources - CATBlog
RE: Macro to convert files (TIF or PDF)
e.g.
Dim PartDocument1 'As Document
leaving the type in will work in catscript, vb, vba but not catvbs
RE: Macro to convert files (TIF or PDF)
PeterGuy: I'm not sure I follow? Like I mentioned, I am not very familiar with VB. Could you please explain.
Thanks,
RE: Macro to convert files (TIF or PDF)
Change
Dim oDocument As Document --VBA
to
Dim oDocument 'As Document --CATScript
ie find and replace all As with 'As
Regards
Derek
RE: Macro to convert files (TIF or PDF)
Any more suggestions?
Here is the actual error message:
Source: CATIADocument
Description: The method ExportData failed
Line: 23
Column: 4
Thanks for all the help thus far!
RE: Macro to convert files (TIF or PDF)
Create 2 directories under C
tempdrawing temppdf
---------------------------------------------------------
Language="VBSCRIPT"
Sub CATMain()
folderinput = InputBox ("Take your files from here","Input","C:\tempdrawing\",2000,4000)
folderoutput = InputBox ("Put your files here","Output","C:\temppdf\",2000,4000)
Dim fs, f, f1, fc, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderinput)
Set fc = f.Files
For Each f1 in fc
Dim PartDocument1 'As Document
Set documents1 = CATIA.Documents
Dim document1 'As Document
INTRARE = folderinput & f1.name
Set PartDocument1 = CATIA.Documents.Open(INTRARE)
IESIRE = folderoutput & f1.name & ".pdf"
PartDocument1.ExportData IESIRE, "pdf"
s = s & f1.name
s = s & vbCrLf
CATIA.ActiveDocument.Close
Next
End Sub
------------------------------------------------------
I am running R16 SP3
Regards,
Derek
RE: Macro to convert files (TIF or PDF)
(PartDocument1.ExportData IESIRE, "pdf")
I'm running v5R14 sp4
thanks,
RE: Macro to convert files (TIF or PDF)
Regards,
Derek
RE: Macro to convert files (TIF or PDF)
Sorry for my very,very,late intervention but I didn't have enough time to surf the net and give you some help.
First I want to thanks to Derek for trying to help (one star from me for this).
I've tested also his CATScript and its working without errors under r14, Windows XP. Also my script its working in same conditions.
I don't know what's happening on your computer Runz. Maybe you have some problems with your CATScript interpretor. I will try also to run the script under UNIX to see if I get some errors.
Regards
Fernando
RE: Macro to convert files (TIF or PDF)