Does anyone know why this code snippet doesn't work? I am trying to set the appearance of sub-components in an assembly using iLogic.
Dim oDoc As Inventor.AssemblyDocument = ThisApplication.ActiveDocument Dim oCompDef As Inventor.ComponentDefinition = oDoc.ComponentDefinition Dim oCompOcc As Inventor.ComponentOccurrence 'parts in the assembly For Each oCompOcc In oCompDef.Occurrences oCompOcc.Definition.Document.ActiveRenderStyle = oCompOcc.Definition.Document.RenderStyles("HVGM") Next
Do you want to change the appearance of the component (actually modify the component), or just override its appearance at the assembly level (not actually modify the component)?
I wanted to actually modify the appearance of the component, not just override it. I was able to solve it after quite a few failed attempts.
Here's a snippet that modifies the appearance of the first component in an assembly:
Dim oDoc As Inventor.AssemblyDocument = ThisApplication.ActiveDocument 'Current Document Dim oCompDef As Inventor.ComponentDefinition = oDoc.ComponentDefinition 'Its Component Definitions Dim oCompOcc As Inventor.ComponentOccurrence 'parts in the assembly Dim oSubDoc As Inventor.PartDocument = oCompDef.Occurrences.Item(1).Definition.Document oSubDoc.ActiveRenderStyle = oSubDoc.RenderStyles("HVGM")
Im having doing almost the same thing in iLogic. Difference is I'm trying to override the appearance. Can you help me with a code snippet of that?
Hi Peter, welcome to the forum.
Here is a snippet that will override the appearance of a component in an assembly:
Component.Color("Your component's browser name here") = "Override appearance name here"
Give that a try and post back if you have any further questions.
Access a broad range of knowledge to help get the most out of your products and services.
Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.
Upgrading to a 2015 product? Make sure to check these out 1st!