jscad / OpenJSCAD.org

JSCAD is an open source set of modular, browser and command line tools for creating parametric 2D and 3D designs with JavaScript code. It provides a quick, precise and reproducible method for generating 3D models, and is especially useful for 3D printing applications.
https://openjscad.xyz/
MIT License
2.66k stars 515 forks source link

Generated stl object is non manifold #77

Closed chertykov closed 7 years ago

chertykov commented 9 years ago

I have generated stl on web site from the following simplest code:

function main() {
   return difference(
         cube({size: 3, center: true}),
         cylinder({r:1, h:3, center: true}).rotateX(90)
      );
}

Then downloaded it and imported to Blender and checked for manifold.

2015-03-05 20 26 45

NateTG commented 9 years ago

That probably has to do with having the cylinder's top and bottom coplanar with the faces of the cube somehow. Have you tried h:3.5 with the cylinder?

chertykov commented 9 years ago

I have tried h:3.5 - no difference.

2015-03-06 10 19 46

franzherzog commented 9 years ago

Code with changes is working on http://joostn.github.io/OpenJsCad/processfile.html

function main() {

  var cube = CSG.cube({
    center:0,
    radius : 3
  });

  var cylinder = CSG.cylinder({
    radius:1,
    start: [0, -3, 0],
    end: [0, 3, 0],
  });

  var csg = cube.subtract(cylinder);
  return csg;

  /*
     code below created many manifold errors on stl export
  */

  /* return difference(
         cube({size: 3, center: true}),
         cylinder({r:1, h:3, center: true}).rotateX(90)
      );
  */
}
hovissimo commented 8 years ago

Any traction on this issue?

I'm having the same problem with a much more complicated part. https://gist.github.com/hovissimo/ce5366a35834c3690488

Light blue lines show discontinuities: http://i.imgur.com/kDbFl6L.png

FWIW, this is worse with the AMF exporter.

z3dev commented 8 years ago

Pull request #107 contains some changes to CSG.js and openjscad.js. I ran some tests and all issues with T-junctions were resolved after making those changes.

If you need this fixed then please make the changes manually.

z3dev commented 7 years ago

This issue was moved to jscad/io#15