Inventor Customization

Inventor Customization

Reply
Valued Contributor
DRudaz
Posts: 65
Registered: ‎04-19-2010
Message 1 of 4 (515 Views)

Use VBA to modify color styles

515 Views, 3 Replies
10-25-2012 06:59 AM

Hi,

 

It is possible to change a document style color with a VBA macro or why not with iLogic ?.

 

I regularly imports STEP and the parts have defined colors. Unfortunately for change must clear all colors of surfaces. By cons, if you edit the styles we see that for each color there is a style with the color name.
So basically if I change a color style, all parts using this style will change.
Hence my question.

 

Thanks for your help

 

Regards

 

Dom

ADN Support Specialist
Vladimir.Ananyev
Posts: 491
Registered: ‎08-14-2012
Message 2 of 4 (492 Views)

Re: Use VBA to modify color styles

11-02-2012 02:36 AM in reply to: DRudaz

Please search this forum and  http://adndevblog.typepad.com  on "RenderStyle".

There are many code samples there.

Cheers,

 

 


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Valued Contributor
DRudaz
Posts: 65
Registered: ‎04-19-2010
Message 3 of 4 (468 Views)

Re: Use VBA to modify color styles

11-13-2012 06:39 AM in reply to: Vladimir.Ananyev

Thank's for the link.

I have make the VBA Macro and it work fine.

But I can not modify all properties.

For the color I have :

 

      Call oStyle.SetAmbientColor(Red, Green, Blue)
      Call oStyle.SetDiffuseColor(Red, Green, Blue)
      Call oStyle.SetSpecularColor(Red, Green, Blue)
      oStyle.Name = Red & "," & Green & "," & Blue
      oStyle.Reflectivity = 31

 

But I don't find how to modify reflectivity, transparency, ....

 

Maybe it is not possible to modify with vba macro all the parameters in the appareance editor ?

 

regards

 

Dom

ADN Support Specialist
Vladimir.Ananyev
Posts: 491
Registered: ‎08-14-2012
Message 4 of 4 (464 Views)

Re: Use VBA to modify color styles

11-13-2012 07:29 AM in reply to: DRudaz

Don't worry, you may control mentioned above RenderStyle properties.

 

RenderStyle.Opacity = 0 .. 1

Property that gets and sets the opacity of the render style.

The opacity is defined using a value between 0 and 1.

A value of 0 results in a completely translucent style while a value of 1 is completely opaque.

 

RenderStyle.Reflectivity = 0 .. 1

Property that gets and sets the reflectivity of the render style.

The reflectivity is defined using a value between 0 and 1.

A value of 0 results in a non-reflective rendering style while a value of 1 is very reflective.

 

Look into Inventor API Help for more detailed description of RenderStyle properties and methods.

 

Cheers, 


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

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.