Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Try to read mass of part in catproduct

Status
Not open for further replies.

gerlado

Mechanical
Oct 17, 2012
23
ES
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
 
Replies continue below

Recommended for you

I believe that this script work :)

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
 
Hey guys plz tell me if i have to export designation ,revision ,nomenclature to an excel file how to do that..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top