Giter VIP home page Giter VIP logo

widget-eagle-soldermask's Introduction

com-chilipeppr-widget-eagle-soldermask

This add-on widget is a tab for the Eagle BRD widget that helps you generate a solder mask.

alt text

ChiliPeppr Widget Add-On / Eagle Solder Mask

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-eagle-soldermask
Name Widget Add-On / Eagle Solder Mask
Description This add-on widget is a tab for the Eagle BRD widget that helps you generate a solder mask.
chilipeppr.load() URL http://raw.githubusercontent.com/chilipeppr/widget-eagle-soldermask/master/auto-generated-widget.html
Edit URL http://ide.c9.io/chilipeppr/widget-eagle-soldermask
Github URL http://github.com/chilipeppr/widget-eagle-soldermask
Test URL https://preview.c9users.io/chilipeppr/widget-eagle-soldermask/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.

chilipeppr.load(
  "#myDivWidgetInsertedInto",
  "http://raw.githubusercontent.com/chilipeppr/widget-eagle-soldermask/master/auto-generated-widget.html",
  function() {
    // Callback after widget loaded into #myDivWidgetInsertedInto
    cprequire(
      ["inline:com-chilipeppr-widget-eagle-soldermask"], // the id you gave your widget
      function(mywidget) {
        // Callback that is passed reference to your newly loaded widget
        console.log("My widget just got loaded.", mywidget);
        mywidget.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-eagle-soldermask/com-chilipeppr-widget-3dviewer/request3dObjectWe need to work with the 3D Viewer and inject content, so by sending out this signal the 3D viewer hears it and sends us back a /recv3dObject with the payload.

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-eagle-soldermask/com-chilipeppr-widget-eagle/addGcodeThis add-on subscribes to this signal so we can inject our own Gcode into the overall Eagle Widget gcode.
/com-chilipeppr-widget-eagle-soldermask/com-chilipeppr-widget-3dviewer/recv3dObjectWe need to get the 3D Viewer so we can inject stuff into it. We must subscribe to this so when we call /request3dObject we get this signal back with the payload of the viewer.

Methods / Properties

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

Method / Property Type Description
idstring"com-chilipeppr-widget-eagle-soldermask"

The ID of the widget. You must define this and make it unique.
namestring"Widget Add-On / Eagle Solder Mask"
descstring"This add-on widget is a tab for the Eagle BRD widget that helps you generate a solder mask."
urlstring"http://raw.githubusercontent.com/chilipeppr/widget-eagle-soldermask/master/auto-generated-widget.html"
fiddleurlstring"http://ide.c9.io/chilipeppr/widget-eagle-soldermask"
githuburlstring"http://github.com/chilipeppr/widget-eagle-soldermask"
testurlstring"http://widget-eagle-soldermask-chilipeppr.c9users.io/widget.html"
publishobjectPlease see docs above.

Define the publish signals that this widget/element owns or defines so that other widgets know how to subscribe to them and what they do.
subscribeobjectPlease see docs above.

Define the subscribe signals that this widget/element owns or defines so that other widgets know how to subscribe to them and what they do.
foreignPublishobjectPlease see docs above.

Document the foreign publish signals, i.e. signals owned by other widgets or elements, that this widget/element publishes to.
foreignSubscribeobjectPlease see docs above.

Document the foreign subscribe signals, i.e. signals owned by other widgets or elements, that this widget/element subscribes to.
eagleWidgetobjectHolds the reference to the main Eagle Widget that we are an add-on for.
initfunctionfunction (eagleWidget)

All widgets should have an init method. It should be run by the instantiating code like a workspace or a different widget.
injectTabfunctionfunction ()

Inject the solder mask tab into the Eagle Brd Widget
isTabShowingboolean
mask3dobjectHolds the solder mask 3d object that we show in the 3D viewer.
onTabShownfunctionfunction ()

When the user clicks to activate our tab, this event is called.
onTabHidefunctionfunction ()

When the user clicks a different tab and this one gets hidden.
showTabfunctionfunction ()

Programatically show the tab from code rather than waiting for user to click.
drawSolderMaskfunctionfunction ()

Iterate through the Eagle BRD dimensions XY coordinates and draw a solder mask over the board.
subscribeToAddGcodeSignalfunctionfunction ()

We subscribe to the main Eagle Widget's addGcode publish signal so that we can inject our own Gcode to the main widget.
onAddGcodefunctionfunction (addGcodeCallback, gcodeParts, eagleWidget, helpDesc)

This is our callback that gets called when the /com-chilipeppr-widget-eagle/addGcode signal is published by the main Eagle Widget. This is where we get to actually inject our own Gcode to the final overall Gcode.
exportGcodeSoldermaskfunctionfunction (eagleWidget)

Generate the gcode for the solder mask
get3dObjfunctionfunction (callback)
get3dObjCallbackfunctionfunction (data, meta)
mySceneGroupobject
sceneAddfunctionfunction (obj)
sceneRemovefunctionfunction (obj)
optionsobjectUser options are available in this property for reference by your methods. If any change is made on these options, please call saveOptionsLocalStorage()
setupUiFromLocalStoragefunctionfunction ()

Call this method on init to setup the UI by reading the user's stored settings from localStorage and then adjust the UI to reflect what the user wants.
saveOptionsLocalStoragefunctionfunction ()

When a user changes a value that is stored as an option setting, you should call this method immediately so that on next load the value is correctly set.
forkSetupfunctionfunction ()

This method loads the pubsubviewer widget which attaches to our upper right corner triangle menu and generates 3 menu items like Pubsub Viewer, View Standalone, and Fork Widget. It also enables the modal dialog that shows the documentation for this widget.

By using chilipeppr.load() we can ensure that the pubsubviewer widget is only loaded and inlined once into the final ChiliPeppr workspace. We are given back a reference to the instantiated singleton so its not instantiated more than once. Then we call it's attachTo method which creates the full pulldown menu for us and attaches the click events.

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?

widget-eagle-soldermask's People

Contributors

chilipeppr avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.