Config File

The config.json file is an essential component of developing a Quick Design framework. This file contains both meta information that describes the calculator as well as input variable information that describes the inputs available in your calculator.

The config.json file serves as the foundation for your calculator's user interface which is generated directly from the file. You can customize the layout, appearance, and input variables of your calculator by editing the information provided in the config.json file.

Layout#

The config.json file uses the JSON file format. At a high level the config starts with the following layout.

{
"meta": {
},
"input_variables": {
}
}

Meta Information#

The meta information is used to both describe the calculator as well as configure certain settings like access control.

KeyRequiredType
nameTRUEString
short_descriptionTRUEString
long_descriptionTRUEString
tagsTRUEComma Separated String
accessTRUEpublic | private
s3d_integratedFALSEBoolean
contactTRUEObject

Contact Objet#

When developing a calculator in the SkyCiv software framework, you may wish to provide information about the calculator's developer.

This is where the contact object comes into play. The contact object is an optional object that can be included in your calculator to display information about the developer. Specifically, this information is displayed in the 'View Module Info' option.

At a minimum this object must be include the email key. If no logo is included the SkyCiv Logo will be used.

{
"email": "Your Email",
"name": "Your Name",
"role": "Your Role",
"company": "Your Company",
"logo": "Logo URL"
}

Input Variable Information#

The input_variable object contains a set of nested objects that are used to build the input form of your calculator. Essentially, you can think of this part of the calculator as a form builder.

Each element in the form is represented by a separate object within the input_variable object. The key of each object represents the name of the related input variable. These elements appear in the user interface in the same order as they are listed in the JSON.

By specifying the necessary information in the input_variable object, you can create a user-friendly input form for your calculator. You can customize each input element, including its label, data type, default value, and other attributes.

Input Elements#

Input elements allow they user to interact and adjust sections the element in the calculator's user interface.

Number Element Example#
"section_width": {
"type": "number",
"label": "Section Width",
"symbol": "S_{W}", //optional, but looks better on reports
"units": "mm",
"info": "The width of the section.",
"default": 12,
"min": 3, //used in validation
"max": 400,
"step": 1, //increments the input by this number
"class": "section-width",
"nullable": true
}
//additional keys:
"exclude_from_input_table": true //will hide the input from your main input table
"hide_info_tip_in_input_table": true //will hide the info tips from the input table
Text Element Example#
"text_input": {
"type": "text",
"label": "Text Input",
"default": "Some Text"
}
Checkbox Element Example#
"checkbox_value": {
"type": "checkbox",
"label": "My Checkbox",
"default": false
}
Dropdown Element Example#
"dropdown_value": {
"type": "dropdown",
"label": "Dropdown Input",
"default": "Yes",
"options": [
{
"selected": true,
"value": "maybe",
"name": "Maybe"
},
{
"selected": true,
"value": "no",
"name": "No"
},
{
"value": "yes",
"name": "Yes"
}
]
}

S3D Section Object#

[S3D Integration Only] This will pass through the Section Object from your S3D model

"s3d_section": {
"type": "s3d_section",
"label": "Section ID",
"info": "Section Object imported from S3D model"
}

Visual Elements#

Visual elements are parts of the input form use to display information or improve the layout of the form.

Image Element Example#
"image": {
"type": "image",
"width": "50%",
"src": "https://skyciv.com/wp-content/uploads/2022/06/SkyCiv_Logo_NoTagline_Dark.png.webp",
"info": "SkyCiv Logo"
}
Heading Element Example#
"heading_1": {
"type": "heading",
"label": "My Heading"
}
Canvas Element Example#
"canvas": {
"type": "canvas",
"id": "ui-canvas"
},
Div Element Example#
"div": {
"type": "div",
"id": "ui-div"
},
Visibility Options#

This option allows users to show/hide certain parameters based on another field's input. For instance, if you have a dropdown to choose a shape, and want to show different inputs for circular VS rectangular, you can use use the visible_variables key:

"shape": {
"label": "Shape",
"s3d_only": true,
"type": "dropdown",
"options": [
{
"value": "circular",
"name": "Circular"
},
{
"selected": true,
"value": "hollow rectangular",
"name": "Hollow Rectangular"
}
],
"visible_variables": {
"custom": [
["show", "rect_image"],
["show", "shape-dimensions"],
["show", ".circular-input"]
],
"hollow rectangular": [
["show", "rect_image"],
["show", "b"],
["show", "d"],
["show", "t1"],
["show", "t2"],
["hide", ".circular-input"]
]
}
}

You can choose to show/hide based on the following options:

  • ["show", "all"] - will show all input variables
  • ["show", "section_width"] - will show the specific input section_width
  • ["show", ".circular-input"] - will show all inputs that have the class "circular-input"
tip

Want to add dynamic user interface elements like charts and drawings that can be updated based on user input? The canvas and div elements are perfect for the job, controlled from your ui.js file.

Template#

{
"meta": {
"name": "My First Calculator",
"short_description": "A sample meta object.",
"long_description": "A sample meta object to help developers get started with the quick design config.",
"tags": "example, draft",
"access": "public",
"contact": {
"name": "SkyCiv",
"role": "Software Developer",
"email": "[email protected]",
"company": "SkyCiv",
"logo": "https://skyciv.com/media/logos/logo-pack/SkyCiv_Logo_Dark_Poweredby.png",
}
},
"input_variables": {
"canvas": {
"type": "canvas",
"id": "ui-canvas"
},
"num": {
"type": "number",
"label": "Number A",
"units": "m",
"default": 4,
"min": 0,
"max": 1000
},
"text_a": {
"type": "text",
"label": "Text Input",
"default": "Some Text"
}
}
}