Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How can i add items to a iMate machlist with VB?

1 REPLY 1
SOLVED
Reply
Message 1 of 2
nielsborgerink2714
556 Views, 1 Reply

How can i add items to a iMate machlist with VB?

Hello, i am trying to add some items in the iMate matchlist. But with the code i use below i recieve a runtime '10' error:

This array is fixed or temporarily locked.

Can someone help me with this?

Thanks in advance.

Matchlist.jpg

 

Function PlaceiMates()
Dim oApp As Application
Set oApp = ThisApplication

If ThisApplication.ActiveDocumentType = kPartDocumentObject Then
    Dim odoc As PartDocument
    Set odoc = oApp.ActiveEditDocument
    
    Dim oInsert As Object
    Dim oInsertiMate As InsertiMateDefinition
    Set oInsert = ThisApplication.CommandManager.Pick(kPartEdgeFilter, "Pick Edge for Imate")
    Set oInsertiMate = odoc.ComponentDefinition.iMateDefinitions.AddInsertiMateDefinition(oInsert, True, "0mm", , "Test")
    Dim ml(1) As String
    ml(0) = "pl"
    oInsertiMate.MatchList = ml
End If
End Function

 

 

1 REPLY 1
Message 2 of 2

Hello,

I solved the problem. I found out that an array must be created and should be filled completely.

Function PlaceiMates()
Dim oApp As Application
Set oApp = ThisApplication

If ThisApplication.ActiveDocumentType = kPartDocumentObject Then
    Dim odoc As PartDocument
    Set odoc = oApp.ActiveEditDocument
    
    Dim oInsert As Object
    Dim oInsertiMate As InsertiMateDefinition
    Set oInsert = ThisApplication.CommandManager.Pick(kPartEdgeFilter, "Pick Edge for Imate")
    Set oInsertiMate = odoc.ComponentDefinition.iMateDefinitions.AddInsertiMateDefinition(oInsert, True, "0mm", , "Test")
    Dim ml(1) As String '<-----------------Enter the ammount of matches you want to add.(start with 0)
    ml(0) = "pl"
    ml(1) = "pl1" '<-----------------------The array should be filled completely
    oInsertiMate.MatchList = ml
End If
End Function

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report