Overview


Custom Commands are designed to help you integrate the tool into your own processes.  You can launch web pages or use data from the tool to create customized functionality on your website.

  • Generate a quote.
  • Use the tool as a step in a configurator.
  • Send data about layouts to a database for analysis later.
  • etc.


Custom Commands allow you to:

  • Navigate to a web page (in a new or existing window).
  • Send POST data to a web page (in a new or existing window).
  • Send POST data to an API (no browser navigation).


Custom Commands can be triggered by the user.

  • Buttons

Add buttons to the toolbar with custom icon and text.

  • After Share

Take action immediately after a layout is shared.

  • After Print

Take action immediately after a layout is printed.

  • Help Override

Override the help command to provide your own documentation/process instead of using the default instructions provided by Lighting Analysts.


Luxiflux Area

Luxiflux Zonal

  • See example input and comments.
  • There is no demo for Luxiflux Zonal, but the functionality is identical to Luxiflux Area.
  • Custom Commands are only available with JSON (not XML) input.


Technical Details


POST data to an API.

  • Works as expected (just like a typical POST to a typical API).


POST data to a web page (in a new or existing window).

  • Since POST can only be done to a server (not a client web page) an alternate method is employed.
  • Instead of posting the data directly (like an API), an HTML form is launched (in a new or existing window) with an input named "json".
  • The HTML form is then immediately submitted (to the server) via the POST method to the command URL.
  • The command URL should return an HTML web page as a response.
  • You will need to retrieve the text from the "json" field and parse it into JSON to consume it as you would in an API.


// Code that is used by Luxiflux tools to POST data 
// to a new or existing window via an HTML form.

PostWindow(url, target, data) {
    const form = document.createElement("form");
    form.action = url;
    form.target = target;
    form.method = "POST";
    form.enctype = "text/plain"
    form.style.display = "none";

    const text = JSON.stringify(data);

    const input = document.createElement("textarea");
    input.name = "json";
    input.value = text;
    form.appendChild(input);

    document.body.appendChild(form);
    form.submit();
    document.body.removeChild(form);
}