Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

CATScript : macro to import .model in a Part.

Status
Not open for further replies.

Xav80

Automotive
Feb 18, 2005
2
Hi everybody,
Firstly, you (=admin and each member) did a great job on this forum!

Software: CATIA v5 r12

I need to import a .model file (catia v4) in a new CATPart thanks to macros. So i ran the "new macro" registering tool:
- i open my .model (and obtain a " *MASTER ")
- i create a new file CATPart(i want a part, not a product ;) )
- selection of *MASTER in my .model window, copy
- paste in my Part document
- Finish

That's OK, no pb, i obtain the right part... but then, when i run the macro again, it crashes at the line corresponding to mySelection.Copy

Does anyone know how to program this kind of import (in CATScrpit or VB, it's very similar)?

Here is the first lines of the macro :

Language="VBSCRIPT"
Sub CATMain()

Dim documents1 As Documents
Set documents1 = CATIA.Documents

Dim partDocument1 As Document
Set partDocument1 = documents1.Add("Part")

Set documents1 = CATIA.Documents

Dim document1 As Document
Set document1 = documents1.Open("I:\myModel.model")

Set document1 = CATIA.ActiveDocument

Dim selection1 As Selection
Set selection1 = document1.Selection

selection1.Copy <<-------- CRASH: Source: CATIASelection, Copy method failed.
... etc...

It seems that the pb comes from the Selection of *Master: What is the type of this element? (something such as Product or Part collection). I should add a line such as slection1.Add("*Master")...

Thanks. See you soon.
 
Replies continue below

Recommended for you

After lots of research, i found a batch for this migration... See Utils> utils (it runs catutil.exe from a catiaV5 session and you can choose differents batches).
In Catia Help, search CATV5ToV4, everything is explained.

hope it would help someone.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor