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

    Andreas

    @Andreas

    10
    Reputation
    1
    Profile views
    36
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    Andreas Unfollow Follow
    registered-users

    Latest posts made by Andreas

    • RE: Problems with SketchUp 8 plugins in Sketchup 2015

      @unknownuser said:

      Perhaps: varstr.to_s.gsub...

      Is a good idea, but does not really works.

      It works like this:

      
         varstr = varstr.to_s
         attstr = varstr.gsub(/(\A@@)/,'')
      
      

      The names of the module variables will be reduced by the first two "@" sign.
      This names will be used later as descriptions to make the color settings. For example for cabinet sides, cabinet doors, tabletops ...

      We are manufacturer of office furniture.
      http://www.momo-moebel.de/

      The application is used to create plans for office furniture.
      You can get the plugins as a free download for usage with SketchUp 8 from our homepage.
      http://www.momo-moebel.de/fileadmin/service/mo_mo_SketchUp_V_3_2_06.zip
      We want to offer that for current sketchup Versions. Therefore, we are reworking the SketchUp plugins.

      posted in Developers' Forum
      A
      Andreas
    • RE: Problems with SketchUp 8 plugins in Sketchup 2015

      It is a large application. Therefore it is comprehensible to declare the variable in a separate file.

      But it seems, that the real problem is included elsewhere. So I've changed my method. Till now I've tried to find out what does not work. Now I am trying to find out what works.

      In that process I found an error in the following code:

      
      require('sketchup.rb')
      
      module ABSBMP;;MoMo
      ...
      
      ...
      
      class << self
      
        # Proxy class inside module ABSBMP;;MoMo
      
        # Create Reader methods for currently defined module variables.
        #{
        ABSBMP;;MoMo;;class_variables.each do |varstr|
      
          kind = eval %[#{varstr}.class]
      		
          attstr = varstr.gsub(/(\A@@)/,'')  <-- Error; #<NoMethodError; undefined method `gsub' for ;@@relExtPfad;Symbol>
      				
          # Reader Method 
          unless ['@@sag','@@skript'].include?(varstr)
            eval %[def #{attstr}(); return #{varstr}; end;]
            if kind.is_a?(TrueClass) || kind.is_a?(FalseClass)
              eval %[alias_method('#{attstr}?','#{attstr}');]
            end
          end
      
        end #} do class_variables.each
      
      
      end  # Proxy class 
      
      end  # module ABSBMP;;MoMo
      
      file_loaded('ABSBMP;mo_mo_var_get')  # global method from 'Tools/sketchup.rb'
      
      
      
      

      %(#4040FF)[The error-message is shown at the start of SketchUp 2015.
      In SketchUp 8 it works well!!!]

      posted in Developers' Forum
      A
      Andreas
    • RE: Problems with SketchUp 8 plugins in Sketchup 2015

      Sorry, my mistake. It is not complete, I forgot something.
      This should be correct:

      # File in SketchUp-Plugins
      
      require('sketchup.rb')
      require('extensions.rb')
      
      module ABSBMP  ### ( Toplevel namespace)
      
        module MoMo  ### ( This plugin's nested namespace. )
          @@relExtPfad = 'ABSBMP/mo_mo_moebel' # relative path 
          @@ladeprogramm = 'mo_mo_load'        # load script 
         
          ...
          @@plugin = SketchupExtension.new( @@sagExt;titel],File.join@@relExtPfad,@@ladeprogramm) )
          ...
            
          Sketchup.register_extension( @@plugin, true )
            
        end # module MoMo
      end # module ABSBMP      
      
      file_loaded('Plugins;ABSBMP_mo_mo_moebel_ext')  # global method from 'Tools/sketchup.rb'
      
      
      
      
      
      # File (@@ladeprogramm 'mo_mo_load') in subdirectory (@@relExtPfad)
      
      require('sketchup.rb')
      
      module ABSBMP;;MoMo
         Sketchup.require(File.join(@@relExtPfad,'mo_mo_main'))
      end  # < module ABSBMP;;MoMo 
      
      file_loaded('ABSBMP;mo_mo_load')  # global method from 'Tools/sketchup.rb'
      
      
      
      
      
      # File ('mo_mo_var_get') in subdirectory (@@relExtPfad)
      
      require('sketchup.rb')
      
      module ABSBMP;;MoMo   
        
        ### MODUL-VARIABLEN  ( MODULE VARIABLES )
      
         ...
         #{# Menüs  ( Menus )
         #
           @@menu = {}
         #
         #}#	
         ...
      	
      end  # module ABSBMP;;MoMo
      
      file_loaded('ABSBMP;mo_mo_var_get')  # global method from 'Tools/sketchup.rb'	
      
      
      
      
      
      # File ('mo_mo_main') in subdirectory (@@relExtPfad)
      
      require('sketchup.rb')
      
      module ABSBMP;;MoMo
          ...
          @@skript = ["mo_mo_var_get"]		
      		
          Sketchup;;require(File.join(@@relExtPfad,@@skript))		
          ...
      
      
          ...
          @@menu[;top]= UI.menu("Plugins")
          ...
         
      
         
      end  # module ABSBMP;;MoMo 
      
      file_loaded('ABSBMP;mo_mo_main')  # global method from 'Tools/sketchup.rb'      
      
      
      
      
      posted in Developers' Forum
      A
      Andreas
    • RE: Problems with SketchUp 8 plugins in Sketchup 2015

      It is a little bit complex.
      I don´t want to show hundreds of lines code here.
      So I try it like this:

      # File in SketchUp-Plugins
      
      require('sketchup.rb')
      require('extensions.rb')
      
      module ABSBMP  ### ( Toplevel namespace)
      
        module MoMo  ### ( This plugin's nested namespace. )
          @@relExtPfad = 'ABSBMP/mo_mo_moebel' # relative path 
          @@ladeprogramm = 'mo_mo_load'        # load script 
      	
          ...
          @@plugin = SketchupExtension.new( @@sagExt;titel],File.join@@relExtPfad,@@ladeprogramm) )
          ...
      		
          Sketchup.register_extension( @@plugin, true )
      		
        end # module MoMo
      end # module ABSBMP		
      
      file_loaded('Plugins;ABSBMP_mo_mo_moebel_ext')  # global method from 'Tools/sketchup.rb'
      
      
      
      
      # File (@@ladeprogramm 'mo_mo_load') in subdirectory (@@relExtPfad)
      
      require('sketchup.rb')
      
      module ABSBMP;;MoMo
        Sketchup.require(File.join(@@relExtPfad,'mo_mo_main'))
      end  # < module ABSBMP;;MoMo 
      
      file_loaded('ABSBMP;mo_mo_load')  # global method from 'Tools/sketchup.rb'
      
      
      
      
      
      # File ('mo_mo_main') in subdirectory (@@relExtPfad)
      
      require('sketchup.rb')
      
      module ABSBMP;;MoMo
          ...
          @@menu[;top]= UI.menu("Plugins")
          ...
      		
      end  # module ABSBMP;;MoMo 
      
      file_loaded('ABSBMP;mo_mo_main')  # global method from 'Tools/sketchup.rb'		
      		
      
      posted in Developers' Forum
      A
      Andreas
    • Problems with SketchUp 8 plugins in Sketchup 2015

      We try to change our SketchUp 8 plugins to SketchUp 2015. But it seems not so easy. There are several problems.

      For example:

        %(#4000FF)[**@@menu[:top]= UI.menu("Plugins")**]
      

      works with SketchUp 8 fine. SketchUp 2015 don´t accept that.

      I can´t find the reason.
      What´s the problem?

      posted in Developers' Forum
      A
      Andreas
    • Save pages as jpg-files

      Hello,

      I have SketchUp-files with pages (scenes).
      And I want to save a jpg-file from the last view of each page in the SketchUP-file automaticly by a button-click in the menu.
      Can someone tell me how does that works???

      Thank you!

      posted in Developers' Forum
      A
      Andreas
    • Inputbox prompts by variable

      I have a problem once again .

      This code works well:

      
      prompts = ['What is your Name?', 'What is your Age?', 'Gender']  
      defaults = ['Enter name', '', 'Male']  
      list = ['', '', 'Male|Female']  
      input = UI.inputbox prompts, defaults, list, 'Tell me about yourself.'
      
      

      Now I want to give the information by variable.
      For example for 'prompts':

      
      p = "'"What is your Name?"'" + "," + "'"What is your Age?"'" + "," + "'"Gender"'"
      prompts = [p]
      ...
      
      

      But that don´t works!
      What is my mistake?
      Is there another way to solve the problem?
      Or is that not possible?

      posted in Developers' Forum
      A
      Andreas
    • RE: Identify groups by its attributevalue and delete them

      Thank you!!!

      But there is an error:

      <span class="syntaxdefault"><br />  elsif e</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">get_attribute</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'section'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'key'</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">==</span><span class="syntaxdefault"> 1<br /></span>
      

      [/quote]

      It must be:

      <span class="syntaxdefault"><br />  elsif group</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">get_attribute</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'section'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'key'</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">==</span><span class="syntaxdefault"> 1<br /> </span>
      

      I see, you want to test me 😉

      Thank you!!!!!!

      posted in Developers' Forum
      A
      Andreas
    • RE: Identify groups by its attributevalue and delete them

      @thomthom said:

      <span class="syntaxdefault"><br />Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">selection</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each </span><span class="syntaxkeyword">{</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">|</span><span class="syntaxdefault">e</span><span class="syntaxkeyword">|<br /></span><span class="syntaxdefault">  next unless e</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">is_a</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Group </span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">  if e</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">get_attribute</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'section'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'key'</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">==</span><span class="syntaxdefault"> </span><span class="syntaxstring">'value'<br /></span><span class="syntaxdefault">    e</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">erase</span><span class="syntaxkeyword">!<br /></span><span class="syntaxdefault">  end<br /></span><span class="syntaxkeyword">}<br /></span><span class="syntaxdefault"> </span>
      

      Thank you!
      That works fine!

      I want to use it also to another job.
      Textures should be assigned to the groups:

      
      Sketchup.active_model.selection.each { |e|
        next unless e.is_a?( Sketchup;;Group )
          if e.get_attribute('section', 'key') == 0
            e.material = "oak_trans"
          elsif e.get_attribute('section', 'key') == 1
            e.material = "oak_long"
          end
      }
      
      
      

      That works with the selected groups.
      But the groups one or more level lower will not be edit.
      What have to be changed to use it for the groups into the groups?

      posted in Developers' Forum
      A
      Andreas
    • RE: Identify groups by its attributevalue and delete them

      @tig said:

      If the instance has the attribute rather than its definition... then it'll be

      <span class="syntaxdefault"><br />    Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">definitions</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each </span><span class="syntaxkeyword">{</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">|</span><span class="syntaxdefault">d</span><span class="syntaxkeyword">|<br /></span><span class="syntaxdefault">      next unless d</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">group</span><span class="syntaxkeyword">?<br /></span><span class="syntaxdefault">      d</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">instances</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each </span><span class="syntaxkeyword">{</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">|</span><span class="syntaxdefault">i</span><span class="syntaxkeyword">|<br /></span><span class="syntaxdefault">          if i</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">get_attribute</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'section'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'key'</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">==</span><span class="syntaxdefault"> </span><span class="syntaxstring">'value'<br /></span><span class="syntaxdefault">            i</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">erase</span><span class="syntaxkeyword">!<br /></span><span class="syntaxdefault">          end<br />        </span><span class="syntaxkeyword">}<br /></span><span class="syntaxdefault">      </span><span class="syntaxkeyword">}<br /></span><span class="syntaxdefault">      </span>
      

      😉

      That works fine for all groups!
      How must the code be changed, if only will be referencing to the selected groups?

      posted in Developers' Forum
      A
      Andreas