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
Thanks,
Steve
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)?
Cameron Whetten
Inventor 2014
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:
Steve
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")
Hi there
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?
Peter
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.
Cameron Whetten
Inventor 2014
Can't find what you're looking for? Ask the community or share your knowledge.