Haskell-Things / ImplicitCAD

A math-inspired CAD program in haskell. CSG, bevels, and shells; 2D & 3D geometry; 2D gcode generation...
https://implicitcad.org/
GNU Affero General Public License v3.0
1.4k stars 142 forks source link

Integration of ImplicitCAD in ExplicitCAD #277

Open hannesweisbach opened 4 years ago

hannesweisbach commented 4 years ago

In the spirit of not hijacking issues anymore I opened a new issue, because I'm actually a bit unhappy with the current interface between ExplicitCAD and openextcad/ImplicitCAD.

I just compiled implicitsnap, after figuring out it is not a snap-archived (https://snapcraft.io/) version of extopenscad ;) I knew about the online-viewer on implicitcad.org, but I forgot it was named snap.

I'm not much of (ok, not at all) a haskell programmer (altough I like that smileys are apparently valid haskell code), so I have a couple of questions:

(1) I want - at least in the long run - support OpenSCAD-style #, i.e. the following object(s) become transparent. This doesn't has to be the #-character, since it is used for comments in extopenscad. I like the feature for debugging as it makes invisible objects (for example inside a difference()) visible, and hence debugable. I often mess up a direction when translating an object, or an axis when rotating it, so seeing the difference between what I think I programmed and the compiled & rendered output let's me fix this stuff real easy.

As for implementation two ideas come to my mind: First, this can of course be implemented in extopenscad as first-class primitive. The downsides are that # already has the meaning for comments, it makes the renderer/parser more difficult, and I don't know if output format such as STL even have the ability to attach something like attributes to objects apparently it doesn't but OBJ does. Second, this can be implemented inside the viewer, i.e. ExplicitCAD. The downsides are that ExplicitCAD has to implement at least a rudimentary parser to find the end of # - probably the matching semicolon. Additionally ExplicitCAD has to overlay the resulting STLs i.e. parse all transformations up the root of the document. Still, I like the second version better, since this allows me to implement color, etc too. Maybe I can re-use the parser from ImplicitCAD for that?

(2) 2D-preview - I tried previewing 2D objects with ExplicitCAD and it complained about empty STLs. Which makes sense :) The previewer on implicitcad.org handles this case. I think it gives 2D objects just a little z-height, so they become 3D objects. Is this done inside the editor or inside implicitsnap/extopenscad/implicitcad?

julialongtin commented 3 years ago

short answers(longer later):

1 is complicated. it's easy to make a section exist / not exist, but transparent is not a thing. 2 yes, it gives a touch of Z height.