Changing Edge "endpoints" rendering option
-
So if Sketchup.active_model.rendering_options["ExtendLines"] lets me toggle the Window->Styles->Extension checkmark box, what is the secret password ( Sketchup.active_model.rendering_options["secret password"] ) for changing the 'Endpoints' checkmark in the same location? I've looked here http://code.google.com/apis/sketchup/docs/ourdoc/renderingoptions.html but to no avail.
-
Loos like it should be
DrawLineEnds
I haven't tested it, but it should work. In looking for it, I've found quite a few keys that are not listed in the API, and I've found at least one so far that is listed but not acutally supported. I'm in the process of writing this up for the API typos thread. Hope it helps,
Chris
PS: Running this in the web console will list all the possible keys:
model = Sketchup.active_model renderingoptions = model.rendering_options renderingoptions.each { | key, value | puts key }
-
Also,
LineEndWidth
should control the size of the endpoints.Chris
-
Chris, you might find these two functions interesting.
One saves the value of the current rendering and shadow options, and the other traces out any changes.
You run the first one, change something, and then run the second one.
You need to replace trace() with printf() and add a \n line feed. I have a routine called trace which display the file name and line number of each output which makes it easier to see who is displaying the output)
You can also see how you could add some other options to make this more complete.
def remember_options model = Sketchup.active_model rendering_options = model.rendering_options $rps_old_rendering_options = {} rendering_options.each_pair do |name , value| $rps_old_rendering_options[name] = value end#loop shadow_info = model.shadow_info $rps_old_shadow_info = {} shadow_info.each_pair do |name , value| $rps_old_shadow_info[name] = value end#loop end#def def compare_options model = Sketchup.active_model rendering_options = model.rendering_options rendering_options.each_pair do |name , value| old_value = $rps_old_rendering_options[name] next if value == old_value next if value.kind_of?(Sketchup;;Color) && value.to_s == old_value.to_s trace("rendering_options[\"%s\"]=%s old; %s", name, value, old_value) $value = value $rps_old_value = old_value end#loop shadow_info = model.shadow_info shadow_info.each_pair do |name , value| old_value = $rps_old_shadow_info[name] next if value == old_value next if value.kind_of?(Sketchup;;Color) && value.to_s == old_value.to_s trace("shadow_info[\"%s\"]=%s old; %s", name, value, old_value) $value = value $rps_old_value = old_value end#loop end#def
-
Hey, that's pretty cool Al, thanks! I'll keep those two methods handy.
Chris
-
Chris -
The answer to my question and then some. Thanks Chris!
So how did you discover this undocumented mystery?
-
I used the code they posted in the API in RenderingOptions "each" method here:
http://code.google.com/apis/sketchup/docs/ourdoc/renderingoptions.html#each_key
But the example puts each key into a messagebox, so I changed "UI.messagebox" to "puts" so it would send it to the Ruby Console. The code looks like this:
model = Sketchup.active_model renderingoptions = model.rendering_options renderingoptions.each_key { | key | puts key }
and I run it in Jim's Web Concolse, which is my favorite Ruby development tool.
Then I just went through the returned keys one by one and compared then to the API. There were quite a few missing ones in the API, and some in the API that don't actually exist.
Chris
Advertisement