×
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

Script for saving multiple drawing to pdf (Catia V5-6 R2014)

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!

RE: Script for saving multiple drawing to pdf (Catia V5-6 R2014)

(OP)
I searched for it but this one I found but I didn't find the solution for the other problems.
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)

If you don't want to open the files, you need to run the macro in batch mode. To modify the automatic naming you need to do it in script by cutting last 11 characters from the end of the name of the file. You can also put a filter for what kind of files to open. Sorry but I don't have time to modify this script.

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

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