1

I want to export the mass of a CATIA product using CATScript. This is my solution:

'Start code
Sub CATMain()

Dim SRT as ProductDocument
Set SRT = CATIA.Documents.Open ("T:\...\SRT_2030.CATProduct")
Set SRT = CATIA.ActiveDocument

Dim oSelection As Selection
Set oSelection = SRT.Selection

Dim oProduct As Selection
Set oProduct = oSelection.FindObject("SRT")

Dim oInertia As AnyObject
Set oInertia = oProduct.GetTechnologicalObject("Inertia")

Dim dMass As Double
dMass = oInertia.Mass

'Display the results
MsgBox dMass

'End code
End Sub

I get this error: The method FindObject failed

What do I do wrong?

Thanks for your help!

Stefan
  • 11
  • 2

1 Answers1

0

You shouldn't need to use the Selection object to accomplish your task. And Selection.FindObject takes an argument of an object type, and it never works anyway.

Instead you should just set oProduct to your product, which will be a property of the Product Document object.

...
Set oProduct = SRT.Product
Set oInertia = oProduct.GetTechnologicalObject("Inertia")
...
C R Johnson
  • 964
  • 1
  • 5
  • 12