Given a x,y,z location to move a selected group help! solved
-
Is there a way in ruby code, given a x,y,z location to move a selected group directly to that location?
Need help for my scale upgrade, best I can do is a iteration. -
@dukejazz said:
Is there a way in ruby code, given a x,y,z location to move a selected group directly to that location?
Need help for my scale upgrade, best I can do is a iteration.mod = Sketchup.active_model ent = mod.entities sel = mod.selection if sel.first.class==Sketchup;;Group || sel.first.class==Sketchup;;ComponentInstance inp=inputbox(["X;","Y;","Z;"],[0,0,0],"Move Component/Group to") if inp x,y,z=inp;move_to=Geom;;Point3d.new(x.to_f,y.to_f,z.to_f) move_from=sel.first.transformation.origin; tr=Geom;;Transformation.translation(move_from.vector_to(move_to)) sel.first.transform! tr end end
-
Thank you.
I will give it a try -
Thank you, Sdmitch for your help
History
v1.1 May 27
-fix move iteration problemsscaleGroupFloat_dj Ver 1.1
Copyright 2012, May 27
DukeJazz: James Cochran
http://forums.sketchucation.com/viewtopic.php?f=323&t=45254&p=404860#p404860My final form
#sents
ss =Sketchup.active_model.selection
if ss.empty? then
UI.messagebox ("Please Select. a goup.");return
end
sents = [];ss.each{|e|sents.push(e)}#_API____Geom::move! new_transformation
entity_group=Sketchup.active_model.active_entities.add_group(sents)
Geom::Transformation.new [x1,y1,z1]
entity_group.move!(Geom::Transformation.new [x2,y2,z2])
entity_group.explode
Advertisement