2

In openSCAD there is a command to project a 3D model to a 2D surface.
I can't find anything about this command in the JSCAD Documentation.

Is there a way to do the same in openJSCAD.

Albert Renshaw
  • 17,282
  • 18
  • 107
  • 195
Bruce
  • 121
  • 4

1 Answers1

2

Yes, it can be done, let me demonstrate with a simple cube:

function main () {
  var z0basis = CSG.OrthoNormalBasis.Z0Plane();
  return (cube({size: 10, center: true})).projectToOrthoNormalBasis(z0basis);
}
Anteino
  • 1,044
  • 7
  • 28
  • Do you have any documentation on this? As I tried it with something else and it's not working for me.. `function main () { var z0basis = CSG.OrthoNormalBasis.Z0Plane(); var obj = sphere(10); return (obj).projectToOrthoNormalBasis(z0basis); }` – Bruce Dec 07 '19 at 08:09
  • 1
    I found the documentation by a quick google search: https://joostn.github.io/OpenJsCad/ – Anteino Dec 07 '19 at 15:33
  • OpenJSCAD seems to be unable to make projections from surfaces that are not flat and aligned with the Z plane. First you have to make a cut and project that to the Z plane as explained here: https://github.com/JamesNewton/AdvancedRoboticsWithJavascript/wiki/OpenJSCAD-tricks Pretty unpractical if you ask me, cause this way the projections of objects change depending on which height you take the cut, which is exactly what you don't wnat because otherwise you would have done a cut in the first place. You got me curious now, I will report back if find something better. – Anteino Dec 07 '19 at 15:41
  • Well you can take cuts at different heights and union them together to approximate the effect of a projection. This is all I can come up with since it seems to be actually impossible otherwise. – Anteino Dec 07 '19 at 16:52