sketchucation logo sketchucation
    • Login
    1. Home
    2. ajlauder
    3. Posts
    ℹ️ 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 1
    • Posts 5
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: I want to write a ruby script : rotate an object

      Thank you for this information.

      Mind you, I'm in no particular hurry to have this plugin up and running; I have a lot of modeling to finish first.

      However, I desire the eventual script to do the following functions:

      -Prompt for a specific rotation angle.
      -Set the axes on specific lines in a model-specific group that can be manually moved and oriented around the model.
      -Select all entities on certain model-specific layers.
      -Then rotate the selection on the origin of the new axes position.

      posted in Developers' Forum
      A
      ajlauder
    • RE: I want to write a ruby script : rotate an object

      I appreciate the response. I'll see what I can't do from here on. (This plugin I'm working on will be a huge time saver if I can get it to work.)

      posted in Developers' Forum
      A
      ajlauder
    • RE: I want to write a ruby script : rotate an object

      I have this simple ruby script to rotate a selection of entities around the red axis by 45 degrees by pressing the up key:

      
      class Rotationtest
      
        # perform rotate
        def rotate(angle)
          tr = Geom;;Transformation.rotation([0,0,0],[1,0,0],angle.degrees)
          Sketchup.active_model.active_entities.transform_entities(tr,Sketchup.active_model.selection)
        end
      
        # process upkey
        def onKeyDown(key, repeat, flags, view)
          case key
            when VK_UP then rotate(45)
          end
        end
      
      end # class Rotationtest
      
      
      if(not $rotatoiontest_menu_loaded)
        UI.menu("Plugins").add_item("ROTATION TEST") { Sketchup.active_model.select_tool Rotationtest.new }
      end
      
      $rotatoiontest_menu_loaded = true 
      
      

      I want to replace the "press up key to rotate 45 degrees" function with an input prompt for a specific rotation angle when I select the plugin function from the menu.

      How should I go about that?

      posted in Developers' Forum
      A
      ajlauder
    • RE: I want to write a ruby script : rotate an object

      I just had a small but satisfying breakthrough reverse-engineering some established ruby scripts to get the functionality I wanted.

      I might just be able to finish this script I have in mind after all...

      posted in Developers' Forum
      A
      ajlauder
    • I want to write a ruby script : rotate an object

      I want a ruby script that selects all entities on a specific layer, the rotates it on the axis origin after prompting for the specific angle.

      Are there any samples of ruby scripts that can do anything like this that I can work from?

      I appreciate any help.

      posted in Developers' Forum
      A
      ajlauder
    • 1 / 1