[OpenSCAD] design processes (was Re: Extending OpenSCAD from assembler to C or Perlish language and adding standard library)

Doug Moen doug at moens.org
Thu Oct 3 02:52:47 EDT 2019


I agree that OpenSCAD often forces you to write code "backwards".

In Curv, which is a new modelling language originally inspired by OpenSCAD, I introduced a "pipe forwards" operator, called ">>", similar to the "|" pipe operator in the Unix shell. This lets me a series of shape transformations where the data flows forwards, rather than backwards, through the pipeline.

cylinder(h=10)
 >> rotate([0,90,0])
 >> translate([0,0,10]);

Once I discovered this, it immediately felt like a more natural way of writing code.

Doug Moen

> 
>> Yours is a useful example of something I have noticed with Openscad.
Developing a model involves a lot of re-tracing of steps. 

For example, I create a cylinder.  
     Then I say "oops, I need to go back and rotate the cylinder". 
            Then "I now need to go back and translate the rotated cylinder". 

Maybe your mind is capable of envisaging the entire process and writing it
directly from top to bottom, but mine certainly is not.
>> 
> 
> Indeed, the design process is often (but not always) "inside out". I start with a primitive component, then position it with respect to other primitive components to form a subassembly, then position that subassembly with respect to others to form a larger subassembly, and so on. Perhaps that would be more obvious if expressed in a reverse Polish notation, e.g.
> 
>> cylinder(h=10) rotate([0,90,0]) translate([0,0,10]);
>> 
> But I don't think so.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20191003/60d11df8/attachment.html>


More information about the Discuss mailing list