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: 

Is creating iLogic "Components " possible from the API?

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
293 Views, 2 Replies

Is creating iLogic "Components " possible from the API?

Hey guys,

 

I'm new to inventor and I need to be able to create coppies of a part in my assembly that are uniquely identified so they can be individually changed. I see that this can be done through the ribbon with the "Place iLogic Component" button, but is it possible to do this from the API in a rule?

 

I am using inventor 2012 pro.

 

Thanks

2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

I found that its possible with this code:

' set a reference to the assembly component definintion.' This assumes an assembly document is open.Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

' Set a reference to the transient geometry object.Dim oTG As TransientGeometry
oTG = ThisApplication.TransientGeometry
    
' Create a matrix.  Dim oMatrix As Matrix
oMatrix = oTG.CreateMatrix

'Iterate through all of the occurrencesDim oOccurrence As ComponentOccurrence

'place an instance of the component 'in this case at 0,0,0oOccurrence = oAsmCompDef.Occurrences.Add(oPath & oFile, oMatrix) 

' Set the translation portion of the matrix so the part will be 'positioned at the co-ordinatesoMatrix.SetTranslation(oTG.CreateVector(0, 0, 0)) 
'ground it in placeoOccurrence.Grounded = True

But, for some reason, my model only appears at coordinates 0,0,0 even if i change it to something else. Could it be that the TransientGeometry is not being used correctly in my case? 

Message 3 of 3
Anonymous
in reply to: Anonymous

I have found that the code provided above does not make unique copies like the iLogic Place Component part button does. Is there anyway to replicate that functionality?

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

Post to forums  

Autodesk Design & Make Report