Number on Instances in an assembly
Number on Instances in an assembly
(OP)
Hi everyone,
I have to calculate the inertia Matrix of all CATParts with in a Product, in oder to improve the calculation time, and since many parts could have many instances. I would like to calculate the inertia matrix just once and not more times if its actually the same Part. Is there a way to know how many different parts do I have in the assembly (I mean, not taking in consideration the instances) and from these Parts to know wich ones have instances and how many do they have??
Thanks in Advance
I have to calculate the inertia Matrix of all CATParts with in a Product, in oder to improve the calculation time, and since many parts could have many instances. I would like to calculate the inertia matrix just once and not more times if its actually the same Part. Is there a way to know how many different parts do I have in the assembly (I mean, not taking in consideration the instances) and from these Parts to know wich ones have instances and how many do they have??
Thanks in Advance





RE: Number on Instances in an assembly
I will let you to develop, is just an example in a CATScript....
Sub CATMain()
Set oPartDocument = CATIA.ActiveDocument
Set oSelection = oPartDocument.Selection
Dim oInputType(0)
Dim oStatus
MsgBox "Select a Part in the SPECIFICATION TREE"
oInputType(0) = "AnyObject"
oStatus = oSelection.SelectElement2(oInputType, "Select a Part", True)
If (oStatus = "Cancel") Then
Exit Sub
End If
Set mySelection = oSelection.Item(1).Value
Dim input
Dim sLF
Dim arrayOfVariantOfBSTR1(0)
'~ '-----------------------------
sLF = Chr(10)
input = InputBox ("This is the input for search Part Number", "Finder", left(mySelection.Name, len(mySelection.Name) -2))
If input = "" Then
Exit Sub
End If
Set productDocument1 = CATIA.ActiveDocument
Set selPN = productDocument1.Selection
selPN.Search "'Assembly Design'.Product.'Part Number'=" & input & ",all"
CATIA.StartCommand "Center graph"
If (CATIA.ActiveDocument.Selection.Count) > 0 Then
For i = 1 To CATIA.ActiveDocument.Selection.Count ' For each element...
Next
End If
MsgBox " Selected Elements " & i-1
End Sub
Regards
Fernando
cadromania.net - Romanian CAD forums