sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Changing Edge "endpoints" rendering option

    Scheduled Pinned Locked Moved Developers' Forum
    7 Posts 3 Posters 341 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R Offline
      ruski_canuk
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • Chris FullmerC Offline
        Chris Fullmer
        last edited by

        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 }

        Lately you've been tan, suspicious for the winter.
        All my Plugins I've written

        1 Reply Last reply Reply Quote 0
        • Chris FullmerC Offline
          Chris Fullmer
          last edited by

          Also, LineEndWidth should control the size of the endpoints.

          Chris

          Lately you've been tan, suspicious for the winter.
          All my Plugins I've written

          1 Reply Last reply Reply Quote 0
          • Al HartA Offline
            Al Hart
            last edited by

            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
            
            

            Al Hart

            http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
            IRender nXt from Render Plus

            1 Reply Last reply Reply Quote 0
            • Chris FullmerC Offline
              Chris Fullmer
              last edited by

              Hey, that's pretty cool Al, thanks! I'll keep those two methods handy.

              Chris

              Lately you've been tan, suspicious for the winter.
              All my Plugins I've written

              1 Reply Last reply Reply Quote 0
              • R Offline
                ruski_canuk
                last edited by

                Chris -

                The answer to my question and then some. Thanks Chris!

                So how did you discover this undocumented mystery?

                1 Reply Last reply Reply Quote 0
                • Chris FullmerC Offline
                  Chris Fullmer
                  last edited by

                  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

                  Lately you've been tan, suspicious for the winter.
                  All my Plugins I've written

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post
                  Buy SketchPlus
                  Buy SUbD
                  Buy WrapR
                  Buy eBook
                  Buy Modelur
                  Buy Vertex Tools
                  Buy SketchCuisine
                  Buy FormFonts

                  Advertisement