sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Transforming an object with SketchUp Ruby

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 2.0k 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.
    • K Offline
      KevinKarney
      last edited by KevinKarney

      I am struggling a bit with Ruby and would really appreciate some help...

      I just want to add some 3D text to my model (which I can do)
      model = Sketchup.active_model entities = model.entities mytext = entities.add_3d_text('test', TextAlignCenter, "Arial", true, false, 2.0, 0.0, 0.0, true, 0)

      I then want to rotate the text about the z-axis with a transformation, such as
      tr1 = Geom::Transformation.rotation(ORIGIN, Z_AXIS, 45.degrees)

      I then want to translate the text with a transformation, such as
      tr2 = Geom::Transformation.translation Geom::Vector3d.new (0,1,0)

      I just cannot work out how to apply tr1, then tr2 to mytext. It's got to be simple, but everything I have tried produces an error.

      Thanks in advance from Wales
      Kevin

      Best Regards
      Kevin Karney

      1 Reply Last reply Reply Quote 0
      • A Offline
        Aerilius
        last edited by

        You need a reference to the object (of the text). Therefore it is usefule to create the text (edges and faces) inside a group and apply the transformations to the group.

        entities = model.entities group = entities.add_group group.entities.add_3d_text("test") group.transform!(tr1) group.transform!(tr2)

        1 Reply Last reply Reply Quote 0
        • K Offline
          KevinKarney
          last edited by

          Aerilius
          You are a star !
          Thanks a million
          Kevin

          Best Regards
          Kevin Karney

          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