I've got an existing assembly in which I need to change the matchlist for the imates. I have been able to change the imate names but not the match list. There is virtually no help on this subject, I'm hoping someone has some references somewhere?
The only reference I have found creates the iMate in a part. I need to edit an existing iMate in the assembly document for the matchlist.
I have some code below, but it is not complete.
------------------------------------------------------
Set MyPart = ThisApplication.Documents.Open(strJobLocalDirectory & strLFVAssyName)
Set oAssyComp = ThisApplication.ActiveDocument.ComponentDefinition
'Dim oDoc As Inventor.AssemblyDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oInsertiMate As InsertiMateDefinition
Dim iMateArray(1)
Dim oInsert As Object
For i = 1 To oAssyComp.iMateDefinitions.Count 'oOcc1.iMateDefinitions.Count
If oAssyComp.iMateDefinitions.Item(i).Name = "FillValveCL" Then
Set oiMateDef1 = oAssyComp.iMateDefinitions.Item(i)
oiMateDef1.Name = "DrainValveCL"
iMateArray(0) = oiMateDef1.Name 'Works fine till here, after this I'm lost
Set oInsert = oAssyComp.iMateDefinitions.Item(i)
Set oInsertiMate = oAssyComp.iMateDefinitions.AddMateiMateDefinition(oDoc, 0, kNoInference, , , oiMateDef1.Name)
'PROBLEM HERE!!!!
End If
If oAssyComp.iMateDefinitions.Item(i).Name = "FillValveFace" Then
Set oiMateDef1 = oAssyComp.iMateDefinitions.Item(i)
oiMateDef1.Name = "DrainValveFace"
iMateArray(0) = oiMateDef1.Name
End If
If oAssyComp.iMateDefinitions.Item(i).Name = "FillValveAngle" Then
Set oiMateDef1 = oAssyComp.iMateDefinitions.Item(i)
oiMateDef1.Name = "DrainValveAngle"
iMateArray(0) = oiMateDef1.Name
End If
Next i
Hi,
I'd suggest you could provide a complete test demo, instead of code snippet. In addition, there is a sample code of AddMateiMateDefinition in Inventor API help referece. Is it helpful for you to address the problem?
Actually I can't there's too many files involved and I can't upload them. The problem lies in that there's no references at all to the match list except one, and that will not work if the part has an existing match list. The code in the api help didn't help really, no. I need to remove the existing matchlist and replace it if I wanted to continue using that method.
At this point, due to the fact there was no response, I eliminiated all of the Imates and did a part by part assembly using the prime planes of the sub assemblies to the main assembly. While that does work, I can't assemble it based on sub assembly parts as they always throw an error at one level below the main assembly. I got it to work as an assembly to assembly mate this way, and I have to move on. I have had many issues with imates in the past and this is just one in a long string of them.
Thanks for at least looking.
Can't find what you're looking for? Ask the community or share your knowledge.