sketchucation logo sketchucation
    • Login
    1. Home
    2. azuby
    3. Posts
    βŒ› Sale Ending | 30% Off Profile Builder 4 ends 30th September
    A
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 23
    • Posts 305
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Search & Replace Name

      Are you familiar with regular expressions?

      azuby

      posted in Developers' Forum
      A
      azuby
    • RE: How to read/parse XML files inside SU

      If I remember right, I had a fully installed Ruby on my PC and took the REXML lib from it. The directory contains 55 files and five folders. I loaded it this way from my script:

      require 'rexml/document' unless defined? REXML
      

      If you also want to load this way you have to make sure that the Ruby interpreter search in the right place. Put the REXML folder to Plugins or Tools folder - should work with the above code.

      To make sure that your script only runs if REXML is loaded, put this condition to your codee:

      if defined? REXML
        # YOUR CODE HERE
      else
        UI.messagebox "REXML is missed, can't load plugin."
      end
      

      Sorry for my late answer - I'm moving from town to town at the moment.

      azuby

      posted in Developers' Forum
      A
      azuby
    • RE: [Plugin] Select Lines by Length (Updated March 9th, 2009)

      I also coded something similar this night reusing the code form "Select all with same orientation" (SAWSO) It's should be simple to integrate the functionality to select more than one line, Chris.

      azuby

      posted in Plugins
      A
      azuby
    • RE: Request_paint reverse

      Maybe you want to try FFlipper - http://errorinitus.de > Downloads - at the moment, it explodes components 😞 No time to fix 😞

      Does the following:

      • front (white): no material
      • back (blue): material X
        =>
      • front (white): material X
      • back (blue): no material

      azuby

      posted in Developers' Forum
      A
      azuby
    • RE: Array of all toolbar names

      You could overwrite the add_toolbar and toolbar_names methods of Sketchup. But you have to make sure that your plugin is the first loaded.

      azuby

      posted in Developers' Forum
      A
      azuby
    • Validation procs and mouse move

      Hey folks,

      does anyone of you can explain, why all validation procs (Menu#set_validation_proc) are called numerous times when I only move the mouse? (Sketchup 6 and 7)

      azuby

      posted in Developers' Forum
      A
      azuby
    • RE: Request - Email Model function in the SU File menu

      Next thought: Using mailto and open the directory containing the .skp file. Unfortunately the user has to drag'n'drop the file into the email window.

      azuby

      posted in Developers' Forum
      A
      azuby
    • RE: All entities in the model?

      @jim said:

      Thomas, what if a definition exists in the DefinitionList but does not have an instance in the model? Do you still want its entities? I guess it depends of what the use of the collection is.
      Use ComponentDefinition#instances:

      Sketchup.active_model.definitions.each do |d|
        if inss = d.instances # line is correct!
          inss.each do |ins|
            # ...
          end
        end
      end
      

      azuby

      posted in Developers' Forum
      A
      azuby
    • RE: Redirect puts to file?

      $stdout points to an IO object. A File object is an IO object too:
      File.ancestors #=> [File, IO, File::Constants, Enumerable, Object, Kernel]

      azuby

      posted in Developers' Forum
      A
      azuby
    • RE: About Modules

      Sorry man 😎 - it was just the term "using classes as objects", this is meta-programming. In most of the scripts the programmers use classes to build objects.

      Modules are kind of light classes, because you can not make objects of them on the direct way.

      azuby

      posted in Developers' Forum
      A
      azuby
    • RE: Redirect puts to file?

      Kernel#puts is much more complex. it would be better using the splat operator:

      def puts *arg
        #...
      end
      

      You also could switch $stdout.

      azuby

      posted in Developers' Forum
      A
      azuby
    • RE: About Modules

      In case of Ruby you are right: classes are objects:

      Class.is_a? Class #=> true
      Class.ancestors #=> [Class, Module, Object, Kernel]
      Class.object_id #=> ...
      class A; end
      A.is_a? Class #=> true
      A.ancestors #=> [A, Object, Kernel]
      A.object_id #=> ...
      

      But for programming, classes are blueprints for building objects. You have to ask yourself, why you do not use objects and so do not make use of classes. It's a question that points on the programming paradigm you use.

      azuby

      posted in Developers' Forum
      A
      azuby
    • RE: Getting file paths in SU 7

      Sketchup 7 uses Ruby 1.8.0 like Sketchup 6 does. Type VERSION to see the version number into the Ruby Console.

      azuby

      posted in Developers' Forum
      A
      azuby
    • RE: How to get an edgeless form

      It's from here: http://betaforum.sketchup.com/showthread.php?t=80231 - lee7000 and RickW.

      azuby

      posted in Developers' Forum
      A
      azuby
    • RE: What if we could use <blank>?

      @jj

      1. What is wrong with WebDialogs?
      2. What is wrong with the multi line consoles I mentioned? (Have you tried them?)
      3. Why not writing an own Python lib with the help of the Sketchup SDK instead of using a bridge and getting angry about Ruby?

      I agree: Sketchup Ruby (1.8.0) is just a basic thing. "True" Ruby (>= 1.8.6) has lots of great libs.

      (PLEAC Ruby - kind of documentation)

      azuby

      posted in Developers' Forum
      A
      azuby
    • RE: What if we could use <blank>?

      I see, you do NOT care about Ruby, jj. You do not look for information - instead YOUR only wish seems to be having Python for improving Sketchup. No problem with that, but it is only YOUR wish.

      Ruby has GUI support for:
      TK
      wxWidgets
      Qt
      GTK
      Fox
      WebDialogs for Sketchup

      Multi line consoles:
      WebConsole - http://sketchuptips.blogspot.com/2007/08/plugin-webconsolerb.html
      d/Code - http://www.errorinitus.de/ => Software

      Your first steps could be using a bridge between Ruby and Python (or use the Sketchup SDK to write your own lib):
      Ruby/Python - http://www.goto.info.waseda.ac.jp/~fukusima/ruby/python/doc/index.html
      Ruby-Python-Bridge - http://www.vyperlogix.com/ruby-python-bridge/
      pyRuby-Python-Bridge - http://pypi.python.org/pypi/pyRuby-Python-Bridge/1.7

      azuby

      posted in Developers' Forum
      A
      azuby
    • RE: What if we could use <blank>?

      Sketchup challenge

      Ruby(0): +1, you can use it with Sketchup
      Ruby(1): +1, it is used by many people to improve Sketchup

      Sketchup challenge - result:
      Ruby 2:0 Python

      Conclusion: I think, I should use Ruby to improve Sketchup instead wasting time explaining all the advantages of progamming language XYZ. Let's call it: Pragmatic programming.

      Btw. The rubyfied school example:

      class SchoolMember
        def initialize name, age
          @name = name
          @age  = age
        end
        def to_s
          "Name; \"#{@name}\" Age; \"#{@age}\""
        end
      end
      
      class Teacher < SchoolMember
        def initialize name, age, salary
          super name, age
          @salary = salary
        end
        def to_s
          super + " Salary; \"#{@salary}\""
        end
      end
      
      class Student < SchoolMember
        def initialize name, age, marks
          super name, age
          @marks = marks
        end
        def to_s
          super + " Marks; \"#{@marks}\""
        end
      end
      
      t = Teacher.new 'Mrs. Jones', 40, 30000
      s = Student.new 'Jack', 23, 75
      [t, s].each { |m| puts m }
      

      Hope, you like the short lines.

      Want to laugh?

      azuby

      posted in Developers' Forum
      A
      azuby
    • RE: SU Ruby Bug? not returning all materials
      Sketchup.active_model.materials.each { |mat| p mat }
      

      works fine. Result:

      #<Sketchup;;Material;0xf2a5110>
      #<Sketchup;;Material;0xf2a50e0>
      #<Sketchup;;Material;0xf2a50b0>
      #<Sketchup;;Material;0xf2a5080>
      #<Sketchup;;Material;0xf2a5050>
      #<Sketchup;;Material;0xf2a5020>
      #<Sketchup;;Material;0xf2a4ff0>
      #<Sketchup;;Material;0xf2a4fc0>
      

      azuby

      posted in SketchUp Bug Reporting
      A
      azuby
    • RE: MaterialsObserver

      I also have noticed, but no solution.

      azuby

      posted in Developers' Forum
      A
      azuby
    • RE: Regex selection filter?

      Don't know, but wouldn't be a difficult thing:

      # get the input
      # ...
      r = Regexp.new input
      # iterate over the elements
      #   checking name
      #   adding to selection, if name fits
      

      azuby

      posted in Developers' Forum
      A
      azuby
    • 1 / 1