Component Scale - Set Z as X&Y Scales
-
Hi,
I have a site plan that someone else has drawn and they have scaled all the trees disproportionately, i.e. they have only scaled the x and y but left the z as 1, so when imported into 3D, all the trees are the same height... some skinny and some fat.
now theres hundreds of trees, how can I set the z scale as the x (or Y) scales so make them proportionate again please?
-
Have the tree component-instances [blocks] been scaled or is it the contents of the component-definition itself ?
Is the scaling consistent ?
How would establish each Z height relative to its XY ?
etc etc...
So much to consider
-
so in autocad the blocks were scaled at for example;
x-5
y-5 (same as x)
z-1the z would need to be the same as the x or y to be proportionate again.
They are just the components, nothing to do with contents.
the scaling of each is different for each size tree, for example;tree 1
x-3, y-3, z-1tree 2
x-8, y-8, z-1where as it should be
tree 1
x-3, y-3, z-3tree 2
x-8, y-8, z-8 -
This one liner copy+pasted into the Ruby Console + <enter> affects ALL component-instances in the model.
It assumes the X/Y is scaled the same amount.
It applies that scale-factor to the Z too.
It is one step undo-able.m=Sketchup.active_model;m.start_operation('!');m.definitions.each{|d|next if d.group? || d.image?; d.instances.each{|i|t=i.transformation;f=t.xscale;i.transform!(Geom;;Transformation.scaling(t.origin,f/t.xscale,f/t.yscale,f/t.zscale,))}};m.commit_operation;This alternative version only processes component-instances in the current Selection.
m=Sketchup.active_model;m.start_operation('!');m.selection.grep(Sketchup;;ComponentInstance).each{|i|t=i.transformation;f=t.xscale;i.transform!(Geom;;Transformation.scaling(t.origin,f/t.xscale,f/t.yscale,f/t.zscale,))};m.commit_operation; -
Perfect Thanks! Needed this so many times as there are a lot of idiots that scale oddly in AutoCAD
Cheers TIG!
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