Double rotations
-
Here is a clip showing two rotations - the first around the z axis, the second the y axis.
[flash=425,344:15gx62mn]http://www.youtube.com/v/kzs7IqroD6E[/flash:15gx62mn]
The first rotation obviously gets lost because the script that gets the component file only deals with one axis. Here's the relevant bit of the ruby:@dlg.add_action_callback("find") {|d, p| a= p.split(",") subDir ="Components/NamesetComponents/" fileName = a[0]+".skp" model = Sketchup.active_model entities = model.active_entities theX = Integer(a[1]).mm theY= Integer(a[2]).mm theZ = Integer(a[3]).mm point = Geom;;Point3d.new theX,theY,theZ txyz = Geom;;Transformation.new point path = Sketchup.find_support_file fileName, subDir definitions = model.definitions componentdefinition = definitions.load path instance = entities.add_instance componentdefinition, txyz theDegrees = Integer(a[4]).degrees theAxis = a[5] rv = Geom;;Vector3d.new(0,0,1) if theAxis == "z" rv = Geom;;Vector3d.new(0,1,0) if theAxis == "y" rv = Geom;;Vector3d.new(1,0,0) if theAxis == "x" tr = Geom;;Transformation.rotation(Geom;;Point3d.new(instance.bounds.center), rv, theDegrees) instance.transform! tr }
Any help gratefully received!
Chris
-
Sorry to bump this but I have a feeling I've missed something fundamental. In this clip I want to see how many baths I can fit into a given space (20' container) using a regular configuration. The problem comes for me when I need the ruby to turn each product through two rotations - in this case both Z and Y. I am sure there is a simple solution ...
[flash=425,344:9y9do5xj]http://www.youtube.com/v/ql6j84Vw_9o[/flash:9y9do5xj]
Chris
-
Fixed [flash=425,344:3qp1491i]http://www.youtube.com/v/TL8q17qSKrk[/flash:3qp1491i]
Advertisement