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 slotReturns 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' containingPoint3dOR 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.clonemethod 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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better đź’—
Register LoginAdvertisement