sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Component Scale - Set Z as X&Y Scales

    Scheduled Pinned Locked Moved SketchUp Discussions
    sketchup
    5 Posts 2 Posters 235 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L Offline
      Lersince1991
      last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        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 πŸ˜•

        TIG

        1 Reply Last reply Reply Quote 0
        • L Offline
          Lersince1991
          last edited by

          so in autocad the blocks were scaled at for example;

          x-5
          y-5 (same as x)
          z-1

          the 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-1

          tree 2
          x-8, y-8, z-1

          where as it should be
          tree 1
          x-3, y-3, z-3

          tree 2
          x-8, y-8, z-8

          1 Reply Last reply Reply Quote 0
          • TIGT Offline
            TIG Moderator
            last edited by

            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;
            

            TIG

            1 Reply Last reply Reply Quote 0
            • L Offline
              Lersince1991
              last edited by

              Perfect Thanks! Needed this so many times as there are a lot of idiots that scale oddly in AutoCAD

              Cheers TIG!

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement