where the new bounding-cube corners are now. Apply the align() operator relative to the origin-axes and let the designer translate()/rotate()/multmatrix() as required.įleshing this out in my own mind, for a given blob() with bounding-cube corners, :Īlign(x="above",y="above",z="above") blob()
Openscad center plus#
align() is less fluent because "align plus zero" isn't English for the concept we want to convey, it sounds more like algebra, "align+0", where "align" is in the position of a variable. I haven't been able to come up with better words than these, which preserve fluency. "Above" and "below" don't just connote height, they are generally used for comparing magnitudes or quantities, such as temperatures, or dollar amounts. Unfortunately, the abbreviation align("above") is not as fluent. The latter reads out loud as "align above zero". I think align("center") is fluent, and so is align(). The more the use of the API has that language like flow, the more fluent it is." Reference:, "The key test of fluency, for us, is the Domain Specific Language quality. It's English-enough that you can guess the meaning, using your knowledge of English.
Openscad center code#
The key idea is that, when you read the code out loud, it reads like English, or at least like some kind of pidgin English.
![openscad center openscad center](https://sfepy.org/doc-devel/_images/sdh_openscad.png)
In order to make code readable for non-professionals, the best practice is to design a "fluent interface". Here's the rationale for "above" and said "I agree, with a small fear that this may make code less readable for non-professionals." The align operator has the same power as the center= argument proposed by #265. It places the cube in the +X,+Y,+Z octant, adjacent to the origin. It centres the cube on the origin.Īlign("above") cube(10) is the same as cube(10, center=false).
![openscad center openscad center](http://archive.fabacademy.org/archives/2016/fablabtrivandrum/students/398/assets/assets/week5/oscad.png)
It would also make sense to be able to use all of these only for one or two axes, while leaving rest intact. for milling you want to have everything in negative coordinates (you are milling down to material from origin), while for 3D printing you usualy use possitive coordinates (you are adding material up from origin). That makes a lot of sense for CNC / CAM purposes, because eg. Such block is then easy to center.Īlso there can be something like fit_possitive() and fit_negative() that would corner whole object next to the center of coordinate system, but completely on positive or negative side. Complicated objects can be simply treated like smallest possible cube/block that fits around that object. Centering solids produced by 3rd party subroutines, or centering import()ed objects that are not centered in original files. (it surely does not make any sense to translate something only to center it back. I'd like to center it back using center() translate() cube() I think it would be useful to have some simple command to center any object in OpenSCAD.Įg.