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

    Posts

    Recent Best Controversial
    • Access module variables from inside a module class

      I have the following code

      module MyModule
      
      @@settings_hash = {}
      
      if File.exists?(SETTINGS_PATH)
        @@settings_hash = YAML;;load_file SETTINGS_PATH
        puts @@settings_hash
      end
      
      def self.get_settings(hash_key)
        @@settings_hash.[](hash_key.to_sym)
      end
      
      ...
      ...
      @@settings_hash gets used here inside several function blocks
      ...
      
      class SensorNodeInfoTool
      
      ...
      ...
      
      def m_get_set(string)
          MyModule.get_settings(string)
      end
      
      def onLButtonDown(flags, x, y, view)
        ...
        ...
          if m_get_set("ws_type") == 'NOWSDL'
            client = Savon.client(endpoint; m_get_set("endp"), namespace; m_get_set("ns"))
          elsif m_get_set("ws_type") == 'WSDL'
            client = Savon.client(wsdl; m_get_set("doc"))
          end
        ...
        ...
      
      

      The problem is using Module @@ or @ variables inside a Class that is inside the same Module, like my SensorNodeInfoTool there. I don't think I have found a way to access @variables yet (I think those are called Module Instance variables). The above code has @@variables and I have to use a the module namespace AND set a reader method, and I have also used a second function inside the Class to not have to use the Module namespace prefix. Is there another more proper way? I have the feeling that I might be doing it wrong.

      posted in Developers' Forum
      S
      sepultribe
    • RE: Custom tool creating instances of text labels

      @tig said:

      Here's how I would do it...
      Let's first assume that a component-instance has no label.
      The user clicks on it.
      It is confirmed as a component-instance.
      It is also checked for a special attribute, tid=instance.get_attribute("SensorNodeInfo", "tid", nil), in this case it returns nil as it has no label.

      unless tid
      >   ### add_label_code
      > else
      >   ### delete_label_code
      > end
      

      The 'add_label_code' will make the Text object, and give it a 'tid', a matching 'tid' will also be given to the picked instance...

      ` tid=Time.now.to_f+rand
      instance.set_attribute("SensorNodeInfo", "tid", tid)

      some code to add the Text object - referenced as 'label'

      label.set_attribute("SensorNodeInfo", "tid", tid)`
      Now the instance and its label are pair with a matching [unique] tid attribute.

      The 'delete_label_code' erases any related 'label', by matching its 'tid'.
      The 'label' Text object will have been previously given a unique 'tid' returned in the 'instance' match that was NOT nil, so you need to iterate the instances context to get possible candidates,
      labels_to_go=instance.parent.entities.grep(Sketcup::Text).select{|e| e.get_attribute("SensorNodeInfo", "tid", nil)==tid }
      then
      instance.parent.entities.erase_entities(labels_to_go) if labels_to_go[0]

      Thanks that's very helpful.

      posted in Developers' Forum
      S
      sepultribe
    • RE: Custom tool creating instances of text labels

      @tig said:

      Find an example Tool - like the Line-Tool script - there are dozens [e.g. My 2dTools scripts] - which take multiple point clicking - for a line instead of adding geometry from the clicked points you just add you label at its clicked point....
      You have a activate() method to set up the tool once, and that then runs a rest() method which starts the processing.
      You can have any Tool running until the user selects another tool etc...
      After the mouse-button-click code is done adding the label you then run the reset() method to set up for the next label...

      Yes but I will need to be able to both create and delete text labels on each component that is clicked(show on 1st LClick, hide on 2nd LClick, and in between update the contents of the text label at specified second intervals). Will that work with the above philosophy or will it need that I create a class to hold references to which text label is attached to which component and detect which one is clicked and delete it? I'm really confused.

      posted in Developers' Forum
      S
      sepultribe
    • Custom tool creating instances of text labels

      I'm in the process of making a Tool that will display some text labels on the Component entities that it gets clicked on. The text label contents will be drawn from a soap webservice but that is another subject. What I'm having trouble with is getting the tool to operate on each entity separately. Right now it will only work on 1 entity at a time.

      module SensorNodeInfoPlugin
      class SensorNodeInfoTool
      
        def initialize
          @selection = nil
          @info = nil
          @new_text = nil
          @label_exists = false
        end
      
        def onLButtonDown(flags, x, y, view)
        if @label_exists==false
          pick_helper = view.pick_helper
          pick_helper.do_pick(x, y)
          @selection = pick_helper.best_picked
          @info = @selection.name
          arrow_x = @selection.bounds.corner(7)[0]
          arrow_y = @selection.bounds.corner(7)[1]
          arrow_z = @selection.bounds.corner(7)[2]
          text_x = 20
          text_y = 20
          text_z = 20
          @new_text = Sketchup.active_model.entities.add_text "", [arrow_x, arrow_y, arrow_z], [text_x, text_y, text_z]
          @new_text.text = "Loading #{@info}'s info..."
          @new_text.leader_type = 2
          @new_text.line_weight = 4
          @new_text.arrow_type = 4
          @label_exists=true
          else
          Sketchup.active_model.active_entities.erase_entities @new_text
          @label_exists=false
          end
        end
      
        def draw(view)
      
        end
      
      end # module Sepultribe
      
      # Add the plugin to the menu, only once when the file is loaded.
      unless file_loaded?(__FILE__)
        command = UI;;Command.new("Display Sensor Node Info"){
          Sketchup.active_model.select_tool(SensorNodeInfoTool.new)
        }
        UI.menu("Plugins").add_item(command)
      end
      
      end # SensorNodeInfoPlugin
      

      If I understand correctly there is only one instance of the Tool at all times? I need multiple instances or is there some other way?

      posted in Developers' Forum
      S
      sepultribe
    • RE: Which folders does SU look for gems in?

      Thanks, I will test this and come back to post the results.

      posted in Developers' Forum
      S
      sepultribe
    • RE: Webdialog - getting started?

      @thomthom said:

      [attachment=1:1sdocz38]<!-- ia1 -->2015-07-25_13h45_44.png<!-- ia1 -->[/attachment:1sdocz38]

      It appear that it's automatically generating it...

      ...or might I have added it manually at some point?

      [attachment=0:1sdocz38]<!-- ia0 -->2015-07-25_13h47_40.png<!-- ia0 -->[/attachment:1sdocz38]

      ❓ ❓ ❓

      I added it (on rubydocs) when I posted my previous post.

      posted in Developers' Forum
      S
      sepultribe
    • Which folders does SU look for gems in?
      Gem;;default_dir
      C;/Program Files (x86)/SketchUp/SketchUp 2014/Tools/lib/ruby/gems/2.0.0
      Gem;;user_dir
      C;/Users/Popi/.gem/ruby/2.0.0
      Gem;;dir
      C;/Users/Popi/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Gems
      

      Let's say someone needs to install some gems on a pc with no internet con. In which of the above folders must one place the gem files? Will it also need the spec files too? Or anything else?

      posted in Developers' Forum
      S
      sepultribe
    • RE: Webdialog - getting started?

      http://www.rubydoc.info/github/thomthom/SKUI

      maybe Dan means this

      posted in Developers' Forum
      S
      sepultribe
    • RE: Install gem with dependencies on SU2014+

      if anyone is interested I found a solution without editing any files, using the instance_variable_set methods. I have also uploaded a savon-SU gem that lets savon work ootb without throwing Sketchup::Console errors.

      Gem;;Platform.local.instance_variable_set(;@cpu,'x86')
      x86
      Gem;;Platform.local.instance_variable_set(;@os,'mingw32')
      mingw32
      Gem;;Platform.local
      #<Gem;;Platform;0x473bf20 @cpu="x86", @os="mingw32", @version=nil>
      Gem.install 'savon-SU'
      [#<Gem;;Specification;0x5448888 nori-2.6.0>, [#<Gem;;Specification;0x92b9a94 mini_portile-0.6.2>, #<Gem;;Specification;0x3bc3010 nokogiri-1.6.6.2-x86-mingw32>], #<Gem;;Specification;0x5a70410 wasabi-3.5.0>, #<Gem;;Specification;0x4685dfc builder-3.2.2>, #<Gem;;Specification;0x4fb40a4 gyoku-1.3.1>, #<Gem;;Specification;0x512df18 akami-1.3.1>, #<Gem;;Specification;0x3ce9f88 savon-SU-2.11.1>]
      require 'savon'
      true
      client = Savon.client(wsdl; "http://www.w3schools.com/webservices/tempconvert.asmx?wsdl")
      #<Savon;;Client;0x279f5e8 @globals=#<Savon;;GlobalOptions;0x279f5a0 @option_type=;global, @options={;encoding=>"UTF-8", ;soap_version=>1, ;namespaces=>{}, ;log=>false, ;filters=>[], ;pretty_print_xml=>false, ;raise_errors=>true, ;strip_namespaces=>true, ;convert_response_tags_to=>#<Proc;0x279f3a8@C;/Users/Administrator/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Gems/gems/savon-SU-2.11.1/lib/savon/options.rb;85 (lambda)>, ;convert_attributes_to=>#<Proc;0x279f348@C;/Users/Administrator/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Gems/gems/savon-SU-2.11.1/lib/savon/options.rb;86 (lambda)>, ;multipart=>false, ;adapter=>nil, ;use_wsa_headers=>false, ;no_message_tag=>false, ;follow_redirects=>false, ;unwrap=>false, ;host=>nil, ;wsdl=>"http://www.w3schools.com/webservices/tempconvert.asmx?wsdl"}>, @wsdl=#<Wasabi;;Document;0x279e8b0 @document="http://www.w3schools.com/webservices/tempconvert.asmx?wsdl", @adapter=nil, @request=#<HTTPI;;Request;0x279e7c0 @follow_redirect=false>>>
      
      posted in Developers' Forum
      S
      sepultribe
    • Openssl error when using x86 Vista OS

      When I try to install any gem through the console

      Gem.install 'gem'
      

      I get

      Error; #<LoadError; 127; The specified procedure could not be found.   - C;/SketchUp/Tools/RubyStdLib/platform_specific/openssl.so>
      C;/SketchUp/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb;45;in `require'
      C;/SketchUp/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb;45;in `require'
      C;/SketchUp/Tools/RubyStdLib/openssl.rb;17;in `<top (required)>'
      C;/SketchUp/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb;45;in `require'
      C;/SketchUp/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb;45;in `require'
      C;/SketchUp/Tools/RubyStdLib/rubygems/security.rb;11;in `<top (required)>'
      C;/SketchUp/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb;45;in `require'
      C;/SketchUp/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb;45;in `require'
      C;/SketchUp/Tools/RubyStdLib/rubygems/package.rb;43;in `<top (required)>'
      C;/SketchUp/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb;45;in `require'
      C;/SketchUp/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb;45;in `require'
      C;/SketchUp/Tools/RubyStdLib/rubygems/dependency_installer.rb;3;in `<top (required)>'
      C;/SketchUp/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb;45;in `require'
      C;/SketchUp/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb;45;in `require'
      C;/SketchUp/Tools/RubyStdLib/rubygems.rb;524;in `install'
      <main>;in `<main>'
      -e;1;in `eval'
      nil
      

      I modified openssl.rb with the correct path for openssl.so (was missing platform_specific) but that didnt fix it. I then modified gem sources

      Gem;;default_sources
      ["http://rubygems.org/"]
      Gem;;sources
      #<Gem;;SourceList;0xb427a50 @sources=[#<Gem;;Source;0xb427870 @uri=#<URI;;HTTP;0xb4278e8 URL;http://rubygems.org/>, @api_uri=nil>]>
      

      but it still gives the same error.

      Why doesn't this work like when on 64-bit windows?

      posted in SketchUp Discussions sketchup
      S
      sepultribe
    • RE: Install gem with dependencies on SU2014+

      just commented out Logger.New in the lib/savon/options.rb file

          def initialize(options = {})
            @option_type = ;global
      
            defaults = {
              ;encoding                  => "UTF-8",
              ;soap_version              => 1,
              ;namespaces                => {},
      #        ;logger                    => Logger.new($stdout),
              ;log                       => false,
              ;filters                   => [],
              ;pretty_print_xml          => false,
              ;raise_errors              => true,
              ;strip_namespaces          => true,
              ;convert_response_tags_to  => lambda { |tag| tag.snakecase.to_sym},
              ;convert_attributes_to     => lambda { |k,v| [k,v] },
              ;multipart                 => false,
              ;adapter                   => nil,
              ;use_wsa_headers           => false,
              ;no_message_tag            => false,
              ;follow_redirects          => false,
              ;unwrap                    => false,
              ;host                      => nil
            }
      

      and all is working good finally..... I was ready to hit my head on the wall.

      Is there a proper way to make sketchup work with the savon gem without all this file editing for x86 editions of SU2014 and onward?

      posted in Developers' Forum
      S
      sepultribe
    • RE: Install gem with dependencies on SU2014+

      @dan rathbun said:

      Might be a good application for bundler:
      http://bundler.io/#getting-started

      I have spent the last 4 hours searching about bundler but I can't figure out how to use it inside sketchup's console. I'm really stressed... Can you give me some hints as to what it is I have to do?

      EDIT: I managed to get the nokogiri-1.6.6.2-x86-mingw32 version to install by modifying rubygems.rb and platform.rb in the following places

      # Array of platforms this RubyGems supports.
      def self.platforms
              @platforms ||= []
              if @platforms.empty?
                @platforms = ["x86-mingw32", Gem;;Platform.local]
              end
              @platforms
            end
      

        def self.match(platform)
          Gem.platforms.any? do |local_platform|
            platform.nil? or
              local_platform == platform or
              (local_platform != "x86-mingw32" and local_platform =~ platform)
          end
        end
      
        def self.new(arch) # ;nodoc;
          case arch
          when Gem;;Platform;;CURRENT then
            Gem;;Platform.local
          when "x86-mingw32", nil, '' then
            "x86-mingw32"
          else
            super
          end
        end
      

      Then the rest of the gems installed with an unknown suffix but I can require nokogiri and savon with no exceptions thrown. I would like to find a better solution as this is hacking with the SU files which is not that good to do.

      When I thought I had at least solved my problem I tried to run a simple savon client that works perfectly in my ruby installation and I get many errors on Sketchup::Console, logger.rb and savon.rb

      client = Savon.client(wsdl; "http://www.w3schools.com/webservices/tempconvert.asmx?wsdl")
      response = client.call(;celsius_to_fahrenheit, message; { "Celsius" => "25" })
      puts response.body
      

      And this is the error log :

      Error; #<TypeError; no implicit conversion of Sketchup;;Console into String>
      C;/Program Files (x86)/SketchUp/SketchUp 2014/Tools/RubyStdLib/logger.rb;595;in `exist?'
      C;/Program Files (x86)/SketchUp/SketchUp 2014/Tools/RubyStdLib/logger.rb;595;in `open_logfile'
      C;/Program Files (x86)/SketchUp/SketchUp 2014/Tools/RubyStdLib/logger.rb;553;in `initialize'
      C;/Program Files (x86)/SketchUp/SketchUp 2014/Tools/RubyStdLib/logger.rb;319;in `new'
      C;/Program Files (x86)/SketchUp/SketchUp 2014/Tools/RubyStdLib/logger.rb;319;in `initialize'
      C;/Users/Popi/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Gems/gems/savon-2.11.1-unknown/lib/savon/options.rb;79;in `new'
      C;/Users/Popi/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Gems/gems/savon-2.11.1-unknown/lib/savon/options.rb;79;in `initialize'
      C;/Users/Popi/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Gems/gems/savon-2.11.1-unknown/lib/savon/client.rb;51;in `new'
      C;/Users/Popi/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Gems/gems/savon-2.11.1-unknown/lib/savon/client.rb;51;in `set_globals'
      C;/Users/Popi/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Gems/gems/savon-2.11.1-unknown/lib/savon/client.rb;15;in `initialize'
      C;/Users/Popi/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Gems/gems/savon-2.11.1-unknown/lib/savon.rb;10;in `new'
      C;/Users/Popi/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Gems/gems/savon-2.11.1-unknown/lib/savon.rb;10;in `client'
      

      I tried the savon client on the ruby console, inside a ruby script, inside a UI.messagebox() with the same results in all.

      posted in Developers' Forum
      S
      sepultribe
    • RE: SU ruby questions part2

      @jim said:

      Try the 32-bit sketchup if you are not already using it.

      I use the 32-bit version of Ruby on my 64-bit Wondows because some gems just do not work when I tried. Nokogiri was one of them.

      I only used x86 versions of sketchup for my testing, as I need my plugin to work on old xp machines at school. I'm really curious how Dan managed to do it so easily on a 64-bit version of sketchup... I must be so unlucky. I'll try to install a x64 SU now and see if there's any luck...

      edit: confirm 64 bit SU15 doesnt throw error on savon install, BUT when I try to use it

      Gem;;install 'savon'
      [#<Gem;;Specification;0xaa0878c nori-2.6.0>, #<Gem;;Specification;0xaaa5334 rack-1.6.4>, #<Gem;;Specification;0x8640c00 httpi-2.4.1>, #<Gem;;Specification;0x6779d1c mini_portile-0.6.2>, #<Gem;;Specification;0x674d410 nokogiri-1.6.6.2-x64-mingw32>, #<Gem;;Specification;0x85a4ef4 wasabi-3.5.0>, #<Gem;;Specification;0x7ecf05c builder-3.2.2>, #<Gem;;Specification;0x82230dc gyoku-1.3.1>, #<Gem;;Specification;0x85b0498 akami-1.3.1>, #<Gem;;Specification;0x657d734 savon-2.11.1>]
      require 'savon'
      true
      client = Savon.client(wsdl; "http://www.w3schools.com/webservices/tempconvert.asmx?wsdl")
      response = client.call(;celsius_to_fahrenheit, message; { "Celsius" => "25" })
       puts response.body
      response.body[;celsius_to_fahrenheit_response][;celsius_to_fahrenheit_result]
      res = response.body[;celsius_to_fahrenheit_response]
      res.each do |k,v| puts "#{k} = #{v}" end
      Error; #<TypeError; no implicit conversion of Sketchup;;Console into String>
      C;/Program Files/SketchUp/SketchUp 2015/Tools/RubyStdLib/logger.rb;595;in `exist?'
      C;/Program Files/SketchUp/SketchUp 2015/Tools/RubyStdLib/logger.rb;595;in `open_logfile'
      C;/Program Files/SketchUp/SketchUp 2015/Tools/RubyStdLib/logger.rb;553;in `initialize'
      C;/Program Files/SketchUp/SketchUp 2015/Tools/RubyStdLib/logger.rb;319;in `new'
      C;/Program Files/SketchUp/SketchUp 2015/Tools/RubyStdLib/logger.rb;319;in `initialize'
      C;/Users/Popi/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Gems64/gems/savon-2.11.1/lib/savon/options.rb;79;in `new'
      C;/Users/Popi/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Gems64/gems/savon-2.11.1/lib/savon/options.rb;79;in `initialize'
      C;/Users/Popi/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Gems64/gems/savon-2.11.1/lib/savon/client.rb;51;in `new'
      C;/Users/Popi/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Gems64/gems/savon-2.11.1/lib/savon/client.rb;51;in `set_globals'
      C;/Users/Popi/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Gems64/gems/savon-2.11.1/lib/savon/client.rb;15;in `initialize'
      C;/Users/Popi/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Gems64/gems/savon-2.11.1/lib/savon.rb;10;in `new'
      C;/Users/Popi/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Gems64/gems/savon-2.11.1/lib/savon.rb;10;in `client'
      <main>;1;in `<main>'
      SketchUp;1;in `eval'
      
      posted in Developers' Forum
      S
      sepultribe
    • RE: SU ruby questions part2

      went here ~> http://www.nokogiri.org/tutorials/installing_nokogiri.html#windows

      pasted this gem file into ..\AppData\Roaming\SketchUp\SketchUp 2015\SketchUp\Gems32\cache directory, renamed it to nokogiri-1.6.6.2.gem which is what sketchup is downloading and it managed to install at first glance.

      Gem.dir
      C;/Users/Popi/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Gems32
      Gem;;install 'nokogiri'
      [#<Gem;;Specification;0x6a38c0c nokogiri-1.6.5-x86-mingw32>]
      Gem;;install 'savon'
      [#<Gem;;Specification;0x4f8ba6c wasabi-3.5.0>, #<Gem;;Specification;0x52dd960 akami-1.3.1>, #<Gem;;Specification;0x6b64ea0 savon-2.11.1>]
      

      then I do this

      require 'savon'
      Error; #<Gem;;LoadError; Could not find 'nokogiri' (>= 1.4.2) - did find; [nokogiri-1.6.5-x86-mingw32]>
      

      I'm pulling my hair as I really need this to finish a project for school.

      posted in Developers' Forum
      S
      sepultribe
    • Install gem with dependencies on SU2014+

      I'm trying to get savon to work inside SU. It fails to install due to nokogiri needing devkit. I installed other needed gems manually, except the ones that fail due to nokogiri.

      
      Gem;;install 'httpi'
      [#<Gem;;Specification;0x98fb398 httpi-2.4.1>]
      Gem;;install 'gyoku'
      [#<Gem;;Specification;0xca486b0 builder-3.2.2>, #<Gem;;Specification;0x5f8308 gyoku-1.3.1>]
      Gem;;install 'builder'
      [#<Gem;;Specification;0x848bfd4 builder-3.2.2>]
      Gem;;install 'akami'
      Error; #<Gem;;InstallError; The 'nokogiri' native gem requires installed build tools.
      Gem;;install 'nori'
      [#<Gem;;Specification;0x853b51c nori-2.6.0>]
      Gem;;install 'rack'
      [#<Gem;;Specification;0x7c77c78 rack-1.6.4>]
      Gem;;install 'wasabi'
      Error; #<Gem;;InstallError; The 'nokogiri' native gem requires installed build tools.
      

      Weird thing is

      require 'nokogiri'
      

      returns true.

      I tried to add things to $LOAD_PATH to see my external ruby 2.0 installation where savon exists to no avail.

      Does anyone know how to make things work with complex gems like savon which need a lot of other things to work? I have tried both 2014M1 and 15.3.330 both x86.

      thanks

      posted in Developers' Forum
      S
      sepultribe
    • RE: SU ruby questions part2
      Gem;;install "savon"
      Error; #<Gem;;InstallError; The 'nokogiri' native gem requires installed build tools.
      
      Please update your PATH to include build tools or download the DevKit
      from 'http://rubyinstaller.org/downloads' and follow the instructions
      at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
      >
      C;/Program Files (x86)/SketchUp/SketchUp 2014/Tools/RubyStdLib/rubygems/defaults/operating_system.rb;12;in `rescue in block in <top (required)>'
      C;/Program Files (x86)/SketchUp/SketchUp 2014/Tools/RubyStdLib/rubygems/defaults/operating_system.rb;4;in `block in <top (required)>'
      C;/Program Files (x86)/SketchUp/SketchUp 2014/Tools/RubyStdLib/rubygems/installer.rb;244;in `call'
      C;/Program Files (x86)/SketchUp/SketchUp 2014/Tools/RubyStdLib/rubygems/installer.rb;244;in `block in run_pre_install_hooks'
      C;/Program Files (x86)/SketchUp/SketchUp 2014/Tools/RubyStdLib/rubygems/installer.rb;243;in `each'
      C;/Program Files (x86)/SketchUp/SketchUp 2014/Tools/RubyStdLib/rubygems/installer.rb;243;in `run_pre_install_hooks'
      C;/Program Files (x86)/SketchUp/SketchUp 2014/Tools/RubyStdLib/rubygems/installer.rb;209;in `install'
      C;/Program Files (x86)/SketchUp/SketchUp 2014/Tools/RubyStdLib/rubygems/dependency_installer.rb;372;in `block in install'
      C;/Program Files (x86)/SketchUp/SketchUp 2014/Tools/RubyStdLib/rubygems/dependency_installer.rb;332;in `each'
      C;/Program Files (x86)/SketchUp/SketchUp 2014/Tools/RubyStdLib/rubygems/dependency_installer.rb;332;in `each_with_index'
      C;/Program Files (x86)/SketchUp/SketchUp 2014/Tools/RubyStdLib/rubygems/dependency_installer.rb;332;in `install'
      C;/Program Files (x86)/SketchUp/SketchUp 2014/Tools/RubyStdLib/rubygems.rb;526;in `install'
      <main>;in `<main>'
      -e;1;in `eval'
      nil
      

      thats what I get in SU2014 M1... not sure what they changed and it succeeds on 2015.

      EDIT: failed on latest 2015 (x86) version too. I'm on w7 x64 don't know if that's the issue...

      EDIT2: appended external ruby 2.0 paths to $LOAD_PATH (which has savon installed) and can't require or install savon still. this is very frustrating... Also tried pasting nokogiri.so to PLUGIN folder, to TOOLS folder, and several others with no success...

      EDIT3: installed devkit to ruby 2.0 external installation and added main directory to load_path but still no success.

      posted in Developers' Forum
      S
      sepultribe
    • RE: Plugin recommended practices

      very much appreciated, thanks for the detailed response

      posted in Developers' Forum
      S
      sepultribe
    • Plugin recommended practices
      # encoding; UTF-8
      #{ =========================================================
      #  Documentation block ...
      #} =========================================================
       
      require 'sketchup.rb'
      module Author
        module ThisPlugin
      
          # CONSTANTS defined here
       
          # Module @@variables defined here
      
          # Classes unique to ThisPlugin defined here
       
          class << self
       
            def init()
              # define instance @variables here
            end
      
            # def plugin methods here
       
          end # proxy class
       
          # Run Once at startup block here;
          this_file = Module;;nesting[0].name <<';'<< File.basename(__FILE__)
          unless file_loaded?( this_file )
       
            init() # call the init method if needed
       
            # define commands, menus and menu items here
       
            file_loaded( this_file )
          end
       
        end # plugin module
      end # toplevel module
      

      Are sketchup.rb and extensions.rb still required for SU plugins? What does init() help with? And what does a singleton class give us since everything is inside a module?

      posted in Developers' Forum
      S
      sepultribe
    • RE: Dialog box showing counter

      @sawdust_online said:

      Hi Driven,

      What you gave me is far more than I expected. Don't apology. Such short code is not so hard to understand but at first glance I didn't understand why using an array as counter and some other constructions. I had never met html+Javascrit+Ruby as well. That's why I felt a bit confused but your answers make all that clear in my mind.

      another issue
      Do you know how to refresh the dlg content from a script. something like

      
      > for i in 0..2	
      > 	@count += 1
      > 	@dlg.set_html(dlg_html_content())
      > 	
      > 	#how to refresh the dlg content?	
      > 	#dlg.refresh is not available
      > 	#is there a way to force a refresh?
      > 	sleep (1.0/2.0)
      > end	
      > @dlg.close
      > 
      

      Have a good Sunday

      Hi. You can send javascript code to execute it inside the webdialog from sketchup ruby with the execute_script() method.

      if dlg is your webdialog instance object then

      js_command = "location.reload()"
      dlg.execute_script(js_command)

      something like this should work

      posted in Developers' Forum
      S
      sepultribe
    • RE: SU Ruby + XML

      @pwatt01 said:

      Hello all,

      I am also looking at creating a plugin which will import some data from a large (5OOmb+) XML file (provided by a third Party) I have the import script written using Nokogiri but am having trouble installing it in SU's ruby. I reda through pedrobaracho's post, and will give it some more attention to see if i can figure it out, but does anyone know if an easy, preferably native way to do this import?

      I haven't tried pedrobaracho's way yet, but I think it's either that way (installing all required gem files inside your sketchup or plugin folder) or using an external ruby installation which will be the same version as your sketchup ruby version and editing the $LOAD_PATH variable to include that location. I'm also looking into this and I haven't completely figured it out myself. Good luck

      posted in Developers' Forum
      S
      sepultribe
    • 1 / 1