• Login
sketchucation logo sketchucation
  • Login
πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

[Plugin] Rotate 90 around [X, Y, Z] axis

Scheduled Pinned Locked Moved Plugins
49 Posts 28 Posters 57.5k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    daiku
    last edited by 17 May 2008, 16:30

    I have a new version ready that rotates around any of the three axes. I tried to edit my original posts to replace the ruby file, but I only succeeded in deleting the old. What's the protocol here? CB.


    rot90.rb

    Clark Bremer
    http://www.northernlightstimberframing.com

    1 Reply Last reply Reply Quote 0
    • C Offline
      CadFather
      last edited by 17 May 2008, 17:37

      ..time we had floating shorcuts! πŸ€“

      301 Moved Permanently

      favicon

      (www.sketchucation.com)

      1 Reply Last reply Reply Quote 0
      • H Offline
        HFM
        last edited by 18 May 2008, 00:22

        @daiku said:

        I have a new version ready that rotates around any of the three axes. I tried to edit my original posts to replace the ruby file, but I only succeeded in deleting the old. What's the protocol here? CB.

        Thanx! will try the shortcut thing tomorrow ^^ [too late now 😲 πŸ‘

        1 Reply Last reply Reply Quote 0
        • H Offline
          HFM
          last edited by 18 May 2008, 00:23

          whoops double post, sorry for that [as mentioned below it is late 🀣 ]

          1 Reply Last reply Reply Quote 0
          • T Offline
            tbd
            last edited by 18 May 2008, 07:58

            daiku: dont reinvent the wheel, extend it πŸ˜„
            here is my old 2004 script for start


            Rotix11 - 2004 script

            SketchUp Ruby Consultant | Podium 1.x developer
            http://plugins.ro

            1 Reply Last reply Reply Quote 0
            • P Offline
              philem
              last edited by 20 May 2008, 10:26

              I downloaded the latest version of this ruby and it worked.
              thanks mate..

              Just do it, it might be fun.

              1 Reply Last reply Reply Quote 0
              • D Offline
                daiku
                last edited by 20 May 2008, 12:50

                @unknownuser said:

                daiku: dont reinvent the wheel, extend it πŸ˜„
                here is my old 2004 script for start

                Yes, that would have been better. I was not aware of this script. This seems to be a recurring theme. What we really need is a central repository that includes detailed descriptions of what each script does, along with detailed usage instructions. There are several collections around, including on this forum, but nothing that does a complete job. I realize this would be a huge undertaking for someone, but whoever steps up would certainly earn "hero" status in our community.

                Clark Bremer
                http://www.northernlightstimberframing.com

                1 Reply Last reply Reply Quote 0
                • T Offline
                  tor
                  last edited by 7 Sept 2010, 03:09

                  Many thanks for this simple, yet very useful plugin... exactly what I was looking for when creating some configurations of modular components.

                  What I think would be really keen is to be able to call this script as one is placing a component from the component browser. Any ideas on how to make that work?

                  Tor

                  1 Reply Last reply Reply Quote 0
                  • D Offline
                    daiku
                    last edited by 7 Sept 2010, 14:13

                    Not sure what you mean. Do you want to rotate EVERY time you place it? Just re-create the component with the correct orientation to the local axes. CB.

                    Clark Bremer
                    http://www.northernlightstimberframing.com

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      tor
                      last edited by 10 Sept 2010, 04:28

                      Well, what I was hoping for is to select a component from the component browser to place into the model, then as it is moving with the mouse at the insertion point, rotate it, so that it's in the correct orientation. Kind of a building block assembly system. And, sometimes a component would need to be rotated, sometimes not.

                      Obviously, I can put the component "down", rotate, then move it, but was just hoping to simplify that process in the creation of numerous modular assemblies.

                      But it seems that the component being placed is not actually selected, per se, so no shortcut key works on it.

                      Tor

                      1 Reply Last reply Reply Quote 0
                      • I Offline
                        InterArchi
                        last edited by 10 Sept 2010, 16:56

                           Thank u
                        
                        1 Reply Last reply Reply Quote 0
                        • EarthMoverE Offline
                          EarthMover
                          last edited by 10 Sept 2010, 18:08

                          Is there a plugin out there that will do this to multiple components at the same time? Or one that will rotate each around it's own z axis simultaneously?

                          3D Artist at Clearstory 3D Imaging
                          Guide Tool at Winning With Sketchup
                          Content Creator at Skapeup

                          1 Reply Last reply Reply Quote 0
                          • D Offline
                            daiku
                            last edited by 10 Sept 2010, 19:49

                            @earthmover said:

                            Is there a plugin out there that will do this to multiple components at the same time? Or one that will rotate each around it's own z axis simultaneously?

                            Easy change. Updated file at the top of the thread. CB.

                            Clark Bremer
                            http://www.northernlightstimberframing.com

                            1 Reply Last reply Reply Quote 0
                            • EarthMoverE Offline
                              EarthMover
                              last edited by 10 Sept 2010, 20:01

                              That was fast. Thanks a ton!!

                              3D Artist at Clearstory 3D Imaging
                              Guide Tool at Winning With Sketchup
                              Content Creator at Skapeup

                              1 Reply Last reply Reply Quote 0
                              • G Offline
                                glro
                                last edited by 5 Feb 2012, 12:29

                                @jim said:

                                @hfm said:

                                okay, very nice script... but could you please also make it work on X and Y axis? And make it so that you can select a shortcut for the tools?

                                Tried to edit it myself but my knowledge of ruby is lacking 🀣
                                [did get the 15 degrees to work though πŸ˜„ ]

                                I always wanted to make a rotator that is sensitive to the view. For example, it would rotate the selection around the axis that is closest to the axis from the camera to the target. If you wanted ro rotate around the Z, you could select the entities, go to Top view and press the shortcut. If you wanted to rotate around the Y axis, select the entities, go to the Front view and use the same shortcut.

                                What do you think?

                                My idea is that, having to change the view would take away the advantage of having the rotator sensitive to the view

                                I have another suggestion: Rot90.rb rotate the component around (ent.bounds.center); would it be possible to rotate around the origin instead, as you did in your mover2.rb plugin?

                                1 Reply Last reply Reply Quote 0
                                • G Offline
                                  glro
                                  last edited by 5 Feb 2012, 13:59

                                  @hfm said:

                                  okay, very nice script... but could you please also make it work on X and Y axis? And make it so that you can select a shortcut for the tools?

                                  Tried to edit it myself but my knowledge of ruby is lacking 🀣
                                  [did get the 15 degrees to work though πŸ˜„ ]

                                  I don't know much about ruby either, but here is a simplified version of the plugin:

                                  rotate around the component origin instead of center
                                  only around z axis and 90 degrees
                                  no context menu, a line in the plugin menu instead (so you can add a keyboard shortcut (pop up menu, window>preferences>shortcut

                                  require 'sketchup.rb'
                                  ##
                                  ## Rotate selected component instance 90 degrees around Z axis
                                  ##
                                  ##  Copyright (c) 2010 Clark Bremer (aka daiku)
                                  ##  Northern Lights Timber Framing
                                  ##  clarkb@northernlightstimberframing.com
                                  ##
                                  ## 05/02/12; rotation autour de l'origine du composant, axe z seulement, acces menu deroulant ou raccourci clavier
                                  ## 9/10/2010;	Multiple Groups/Comps 
                                  ## 5/17/08;  All 3 axes.  Input from Matt666
                                  ## 4/24/08; Use center as rotation point instead of CI origin.  Also works on groups now.
                                  ##
                                  
                                  # Add a menu item to launch our plugin.
                                  UI.menu("PlugIns").add_item("rotation90z") { rotate90z }
                                  # -----------------------------------------------------------------------------
                                  
                                  
                                   def selected_comps_and_groups
                                       mm = Sketchup.active_model
                                       ss = mm.selection
                                   	return nil if ss.empty?
                                   	ss.each do |cc| 
                                   		return nil if not ((cc.instance_of? Sketchup;;ComponentInstance) or (cc.instance_of? Sketchup;;Group))
                                   	end	
                                      ss
                                   end
                                  
                                  #def rotate90(sel, axis)
                                  def rotate90z
                                  	sel = selected_comps_and_groups
                                  #	axis == "z"
                                  	rv = Geom;;Vector3d.new(0,0,1)
                                  #	rv = Geom;;Vector3d.new(0,0,1) if axis == "z"
                                  #	rv = Geom;;Vector3d.new(0,1,0) if axis == "y"
                                  #	rv = Geom;;Vector3d.new(1,0,0) if axis == "x"
                                  	ra = 90.degrees
                                  	#rt = Geom;;Transformation.rotation(rp, rv, ra) #autour du centre de la boite enveloppe 
                                  	sel.each do |ent|
                                  		# rp = Geom;;Point3d.new(ent.bounds.center) 		#rotation point
                                  		rp = Geom;;Point3d.new(ent.transformation.origin)
                                  		ent.transform!(Geom;;Transformation.rotation(rp, rv, ra))
                                  	end	
                                  end
                                  
                                  
                                  
                                  #if( not file_loaded?("rot90.rb") )
                                  #   UI.add_context_menu_handler do |menu|
                                  #		if menu == nil then 
                                  #			UI.messagebox("Error setting context menu handler")
                                  #		else
                                  #			if (sel = selected_comps_and_groups)
                                  #				sbm = menu.add_submenu("Rotate 90")
                                  #				sbm.add_item("Around Red") {rotate90 sel, "x"}
                                  #				sbm.add_item("Around Green") {rotate90 sel, "y"}
                                  #				sbm.add_item("Around Blue") {rotate90 sel, "z"}
                                  #			end
                                  #		end
                                  #        
                                  #	end
                                  #end
                                  
                                  
                                  #file_loaded("rot90.rb")
                                  
                                  1 Reply Last reply Reply Quote 0
                                  • M Offline
                                    Mainline411
                                    last edited by 27 Jul 2012, 11:34

                                    @glro said:

                                    @hfm said:

                                    okay, very nice script... but could you please also make it work on X and Y axis? And make it so that you can select a shortcut for the tools?

                                    Tried to edit it myself but my knowledge of ruby is lacking 🀣
                                    [did get the 15 degrees to work though πŸ˜„ ]

                                    I don't know much about ruby either, but here is a simplified version of the plugin:

                                    rotate around the component origin instead of center
                                    only around z axis and 90 degrees
                                    no context menu, a line in the plugin menu instead (so you can add a keyboard shortcut (pop up menu, window>preferences>shortcut

                                    require 'sketchup.rb'
                                    > ##
                                    > ## Rotate selected component instance 90 degrees around Z axis
                                    > ##
                                    > ##  Copyright (c) 2010 Clark Bremer (aka daiku)
                                    > ##  Northern Lights Timber Framing
                                    > ##  clarkb@northernlightstimberframing.com
                                    > ##
                                    > ## 05/02/12; rotation autour de l'origine du composant, axe z seulement, acces menu deroulant ou raccourci clavier
                                    > ## 9/10/2010;	Multiple Groups/Comps 
                                    > ## 5/17/08;  All 3 axes.  Input from Matt666
                                    > ## 4/24/08; Use center as rotation point instead of CI origin.  Also works on groups now.
                                    > ##
                                    > 
                                    > # Add a menu item to launch our plugin.
                                    > UI.menu("PlugIns").add_item("rotation90z") { rotate90z }
                                    > # -----------------------------------------------------------------------------
                                    > 
                                    > 
                                    >  def selected_comps_and_groups
                                    >      mm = Sketchup.active_model
                                    >      ss = mm.selection
                                    >  	return nil if ss.empty?
                                    >  	ss.each do |cc| 
                                    >  		return nil if not ((cc.instance_of? Sketchup;;ComponentInstance) or (cc.instance_of? Sketchup;;Group))
                                    >  	end	
                                    >     ss
                                    >  end
                                    > 
                                    > #def rotate90(sel, axis)
                                    > def rotate90z
                                    > 	sel = selected_comps_and_groups
                                    > #	axis == "z"
                                    > 	rv = Geom;;Vector3d.new(0,0,1)
                                    > #	rv = Geom;;Vector3d.new(0,0,1) if axis == "z"
                                    > #	rv = Geom;;Vector3d.new(0,1,0) if axis == "y"
                                    > #	rv = Geom;;Vector3d.new(1,0,0) if axis == "x"
                                    > 	ra = 90.degrees
                                    > 	#rt = Geom;;Transformation.rotation(rp, rv, ra) #autour du centre de la boite enveloppe 
                                    > 	sel.each do |ent|
                                    > 		# rp = Geom;;Point3d.new(ent.bounds.center) 		#rotation point
                                    > 		rp = Geom;;Point3d.new(ent.transformation.origin)
                                    > 		ent.transform!(Geom;;Transformation.rotation(rp, rv, ra))
                                    > 	end	
                                    > end
                                    > 
                                    > 
                                    > 
                                    > #if( not file_loaded?("rot90.rb") )
                                    > #   UI.add_context_menu_handler do |menu|
                                    > #		if menu == nil then 
                                    > #			UI.messagebox("Error setting context menu handler")
                                    > #		else
                                    > #			if (sel = selected_comps_and_groups)
                                    > #				sbm = menu.add_submenu("Rotate 90")
                                    > #				sbm.add_item("Around Red") {rotate90 sel, "x"}
                                    > #				sbm.add_item("Around Green") {rotate90 sel, "y"}
                                    > #				sbm.add_item("Around Blue") {rotate90 sel, "z"}
                                    > #			end
                                    > #		end
                                    > #        
                                    > #	end
                                    > #end
                                    > 
                                    > 
                                    > #file_loaded("rot90.rb")
                                    

                                    How do I use this plugin I put the file in plugins and there is nothing in plugins dropdown and nothing when I right click.

                                    1 Reply Last reply Reply Quote 0
                                    • D Offline
                                      d12dozr
                                      last edited by 7 Dec 2012, 01:35

                                      Great plugin when mapped to a shortcut. Thanks Clark!

                                      FYI everybody, Clark just headed up a local meetup about ruby programming. πŸŽ‰

                                      3D Printing with SketchUp Book
                                      http://goo.gl/f7ooYh

                                      1 Reply Last reply Reply Quote 0
                                      • W Offline
                                        waltersalter
                                        last edited by 12 Apr 2017, 12:08

                                        Sorry, does anyone know hot to use this very useful plugin in SketchUp2016? I tried just putting it with other rb files in rooth folder, but it didn't work. Help please!

                                        1 Reply Last reply Reply Quote 0
                                        • K Offline
                                          Kmyklpenter
                                          last edited by 17 Mar 2020, 21:08

                                          Hello! Thanks for the plugin! For some reason Im having problem assigning a keybouard shortcut for certain actions. The plugin does not appear in shortcuts list.

                                          How can I do that?

                                          Thank you.

                                          1 Reply Last reply Reply Quote 0
                                          • 1
                                          • 2
                                          • 3
                                          • 2 / 3
                                          • First post
                                            Last post
                                          Buy SketchPlus
                                          Buy SUbD
                                          Buy WrapR
                                          Buy eBook
                                          Buy Modelur
                                          Buy Vertex Tools
                                          Buy SketchCuisine
                                          Buy FormFonts

                                          Advertisement