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