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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement