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 do I run code on a part within an assembly?

0 REPLIES 0
Reply
Message 1 of 1
jpblower
239 Views, 0 Replies

how do I run code on a part within an assembly?

I have this ilogic routine

InventorVb.RunMacro("DocumentProject", "Color", "ChangeColor","red")

 However I want it to run this macro

 

Option Explicit

Dim oPartDoc As PartDocument
Dim oCompDef As ComponentDefinition

 
Public Sub ChangeColor(strColor As String)
    Set oPartDoc = ThisApplication.ActiveDocument
    Set oCompDef = oPartDoc.ComponentDefinition
    Dim appAsset As Asset
    Dim oLib As AssetLibrary
    Set oLib = ThisApplication.AssetLibraries("Autodesk Appearance Library")
    Set appAsset = oLib.AppearanceAssets(strColor)
    oPartDoc.ActiveAppearance = appAsset
End Sub

 within the part itself. 

 

Ultimately I need to save 3 versions of a file in an assy, each of a different color.  So I'm trying to set up a routine that takes the active part, copies an object from the assy to the part, saves 3 copies of different colors, and then creates an assy of each of those 3 parts.  I have code to perform almost all of these tasks but I'm stuck trying to bring them together. 

 

My guess is if I can figure out how to run macros on a part from within the Assy I can do the rest.

 

0 REPLIES 0

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

Post to forums  

Autodesk Design & Make Report