Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Use VBA to modify color styles

4 REPLIES 4
Reply
Message 1 of 5
DRudaz
1364 Views, 4 Replies

Use VBA to modify color styles

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

4 REPLIES 4
Message 2 of 5
Vladimir.Ananyev
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

Message 3 of 5
DRudaz
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

Message 4 of 5
Vladimir.Ananyev
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

Message 5 of 5
mmoucka
in reply to: Vladimir.Ananyev

Good morning.

I think, that it is not wholly a true. When I want modify the ".Reflectivity" over VBA macro, I have problems with setting of new value of this property and old value of some tried basic Inventor render styles are between 0 and 100 (for example "Skin" is 52). I know, that it is wrote in API help too, but I have another information about this variable straight from the VBA.

What I remember, I have always problems at settings of some render styles parameters in VBA.

Select material - click apply - error - run again - click on the same renderstyle - all O.K. - click on the same renderstyle - error...

I still have not a solution and on the web is not any usable recipe. I think, that problem is in the Inventor, and still not soluted.

Thanks.

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

Post to forums  

Autodesk Design & Make Report