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: 

iLogic Rule to import custom material library and assign materials by appearance?

1 REPLY 1
Reply
Message 1 of 2
loganshaunbell
579 Views, 1 Reply

iLogic Rule to import custom material library and assign materials by appearance?

loganshaunbell
Explorer
Explorer

Hello,

 

I am working with a multibody part system that I am pushing to an assembly using "make components". I can only assign appearances in the part model, so I am trying to find an iLogic rule that can 1.) import a custom material library to an assembly document, and 2.) assign a material from the custom library based on the set appearance for each part in the iam file.

 

Any help is greatly appreciated.

0 Likes

iLogic Rule to import custom material library and assign materials by appearance?

Hello,

 

I am working with a multibody part system that I am pushing to an assembly using "make components". I can only assign appearances in the part model, so I am trying to find an iLogic rule that can 1.) import a custom material library to an assembly document, and 2.) assign a material from the custom library based on the set appearance for each part in the iam file.

 

Any help is greatly appreciated.

1 REPLY 1
Message 2 of 2
WCrihfield
in reply to: loganshaunbell

WCrihfield
Mentor
Mentor

Hi @loganshaunbell.  I generally do not use the 'Make Components' process, but understand its basics.  It creates a new part file from a SurfaceBody in an existing Part, then inserts that newly generated part into an assembly as an assembly component for you.  And you have the option to derive parameters from the source part into the new part that gets created, which would leave a link to the source, if you choose to do so.  Assembly's do not generally contain any materials themselves, other than one to apply to any new 'Virtual' components you may create (for BOM use only) and one to use for any weld beads you create within a weldment type assembly.

 

You can not apply assembly level materials to the components (ComponentOccurrences) within the assembly directly, but you can apply assembly level colors or appearances to them directly.  Materials can only be applied to a PartDocument directly (PartDocument.ActiveMaterial & PartDocument.MaterialAssets), not a ComponentOccurrence within an assembly.  And there has to be a copy of that material saved within the PartDocument's own local materials (not just in the material library) before you can apply that material to the part, when doing it by code.  The drop-down list of materials you can see at the top of an assembly screen is being sourced from external library files, and are not necessarily 'imported' into the AssemblyDocument or within the AssemblyDocument itself.  You can see which materials are locally available within an assembly or part by opening the real 'Material Browser' dialog, and looking within the 'Document Materials' section of that dialog (usually in upper half of dialog).  Other materials that are available within the material libraries will be displayed in the lower part of that dialog, and can be copied up into the document materials if needed.

 

There is actually an iLogic shortcut snippet to help with changing the material of part document being referenced by an assembly component.  But it will only work on ComponentOccurrence objects that are in the top level of the assembly, not ones that are down within sub-assemblies.

iProperties.Material("ComponentName") = "Material Name"

But as I said before, I think that material name you specify there must already be present within that part for it to work.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes

Hi @loganshaunbell.  I generally do not use the 'Make Components' process, but understand its basics.  It creates a new part file from a SurfaceBody in an existing Part, then inserts that newly generated part into an assembly as an assembly component for you.  And you have the option to derive parameters from the source part into the new part that gets created, which would leave a link to the source, if you choose to do so.  Assembly's do not generally contain any materials themselves, other than one to apply to any new 'Virtual' components you may create (for BOM use only) and one to use for any weld beads you create within a weldment type assembly.

 

You can not apply assembly level materials to the components (ComponentOccurrences) within the assembly directly, but you can apply assembly level colors or appearances to them directly.  Materials can only be applied to a PartDocument directly (PartDocument.ActiveMaterial & PartDocument.MaterialAssets), not a ComponentOccurrence within an assembly.  And there has to be a copy of that material saved within the PartDocument's own local materials (not just in the material library) before you can apply that material to the part, when doing it by code.  The drop-down list of materials you can see at the top of an assembly screen is being sourced from external library files, and are not necessarily 'imported' into the AssemblyDocument or within the AssemblyDocument itself.  You can see which materials are locally available within an assembly or part by opening the real 'Material Browser' dialog, and looking within the 'Document Materials' section of that dialog (usually in upper half of dialog).  Other materials that are available within the material libraries will be displayed in the lower part of that dialog, and can be copied up into the document materials if needed.

 

There is actually an iLogic shortcut snippet to help with changing the material of part document being referenced by an assembly component.  But it will only work on ComponentOccurrence objects that are in the top level of the assembly, not ones that are down within sub-assemblies.

iProperties.Material("ComponentName") = "Material Name"

But as I said before, I think that material name you specify there must already be present within that part for it to work.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

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

Post to forums  

Autodesk Design & Make Report