Reply

Include excluded occurrence in assembly family

In an assembly of 2 parts with 2 members ,member1 and member2.

In member1 parts 1 and 2 are include.

In member2 part 1 is include and part 2 is exclude.

 

Using this code i'd like to include part 2 in member2, but I can't find the occurrence part 2 :

 

Try

objApplication = Marshal.GetActiveObject("SolidEdge.Application")

Dim objAsm As SolidEdgeAssembly.AssemblyDocument = objApplication.ActiveDocument

Dim FamilyMemberID As Integer = 0

Dim Occ As Object = Nothing

 

'Find Id of the family member

For i = 1 To objAsm.AssemblyFamilyMembers.Count

If objAsm.AssemblyFamilyMembers.Item(i).MemberName = "Member2" Then

FamilyMemberID = i

Exit For

End If

Next i

 

'Get occurrence by string

For i = 0 To objAsm.Occurrences.Count - 1

If objAsm.Occurrences(i).name = "part 2" Then

Occ = objAsm.Occurrences(i)

End If

Next

 

'Include Occurrence to family member

If objAsm.IsFileFamilyByDocument = True And Not (FamilyMemberID = 0) And Not (Occ Is Nothing) Then

objAsm.AssemblyFamilyMembers.Item(FamilyMemberID).IncludeObject(Occ)

End If

Catch ex As Exception

End Try

 

Posted by: Romuald
Post date: 8/19/2013 8:32:44 AM