by renderiza » Sat Jun 22, 2013 8:34 pm
Hi, I want to create a plugin that will set scenes with different rendering styles so I can then export them to Photoshop. To get better idea of what I want to create through code please open this LINK to see the rendering setting to set scenes for Color, Shadows, Alpha Channel and ZDeapth. I can't seem to find a way to control Shadows parameter like 'Light' and 'Dark' values. Also the only way to active Shadows through code that I know of is this the following... Sketchup.send_action(1213) ... I am just starting this so I don't have much but here is a WIP to creat aplha channel (still not complete). - Code: Select all
################## ###Alpha Channe### ##################
Sketchup.active_model.rendering_options['DisplayFog']=false Sketchup.active_model.rendering_options['BackgroundColor']=[0, 0, 0] #Ground Sketchup.active_model.rendering_options['DrawGround']=false #Sky Sketchup.active_model.rendering_options['DrawHorizon']=false #EndPoint (lines) Sketchup.active_model.rendering_options['DrawLineEnds']=false #Profile (lines) Sketchup.active_model.rendering_options['DrawSilhouettes']=false #Display Lines? Sketchup.active_model.rendering_options['EdgeDisplayMode']=0 #Back Face Color Sketchup.active_model.rendering_options['FaceBackColor']=[255, 255, 255] #Front Face Color Sketchup.active_model.rendering_options['FaceFrontColor']=[255, 255, 255] #Fog Color Sketchup.active_model.rendering_options['FogColor']=[255, 255, 255]
If anyone can help me I will be very greatfull. Thanks!
Last edited by renderiza on Sun Jun 23, 2013 1:42 am, edited 1 time in total.
-

renderiza
- Premium Member

-
- Posts: 786
- Joined: Thu Sep 13, 2012 9:41 pm
- Location: Puerto Rico
- Name: RafaelRivera
- Operating system: Mac
- SketchUp version: 2020
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by TIG » Sat Jun 22, 2013 10:31 pm
You also need to consider the shadow_info and its ['Light'] & ['Dark'] settings [%] ?
TIG
-

TIG
- Global Moderator
-
- Posts: 20294
- Joined: Mon Nov 12, 2007 7:24 pm
- Location: Northumbria UK
- Name: TIG
- Operating system: Windows
- SketchUp version: 2021
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by renderiza » Sat Jun 22, 2013 11:01 pm
For example if I want to set the Alpha Channel scene I need to set the following shadow settings with code... Shadow Settings: >> Use Shadow = false >> Light = 0 >> Dark = 100 >> Use sun for shading = true If I am not mistaken the shadow_info Api is only to extract their values so it cannot let me set their values right? ... Maybe the solution is to provide SketchUp File with all the scenes with styles settings already provided and just import the them somehow but not sure if that is possible. I need to do some more research! 
-

renderiza
- Premium Member

-
- Posts: 786
- Joined: Thu Sep 13, 2012 9:41 pm
- Location: Puerto Rico
- Name: RafaelRivera
- Operating system: Mac
- SketchUp version: 2020
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by TIG » Sat Jun 22, 2013 11:11 pm
No. Play around in the Ruby Console to see what changing things does... Sketchup.active_model.shadow_info['Dark']=0 Sketchup.active_model.shadow_info['Light']=100Will both change things as you might expect 
TIG
-

TIG
- Global Moderator
-
- Posts: 20294
- Joined: Mon Nov 12, 2007 7:24 pm
- Location: Northumbria UK
- Name: TIG
- Operating system: Windows
- SketchUp version: 2021
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by renderiza » Sat Jun 22, 2013 11:38 pm
WOW! TIG, did I said you are awesome! Thanks!
-

renderiza
- Premium Member

-
- Posts: 786
- Joined: Thu Sep 13, 2012 9:41 pm
- Location: Puerto Rico
- Name: RafaelRivera
- Operating system: Mac
- SketchUp version: 2020
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by renderiza » Sun Jun 23, 2013 1:41 am
The following is the code for creating an Alpha Channel Scene... - Code: Select all
################## ###Alpha Channe### ##################
###Create Scene### Sketchup.send_action(CMD_PAGE_NEW)
###Style### Sketchup.active_model.rendering_options['RenderMode']=5
#Edge Settings Sketchup.active_model.rendering_options['EdgeDisplayMode']=0 Sketchup.active_model.rendering_options['DrawSilhouettes']=false
#Face Settings Sketchup.active_model.rendering_options['FaceFrontColor']=[255, 255, 255] Sketchup.active_model.rendering_options['FaceBackColor']=[255, 255, 255]
#Background Settings Sketchup.active_model.rendering_options['BackgroundColor']=[0, 0, 0] Sketchup.active_model.rendering_options['DrawHorizon']=false Sketchup.active_model.rendering_options['DrawGround']=false
#Watermark Settings Sketchup.active_model.rendering_options['DisplayWatermarks']=false
###Shadow Settings### Sketchup.active_model.shadow_info['DisplayShadows']=false Sketchup.active_model.shadow_info['UseSunForAllShading']=true Sketchup.active_model.shadow_info['Light']=0 Sketchup.active_model.shadow_info['Dark']=100
###Fog Settings### Sketchup.active_model.rendering_options['DisplayFog']=false
############ ###Update### ############ model = Sketchup.active_model pages = model.pages c_page = pages.selected_page
c_page.update
Only thing I wish didn't happen is the Warning! message saying "You are creating or updating a scene and have not saved the changes you've made to your style." Is there a way to get rid of that? Anyways just wanted to post what I had so far...thanks!
-

renderiza
- Premium Member

-
- Posts: 786
- Joined: Thu Sep 13, 2012 9:41 pm
- Location: Puerto Rico
- Name: RafaelRivera
- Operating system: Mac
- SketchUp version: 2020
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by renderiza » Sun Jun 23, 2013 2:12 am
Here is an interesting plugin... Rendering Favourites (v1.1) by Trogluddite - This is a plugin which can store style options and its great to store things like Alpha Channels, ZDeapth, Color, ect.
-

renderiza
- Premium Member

-
- Posts: 786
- Joined: Thu Sep 13, 2012 9:41 pm
- Location: Puerto Rico
- Name: RafaelRivera
- Operating system: Mac
- SketchUp version: 2020
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by renderiza » Sun Jun 23, 2013 8:41 pm
Hi, Here is what I assume to be a BUG... When the code creates the Zdepth page even though the Fog settings appear to be applied it doesn't display it! This is strange and for it to work I need to move the distance slider a nudge manually which defeats the purpose. Here is the code...Notice I saved the style properties into folder and I am just importing them so the rest of the code works on Shadow & Fog properties. - Code: Select all
model = Sketchup.active_model pages = model.pages
######################################## ###Aplha################################ ########################################
###Shadow Settings### Sketchup.active_model.shadow_info['DisplayShadows']=false Sketchup.active_model.shadow_info['UseSunForAllShading']=true Sketchup.active_model.shadow_info['Light']=0 Sketchup.active_model.shadow_info['Dark']=100
###Fog Settings### Sketchup.active_model.rendering_options['DisplayFog']=false
pages.add("Aplha") styles = Sketchup.active_model.styles status = styles.add_style "c:\\styles\\Aplha Style.style", true
selpage = pages.selected_page selpage.update
######################################## ###Zdepth############################### ########################################
###Shadow Settings### Sketchup.active_model.shadow_info['DisplayShadows']=false Sketchup.active_model.shadow_info['UseSunForAllShading']=true Sketchup.active_model.shadow_info['Light']=0 Sketchup.active_model.shadow_info['Dark']=100
###Fog Settings### Sketchup.active_model.rendering_options["FogEndDist"]=35.m Sketchup.active_model.rendering_options['DisplayFog']=true
pages.add("Zdepth") styles = Sketchup.active_model.styles status = styles.add_style "c:\\styles\\Zdepth Style.style", true
selpage = pages.selected_page selpage.update
Any help will be appreciated! 
-

renderiza
- Premium Member

-
- Posts: 786
- Joined: Thu Sep 13, 2012 9:41 pm
- Location: Puerto Rico
- Name: RafaelRivera
- Operating system: Mac
- SketchUp version: 2020
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by renderiza » Mon Jun 24, 2013 12:45 am
Seems the Fog part is working now but not sure what was that I did to fix it. For the most part I think I am finish but just need to worry about the interface part of things now. - Code: Select all
model = Sketchup.active_model pages = model.pages
######################################## ###Alpha################################ ########################################
###Shadow Settings### Sketchup.active_model.shadow_info['DisplayShadows']=false Sketchup.active_model.shadow_info['UseSunForAllShading']=true Sketchup.active_model.shadow_info['Light']=0 Sketchup.active_model.shadow_info['Dark']=100
###Fog Settings### Sketchup.active_model.rendering_options['DisplayFog']=false
###Add Page### pages.add("Alpha") styles = Sketchup.active_model.styles status = styles.add_style "c:\\styles\\Alpha Style.style", true
###Update### selpage = pages.selected_page selpage.update
######################################## ###Cley################################# ########################################
###Shadow Settings### Sketchup.active_model.shadow_info['DisplayShadows']=false Sketchup.active_model.shadow_info['UseSunForAllShading']=true Sketchup.active_model.shadow_info['Light']=50 Sketchup.active_model.shadow_info['Dark']=15
###Fog Settings### Sketchup.active_model.rendering_options['DisplayFog']=false
###Add Page### pages.add("Cley") styles = Sketchup.active_model.styles status = styles.add_style "c:\\styles\\Cley Style.style", true
###Update### selpage = pages.selected_page selpage.update
######################################## ###Color################################ ########################################
###Shadow Settings### Sketchup.active_model.shadow_info['DisplayShadows']=false Sketchup.active_model.shadow_info['UseSunForAllShading']=true Sketchup.active_model.shadow_info['Light']=0 Sketchup.active_model.shadow_info['Dark']=100
###Fog Settings### Sketchup.active_model.rendering_options['DisplayFog']=false
###Add Page### pages.add("Color") styles = Sketchup.active_model.styles status = styles.add_style "c:\\styles\\Color Style.style", true
###Update### selpage = pages.selected_page selpage.update
######################################## ###Color by Layer####################### ########################################
###Shadow Settings### Sketchup.active_model.shadow_info['DisplayShadows']=false Sketchup.active_model.shadow_info['UseSunForAllShading']=true Sketchup.active_model.shadow_info['Light']=0 Sketchup.active_model.shadow_info['Dark']=100
###Fog Settings### Sketchup.active_model.rendering_options['DisplayFog']=false
###Add Page### pages.add("Color by Layer") styles = Sketchup.active_model.styles status = styles.add_style "c:\\styles\\Color by Layer Style.style", true
###Update### selpage = pages.selected_page selpage.update
######################################## ###Line################################ ########################################
###Shadow Settings### Sketchup.active_model.shadow_info['DisplayShadows']=false Sketchup.active_model.shadow_info['UseSunForAllShading']=true Sketchup.active_model.shadow_info['Light']=0 Sketchup.active_model.shadow_info['Dark']=100
###Fog Settings### Sketchup.active_model.rendering_options['DisplayFog']=false
###Add Page### pages.add("Line") styles = Sketchup.active_model.styles status = styles.add_style "c:\\styles\\Line Style.style", true
###Update### selpage = pages.selected_page selpage.update
######################################## ###Profile############################## ########################################
###Shadow Settings### Sketchup.active_model.shadow_info['DisplayShadows']=false Sketchup.active_model.shadow_info['UseSunForAllShading']=true Sketchup.active_model.shadow_info['Light']=0 Sketchup.active_model.shadow_info['Dark']=100
###Fog Settings### Sketchup.active_model.rendering_options['DisplayFog']=false
###Add Page### pages.add("Profile") styles = Sketchup.active_model.styles status = styles.add_style "c:\\styles\\Profile Style.style", true
###Update### selpage = pages.selected_page selpage.update
######################################## ###Shadow################################ ########################################
###Shadow Settings### Sketchup.active_model.shadow_info['DisplayShadows']=true Sketchup.active_model.shadow_info['UseSunForAllShading']=true Sketchup.active_model.shadow_info['Light']=100 Sketchup.active_model.shadow_info['Dark']=0
###Fog Settings### Sketchup.active_model.rendering_options['DisplayFog']=false
###Add Page### pages.add("Shadow") styles = Sketchup.active_model.styles status = styles.add_style "c:\\styles\\Shadow Style.style", true
###Update### selpage = pages.selected_page selpage.update
######################################## ###Texture################################ ########################################
###Shadow Settings### Sketchup.active_model.shadow_info['DisplayShadows']=false Sketchup.active_model.shadow_info['UseSunForAllShading']=true Sketchup.active_model.shadow_info['Light']=0 Sketchup.active_model.shadow_info['Dark']=100
###Fog Settings### Sketchup.active_model.rendering_options['DisplayFog']=false
###Add Page### pages.add("Texture") styles = Sketchup.active_model.styles status = styles.add_style "c:\\styles\\Texture Style.style", true
###Update### selpage = pages.selected_page selpage.update
######################################## ###Zdepth############################### ########################################
###Shadow Settings### Sketchup.active_model.shadow_info['DisplayShadows']=false Sketchup.active_model.shadow_info['UseSunForAllShading']=true Sketchup.active_model.shadow_info['Light']=0 Sketchup.active_model.shadow_info['Dark']=100
###Fog Settings### Sketchup.active_model.rendering_options['FogEndDist']=35.m Sketchup.active_model.rendering_options['DisplayFog']=true
###Add Page### pages.add("Zdepth") styles = Sketchup.active_model.styles status = styles.add_style "c:\\styles\\Zdepth Style.style", true
###Update### selpage = pages.selected_page selpage.update
-

renderiza
- Premium Member

-
- Posts: 786
- Joined: Thu Sep 13, 2012 9:41 pm
- Location: Puerto Rico
- Name: RafaelRivera
- Operating system: Mac
- SketchUp version: 2020
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by mrsailboat83 » Tue Jul 17, 2018 3:24 am
dude, did you know that everytime you save a scene there is the option to save it with the current settings? Maybe this wasn't the case back in 2013 but there you go
-
mrsailboat83
-
- Posts: 2
- Joined: Sat Oct 29, 2016 9:05 pm
- Name: brandon shaw
- Operating system: Mac
- SketchUp version: 2015
- License type: Pro
- SketchUp use: hobby
- Level of SketchUp: Intermediate
by Ad Machine » 5 minutes ago
-
Ad Machine
- Robot
-
- Posts: 2012
-
Return to Developers' Forum
|