ShapeJS Developer Tutorials

As with all kinds of scripting, you may occasionally have flaws in the script that are difficult to find but cause problematic results or prevent the script from functioning at all. In the latter case, ShapeJS will endeavor to highlight the problematic line and say what the issue is, but in the former it can be difficult to track problems down. This is a list of tips and tricks for dealing with specific issues you may encounter while using ShapeJS.

Entire view red

This means that you are zoomed in so far you are inside of the data source. Zoom back out. Relax.

Red cube

If you set your Bounds to a reasonable size and nonetheless get a red cube, it likely means that the data source was not scaled properly to fit the scene. If you were not using a model, make sure that the dimensions of any data sources you are using are multiplied by MM or IN, whichever you are using for your bounds, and that the bounds are a reasonable size. Keep in mind that some data sources like planes or cones will naturally run into the bounds. If you are using a model, either use the scale function from the Simple Transform Tutorial or go back to whatever program it was made and and ensure that the scale is set to millimeters or, for very large models, centimeters.

New Data Sources not showing up

Make sure that they are within the bounds, and make sure that you have told the scene that they are supposed to be displayed.

Booleans Invisible

Your Boolean Subtractions may not be showing up or may be deleting the whole object. Try switching them to Union to check their actual location. If you still cannot locate them, they are likely outside of the Bounds or completely enclosed in another data source. If you are having problems with Intersections, try the same thing.

Booleans result in strange membrane

If you get a 2D surface with lots of grain after having performed a Subtraction, that means that a portion of the data source being subtracted from has lined up exactly with part of the data source being subtracted. Simply make sure that the part being subtracted extends slightly past the one being subtracted from and the membrane should go away.

ShapeJS Lag or Error not in output window

First, save the script and try restarting ShapeJS. If that does not help, see if, say, a script from one of the tutorials is lagging or causing issues in the same way. If not, that likely means that your script is going overboard on detail. Try lowering the Bounds or decreasing voxel density.

Render is noisy/distorted

If part of your shape is showing up as a cloud of particles, or in some other way seems to be separating or distorted, this means that it is too small to accurately show up on the voxel grid--and thus almost certainly too thin to print. Find a way to thicken the object or up the voxel resolution.

The same cause may also manifest itself as black areas, particularly around actual edges. This is also cause by the model being too thin.

Importing Files

ShapeJS currently supports the import and export of STL and X3D. Guidelines for saving externally made 3D models in other programs so that ShapeJS can read them can be found at https://www.shapeways.com/tutorials/supported-applications. Also check if meshErrorFactor has been set lower than the default value of 0.5*MM, as this can result in an excess of information.

Check for success or failure

If you have an operation whose success you are unsure of, try using the "print()" function, so that it can say if it believes itself to have succeeded. If variables are getting messed up, use this to print them to the output console where you can see them.

Incorrect Printing

Check the Guidelines for your material. For more expensive materials, consider giving your models test prints on similar cheaper materials to ensure all is well.

Noise or black at cutoff

This is caused by having part of the surface extending right to the edge of the bounds without technically entering it. Make the bounds a tiny bit bigger or the data source a tiny bit smaller to resolve the issue.

If this happens with the camera it means you have managed to zoom in to exact angle and position equilibrium with the object. Congratulations.