Script for saving multiple drawing to pdf (Catia V5-6 R2014)
Script for saving multiple drawing to pdf (Catia V5-6 R2014)
(OP)
Hi Everyone,
I know this topic is well-discussed in the forum but I haven't found any working macro I want, maybe the version number difference is the problem, I have V5-6 R2014. And I am quite new in this macro topic so I need a lot help.
I would like to make a macro to save multiple drawings to pdf without opening them. The drawings have 3 sheets and I just want to save only the first one.
I found this code shown below and it works well but saves all the sheet in the drawing to the pdf and I want only the first sheet. And it would be great if the filename would not contain the xxxx.CATDrawing.pdf ending.
The other thing is that this code want to open every file in the folder, and I just want the macro to open only .CADDrawing filetypes.
For starters I would be happy if these methods will work.
Language="VBSCRIPT"
Sub CATMain()
folderinput = InputBox ("Take your files from here","Input","",2000,4000)
folderoutput = InputBox ("Put your files here","Output","",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
Thank You in advance!
I know this topic is well-discussed in the forum but I haven't found any working macro I want, maybe the version number difference is the problem, I have V5-6 R2014. And I am quite new in this macro topic so I need a lot help.
I would like to make a macro to save multiple drawings to pdf without opening them. The drawings have 3 sheets and I just want to save only the first one.
I found this code shown below and it works well but saves all the sheet in the drawing to the pdf and I want only the first sheet. And it would be great if the filename would not contain the xxxx.CATDrawing.pdf ending.
The other thing is that this code want to open every file in the folder, and I just want the macro to open only .CADDrawing filetypes.
For starters I would be happy if these methods will work.
Language="VBSCRIPT"
Sub CATMain()
folderinput = InputBox ("Take your files from here","Input","",2000,4000)
folderoutput = InputBox ("Put your files here","Output","",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
Thank You in advance!





RE: Script for saving multiple drawing to pdf (Catia V5-6 R2014)
This is done when I started to learn how to create CATScripts
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: Script for saving multiple drawing to pdf (Catia V5-6 R2014)
Can I ask you how did you learn CATScripts? From what kind of learning material? I am not really familiar with programming, back in the university there was some visual basic and that is, but it was a long time ago. With this background is this any chance that I can learn it by myself?
Thanks!
Regards,
Daniel
RE: Script for saving multiple drawing to pdf (Catia V5-6 R2014)
I've learned scripting by searching the forums and looking in CATIA automation docs. There is a FAQ section here, take a look at the end of the page.
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU