Inventor Customization

Reply
Contributor
tom_wise
Posts: 15
Registered: ‎07-30-2007
Message 1 of 3 (193 Views)

Edit/Add Matchlist items in Assembly with Imates

193 Views, 2 Replies
02-27-2013 03:07 PM

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

ADN Support Specialist
xiaodong.liang
Posts: 1,233
Registered: ‎06-12-2011
Message 2 of 3 (145 Views)

Re: Edit/Add Matchlist items in Assembly with Imates

03-10-2013 08:15 PM in reply to: tom_wise

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?



Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Contributor
tom_wise
Posts: 15
Registered: ‎07-30-2007
Message 3 of 3 (139 Views)

Re: Edit/Add Matchlist items in Assembly with Imates

03-11-2013 05:43 AM in reply to: tom_wise

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.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube