Newbie Here. (yet another) 3d to 2d question

  • Hi,

    I wrote a little SCAD script to help those battling with Elephant's Foot. It allows a user to import their STL, and it slices the bottom (n) layers, offsets those layers by user selected amount and, when rendered, creates a new model with basically a custom chamfer along the bottom. Elephants Foot Compensation

    Now I am trying to do the same thing in openJSCAD

    openSCAD uses a "projection" tool that seems to create a 2d path where the model intersects with the Z=0 plane. The path has both external vertices (the outside of the model) and internal vertices (if their are holes).

    openSCAD also has an offset tool. This allows one to offset the aforementioned path. If one offsets in the positive, then it will expand the external vertices along the path pushing out along normals AND it would "shrink" internal vertices, pushing normally inward along the path.

    Those paths can then be re-extruded to recreate the modified model. Anyway, those are the tools I used in openSCAD to make the tool.

    As a newb to JSCAD, I'm not really understanding the overall difference between V1 and V2.

    For slicing, I have tried this

    var cag = obj.projectToOrthoNormalBasis(z0basis);
    return cag;

    And it seems to be a path, but then I can't seem to offset it or extrude it.


    When I try this as an example

    var z0basis = CSG.OrthoNormalBasis.Z0Plane();
    var cag = obj.projectToOrthoNormalBasis(z0basis);
    var NewCag = cag.extrude([0,0,25]);
    return NewCag;

    There is a slight extrusion. But no matter what value I put in for the Z val, the slight extrusion appears to be the same.


    I read that there is no offset in V1 but there is in V2.

    After that long intro...

    1. Is there a JSCAD equivalent to SCAD projection that can yield a 2d path
    2. is there a JSCAD equivalent to SCAD offset that can offset that 2d path
    3. can that path then be extruded back into a 3d solid

    Thank you in advance


  • @z3dev Apparently the temporary v2 website doesn't handle links like those of examples, it may be easier to wait for the original website to be online.

  • We have a really strong group of users now. I think others will reply with some examples. đź‘Ť

  • @z3dev Thank you for taking the time to reply. I looked at that (and will go back and study) that discussion, as well as the link to "fromFakePolygons".

    When one is accustomed to a particular set of tools, one tries to tackle a problem using those tools. But when presented with a new set of tools, sometimes one will still try to use a wrench as a hammer. To me, JSCAD is the new set of tools. Now I need to learn how to use them.

    Thanks again for doing so much work.

    All the best


  • @retroglyph welcome!

    Ah... converting 3D slices to 2D... there was a similar question in the Development Discussions. Please see “2D slice from extruded polygon after substraction”

    If that doesn’t help then let us know. There are several ways to get the outline of slices.

Log in to reply