Inventables Community Forum

Source code for the Replicator app

Hi Easel app devs!

I recently posted in the Apps category about the new Replicator app:

For anyone interested in seeing how it works, I’ve posted the source code on Github:

Feel free to ask questions about how or why something works, or to submit pull requests!

Cheers,
Jim

While you’re developing the app, it will be marked “private” and visible only to you. You can test it in Easel, and when it’s working the way you expect, you can notify us (on the forum) that it’s ready for review. We’ll be building out a more automated way to submit it for review in the future, as well as potentially more testing tools. We’d like feedback about how we can make all of this better for developers.

1 Like

I am working with a local high school that has an x-carve. In order to save the waste board I suggested that we cut a 24" by 24" by 1/4" board to put on top of the waste board to protect it. The board was to have holes cut to match the holes in the waste board so the existing holes could still be used. The existing Replicator App only deals with inches, spacing is between objects and has a limit of 1" between objects and only a 10 by 10 grid it didn’t work to make holes 75mm on center. The Replicator does work great to make one object and then replicated it for cutting within its limits. Since the code for Replicator is provided as an example I made the following changes in a version I called OffsetReplicator. Up to 50 rows and 50 columns, Units in inches or mm along with a slider for inches and a slider for mm. Scales for inches go up to 4" and mm to 200mm. The code was also changed to do an offset of each object instead of space between objects. This makes it easier to place holes 75mm on center to match the existing waste board holes. It was interesting figuring out enough of how the existing code worked to be able to modify it. I did provide two different sliders for mm and inches since they needed different ranges and precisions. Someone better with JavaScript or jQuery could hide/show the appropriate slider based on the units chosen or could adjust the range of a single slider.
The documentation on the existing code should be updated to note that when developing the app the “Requires selected shape?” checkbox next to the editing window needs to be checked.
I haven’t had a chance to cut a board with holes to check the accuracy of the replication. That might get done on Monday. Sizes of the selected object are returned in inches. Is there a way for the API to return them in mm? When dealing with mm I have been dividing the mm returned from the slider by 25.4 but I’m not sure the precision return in JavaScript.

That should be fine. JavaScript’s floating point numbers are good to about 15 digits, which is several orders of magnitude better than the precision of the machine.

The documentation on the existing code should be updated to note that when developing the app the “Requires selected shape?” checkbox next to the editing window needs to be checked.

Thanks for pointing this out. I’ll add a note mentioning that in the easel-replicator project.