mvangild
Automotive
- Dec 5, 2005
- 5
OK, got another question. In R12.4.15, I opened an existing IGES file and immediately started recording a macro to create a single pad from a single surface in the X direction. I closed the file without saving changes, re-opened the same IGES file, and tried to run the macro. It failed, giving me the error "The method Item failed" in reference to the line "Set hybridShapeLineExplicit1 = parameters2.Item("X Axis")" ( a more complete version of this code follows below). The macro is in VBScript. Do I need to have the macro create a line in the X direction? Or is there something else that needs done? When macros won't even work when running the macro from the exact same point that you started recording from, it makes it a bit difficult to figure out what's going on. As promised, here's the relevant code that CATIA recorded.
Sub CATMain()
...
Set reference1 = part1.CreateReferenceFromName("")
Set pad1 = shapeFactory1.AddNewPadFromRef(reference1,20.00)
Set parameters1 = part1.Parameters
Set hybridShapeSurfaceExplicit1 = parameters1.Item("surfname")
Set reference2 = part1.CreateReferenceFromObject(hybridShapeSurfaceExplicit1)
pad1.SetProfileElement reference2
Set parameters2 = part1.Parameters
Set hybridShapeLineExplicity1 = parameters2.Item("X Axis")
' ^^ this is where the macro fails
Set reference3 = part1.CreateReferenceFromObject(hybridShapeLineExplicit1)
...
End Sub
So, why does it choke on the reference to the X Axis? Thanks for the help in advance.
Sub CATMain()
...
Set reference1 = part1.CreateReferenceFromName("")
Set pad1 = shapeFactory1.AddNewPadFromRef(reference1,20.00)
Set parameters1 = part1.Parameters
Set hybridShapeSurfaceExplicit1 = parameters1.Item("surfname")
Set reference2 = part1.CreateReferenceFromObject(hybridShapeSurfaceExplicit1)
pad1.SetProfileElement reference2
Set parameters2 = part1.Parameters
Set hybridShapeLineExplicity1 = parameters2.Item("X Axis")
' ^^ this is where the macro fails
Set reference3 = part1.CreateReferenceFromObject(hybridShapeLineExplicit1)
...
End Sub
So, why does it choke on the reference to the X Axis? Thanks for the help in advance.