STL with errors from valid SCAD model

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

STL with errors from valid SCAD model

bradipao
Hi all, I am a relatively new openscad user and fan. Thanks to this awesome
tool, I managed to create my own 3D models. I recently purchased a 3D
printer (Tiertime Cetus3D) and started printing my own creations.

A few days ago I printed my own version of "sierpinski tetrahedron" (see
https://www.thingiverse.com/thing:3353362). I carefully developed model to
be a valid SCAD model (no warnings after F6) and optimized for 3D printing
(no tricky geometries and no need for printing-supports).

As you can see from photos on thingiverse, printed model is good. But
printing software (UP Studio) marks a specific face on STL model as "red"
and looking at that face on the printed item, there is clearly a defect. The
"fix" command of UP Studio does not fix error, and generates additional
"red" faces.

Uploading the STL model (the one that can be downloaded from
https://www.thingiverse.com/thing:3353362) to 3dhubs.com/3dprint for STL
checking, it says that model is printable, but suprisingly there are 183
intersecting faces and 16 non-manifold edges.


Is it normal to have intersecting faces and non-manifold edges as "valid"
output from openscad?

Is it a problem with my SCAD model (see below), or with the slicer algorithm
of UP Studio ?


// Sierpinski tetrahedron with underlying volume cleared
difference() {
  sierpinski3D(50,1,4);
  translate([0,0,-5]) cube([100,100,10],center=true);
}
// Base frame to make reverse pyramids stick to printer support
translate([0,0,0]) sierpinski2Dbase(50,1,4);


// tridimensional recursive sierpinski function
module sierpinski3D(ww,nn,mm) {
  // condition to propagate recursion
  if (nn<mm) {
    // single iteration of fractal transformation and recursion step
    translate([-ww/4,-ww/(4*sqrt(3)),0])        sierpinski3D(ww/2,nn+1,mm);
    translate([+ww/4,-ww/(4*sqrt(3)),0])        sierpinski3D(ww/2,nn+1,mm);
    translate([0,ww/(2*sqrt(3)),0])             sierpinski3D(ww/2,nn+1,mm);
    translate([0,0,ww/sqrt(6)])                 sierpinski3D(ww/2,nn+1,mm);
    translate([0,0,ww/sqrt(6)]) mirror([0,0,1]) sierpinski3D(ww/2,nn+1,mm);
  }
  // end of recursion, draw basic shape with enlarging factor
  else {
    tetra(ww*1.15);
  }
}

module tetra(ww) {
  pp = [[-ww/2,-ww/(2*sqrt(3)),0], [ww/2,-ww/(2*sqrt(3)),0],
        [0,ww/sqrt(3),0],          [0,0,ww*sqrt(6)/3]];
  ff = [[0,1,2], [0,3,1], [1,3,2], [2,3,0]];
  polyhedron(pp,ff);
}


// bidimensional recursive sierpinski function for base frame
module sierpinski2Dbase(ww,nn,mm) {
  if (nn<mm) {
    translate([-ww/4,-ww/(4*sqrt(3)),0]) sierpinski2Dbase(ww/2,nn+1,mm);
    translate([+ww/4,-ww/(4*sqrt(3)),0]) sierpinski2Dbase(ww/2,nn+1,mm);
    translate([0,ww/(2*sqrt(3)),0])      sierpinski2Dbase(ww/2,nn+1,mm);
    rotate([0,0,180]) tribase(1.15*ww/2);
  }
}

module tribase(ww) {
  rotate([0,0,-30]) translate([-ww/8,0,0.5]) cube([ww/4,1,1],center=true);
  rotate([0,0,-150]) translate([-ww/8,0,0.5]) cube([ww/4,1,1],center=true);
  rotate([0,0,90]) translate([-ww/8,0,0.5]) cube([ww/4,1,1],center=true);
}



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: STL with errors from valid SCAD model

nophead
If you do show edges you see that nothing lines up exactly because of the irrational square roots. That probably leads to minute slivers that when truncated to floats for the STL file cause self intersections due to vertices merging.

I don't know how it would be solved. Perhaps by modelling it as a solid tetrahedron and subtracting the holes.

On Tue, 15 Jan 2019 at 11:18, bradipao <[hidden email]> wrote:
Hi all, I am a relatively new openscad user and fan. Thanks to this awesome
tool, I managed to create my own 3D models. I recently purchased a 3D
printer (Tiertime Cetus3D) and started printing my own creations.

A few days ago I printed my own version of "sierpinski tetrahedron" (see
https://www.thingiverse.com/thing:3353362). I carefully developed model to
be a valid SCAD model (no warnings after F6) and optimized for 3D printing
(no tricky geometries and no need for printing-supports).

As you can see from photos on thingiverse, printed model is good. But
printing software (UP Studio) marks a specific face on STL model as "red"
and looking at that face on the printed item, there is clearly a defect. The
"fix" command of UP Studio does not fix error, and generates additional
"red" faces.

Uploading the STL model (the one that can be downloaded from
https://www.thingiverse.com/thing:3353362) to 3dhubs.com/3dprint for STL
checking, it says that model is printable, but suprisingly there are 183
intersecting faces and 16 non-manifold edges.


Is it normal to have intersecting faces and non-manifold edges as "valid"
output from openscad?

Is it a problem with my SCAD model (see below), or with the slicer algorithm
of UP Studio ?


// Sierpinski tetrahedron with underlying volume cleared
difference() {
  sierpinski3D(50,1,4);
  translate([0,0,-5]) cube([100,100,10],center=true);
}
// Base frame to make reverse pyramids stick to printer support
translate([0,0,0]) sierpinski2Dbase(50,1,4);


// tridimensional recursive sierpinski function
module sierpinski3D(ww,nn,mm) {
  // condition to propagate recursion
  if (nn<mm) {
    // single iteration of fractal transformation and recursion step
    translate([-ww/4,-ww/(4*sqrt(3)),0])        sierpinski3D(ww/2,nn+1,mm);
    translate([+ww/4,-ww/(4*sqrt(3)),0])        sierpinski3D(ww/2,nn+1,mm);
    translate([0,ww/(2*sqrt(3)),0])             sierpinski3D(ww/2,nn+1,mm);
    translate([0,0,ww/sqrt(6)])                 sierpinski3D(ww/2,nn+1,mm);
    translate([0,0,ww/sqrt(6)]) mirror([0,0,1]) sierpinski3D(ww/2,nn+1,mm);
  }
  // end of recursion, draw basic shape with enlarging factor
  else {
    tetra(ww*1.15);
  }
}

module tetra(ww) {
  pp = [[-ww/2,-ww/(2*sqrt(3)),0], [ww/2,-ww/(2*sqrt(3)),0],
        [0,ww/sqrt(3),0],          [0,0,ww*sqrt(6)/3]];
  ff = [[0,1,2], [0,3,1], [1,3,2], [2,3,0]];
  polyhedron(pp,ff);
}


// bidimensional recursive sierpinski function for base frame
module sierpinski2Dbase(ww,nn,mm) {
  if (nn<mm) {
    translate([-ww/4,-ww/(4*sqrt(3)),0]) sierpinski2Dbase(ww/2,nn+1,mm);
    translate([+ww/4,-ww/(4*sqrt(3)),0]) sierpinski2Dbase(ww/2,nn+1,mm);
    translate([0,ww/(2*sqrt(3)),0])      sierpinski2Dbase(ww/2,nn+1,mm);
    rotate([0,0,180]) tribase(1.15*ww/2);
  }
}

module tribase(ww) {
  rotate([0,0,-30]) translate([-ww/8,0,0.5]) cube([ww/4,1,1],center=true);
  rotate([0,0,-150]) translate([-ww/8,0,0.5]) cube([ww/4,1,1],center=true);
  rotate([0,0,90]) translate([-ww/8,0,0.5]) cube([ww/4,1,1],center=true);
}



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: STL with errors from valid SCAD model

nophead
Here is a bodge that seems to work:

// tridimensional recursive sierpinski function
module sierpinski3D(ww,nn,mm) {
  // condition to propagate recursion
  if (nn<mm) {
    // single iteration of fractal transformation and recursion step
    translate([-ww/4,-ww/(4*sqrt(3)),0])        sierpinski3D(ww/2,nn+1,mm);
    translate([+ww/4,-ww/(4*sqrt(3)),0])        sierpinski3D(ww/2,nn+1,mm);
    translate([0,ww/(2*sqrt(3)),0])             sierpinski3D(ww/2,nn+1,mm);
    translate([0,0,ww/sqrt(6)])                 sierpinski3D(ww/2,nn+1,mm);
    translate([0,0,ww/sqrt(6)]) mirror([0,0,1]) sierpinski3D(ww/2,nn+1,mm);
  }
  // end of recursion, draw basic shape with enlarging factor
  else {
    rotate(0.1)
        tetra(ww*1.15);
  }
}

I simply rotate the tetrahedron by 0.1 degrees. That makes sure the edges don't coincide. In OpenSCAD they need to either exactly coincide or definitely not. If the only differ by less than the resolution of a float the STL will be non-manifold.


On Tue, 15 Jan 2019 at 11:47, nop head <[hidden email]> wrote:
If you do show edges you see that nothing lines up exactly because of the irrational square roots. That probably leads to minute slivers that when truncated to floats for the STL file cause self intersections due to vertices merging.

I don't know how it would be solved. Perhaps by modelling it as a solid tetrahedron and subtracting the holes.

On Tue, 15 Jan 2019 at 11:18, bradipao <[hidden email]> wrote:
Hi all, I am a relatively new openscad user and fan. Thanks to this awesome
tool, I managed to create my own 3D models. I recently purchased a 3D
printer (Tiertime Cetus3D) and started printing my own creations.

A few days ago I printed my own version of "sierpinski tetrahedron" (see
https://www.thingiverse.com/thing:3353362). I carefully developed model to
be a valid SCAD model (no warnings after F6) and optimized for 3D printing
(no tricky geometries and no need for printing-supports).

As you can see from photos on thingiverse, printed model is good. But
printing software (UP Studio) marks a specific face on STL model as "red"
and looking at that face on the printed item, there is clearly a defect. The
"fix" command of UP Studio does not fix error, and generates additional
"red" faces.

Uploading the STL model (the one that can be downloaded from
https://www.thingiverse.com/thing:3353362) to 3dhubs.com/3dprint for STL
checking, it says that model is printable, but suprisingly there are 183
intersecting faces and 16 non-manifold edges.


Is it normal to have intersecting faces and non-manifold edges as "valid"
output from openscad?

Is it a problem with my SCAD model (see below), or with the slicer algorithm
of UP Studio ?


// Sierpinski tetrahedron with underlying volume cleared
difference() {
  sierpinski3D(50,1,4);
  translate([0,0,-5]) cube([100,100,10],center=true);
}
// Base frame to make reverse pyramids stick to printer support
translate([0,0,0]) sierpinski2Dbase(50,1,4);


// tridimensional recursive sierpinski function
module sierpinski3D(ww,nn,mm) {
  // condition to propagate recursion
  if (nn<mm) {
    // single iteration of fractal transformation and recursion step
    translate([-ww/4,-ww/(4*sqrt(3)),0])        sierpinski3D(ww/2,nn+1,mm);
    translate([+ww/4,-ww/(4*sqrt(3)),0])        sierpinski3D(ww/2,nn+1,mm);
    translate([0,ww/(2*sqrt(3)),0])             sierpinski3D(ww/2,nn+1,mm);
    translate([0,0,ww/sqrt(6)])                 sierpinski3D(ww/2,nn+1,mm);
    translate([0,0,ww/sqrt(6)]) mirror([0,0,1]) sierpinski3D(ww/2,nn+1,mm);
  }
  // end of recursion, draw basic shape with enlarging factor
  else {
    tetra(ww*1.15);
  }
}

module tetra(ww) {
  pp = [[-ww/2,-ww/(2*sqrt(3)),0], [ww/2,-ww/(2*sqrt(3)),0],
        [0,ww/sqrt(3),0],          [0,0,ww*sqrt(6)/3]];
  ff = [[0,1,2], [0,3,1], [1,3,2], [2,3,0]];
  polyhedron(pp,ff);
}


// bidimensional recursive sierpinski function for base frame
module sierpinski2Dbase(ww,nn,mm) {
  if (nn<mm) {
    translate([-ww/4,-ww/(4*sqrt(3)),0]) sierpinski2Dbase(ww/2,nn+1,mm);
    translate([+ww/4,-ww/(4*sqrt(3)),0]) sierpinski2Dbase(ww/2,nn+1,mm);
    translate([0,ww/(2*sqrt(3)),0])      sierpinski2Dbase(ww/2,nn+1,mm);
    rotate([0,0,180]) tribase(1.15*ww/2);
  }
}

module tribase(ww) {
  rotate([0,0,-30]) translate([-ww/8,0,0.5]) cube([ww/4,1,1],center=true);
  rotate([0,0,-150]) translate([-ww/8,0,0.5]) cube([ww/4,1,1],center=true);
  rotate([0,0,90]) translate([-ww/8,0,0.5]) cube([ww/4,1,1],center=true);
}



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: STL with errors from valid SCAD model

RevarBat
I coded up my own Sierpinski sponge for kicks and came up with this:

module sierpinski(side=100, minside=10, overlap=1) {
    r = side/sqrt(3);
    h = side*2/3;
    pts=[[0,r,h], [side/2,-r/2,h], [-side/2,-r/2,h], [0,0,0]];
    if (side <= minside) {
        rotate(0.01) {
            polyhedron(
                points=[for (pt = pts) pt*(r+overlap)/r],
                faces=[[0,1,2], [0,3,1], [1,3,2], [2,3,0]],
                convexity=2
            );
        }
    } else {
        for (pt = pts) {
            translate(pt/2) sierpinski(side/2, minside);
        }   
    }   
}   
sierpinski(160);

It renders fine, and exports to a valid error-free STL, though I had to use the slight (0.01 degree) rotation trick nop head suggested. My addition to the discussion is to make the tetrahedron point-down because it can print without any interior supports in that orientation, so long as you print with a brim, and exterior-only support.

- Revar



On Jan 15, 2019, at 12:03 PM, nop head <[hidden email]> wrote:

Here is a bodge that seems to work:

// tridimensional recursive sierpinski function
module sierpinski3D(ww,nn,mm) {
  // condition to propagate recursion
  if (nn<mm) {
    // single iteration of fractal transformation and recursion step
    translate([-ww/4,-ww/(4*sqrt(3)),0])        sierpinski3D(ww/2,nn+1,mm);
    translate([+ww/4,-ww/(4*sqrt(3)),0])        sierpinski3D(ww/2,nn+1,mm);
    translate([0,ww/(2*sqrt(3)),0])             sierpinski3D(ww/2,nn+1,mm);
    translate([0,0,ww/sqrt(6)])                 sierpinski3D(ww/2,nn+1,mm);
    translate([0,0,ww/sqrt(6)]) mirror([0,0,1]) sierpinski3D(ww/2,nn+1,mm);
  }
  // end of recursion, draw basic shape with enlarging factor
  else {
    rotate(0.1)
        tetra(ww*1.15);
  }
}

I simply rotate the tetrahedron by 0.1 degrees. That makes sure the edges don't coincide. In OpenSCAD they need to either exactly coincide or definitely not. If the only differ by less than the resolution of a float the STL will be non-manifold.


On Tue, 15 Jan 2019 at 11:47, nop head <[hidden email]> wrote:
If you do show edges you see that nothing lines up exactly because of the irrational square roots. That probably leads to minute slivers that when truncated to floats for the STL file cause self intersections due to vertices merging.

I don't know how it would be solved. Perhaps by modelling it as a solid tetrahedron and subtracting the holes.

On Tue, 15 Jan 2019 at 11:18, bradipao <[hidden email]> wrote:
Hi all, I am a relatively new openscad user and fan. Thanks to this awesome
tool, I managed to create my own 3D models. I recently purchased a 3D
printer (Tiertime Cetus3D) and started printing my own creations.

A few days ago I printed my own version of "sierpinski tetrahedron" (see
https://www.thingiverse.com/thing:3353362). I carefully developed model to
be a valid SCAD model (no warnings after F6) and optimized for 3D printing
(no tricky geometries and no need for printing-supports).

As you can see from photos on thingiverse, printed model is good. But
printing software (UP Studio) marks a specific face on STL model as "red"
and looking at that face on the printed item, there is clearly a defect. The
"fix" command of UP Studio does not fix error, and generates additional
"red" faces.

Uploading the STL model (the one that can be downloaded from
https://www.thingiverse.com/thing:3353362) to 3dhubs.com/3dprint for STL
checking, it says that model is printable, but suprisingly there are 183
intersecting faces and 16 non-manifold edges.


Is it normal to have intersecting faces and non-manifold edges as "valid"
output from openscad?

Is it a problem with my SCAD model (see below), or with the slicer algorithm
of UP Studio ?


// Sierpinski tetrahedron with underlying volume cleared
difference() {
  sierpinski3D(50,1,4);
  translate([0,0,-5]) cube([100,100,10],center=true);
}
// Base frame to make reverse pyramids stick to printer support
translate([0,0,0]) sierpinski2Dbase(50,1,4);


// tridimensional recursive sierpinski function
module sierpinski3D(ww,nn,mm) {
  // condition to propagate recursion
  if (nn<mm) {
    // single iteration of fractal transformation and recursion step
    translate([-ww/4,-ww/(4*sqrt(3)),0])        sierpinski3D(ww/2,nn+1,mm);
    translate([+ww/4,-ww/(4*sqrt(3)),0])        sierpinski3D(ww/2,nn+1,mm);
    translate([0,ww/(2*sqrt(3)),0])             sierpinski3D(ww/2,nn+1,mm);
    translate([0,0,ww/sqrt(6)])                 sierpinski3D(ww/2,nn+1,mm);
    translate([0,0,ww/sqrt(6)]) mirror([0,0,1]) sierpinski3D(ww/2,nn+1,mm);
  }
  // end of recursion, draw basic shape with enlarging factor
  else {
    tetra(ww*1.15);
  }
}

module tetra(ww) {
  pp = [[-ww/2,-ww/(2*sqrt(3)),0], [ww/2,-ww/(2*sqrt(3)),0],
        [0,ww/sqrt(3),0],          [0,0,ww*sqrt(6)/3]];
  ff = [[0,1,2], [0,3,1], [1,3,2], [2,3,0]];
  polyhedron(pp,ff);
}


// bidimensional recursive sierpinski function for base frame
module sierpinski2Dbase(ww,nn,mm) {
  if (nn<mm) {
    translate([-ww/4,-ww/(4*sqrt(3)),0]) sierpinski2Dbase(ww/2,nn+1,mm);
    translate([+ww/4,-ww/(4*sqrt(3)),0]) sierpinski2Dbase(ww/2,nn+1,mm);
    translate([0,ww/(2*sqrt(3)),0])      sierpinski2Dbase(ww/2,nn+1,mm);
    rotate([0,0,180]) tribase(1.15*ww/2);
  } 
}

module tribase(ww) {
  rotate([0,0,-30]) translate([-ww/8,0,0.5]) cube([ww/4,1,1],center=true);
  rotate([0,0,-150]) translate([-ww/8,0,0.5]) cube([ww/4,1,1],center=true);
  rotate([0,0,90]) translate([-ww/8,0,0.5]) cube([ww/4,1,1],center=true);
}



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: STL with errors from valid SCAD model

bradipao
In reply to this post by nophead
@nophead:

Awesome!! With your solution there are ZERO errors/warnings checking on
3dhubs.com/3dprint.

Thank you very much, now I can schedule printing of a 100mm tetrahedron with
one additional level of recursion (several hours with my printer). :)





--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: STL with errors from valid SCAD model

bradipao
In reply to this post by RevarBat
@RevarBat:

Thank you for contributing with your version, I definitely need to make
practice with lists.


Regarding the point-down tetrahedron, I know it is the standard printing
orientation, but I preferred to do something different, for fun.

I added the fifth reversed tetrahedron internally just to work as a support
and to make the sponge "less empty". When I tried to print it, unfortunately
the small triangle of the reversed tetrahedron detached from printing plane,
because of very tiny base, so I added the "support lines". On the final
printed item it is quite easy to cut those lines.



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org