【问题标题】:CATScript - The method FindObject failedCATScript - FindObject 方法失败
【发布时间】:2018-02-01 03:05:29
【问题描述】:

我想使用 CATScript 导出大量 CATIA 产品。这是我的解决方案:

'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

我收到此错误:方法 FindObject 失败

我做错了什么?

感谢您的帮助!

【问题讨论】:

    标签: catia


    【解决方案1】:

    您不需要使用 Selection 对象来完成您的任务。 而且 Selection.FindObject 接受一个对象类型的参数,而且它永远不会起作用。

    相反,您应该将 oProduct 设置为您的产品,这将是 Product Document 对象的一个​​属性。

    ...
    Set oProduct = SRT.Product
    Set oInertia = oProduct.GetTechnologicalObject("Inertia")
    ...
    

    【讨论】:

      猜你喜欢
      • 2017-04-08
      • 2016-01-03
      • 2018-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-20
      • 2023-04-07
      • 2014-06-19
      相关资源
      最近更新 更多