• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

Geom::Transformation

Scheduled Pinned Locked Moved Developers' Forum
5 Posts 2 Posters 1.4k Views
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.
  • A Offline
    anteolic
    last edited by 11 Aug 2017, 12:03

    I am totaly beginner in Sketchup scripting.

    This code move object to some position,

    trans = Geom::Transformation.new(bb.center.vector_to([100,0,0])) ; # move the temp bounding box
    How is posible to move object just by zaxis and other axis dont affect.

    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 11 Aug 2017, 12:25

      Your example uses a point [100,0,0] to move the object 100 inches along the X_AXIS.
      To move it in the Z_AXIS just try [0,0,100]

      Also it'll be best to do a simple 'translate' rather than '[re]locate' it ?
      trans = Geom::Transformation.translation([0, 0, 100])

      A three element array can be substituted for a point or a vector.

      If you want units other than inches do it like this 100.mm

      TIG

      1 Reply Last reply Reply Quote 0
      • A Offline
        anteolic
        last edited by 11 Aug 2017, 12:33

        I have some object with his location, and select it and i want just to move this object to zaxis=0, and leave other axis unchanged.

        1 Reply Last reply Reply Quote 0
        • T Offline
          TIG Moderator
          last edited by 11 Aug 2017, 14:02

          Slightly different question.
          If you want to move its center onto the ground-plane [z=0], consider this...

          ### ... bb = some_object.bounds ct = bb.center pt = ct.clone pt.z = 0 ve = ct.vector_to(pt) tr = Geom::Transformation.translation(ve) some_object.transform!(tr)

          TIG

          1 Reply Last reply Reply Quote 0
          • A Offline
            anteolic
            last edited by 11 Aug 2017, 15:26

            Thanks!

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

            Advertisement