Not sure if this is the right place and I have only a very limited knowledge on Ruby but here goes!
I want to use / modify Clark Bremer’s Rotate 90 extension to rotate single components around their component axis … unfortunately it seems to rotate around the bounding box axis
I think I have identified the code that does this but after browsing API coding my eyes are starting to water and my head hurts…
rp = Geom::Point3d.new(ent.bounds.center) #rotation point
I assume there is an equivalent line to rotate around a component axis instead of a bounding box,
PS, I did search for other extensions that might do a simple rotate 90 [for aligning doors, windows , furniture etc with a quick hot key selection] but all seemed overly elaborate.
Any help appreciated from all you talented extension developers…
I must be getting old, I seem to have the attention span of a 2 year old!
As a CAD user and developer for over 40 years, I’ve observed what kinds of transforms and rotations are most frequently needed in design, All can be accomplished with the powerful bultin SketchUp tools for scale, rotate and move.
However there is trade off in user complexity.
So I developed the extension called 2DXY SlickMoves. It provides “one click” execution of the 13 moves most often needed.
For rotation of objects (components or groups): the most common need is for rotation about the object Z axis at its center, with a default of plus or minus 45 degrees.
See the overview video at 2DXY SlickMoves Demonstration - YouTube
For more detail on rotation see the instruction video at 2DXY SlickMoves Object Tools - YouTube following the 10 minute mark.
Nice extension and I appreciate your approach, are you rotating around the bounding box centre or are you rotating around the objects z axis? . As you know the insertion point [component axis] often is in a specific location related to how that object is positioned in the design and it is not always the centre of the bounding box.
Maybe it is easier just to make it a dynamic component and use functions and click to rotate it around the axis. Thanks for your advice
I do agree with Barry that usually Sketchup’s built in rotate tool is enough, but there may be some times when there’s no face to snap to which lets you set the rotation.
Try this:
def CB_R90.rotate90(sel, axis)
ra = 90.degrees
sel.each do |ent|
rv = ent.transformation.zaxis if axis == "z"
rv = ent.transformation.yaxis if axis == "y"
rv = ent.transformation.xaxis if axis == "x"
rp = ent.transformation.origin
ent.transform!(Geom::Transformation.rotation(rp, rv, ra))
end
end
I like to refer to the real world. In reality a physical chair doesn’t have an “insertion point”. If it did, there is no way to tell where it is, so why think that you need it? (It might be anywhere depending on the whim of the chair builder.)
But as a designer I can look the chair and visualize it’s center. That’s the point I most often want to use at the Z axis for rotation.
As an architect, and because of the fact of gravity, I observe that its very rare that I ever need to rotate any real object about any axis other than the local Z.