OpenJSCAD Wisdom Collector

OpenJSCAD is an object-oriented Javascript remix of OpenSCAD, and I’m going to try to figure out how to use it.  Here we go!

Boots on the Ground

  • Jump right in
    At the OpenJSCAD.org website you can edit code and see the output right in your browser.  Try modifying the sample code to get a feel for how things work.  Warning: This isn’t the best way to work long-term, because reloading the page will wipe out your code!
  • Get set up locally
    Go to the OpenJSCAD User Guide and scroll down to the Local Installation section, which will tell you how to install NodeJS and clone OpenJSCAD from GitHub.  This is the part where having a friend that knows what they are doing is very helpful (thanks, Angelo!). At the end of this process you should have a folder called OpenJSCAD.org that contains examples, javascript files, and an index.html file.
  • Write code in your own editor and view mesh output in your browser
    Now open up a new file in your favorite coding editor (for example Sublime), and copy in the example code from OpenJSCAD.org. Save this document. Open Chrome and load the index.html file that is inside your OpenJSCAD.org folder. Then drag your code file into the input box in the lower left, and check “Auto Reload”.  Now when you change things in your code editor and save, it should automatically reload the mesh in your browser.
  • Turn off the in-browser editor
    Since you’re not using the editor inside your browser,  you can turn it off and get more visual real estate for your mesh.  One way to do this is to right-click to “Inspect Element” and then use the Developer Tools in Chrome to find the part of the code that controls the editor box.  Find the top-level of code that highlights the editor and then Delete it! (Note this is the “hacktastic” way to do this – really we should just edit out the editor in the html code so that we don’t have to delete the editor each time we reload the page later. We’ll do that another day…)

 Learning to Code with OpenJSCAD

  • Start with the User Guide walkthrough
    Work through the OpenJSCAD User Guide, starting with the “Anatomy of a JSCAD file” section and then working through the descriptions of the basic primitives, transformations, and functions.
  • OpenJSCAD Google+ Community
    Ask and answer questions, hear the latest news, see what there is to see at the OpenJSCAD Community on Google+.

Fun Facts

  • CSG.roundedCube is one of the default primitives, so it’s easy to get rounded objects in OpenJSCAD, hooray!

Leave a Reply

Your email address will not be published. Required fields are marked *