[OpenSCAD] STL without render?

Parkinbot rudolf at parkinbot.com
Thu Jun 2 10:29:04 EDT 2016

bsuter wrote
> In that post you wrote "A single sweep() along a smoothed trajectory
> will be faster than a union of cylinders and spheres describing the
> same". Could you please explain further what you mean, in OpenSCAD
> terms, by "single sweep() along a smoothed trajectory"? 

This code is a good starting point and show case:
to get an idea, how sweeps behave. The (implicit) union() is needed for
marriage of different sweep trajectories. 

> Certainly each of my branches can be modeled as a sequence of
> nodes, where each node has an associated radius. Is there a way to
> represent this directly in OpenSCAD? I.e. to specify a trajectory in
> 3D, and then extrude (ideally a circular cross-section, but a polygon
> would work too) along this trajectory, with the extrusion radius
> defined at each node?

There is no language support for general extrusion along trajectories, and
there is no data structure support (or let's say only weak array support)
for things like trees and so on. But there are libraries like sweep() and
skin() going into this direction. Also see here:

>> I've implemented some Matlab class to generically describe arteries with
>> an
>> interpolation scheme. The output is a winding 'wire' in 3D with free
>> radius
>> at each point in STL-format.

this is an example of the outcome: 

The class simply does some nspline calculation over a sequence of 4D vectors
(x, y, z, r) describing a skeleton line. Most of the code is for handling
STL-triangulation and output. 

>> In lack of an own union or furcation operator
>> capable to do the intersection triangulation we currently use OpenSCAD
>> and
>> Blender to compose porperly placed wires into tree structures which we
>> again
>> cut into puzzle pieces for 3D print.
> This part I don't understand ;(

STL triagulation is easy and fast if you don't have to check for
self-intersection (SI). I.e. if the code can assume, no SI will happen, it
can skip all tests and calculations that would be needed to treat SI and
just knit some generic triangulation pattern in a straight forward manner.
Its helps to think about physical knitting to understand what is going on. 
For the puzzle part: It might be interesting to print a structure in pieces,
e.g. to compose a construction kit or similar (which can also be used for
moulding).  In your case, it might be advantegous to print the neurons and
the dendrits as destinct pieces and design a connector for piecing parts
together as puzzle. 
A union of any non-SI shapes might be SI - and will be SI at defined
locations in the case of furcations and trees. So, if SI is only happening
at furcation points, the intersection can be calculated somehow in a fast
manner, to get a proper triangulation. Have a look, how the union of two
cylinders is mapped into STL (to get a first impression, you can use F10 and
Ctrl+1 which only partly triangulates). 
This is the principle. OpenSCAD has this operator in form of union(). So,
one way is to import a bunch of branches (STLs) already correctly placed und
let OpenSCAD do the work dirty work in a general way. 
In fact at CSG-level (F5) this is done only virtually by the graphics card.
And when it comes to STL output (F6) CGAL is used, which takes its time. 

Knowing that all your branches will not SI, except at furcation points, you
can write your own specialized (and thus fast) union() that remeshes just
the furcation intersection part of the branches. 

> My main goal is (a) virtual reality visualization of many neurons
> together, and (b) 3D printing of individual neurons. 

It depends on how often this is repeated. If you model just some two or
three examples, long CGAL rendering times for that what you have, might be
tolerable, as recoding consumes much more time. 

For virtual visualization you might want to put in more effort. OpenSCAD has
some nice animation support on the CSG-level. Trygon used it to do some
amazing things.
Much more of course is offered by Blender. 


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

More information about the Discuss mailing list