jscad / io

DEPRECATED : Input Output handling for JSCAD (see the link below)
https://github.com/jscad/OpenJSCAD.org/tree/V2/packages
34 stars 13 forks source link

exported stl object is not sliceable #19

Closed jeromew closed 7 years ago

jeromew commented 7 years ago

Hello,

Usually, I use openscad and can directly slice the exported models. With openjscad, slic3r tells me that there are manifold errors and the slicing operation does not succeed.

This happens with a very simple model like

function main() {
   return difference(
         cube({size: 2, center: true}),
         cube({size: [1,1,10], center: true})
      )
}

so I think that we should try and modify something into openjscad so that these kind of simple models can be sliced directly after beeing generated.

I saw that there are other issues regarding this but I do no understand what is the current status of this issue/bug. I will post here what I discover.

If you have any direction as to how this issue could be solved, don't hesitate !

kaosat-dev commented 7 years ago

Hello @jeromew This is very likely an issue with csg.js itself, and not the the exported stl : have you tried other format exports to verify? (I think amf is still supported by Slic3r right ?). If the issue is indeed with CSG.js, then it makes it non trivial : I have started reorganized that code base to make it more maintainable , but also started writing down all the aspects that would need to be overhauled to make the generated solids more robust. My plan was to rewrite all the core this summer. In the much longer run, there are also plans for 'alternative' modeling cores which could be non geometry based but ensure 100% manifoldness & printability (implicit modelling, signed distance fields etc).

We will take all the help we can get :) For example , if you know of a way to detect manifoldness so that we can add unit tests for that it would be great !

jeromew commented 7 years ago

yes the problem also appears with amf (I forgot to mention it). I had earlier experience with csg.js and do not recall problems but at that time (1+ year ago) I was printing with another printer with a proprietary slicer so It maybe was hiding the issue.

I am trying to compare the stl output (32 facets so it should be doable by hand) of openscad and openjscad on the model I gave to see what difference they see in the model. I was thinking that maybe a small modification on csg.js may give a better ordering of vertexes or what-else. On such a small model-with-a-hole, I think the problem is probably about detecting the correct inside/outside of the model, and making sure that the ordering of the 3 vertexes is coherent with this inside/outside interpretation.

There are probably "invariants" that need to be verified for manifoldness but I am not yet sufficiently aware of those problems. I'll dig a little more and update this issue accordingly.

kaosat-dev commented 7 years ago

@jeromew Thanks for already digging into this in more details ! Sorry to be a bother, but would you mind moving this issue (re opening one?) to CSG.js so it is easier to keep track of ? I just tested your jscad script's output as binary stl in Cura and I did not see any issues (then again Cura has a small amount of built in fixes), so slicers mileage /tolerance seems to vary. You could be right about the ordering of vertices: @z3dev recently fixed a similar issue for 2d geometry where winding order was messed up. Csg.js sadly has a ton of issues and weird internal constructs, but hey it can and will be improved :) Merci d'avance ! :)

jeromew commented 7 years ago

I can move the issue (or at least close here and recreate there) but which csg.js is the good one ? is https://github.com/jscad/csg.js the one that you are talking about ?

kaosat-dev commented 7 years ago

yes that is the one : the original author(s) agreed to put all relevant repositories in this organization