chilipeppr-grbl / widget-grbl-autolevel

2 stars 7 forks source link

com-chilipeppr-widget-autolevel

Allows you to auto-level your PCB before milling. Most raw PCB boards have a slight warpage. This widget lets you probe the warpage and then it auto-scales your Gcode to match the warpage so you get very clean/predictable z-positions in your milling job.

ChiliPeppr Widget / Auto-Level

All ChiliPeppr widgets/elements are defined using cpdefine() which is a method that mimics require.js. Each defined object must have a unique ID so it does not conflict with other ChiliPeppr widgets.

Item Value
ID com-chilipeppr-widget-autolevel
Name Widget / Auto-Level
Description Allows you to auto-level your PCB before milling. Most raw PCB boards have a slight warpage. This widget lets you probe the warpage and then it auto-scales your Gcode to match the warpage so you get very clean/predictable z-positions in your milling job.
chilipeppr.load() URL http://raw.githubusercontent.com/raykholo/grbl-widget-autolevel/master/auto-generated-widget.html
Edit URL http://ide.c9.io/raykholo/grbl-widget-autolevel
Github URL http://github.com/raykholo/grbl-widget-autolevel
Test URL https://preview.c9users.io/raykholo/grbl-widget-autolevel/widget.html

Example Code for chilipeppr.load() Statement

You can use the code below as a starting point for instantiating this widget inside a workspace or from another widget. The key is that you need to load your widget inlined into a div so the DOM can parse your HTML, CSS, and Javascript. Then you use cprequire() to find your widget's Javascript and get back the instance of it.

// Inject new div to contain widget or use an existing div with an ID
$("body").append('<' + 'div id="myDivWidgetAutolevel"><' + '/div>');

chilipeppr.load(
  "#myDivWidgetAutolevel",
  "http://raw.githubusercontent.com/raykholo/grbl-widget-autolevel/master/auto-generated-widget.html",
  function() {
    // Callback after widget loaded into #myDivWidgetAutolevel
    // Now use require.js to get reference to instantiated widget
    cprequire(
      ["inline:com-chilipeppr-widget-autolevel"], // the id you gave your widget
      function(myObjWidgetAutolevel) {
        // Callback that is passed reference to the newly loaded widget
        console.log("Widget / Auto-Level just got loaded.", myObjWidgetAutolevel);
        myObjWidgetAutolevel.init();
      }
    );
  }
);

Publish

This widget/element publishes the following signals. These signals are owned by this widget/element and are published to all objects inside the ChiliPeppr environment that listen to them via the chilipeppr.subscribe(signal, callback) method. To better understand how ChiliPeppr's subscribe() method works see amplify.js's documentation at http://amplifyjs.com/api/pubsub/

Signal Description
(No signals defined in this widget/element)

Subscribe

This widget/element subscribes to the following signals. These signals are owned by this widget/element. Other objects inside the ChiliPeppr environment can publish to these signals via the chilipeppr.publish(signal, data) method. To better understand how ChiliPeppr's publish() method works see amplify.js's documentation at http://amplifyjs.com/api/pubsub/

Signal Description
(No signals defined in this widget/element)

Foreign Publish

This widget/element publishes to the following signals that are owned by other objects. To better understand how ChiliPeppr's subscribe() method works see amplify.js's documentation at http://amplifyjs.com/api/pubsub/

Signal Description
/com-chilipeppr-widget-autolevel/com-chilipeppr-widget-3dviewer/sceneaddWe ask the 3D viewer to add THREE.js objects to the scene.
/com-chilipeppr-widget-autolevel/com-chilipeppr-widget-3dviewer/sceneremoveWe ask the 3D viewer to remove THREE.js objects from the scene.
/com-chilipeppr-widget-autolevel/com-chilipeppr-widget-3dviewer/request3dObjectWe ask the 3D viewer to send us the user object being shown in 3D viewer so we can analyze it. In particular, we want to know its bounding box for calculating the probe area.

Foreign Subscribe

This widget/element publishes to the following signals that are owned by other objects. To better understand how ChiliPeppr's publish() method works see amplify.js's documentation at http://amplifyjs.com/api/pubsub/

Signal Description
/com-chilipeppr-widget-autolevel/com-chilipeppr-widget-3dviewer/recv3dObjectWhen we request a /com-chilipeppr-widget-3dviewer/request3dObject we get back this signal and the payload is the actual user object so we can analyze it.
/com-chilipeppr-widget-autolevel/com-chilipeppr-interface-cnccontroller/proberesponsewe receive the parsed probe trigger coordinates back from the cnc interface.

Methods / Properties

The table below shows, in order, the methods and properties inside the widget/element.

Method / Property Type Description
idstring"com-chilipeppr-widget-autolevel"
urlstring"http://raw.githubusercontent.com/raykholo/grbl-widget-autolevel/master/auto-generated-widget.html"
fiddleurlstring"http://ide.c9.io/raykholo/grbl-widget-autolevel"
githuburlstring"http://github.com/raykholo/grbl-widget-autolevel"
testurlstring"http://grbl-widget-autolevel-raykholo.c9users.io/widget.html"
namestring"Widget / Auto-Level"
descstring"Allows you to auto-level your PCB before milling. Most raw PCB boards have a slight warpage. This widget lets you probe the warpage and then it auto-scales your Gcode to match the warpage so you get very clean/predictable z-positions in your milling job."
publishobjectPlease see docs above.
subscribeobjectPlease see docs above.
foreignPublishobjectPlease see docs above.
foreignSubscribeobjectPlease see docs above.
initfunctionfunction ()
showDatafunctionfunction ()
loadTextfunctionfunction ()
deleteRecentFilesfunctionfunction ()
createRecentFileEntryfunctionfunction (fileStr, info)
buildRecentFileMenufunctionfunction ()
loadFileFromLocalStorageKeyfunctionfunction (key)
loadTestDatafunctionfunction (data)
matrixobject
previousLayerOpacitiesobject
toggleShowMatrixfunctionfunction ()
isMatrixShowingboolean
showProbeMatrixfunctionfunction ()
hideProbeMatrixfunctionfunction ()
refreshProbeMatrixfunctionfunction ()
isFadeOutUserObjectboolean
fadeOutUserObjectfunctionfunction ()
unfadeOutUserObjectfunctionfunction ()
sendGcodeToWorkspacefunctionfunction ()
envelopeViewfunctionfunction (evt, opts)
autolevelledGcodeobject
envelopefunctionfunction (options)
getUnitMeshfunctionfunction ()
rayCastfunctionfunction ()
exaggerateMultnumber
setExaggeratefunctionfunction (evt)
probeMeshobject
drawMatrixfunctionfunction ()
removeMatrixfunctionfunction ()
onDisplayfunctionfunction ()
onUndisplayfunctionfunction ()
runTestProbefunctionfunction ()
startAutoLevelfunctionfunction ()
stopAutoLevelfunctionfunction ()
formUpdatefunctionfunction ()
probesobject
maxxobject
maxyobject
genProbeGcodefunctionfunction ()
modalCompletefunctionfunction ()
genProbeStepsfunctionfunction ()
currentStepobject
isPausedboolean
pausefunctionfunction ()
doNextStepfunctionfunction ()
probeResponsefunctionfunction (result)
sendfunctionfunction (gcode)
statElobject
statusfunctionfunction (txt)
zsettingsobject
modalStartfunctionfunction ()
autoFillDatafunctionfunction ()
user3dObjectobject
recv3dObjectfunctionfunction (obj)
get3dObjectFrom3dViewerfunctionfunction ()
bboxHelperobject
getBboxfunctionfunction ()
calcStepsfunctionfunction ()
toggleProbeAreafunctionfunction ()
regionObjobject
isRegionShowingboolean
addRegionTo3dfunctionfunction ()
removeRegionFrom3dfunctionfunction ()
makeSpritefunctionfunction (vals)
makeSpriteOldfunctionfunction (vals)
makeSprite2functionfunction (vals)
createTextfunctionfunction (text)
forkSetupfunctionfunction ()

About ChiliPeppr

ChiliPeppr is a hardware fiddle, meaning it is a website that lets you easily create a workspace to fiddle with your hardware from software. ChiliPeppr provides a Serial Port JSON Server that you run locally on your computer, or remotely on another computer, to connect to the serial port of your hardware like an Arduino or other microcontroller.

You then create a workspace at ChiliPeppr.com that connects to your hardware by starting from scratch or forking somebody else's workspace that is close to what you are after. Then you write widgets in Javascript that interact with your hardware by forking the base template widget or forking another widget that is similar to what you are trying to build.

ChiliPeppr is massively capable such that the workspaces for TinyG and Grbl CNC controllers have become full-fledged CNC machine management software used by tens of thousands.

ChiliPeppr has inspired many people in the hardware/software world to use the browser and Javascript as the foundation for interacting with hardware. The Arduino team in Italy caught wind of ChiliPeppr and now ChiliPeppr's Serial Port JSON Server is the basis for the Arduino's new web IDE. If the Arduino team is excited about building on top of ChiliPeppr, what will you build on top of it?