×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Try to read mass of part in catproduct

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

RE: Try to read mass of part in catproduct

(OP)
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

RE: Try to read mass of part in catproduct

Hey guys plz tell me if i have to export designation ,revision ,nomenclature to an excel file how to do that..

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources