• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Offset-function per ruby (simple)

Scheduled Pinned Locked Moved Developers' Forum
6 Posts 4 Posters 420 Views 4 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.
  • A Offline
    artmusicstudio
    last edited by 25 Nov 2013, 23:36

    hi,
    is there an equivalent for the skp-function "offset" in ruby for simple forms like square or circle ?
    thanx stan

    1 Reply Last reply Reply Quote 0
    • D Offline
      Dan Rathbun
      last edited by 26 Nov 2013, 13:51

      If you group the objects it makes things much simplier:

      g.move! [1,1,0]

      Moves the group by the vector array argument. (The API dictionary says the arg should be a Geom::Transformation instance, but the method also takes an array representing a vector.) Does NOT add the move to the Undo stack.

      g.transform! [1,1,0]

      Moves the group by the vector array argument. (The API dictionary says the arg should be a Geom::Transformation instance, but the method also takes an array representing a vector.) ADDS the move to the Undo stack as "Move".

      I would assume that these methods may also accept a Geom::Vector3d argument ?

      💭

      I'm not here much anymore.

      1 Reply Last reply Reply Quote 0
      • D Offline
        Dan Rathbun
        last edited by 26 Nov 2013, 14:13

        For simple objects you can move them without grouping.

        Assume c is the reference to a circle object.

        c.parent.entities.transform_entities( [1,1,0], c )


        Or for an array [e1,e2,e3,e4] of edges making up a square:

        e1.parent.entities.transform_entities( [1,1,0], [e1,e2,e3,e4] )


        • The above methods add to the undo stack.

        Also be aware strange results may happen if the entities to be moved are not in the current editing context.

        💭

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • S Offline
          slbaumgartner
          last edited by 27 Nov 2013, 14:35

          @artmusicstudio said:

          hi,
          is there an equivalent for the skp-function "offset" in ruby for simple forms like square or circle ?
          thanx stan

          Were you looking to move objects, per Dan's replies, or for a Ruby equivalent to the offset tool (i.e. to create a "parallel" shape inside or outside the original)?

          1 Reply Last reply Reply Quote 0
          • A Offline
            artmusicstudio
            last edited by 28 Nov 2013, 22:34

            @slbaumgartner said:

            @artmusicstudio said:

            hi,
            is there an equivalent for the skp-function "offset" in ruby for simple forms like square or circle ?
            thanx stan

            Were you looking to move objects, per Dan's replies, or for a Ruby equivalent to the offset tool (i.e. to create a "parallel" shape inside or outside the original)?

            hi, slbaumgartner,
            yes , you got it,
            what i look for here (though dan's advice is also helpful for other things)
            is in deed the offset-function, creating a parallel shape (only simple forms like rectangles or circles).

            stan

            1 Reply Last reply Reply Quote 0
            • I Offline
              icehuli
              last edited by 29 Nov 2013, 05:52

              @artmusicstudio said:

              @slbaumgartner said:

              @artmusicstudio said:

              hi,
              is there an equivalent for the skp-function "offset" in ruby for simple forms like square or circle ?
              thanx stan

              Were you looking to move objects, per Dan's replies, or for a Ruby equivalent to the offset tool (i.e. to create a "parallel" shape inside or outside the original)?

              hi, slbaumgartner,
              yes , you got it,
              what i look for here (though dan's advice is also helpful for other things)
              is in deed the offset-function, creating a parallel shape (only simple forms like rectangles or circles).

              stan

              you can try this:
              http://www.smustard.com/script/Offset
              simply works for faces(polygons) and polylines

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

              Advertisement