How to get iMateDefinition.ReferencedEntity

How to get iMateDefinition.ReferencedEntity

Anonymous
Not applicable
580 Views
1 Reply
Message 1 of 2

How to get iMateDefinition.ReferencedEntity

Anonymous
Not applicable
I have a part with a iMate in it called Part1.ipt
This part is inserted in a assembly called assy1.iam
assy1 is inserted in another assambly called assy2.iam.
I work with INV 2011 and VB6

I now want to get the entity where the iMate is based on from out of Assy2
I tried this with no result:

'oAsmCompDef = Assy2
'oOcc = Assy1
'oOccInsert = Part1

Dim oAsmCompDef As AssemblyComponentDefinition
Set oAsmCompDef = objInventorApp.ActiveDocument.ComponentDefinition
Dim oOcc As ComponentOccurrence
Set oOcc = oAsmCompDef.Occurrences.item(1)
Dim oOccInsert As ComponentOccurrence
Set oOccInsert = oOcc.SubOccurrences.Item(1)
'Get proper iMate
For i = 1 To oOccInsert.iMateDefinitions.Count
If oOccInsert.iMateDefinitions.Item(i).Name = "Insert In1" Then
Dim oiMate As Inventor.iMateDefinition
Set oiMate = oOccInsert.iMateDefinitions.Item(i) 'iMate is found
Exit For
End If
Next i
Dim oInsertEdge As iMateDefinition 'Edge
Set oInsertEdge = oiMate.ReferencedEntity -> this gives Nothing

Any clue?

Regards,

Geert

Edited by: GVDB on May 31, 2010 3:00 PM Edited by: GVDB on May 31, 2010 3:01 PM
0 Likes
581 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

Hi Geert,

 

You can accces the refereced entity were the iMate was placed whit this code:

 

Dim oInsertEdge as Edge

Set oInsertEdge = oiMate.Entity

 

 

Regards,

 

Daniela Dubois

0 Likes