Quick Design Advanced

Requiring Files#

With the "Upload New Local Calc Pack" option files located in the directories called json and utils will also be uploaded so that they can be required in your calculate.js on the server. The goal of this functionality it to encourage reusability of code and to help keep large calc packs maintainable. An example of how these folders must be structured is found in the image below.

Requiring JSON Files#

Files in the json directory must all have the extension .json. These files can be required in the calculate.js with the global requireJSON(filename) function.

Import Example#

const data = requireJSON('data.json');

Requiring JavaScript Files#

Files in the utils directory must all have the extension .js. These files can be required in the calculate.js with the global requireUtil(filename) function. These files will need to contain functions that are exported with module.exports so that they can be executable in the calculate.js.

Export Example#

module.exports = {
'foo': function (bar) {
return bar.toLowerCase();
}
}

Import Example#

const utils = requireUtil('util.js');

Calling other Quick Designs#

You can call Quick Design calculators from within your own calculate.js to allow you to chain multiple tools together.

Example

module.exports = async function (input_json) {
const uid = '1002-column-buckling-calculator';
const calc_json = {
"support_conditions": "Fixed - Fixed",
"L": 1,
"A": 4000,
"I": 200000,
"E": 200000,
"sigma_y": 260
};
let res = await callQDCalculator(uid, calc_json);
logger(JSON.stringify(await res));
//export your results to view in the UI
var output = {
'report': REPORT,
'results': {}
}
return output;
};