sketchucation logo sketchucation
    • Login
    1. Home
    2. dolzenko
    3. Posts
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    D
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 7
    • Groups 1

    Posts

    Recent Best Controversial
    • Ruby - WebDialog.set_html() and string with null character

      When the string containing null character is passed to WebDialog.set_html() the page is loaded up to this characted.

      Here is the test case:

      NASTY_STRING = "asd\000dsa"
      
      UI.menu("Plugins").add_item("test set_html") do
      	dlg = UI;;WebDialog.new("test set_html", true);
      	dlg.set_html(NASTY_STRING)
      	dlg.show() # only "asd" is displayed
      end
      
      UI.menu("Plugins").add_item("test set_file") do
      	dlg = UI;;WebDialog.new("test set_file", true);
      	temp_file = ENV['TEMP'] + "\\test_set_file.html"
      	File.open(temp_file, "wb") do |file|
      		file.write(NASTY_STRING)
      	end	
      	dlg.set_file(temp_file) # only "asddsa" is displayed
      	dlg.show()
      end
      

      I understand this is pretty nasty edge case, but still can produce mind boggling results/surprises.

      posted in Developers' Forum
      D
      dolzenko
    • RE: Manually creating finite length construction lines

      Great, thank you. I knew about linetool.rb but liked the built-in tool better.

      Now I think I'll settle with this enhanced version of linetool.rb as I understand it's not possible with the built-in tools anyway.

      And sorry, xLine.rb doesn't look like what I need, that http://www.smustard.com/script/Xline page says "Convert edges to construction lines", but thank you anyway.

      posted in SketchUp Discussions
      D
      dolzenko
    • Manually creating finite length construction lines

      Through Ruby API it is possible to turn existing construction line into finite length one by setting start/end properties. Described here: http://code.google.com/intl/ru-RU/apis/sketchup/docs/ourdoc/constructionline.html

      Now is there a way to create finite length construction line manually? I have read the manual for Protractor tool and failed to find any way to do that. Maybe I should use other tool?

      posted in SketchUp Discussions sketchup
      D
      dolzenko
    • RE: Producing an error message for a run-time ruby error
      def test_error1
         begin
            test_error2 # code which may contain an error
         rescue Exception => e
            do_rescue(e, "Test Error")
         end#begin
      end#def
      

      can be even reduced to

      def test_error1
        test_error2 # code which may contain an error
      rescue Exception => e
        do_rescue(e, "Test Error")
      end
      

      But what really bothers me is that there is no option to make Ruby console pop up when there are new messages and stay hidden otherwise.

      As for now I guess I would just keep a file with

      Sketchup.send_action("showRubyPanel;")
      

      in the Plugins folders while doing active development.

      posted in Developers' Forum
      D
      dolzenko
    • RE: Anchor the leader for text entity

      Thank you for your quick reply.

      And yeah I noticed your suggestion in one of the above links too.

      The observer solution seems a little kludgey to me, especially when you can create the needed leader manually with the Text tool.

      So I'm still pretty new to SketchUp development, how that observers solution would work when say I would like to move my *.skp file to the other PC? I would obviously have to move it with the script which sets up observers?

      posted in Developers' Forum
      D
      dolzenko
    • RE: Anchor the leader for text entity

      So far I have found these links, both of which indirectly confirm that this is impossible with the current API. Can anybody confirm/deny this?

      http://groups.google.com/group/sketchupruby/browse_thread/thread/4561e6ec1f3e41cc/55d97084b224a2eb?lnk=gst&q=leader#55d97084b224a2eb

      http://groups.google.com/group/Ruby-API/browse_thread/thread/434fc8f36f394a7b/9d00a83d3f7084a7#9d00a83d3f7084a7

      posted in Developers' Forum
      D
      dolzenko
    • Anchor the leader for text entity

      When working with the Text tool you can anchor the created leader to Endpoint or Face of the component. Then when you move the component the leader follows the original point on component (or face, etc.).

      Is there a way to add a text with the leader by

      add_text (Sketchup;;Entities)
      

      function, with leader being anchored to specific Endpoint in my component?

      Thanks in advance.

      posted in Developers' Forum
      D
      dolzenko
    • 1 / 1