[OpenSCAD] eval( ) ???

runsun runsun at gmail.com
Sat May 16 18:24:23 EDT 2015


@doug.moen, 

I believe your oop-like idea is exactly what I have in mind. 

The first time I learned about Openscad, I was amazed by how easy it can
produce a shape with simple code. I went on to design a crank, with as
simple as two objects: an arm ( a bar between points A and B) and a wheel.
When the wheel turns, A should follows a point C on the wheel.

Then I realize that openscad object has no way to bear data, so once it's
made, it can't following the coordinate of C. As a result, moving A to
follow C is more difficult than I thought, involving in more complicated
calc, especially if this crank is to be put on some face of some other
object.  

The 2nd thing giving me a surprise is that openscad doesn't have a mind of
drawing a line from A to B. The simplest way is to make a sphere at the
origin, move to A, and another one to move to B, then do a hull() between A
and B. But the result (shape of line) is not very controllable. 

In fact, everything openscad makes is to follow this: (1) make at the
origin, (2) do a rotation, and (3) translate to the target location. Even as
simple as a point in space has to go through these steps. 

To me, an idea modeling tool would be able to: (a) make an object X directly
at any point in spcace; (b) X can report where it is, i.e., contains data,
especially coordinates; and (c) attachment to that object can be made based
on the data of X. That is, given a point A on X, users can make a line, a
wheel ... ect, based on A, but don't have to go through (1~3) steps all over
again. 

To achieve this, it has to rely heavily on *polyhedron-based approach* ---
everything has to be polyhedron, because only polyhedron can bear coordinate
info. 

In the past year, I've spent most of my openscad time on developing a lib
toward that direction (well, other than the doctest lib). The most important
ingredient is the hash parameter to mimic the associated array. Using
something like:

   data= ["angle",30, "r", 3]

makes it possible to pack all parameters of an object. In some sense, this
data becomes THE object. It can be updated with new info, thus produce a
sub-object easily. Without this I can't even start the first step. 

Since a set of data represents an object, in the future we might be able to
do:

  data= [ "angle", 30
            , "r", 3
            , "action", ["bend",  ... ]
            , "merge", some_other_object
            ];

But that's a very long road ahead. 



_______________________________________________
OpenSCAD mailing list
Discuss at .openscad
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org





-----

$  Runsun Pan, PhD 

$ -- OpenScad_DocTest: doc and unit test ( Github , Thingiverse  ) 

$ -- hash parameter model: here , here 

$ -- Linux Mint 17.1 Rebecca x64  + OpenSCAD 2015.03.15/2015.04.01.nightly 




--
View this message in context: http://forum.openscad.org/eval-tp12627p12669.html
Sent from the OpenSCAD mailing list archive at Nabble.com.




More information about the Discuss mailing list