Try to read mass of part in catproduct
Try to read mass of part in catproduct
(OP)
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





RE: Try to read mass of part in catproduct
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 resul As Double
Dim cont As Integer
cont = 0
MsgBox "Select in the tree of catia the part "
While cont <= 88
Status = sel.SelectElement2(InputObjectType, "Seleccione los Part: ", True)
Dim electro
If (Status = "Cancel") Then
If resul > 0 Then
If electro = 1 Then
electro = resul
Else
MsgBox resul
End If
End If
Exit Sub
End If
Set refBorde = myselection.Item(1).Value
Dim oselection As Selection
Set oselection = CATIA.ActiveDocument.Selection
Dim Status2 As AnyObject
On Error Resume Next
Set Status2 = oselection.FindObject("CATIAProduct")
If (Err.Number <> 0) Then
MsgBox "Not select element"
Else
On Error GoTo 0
Dim oInertia As AnyObject
Set oInertia = Status2.GetTechnologicalObject("Inertia")
Dim dMass As Double
dMass = oInertia.Mass
Dim total
total = dMass
resul = total + resul
End If
sel.Clear
Wend
myselection.Clear
End Sub
RE: Try to read mass of part in catproduct