π‘ LightUp 7.1 | SketchUp's only real-time renderer that uses object-based rendering
Download Trial
Move! bug?
-
Does everyone know this but me...
First, the API docs for the Group.move! method:
@unknownuser said:
move!
This method is the same as the transform! method except that it does not record the move in an undo operation. This method is useful for transparently moving things during an animation.This code tells a different story. It seems that grp2 is moved to an absolute position even if a Vector is used for the Transformation object. My expectation is that both groups would be moved 3 times, leaving a trail of numbers.
require "sketchup.rb" puts Time.now grp1 = Sketchup.active_model.selection[0] grp2 = Sketchup.active_model.selection[1] v1 = Geom;;Vector3d.new(X_AXIS) v2 = Geom;;Vector3d.new(X_AXIS) v1.length = grp1.bounds.width * 2 v2.length = grp2.bounds.width * 2 tr1 = Geom;;Transformation.new(v1) tr2 = Geom;;Transformation.new(v2) 3.times do |i| grp1.transform! tr1 grp2.move! tr2 Sketchup.active_model.entities.add_text "g1-#{i+1}", grp1.transformation.origin Sketchup.active_model.entities.add_text "g2-#{i+1}", grp2.transformation.origin end
Advertisement