-
Notifications
You must be signed in to change notification settings - Fork 176
xcyl(), ycyl(), zcyl() pass through all parameters to cyl() #1749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
All pass-through arguments are now named, for robustness in case the arg list for cyl() ever changes. Also, the original function version of cyl() had Re-tested examples in cuboid(), xcyl(), ycycl(), and zcyl(), as well as examples in cyl(). |
|
The docs for xcyl (and I assume others) should state that Lastly, and more trouble, maybe, I think the function forms need to accept anchor= and spin= and should call reorient, which should have the same args as attachable. I'll admit I've never used this feature, but Revar set things up that way so that even the functional forms can be anchored, oriented (though not in this case) and spun. |
|
I was afraid that nothing is ever simple. So in order to have function versions of x/y/zcyl(), I would have to do that weird callback technique that is used in squircle() and other places? |
|
I think you just need to wrap the return value in a reorient() call. Anchoring is very simple here, so nothing more complex should be necessary. |
|
cyl() has a function form, and the xcyl() function just calls the cyl() function, which already takes anchor, spin, and orient. So why would a call to reorient() be needed? |
|
Because the whole point of xcyl() is that its anchoring is different. If you just pass anchor, spin and orient then you'll get the cyl() anchoring, where the TOP anchor is on a circular face. The point is that vnf=xcyl(...., anchor=TOP) is supposed to make a cylinder whose round edge is on the X axis. But vnf=cyl(..., anchor=TOP) makes a vnf whose top circle is on the XY plane. |
|
I didn't change the way the xcyl() module works; all I did was make the parameter list complete. It still calls cyl(). Original version: New version, the only difference is the parameter list, made more complete with the order the same as cyl(). I also removed the And yet, if I pass anchor=TOP into the new one, it behaves differently. |
|
Oh. Hmm. In the original, whatever the user sets for |
Yes, that's exactly the bug I though you had created and described in my previous message. The attachable() call will handle object positioning based on the anchor, spin and usually orient that are passed to attachable. The object as created as the child to attachable must be the native position object, created with orient=UP, anchor=CENTER and spin=0. Otherwise, you'll apply anchoring transformations twice. In this case, of course, orient needs to be RIGHT. But you also propagate the user value for spin. That's also going to cause problems if the user sets spin, with the shape getting spun two times. I think the error there will be subtle, because one of the spins will be around the cylinder axis, so it will change how the facets are aligned. |
|
Apparently I need to repeat myself. If you anchor a child using vnf_polyhedron the anchors have NOTHING TO DO with the anchors that were computed in the code that made the object. The VNF anchoring code looks at the VNF and tries to fabricate some non-idiotic anchors. It works sometimes. The chance that they are the same anchors produced by the code that compute the object is basically zero unless the object is a cube or axis oriented cylinder. So drawing those anchors is only a potential source of confusion here. With one exception, reorient should be receiving precisely the same parameters as attachable in the module version so that it does the same anchoring (conoid). That exception is that attachable gets the object to act on as a child, but reorient gets the object to act on as an input VNF in the p= parameter. Instead of giving the same attachable parameters (radii, length, axis) you seem to be giving it a vnf for the attachment parameters, so you will get VNF anchoring instead of conoid anchoring, which of course will not agree. |
|
Ah, there we go. Giving reorent() the same parameters as attachable() did the trick. I'll fix up ycyl and zcyl, and commit another change. The next change will include attachments.scad with the echo commented out and a newline on all the assert() messages. |
… added newlines to assert messages in attachments
|
Is this ready to be merged? |
|
Wait a bit... It occurred to me that I should test various combinations of anchor with spin and compare the module to the function. I also want to test cuboid() with textures, if applicable, because cuboid() uses the x/y/zcyl() modules. |
|
Ok. Use a very small $fn value so you can see rotation around the axis. |








Changes to xcyl(), ycyl(), and zcyl() in shapes3d.scad:
orient.orientis used to orient the cylinder.The
cuboid()module calls xcyl(), ycyl(), and zcyl(). Tested all examples in cuboid() as well as the original examples in xcyl(), ycyl(), and zcyl().