Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Setting sub-component appearances with iLogic

8 REPLIES 8
Reply
Message 1 of 9
ad64
1557 Views, 8 Replies

Setting sub-component appearances with iLogic

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

8 REPLIES 8
Message 2 of 9
cwhetten
in reply to: ad64

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

Message 3 of 9
mrattray
in reply to: ad64

At a glance, this doen't look right : oCompOcc.Definition.Document.ActiveRenderStyle
What is the snippet (not) doing?
Mike (not Matt) Rattray

Message 4 of 9
ad64
in reply to: cwhetten

 

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")

 

Message 5 of 9
petermoltrup
in reply to: cwhetten

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

Message 6 of 9
cwhetten
in reply to: petermoltrup

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

Message 7 of 9
petermoltrup
in reply to: cwhetten

Thanks a lot....So easy once you know it!

 

Smiley Happy

Message 8 of 9
Neil.Morrison
in reply to: cwhetten

Hi, I'm wondering how you can override the colour of a part within a sub assembly from the top level assembly using iLogic? Using Component.Color doesn't affect the override from the top level, only in the sub assembly file is this override visible. Thanks for any help you can give me in advance. Neil.
Message 9 of 9
Neil.Morrison
in reply to: cwhetten

Hi Peter, Think I should have sent my first email to you. Hi, I'm wondering how you can override the colour of a part within a sub assembly from the top level assembly using iLogic? Using Component.Color doesn't affect the override from the top level, only in the sub assembly file is this override visible. Thanks for any help you can give me in advance. Neil.

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

Post to forums  

Autodesk Design & Make Report