SketchUcation Plugin Store

 

 

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

Re: [Plugin] Rotate 90 around Z axis

Postby philem » Sat May 17, 2008 10:50 am

watkins wrote:Dear Philip,

I noticed something similar when I first tried the script. I created a cube and used the script, and nothing "apparently" happened. The cube is a nice, 4-fold axially symmetric object and looks the same when rotated 90 degrees. Try something with a feature, like a notch, to make your object asymmetric about its Z-axis.

Kind regards,
Bob


I didn't realise that fact about Bryce..but still no joy,

I still can't get it to work, I have drawn an object with a notch and a cut out etc. just to be sure,(attached) I even made sure the Z axis went though the part but still can't get it to work. I have even removed the plugin, restarted Sketchup, closed it down, copied the plugin back in again still no luck.. :(

Just do it, it might be fun.
philem
 
Posts: 69
Joined: Wed Nov 21, 2007 9:41 am
Location: South Australia
Name: Philip
Operating system: Windows
SketchUp version: 8
License type: Free/Make
SketchUp use: hobby
Level of SketchUp: Beginner

Re: [Plugin] Rotate 90 around Z axis

Postby HFM » Sat May 17, 2008 12:28 pm

Jim wrote:
HFM wrote: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 :roflmao:
[did get the 15 degrees to work though :D ]


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?


Cool, but I thought of an easier version [at least I think it's easier]

Rotation 15 degrees on X axis under NUM1 shortcut
Rotation 15 degrees on Y axis under NUM2 shortcut
Rotation 15 degrees on Z axis under NUM3 shortcut

off course all rotations are from center of the component or group

now, tell me what do you think ;)

[maybe a modification of you fantastic mover? :D :?: ]


PS. Philem don't forget to create a component of your model or group it, or it won't work.
HFM
 
Posts: 337
Joined: Mon Apr 14, 2008 5:57 pm
Location: The Netherlands
Name: HFM

Re: [Plugin] Rotate 90 around Z axis

Postby philem » Sat May 17, 2008 1:17 pm

HFM wrote:
Jim wrote:
HFM wrote: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 :roflmao:
[did get the 15 degrees to work though :D ]


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?


Cool, but I thought of an easier version [at least I think it's easier]

Hi H

I did find that early in the piece. If its not a component it doesn't show up in the context menu..
I even used a componen from the Component library, and it didn't work..

Not giving up :)

Rotation 15 degrees on X axis under NUM1 shortcut
Rotation 15 degrees on Y axis under NUM2 shortcut
Rotation 15 degrees on Z axis under NUM3 shortcut

off course all rotations are from center of the component or group

now, tell me what do you think ;)

[maybe a modification of you fantastic mover? :D :?: ]


PS. Philem don't forget to create a component of your model or group it, or it won't work.
Just do it, it might be fun.
philem
 
Posts: 69
Joined: Wed Nov 21, 2007 9:41 am
Location: South Australia
Name: Philip
Operating system: Windows
SketchUp version: 8
License type: Free/Make
SketchUp use: hobby
Level of SketchUp: Beginner

Re: [Plugin] Rotate 90 around Z axis

Postby Juju » Sat May 17, 2008 1:28 pm

^^ huh?! o_O
Save the Earth, it's the only planet with chocolate.



Keeping things organised is not a sin. ;)
Juju
 
Posts: 1127
Joined: Mon Oct 22, 2007 1:45 pm
Location: Durbanville, Cape Town, South Africa.
Name: Julian Smith

Re: [Plugin] Rotate 90 around Z axis

Postby Didier Bur » Sat May 17, 2008 2:13 pm

Mmmmm, this reminds me oldies but goldies "rotix.rb" "rotator.rb", the're working with arrow keys also.
Didier Bur (Bytes Farmer)
Ecole Nationale Supérieure d'Architecture de Nancy (F)
http://rld.crai.archi.fr/rubylibrarydepot/
User avatar
Didier Bur
 
Posts: 1238
Joined: Wed Nov 14, 2007 10:07 pm
Location: Nancy, France
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: [Plugin] Rotate 90 around Z axis

Postby daiku » Sat May 17, 2008 5:21 pm

HFM wrote: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 :roflmao:
[did get the 15 degrees to work though :D ]



To map a context menu item to a shortcut key, you must have an appropriate item selected before you bring up the preferences window. The context menu commands will show up under "edit item". CB.
daiku
 
Posts: 213
Joined: Mon Nov 12, 2007 2:54 pm
Location: Minneapolis
Name: Clark Bremer

Re: [Plugin] Rotate 90 around Z axis

Postby daiku » Sat May 17, 2008 5:25 pm

philem wrote:
watkins wrote:Dear Philip,

I noticed something similar when I first tried the script. I created a cube and used the script, and nothing "apparently" happened. The cube is a nice, 4-fold axially symmetric object and looks the same when rotated 90 degrees. Try something with a feature, like a notch, to make your object asymmetric about its Z-axis.

Kind regards,
Bob


I didn't realise that fact about Bryce..but still no joy,

I still can't get it to work, I have drawn an object with a notch and a cut out etc. just to be sure,(attached) I even made sure the Z axis went though the part but still can't get it to work. I have even removed the plugin, restarted Sketchup, closed it down, copied the plugin back in again still no luck.. :(



But the command does show up on the context menu? That's odd.
daiku
 
Posts: 213
Joined: Mon Nov 12, 2007 2:54 pm
Location: Minneapolis
Name: Clark Bremer

Re: [Plugin] Rotate 90 around Z axis

Postby daiku » Sat May 17, 2008 5:30 pm

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.
Please, register (free) to access all the attachments on the forums.
daiku
 
Posts: 213
Joined: Mon Nov 12, 2007 2:54 pm
Location: Minneapolis
Name: Clark Bremer

Re: [Plugin] Rotate 90 around Z axis

Postby CadFather » Sat May 17, 2008 6:37 pm

Quarr-IT - SketchUp Training from the Master.. . ;) .
User avatar
CadFather
 
Posts: 809
Joined: Fri Nov 16, 2007 11:03 am
Location: London, Milano, Sicily
Name: Max Coppoletta

Re: [Plugin] Rotate 90 around Z axis

Postby HFM » Sun May 18, 2008 1:21 am

whoops double post, sorry for that [as mentioned below it is late :roflmao: ]
Last edited by HFM on Sun May 18, 2008 1:23 am, edited 1 time in total.
HFM
 
Posts: 337
Joined: Mon Apr 14, 2008 5:57 pm
Location: The Netherlands
Name: HFM

Re: [Plugin] Rotate 90 around Z axis

Postby HFM » Sun May 18, 2008 1:22 am

daiku wrote: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 :shock: :thumb:
HFM
 
Posts: 337
Joined: Mon Apr 14, 2008 5:57 pm
Location: The Netherlands
Name: HFM

Re: [Plugin] Rotate 90 around Z axis

Postby tbd » Sun May 18, 2008 8:58 am

daiku: dont reinvent the wheel, extend it :)
here is my old 2004 script for start
Please, register (free) to access all the attachments on the forums.
SketchUp Ruby Consultant | Podium 1.x developer
http://plugins.ro
User avatar
tbd
 
Posts: 1018
Joined: Wed Nov 14, 2007 10:47 am
Location: Romania
Name: TBD

Re: [Plugin] Rotate 90 around Z axis

Postby philem » Tue May 20, 2008 11:26 am

I downloaded the latest version of this ruby and it worked.
thanks mate..
Just do it, it might be fun.
philem
 
Posts: 69
Joined: Wed Nov 21, 2007 9:41 am
Location: South Australia
Name: Philip
Operating system: Windows
SketchUp version: 8
License type: Free/Make
SketchUp use: hobby
Level of SketchUp: Beginner

Re: [Plugin] Rotate 90 around Z axis

Postby daiku » Tue May 20, 2008 1:50 pm

TBD wrote: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.
daiku
 
Posts: 213
Joined: Mon Nov 12, 2007 2:54 pm
Location: Minneapolis
Name: Clark Bremer

Re: [Plugin] Rotate 90 around Z axis

Postby tor » Tue Sep 07, 2010 4:09 am

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
tor
 
Posts: 5
Joined: Fri Jun 04, 2010 5:30 am
Name: Tor Gilbertson

Re: [Plugin] Rotate 90 around Z axis

Postby daiku » Tue Sep 07, 2010 3:13 pm

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.
daiku
 
Posts: 213
Joined: Mon Nov 12, 2007 2:54 pm
Location: Minneapolis
Name: Clark Bremer

Re: [Plugin] Rotate 90 around Z axis

Postby tor » Fri Sep 10, 2010 5:28 am

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
tor
 
Posts: 5
Joined: Fri Jun 04, 2010 5:30 am
Name: Tor Gilbertson

Re: [Plugin] Rotate 90 around Z axis

Postby InterArchi » Fri Sep 10, 2010 5:56 pm

:berserk: :berserk: :berserk: Thank u
InterArchi
 
Posts: 44
Joined: Mon Jul 05, 2010 10:36 pm
Name: InterArchi

Re: [Plugin] Rotate 90 around Z axis

Postby EarthMover » Fri Sep 10, 2010 7:08 pm

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?
A designer is an emerging synthesis of artist, inventor, mechanic, objective economist and evolutionary strategist. - R. Buckminster Fuller
Some of my 3D crap
User avatar
EarthMover
Top SketchUcator
 
Posts: 1792
Joined: Fri Sep 12, 2008 9:06 pm
Location: Eastern Pennsylvania
Name: Adam Hails

Re: [Plugin] Rotate 90 around Z axis

Postby daiku » Fri Sep 10, 2010 8:49 pm

EarthMover wrote: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.
daiku
 
Posts: 213
Joined: Mon Nov 12, 2007 2:54 pm
Location: Minneapolis
Name: Clark Bremer

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

Postby EarthMover » Fri Sep 10, 2010 9:01 pm

That was fast. Thanks a ton!!
A designer is an emerging synthesis of artist, inventor, mechanic, objective economist and evolutionary strategist. - R. Buckminster Fuller
Some of my 3D crap
User avatar
EarthMover
Top SketchUcator
 
Posts: 1792
Joined: Fri Sep 12, 2008 9:06 pm
Location: Eastern Pennsylvania
Name: Adam Hails

Re: [Plugin] Rotate 90 around Z axis

Postby glro » Sun Feb 05, 2012 1:29 pm

Jim wrote:
HFM wrote: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 :roflmao:
[did get the 15 degrees to work though :D ]


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?
glro
 
Posts: 130
Joined: Mon Nov 30, 2009 9:45 am
Location: Spain
Name: Georges LE ROUX
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: engineering and mechanical design
Level of SketchUp: Intermediate

Re: [Plugin] Rotate 90 around Z axis

Postby glro » Sun Feb 05, 2012 2:59 pm

HFM wrote: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 :roflmao:
[did get the 15 degrees to work though :D ]


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
Code: Select all
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")
glro
 
Posts: 130
Joined: Mon Nov 30, 2009 9:45 am
Location: Spain
Name: Georges LE ROUX
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: engineering and mechanical design
Level of SketchUp: Intermediate

Re: [Plugin] Rotate 90 around Z axis

Postby Mainline411 » Fri Jul 27, 2012 12:34 pm

glro wrote:
HFM wrote: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 :roflmao:
[did get the 15 degrees to work though :D ]


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
Code: Select all
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.
Mainline411
 
Posts: 9
Joined: Mon Jul 09, 2012 11:49 am

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

Postby d12dozr » Fri Dec 07, 2012 2:35 am

Great plugin when mapped to a shortcut. Thanks Clark!

FYI everybody, Clark just headed up a local meetup about ruby programming. :bounce:
"There is a man in the world who will never be turned down... he is the man who delivers the goods."
d12dozr
Top SketchUcator
 
Posts: 1925
Joined: Mon Feb 09, 2009 8:43 am
Location: Minnesota
Name: Marcus
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: product design
Level of SketchUp: Advanced

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Not a Premium Member yet? Check out the great time-limited deal we are offering.

Ad Machine
Robot
 
Posts: 2012

Next

Return to Plugins

Who is online

Users browsing this forum: blackquod, cgana, Google Bot, Google Feedfetcher, parkmancarter and 10 guests