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

    Reversing direction of a feature

    Scheduled Pinned Locked Moved Plugins
    3 Posts 2 Posters 168 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
      ktkoh
      last edited by

      The continuing saga of woodworking joint scripts.
      Is there a simple way to reverse the z direction of a point array. My previous features were only push/pull and easily reversed for the second component. Now biscuit slots are created differently and I need points with the z values reversed or multiplied by -1. Before I do it the long way of adding separate calculations for all the points I thought I would ask if there is a way of changing an array of points (x,y,z) to (x,y,z*(-1))??

      points_BiscuitSlot(@xcl[i],ycl,z) #Method calculates points for creating biscuit slot
      

      Returns values for @pt[] 0 thru 15 & I use these to draw the biscuit slot in component 1
      Then the points are translated to global coord and then translated to component 2 coord. However at this point the feature protrudes from the face of component 2 and I need it to be recessed into the face (making a slot).

      Thanks
      Keith

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

        Try
        points.each{|pt|pt.z = -1 * pt.z}
        Works with an array 'points' containing Point3d OR Array [x,y,z] objects...
        It will change the values of each Array/Point3d, so ensure you have finished using them in there original orientation before changing them... OR make another 'set' using the .clone method on each of the Array or Point3ds, and you then have two sets of 'mirrored' values...

        TIG

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

          Thanks TIG that was exactly what I was looking for and it works perfectly!!

          Keith

          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