Inventor General Discussion

Inventor General Discussion

Reply
Distinguished Contributor
ad64
Posts: 141
Registered: ‎11-03-2006
Message 1 of 7 (312 Views)

Setting sub-component appearances with iLogic

312 Views, 6 Replies
11-07-2013 09:13 AM

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

*Expert Elite*
cwhetten
Posts: 1,077
Registered: ‎09-03-2008
Message 2 of 7 (283 Views)

Re: Setting sub-component appearances with iLogic

11-08-2013 10:20 AM 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

*Expert Elite*
mrattray
Posts: 2,507
Registered: ‎09-13-2011
Message 3 of 7 (279 Views)

Re: Setting sub-component appearances with iLogic

11-08-2013 10:40 AM 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

Distinguished Contributor
ad64
Posts: 141
Registered: ‎11-03-2006
Message 4 of 7 (262 Views)

Re: Setting sub-component appearances with iLogic

11-12-2013 02:28 PM 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")

 

Member
petermoltrup
Posts: 3
Registered: ‎12-07-2007
Message 5 of 7 (96 Views)

Re: Setting sub-component appearances with iLogic

06-25-2014 05:55 AM 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

*Expert Elite*
cwhetten
Posts: 1,077
Registered: ‎09-03-2008
Message 6 of 7 (90 Views)

Re: Setting sub-component appearances with iLogic

06-25-2014 07:43 AM 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

Member
petermoltrup
Posts: 3
Registered: ‎12-07-2007
Message 7 of 7 (81 Views)

Re: Setting sub-component appearances with iLogic

06-27-2014 04:59 AM in reply to: cwhetten

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

 

:smileyhappy:

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.