Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Just a simple macro. Error running in batch mode

Status
Not open for further replies.

L3munoz

Industrial
Aug 29, 2011
26
0
0
ES
Hi everybody,

I'm just starting working with CATIA macros, and I wrote my first CATScript. Just a simple one to open CATIA and to create a new part document and activate it. Please, see below the code. The problem is when I try to run it I get two errors. The first one, when I write in the command line

cd "C:\Program Files (x86)\Dassault Systemes\B19\intel_a\code\bin" CNEXT.exe -batch -macro "C:\Users\mjorge\Documents\iWork\Test.CATScript"

(believe me the path is correct) the message I receive is "The filename, directory name or volume label syntax is incorrect"

The second one, if I just click twice the CATScript file to execute it, it seems there is an error in line 29, the one in which appears Sub CATMain()!! How can it be wrong?? Any idea??

Thanks in advance...

Language="VBSCRIPT"
'-----
' Open CATIA Application
'-----
Function OpCATIA() As Object
Dim CATIA As Object
Set CATIA = CreateObject("CATIA.Application")
CATIA.Visible = True

Set OpCATIA = CATIA
End Function
'-----
' Create and activate new Part Document
'-----
Function GetCATIAPartDocument() As Object
Set CATIA = OpCATIA
Dim AuxPartDocument As Object

CATIA.Documents.Add("Part")
CATIA.Documents.Item(1).Activate

Set AuxPartDocument = CATIA.ActiveDocument

Set GetCATIAPartDocument = AuxPartDocument

'-----
'MAIN PROGRAM
'-----
Sub CATMain()

GetCATIAPartDocument

End Sub
 
Replies continue below

Recommended for you

Sorry, the End Function of GetCATIAPartDocument() is missing. However, in line 16, it gives the message:

Object doesn't support this property or method: 'CATIA'

Why?
 
Status
Not open for further replies.
Back
Top