ExportData properties

Antoine Tuto58208

ExportData properties
Hi !

I 'm new on that forum, and I have a little problem. I'm also french, so excuse me if my english is not perfect !

I 'm working on a macro on Catia which have to save lots of CATDrawing documents into PDF files.

After the opening of the drawing, I use that code :

        Set drawingDocument1 = CATIA.ActiveDocument
        drawingDocument1.ExportData "C:\Users\Machine\Plans\plantest.pdf", "pdf"

The code works and saves the file, but I would like to add two possibilities :

First, if the file already exists, I have a message "Do you want to overwrite". Of course, I want to, but I would like this question to be answered "yes" every time (lots of drawings to convert), so how to skip that message and say "Yes" directly ?

Then, if the folder doesn't already exist, I got a message which says "The folder C:... doesn't exist" and the macro stops (bug). So I would like to know if it's possible to create the folder in the same time that the exportdata instruction is executed. If not, I guess I will have to check if the folder exists, and so create it if it doesn't already exists.

I think there might be properties to add to the exportdata instruction to do it, but I don't know them.

I already check the help on Catia, but there was nothing interesting about the exportdata instruction (just the explanation of the parameters used by the instruction). I also checked on the forum, but didn't find anything.

I hope that someone will be able to help me.

Thanks !


Xavier Klein

RE: ExportData properties
(in response to Antoine Tuto58208)
Hello Antoine,
Welcome to the French Catia User !
About your questions :
I do not know which language you use for your macro
with VBA , you can use the FileSystemObject
exemple : Dim  Fso As New FileSystemObject    Fso.FolderExist   Fso.FileExist  .....
Also there is a similar object in the CATIA Automation object  : FileSystem
Dim MyFileSystemObject as FileSystem
MyFileSystemObject .FileExist      MyFileSystemObject.FolderExist   ...
About PDF convesion , have a look in the forum , but you have to take care about
CATIA / Tools / Options / Compatibility / Graphic Format / PDF
- create only one PDF for all Pages
- set Active Page az the First Page

Also , you can check if you have Drawing  DETAIL

sample code to check if you have Detail :
Set LeDocumentCourant = CATIA.ActiveDocument
For i = 1 To LeDocumentCourant.Sheets.Count
If LeDocumentCourant.Sheets.Item(i).IsDetail Then 
   MsgBox "No Detail in Drawing ! "
End If

Antoine Tuto58208

RE: ExportData properties
(in response to Antoine Tuto58208)
Thanks for your reply.

Yes, I'm using vba with the vb editor included in Catia, and I found how to solve my problem.

To skip the message box, I use CATIA.DisplayFileAlerts = False, and I reactivate it after the exportdata. Maybe not a perfect solution, but it works.

For the other problem, the creation of a folder, I will do as you said (in fact I have already used the FileSystemObject in Excel) with the FSO.

Thanks !