Hi friends, I try to read the mass of part in a catproduct, this is the script:
Sub MasaProduct()
Dim Language As String
Language = "VBSCRIPT"
Dim colDocum As Documents
Dim DocActivo As Document
Dim Status As String
Dim myselection As Selection
Dim InputObjectType(0)
InputObjectType(0) = "AnyObject"
Dim refBorde As Reference
Set DocActivo = CATIA.ActiveDocument
Set myselection = DocActivo.Selection
Dim sel
Set sel = CATIA.ActiveDocument.Selection
sel.Clear
Dim resultado As Double
Dim cont As Integer
cont = 0
MsgBox "Select in the tree of Catia the Part and ESC to finish "
While cont <= 88
Status = sel.SelectElement2(InputObjectType, "Select the Part: ", True)
If (Status = "Cancel") Then
If resultado > 0 Then
End If
Exit Sub
End If
Set refBorde = myselection.Item(1).Value
Dim oInertia As AnyObject
Dim oProduct As AnyObject
Set oInertia = oProduct.GetTechnologicalObject("Inertia")
Dim dMass As Double
dMass = oInertia.Mass
resultado = dMass
sel.Clear
Wend
myselection.Clear
End Sub
The Script don´t work, anybody know what is the problem
Thanks
Sub MasaProduct()
Dim Language As String
Language = "VBSCRIPT"
Dim colDocum As Documents
Dim DocActivo As Document
Dim Status As String
Dim myselection As Selection
Dim InputObjectType(0)
InputObjectType(0) = "AnyObject"
Dim refBorde As Reference
Set DocActivo = CATIA.ActiveDocument
Set myselection = DocActivo.Selection
Dim sel
Set sel = CATIA.ActiveDocument.Selection
sel.Clear
Dim resultado As Double
Dim cont As Integer
cont = 0
MsgBox "Select in the tree of Catia the Part and ESC to finish "
While cont <= 88
Status = sel.SelectElement2(InputObjectType, "Select the Part: ", True)
If (Status = "Cancel") Then
If resultado > 0 Then
End If
Exit Sub
End If
Set refBorde = myselection.Item(1).Value
Dim oInertia As AnyObject
Dim oProduct As AnyObject
Set oInertia = oProduct.GetTechnologicalObject("Inertia")
Dim dMass As Double
dMass = oInertia.Mass
resultado = dMass
sel.Clear
Wend
myselection.Clear
End Sub
The Script don´t work, anybody know what is the problem
Thanks