Error when create imateresult from two imate

Error when create imateresult from two imate

SandmanINV
Advocate Advocate
399 Views
1 Reply
Message 1 of 2

Error when create imateresult from two imate

SandmanINV
Advocate
Advocate
Hi, I am stuck in create imate from two imate. I have a hole on a Part, Create an Imate on it. And a bolt from library which have 3 iMate already by default. One of them is isert iMate. I created 2 imate def, but i dont know why errror when add them to imate result. Below is my code. Please give me some advice. Thank you. Ooccdef.iMateDefinitions.AddInsertiMateDefinition(Oface.Edges(1), True, 0) ' Dim Oimate1 As iMateDefinition = Oocc_bolt_def.iMateDefinitions.Item() Dim i As Long Dim oiMateDef1 As iMateDefinition For i = 1 To Oocc_bolt_def.iMateDefinitions.Count If Oocc_bolt_def.iMateDefinitions.Item(i).Name = "Insert In1" Then oiMateDef1 = Oocc_bolt_def.iMateDefinitions.Item(i) Exit For End If Next If oiMateDef1 Is Nothing Then MsgBox("An iMate definition named ""Insert In1"" does not exist in " & Oocc_bolt_def.Name) Exit Sub End If Dim j As Long Dim oiMateDef2 As iMateDefinition For j = 1 To Ooccdef.iMateDefinitions.Count If Ooccdef.iMateDefinitions.Item(i).Name = "iInsert:1" Then oiMateDef2 = Ooccdef.iMateDefinitions.Item(i) Exit For End If Next If oiMateDef2 Is Nothing Then MsgBox("An iMate definition named ""iInsert:1"" does not exist in " & Ooccdef.Name) Exit Sub End If 'Dim Oimate2 As iMateDefinition = Ooccdef.iMateDefinitions.Item("iInsert:1") Dim Oimate1_result As iMateResult Try Oimate1_result = Oasmdef.iMateResults.AddByTwoiMates(oiMateDef1, oiMateDef2) Catch ex As Exception MsgBox(ex.Message) End Try
0 Likes
Accepted solutions (1)
400 Views
1 Reply
Reply (1)
Message 2 of 2

SandmanINV
Advocate
Advocate
Accepted solution
I found error with document reference. Problem solve.
0 Likes