[OpenSCAD] sumUp() to Replace Difference() (in most cases)

pproj pproj at posteo.de
Thu Oct 6 18:13:48 EDT 2016

hmm.. there must be a misunderstanding.
  i have stated that sumUp() is slower than difference() in complex 
projects (thats its main drawback) and asked if it can be hardcoded to 
make it faster...
i think we are of the same opinion on that. i believe the cleanliness of 
code, reduction of nesting and thus redundancy by far outweigh the very 
unpleasant fact that i have to wait for several minutes for a complex 
model to render, and this would have been times faster with the messier 
difference()-using code

On 06.10.2016 23:45, Ronaldo Persiano wrote:
> Interesting approach. I don't have any reason to question your
> statement that sumUp() could favor modelling complex projects. I have
> no experience on that and have to give it a try. But I don't
> understand why you say it is faster. Ultimately, sumUp will perform
> the same boolean operations. I compared the CSG tree your code
> generated with the CSG tree generated for a code I wrote to produce
> the same model using directly the boolean operations. The CSG tree of
> sumUp is a lot bigger than the later. The preview time of sumUp was a
> bit bigger.
> 2016-10-06 16:55 GMT-03:00 pproj at posteo.de <pproj at posteo.de>:
>> hello after few years of work on my quite complex cad project,
>> which i created using openscad .(my love to openscad was hampered by
>> quite few a limittions for a compex project- but i am still working
>> with it)
>> anyway,
>> i have decided it is time to share with others some of the things i
>> have discovered and developed in the years of use.
>> i will start with the sumUp(). which is an advanced replacement for
>> the difference() keyword and allows for holes inside modules, and
>> reduced nesting producing simpler code among other things.
>> i have put it it under:
>> https://github.com/solidboredom/sumUp [1]
>> but to show you why i have been using it so much: it can produce
>> this example. the code below and the lib is all you need
>> :
>> include<sumup.scad>
>> sumUp()
>> {
>> add()
>> cube([20,20,7],center=true);
>> lidWithNailsAndWasher();
>> }
>> //== modules below ==
>> module lidWithNailsAndWasher()
>> {
>> add() //washer
>> translate([0,0,8])
>> cube([20,20,1],center=true);
>> addAfterRemoving() //top cover without holes
>> translate([0,0,11])
>> color("green")
>> cube([17,17,2],center=true);
>> for(x=[-1,1],y=[-1,1])
>> translate([x*7,y*7,2])
>> {
>> remove()
>> cylinder(h=25,d=4.5,center=true);
>> #addAfterRemoving()
>> cylinder(h=10,d2=3,d1=1);
>> }
>> }
>> i have been quite happy with thhe library (actually its
>> predecessor) so i hope you will find it useful too.
>> i have been using it so much i would like to have its approach
>> somehow integrated in openscad itself.
>> this perhaps could resolve its main drawback: speed on complex
>> models: openscad creates a lot groups and getting much slower on
>> complex models than with the difference().
>> i would also like to share another library: essentially a human(not
>> linear algebra robot) oriented syntax rewrite library for basic
>> openscad operations i use a lot, but still need to make it ready for
>> publishing and documented first.
>> so whats your take folks?
>> Peter
>> _______________________________________________
>> OpenSCAD mailing list
>> Discuss at lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>> [2]
> Links:
> ------
> [1] https://github.com/solidboredom/sumUp
> [2] 
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
> _______________________________________________
> OpenSCAD mailing list
> Discuss at lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

More information about the Discuss mailing list