×
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

MACRO CATIA from cat.drawing to TIFF

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
---------------------------------------------------------------------------------------------------------

RE: MACRO CATIA from cat.drawing to TIFF

(OP)
VBA,

yes, it is for .pdf, but if i read correctly you can change .pdf to .tif?

RE: MACRO CATIA from cat.drawing to TIFF

(OP)
OK , but I am sorry to say that I still get error.

source: CATIAdocuments
Description: The merhod open failed
Line: 18
column: 4

many thanks:)

RE: MACRO CATIA from cat.drawing to TIFF

(OP)
ok, It works fine i did not finish the folder adress with \ like:C:\Users\....\2D\cat\

thanks!

RE: MACRO CATIA from cat.drawing to TIFF

(OP)
Hello,

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

hii pnavy,
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

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