Reversing direction of a feature
-
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 -
Try
points.each{|pt|pt.z = -1 * pt.z}
Works with an array 'points' containingPoint3d
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... -
Thanks TIG that was exactly what I was looking for and it works perfectly!!
Keith
Advertisement