sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    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.
    • artmusicstudioA Offline
      artmusicstudio
      last edited by

      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
      • Dan RathbunD Offline
        Dan Rathbun
        last edited by

        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
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          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

            @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
            • artmusicstudioA Offline
              artmusicstudio
              last edited by

              @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
              • icehuliI Offline
                icehuli
                last edited by

                @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
                • First post
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement