MACRO CATIA from cat.drawing to TIFF
MACRO CATIA from cat.drawing to TIFF
(OP)
Hello,
since I wanted to reply on all ready open thread but i could not I decided to open a new thread, for that if I am wrong I am sorry!
I have started to get acquainted with some basic macro programs for catia and I found macro to convert from drawing to pdf.
The problem is that I get compile error (byref argument type mismatch) message every time, seems that is something wrong with IESIRE and INTRARE statement.
I use catia v5r20
so below is quote from user ferdo from 20 Mar 06 18:43 source
---------------------------------------------------------------------------------------------------------
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
---------------------------------------------------------------------------------------------------------
since I wanted to reply on all ready open thread but i could not I decided to open a new thread, for that if I am wrong I am sorry!
I have started to get acquainted with some basic macro programs for catia and I found macro to convert from drawing to pdf.
The problem is that I get compile error (byref argument type mismatch) message every time, seems that is something wrong with IESIRE and INTRARE statement.
I use catia v5r20
so below is quote from user ferdo from 20 Mar 06 18:43 source
---------------------------------------------------------------------------------------------------------
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
---------------------------------------------------------------------------------------------------------





RE: MACRO CATIA from cat.drawing to TIFF
Your macro is written in a catvbs, CATScript or catvba?
Andd by the way, that macro is for pdf (not tiff) and has some limitations if I remind well...
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: MACRO CATIA from cat.drawing to TIFF
yes, it is for .pdf, but if i read correctly you can change .pdf to .tif?
RE: MACRO CATIA from cat.drawing to TIFF
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: MACRO CATIA from cat.drawing to TIFF
source: CATIAdocuments
Description: The merhod open failed
Line: 18
column: 4
many thanks:)
RE: MACRO CATIA from cat.drawing to TIFF
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: MACRO CATIA from cat.drawing to TIFF
thanks!
RE: MACRO CATIA from cat.drawing to TIFF
It is me again, so I use the macro and it works! But I am wondering if it is possile to edit the code so that the extension .catdrawing would not be inserted in .tiff file naming:
Example:
Name of CAD drawing with extension: drawing_1.CATdrawing
name of converted file with extension: drawing_1.CATdrawing.tiff
many thanks!
RE: MACRO CATIA from cat.drawing to TIFF
for this you can use Left command to remove extra character from the name string
check below code
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
dim a as string
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
INTRARE = folderinput & f1.name
Set PartDocument1 = CATIA.Documents.Open(INTRARE)
a=Left(f1.name , Len(f1.name ) - 11)
IESIRE = folderoutput & a & ".pdf"
PartDocument1.ExportData IESIRE, "pdf"
s = s & f1.name
s = s & vbCrLf
CATIA.ActiveDocument.Close
Next
End Sub