4.21.3.1. Adding buttons to the user interface

Buttons must be subject to /libs/pappserver/webapps/3dfindit-enterprise/custom_config.json .

[Note]Note

Changes must be placed under "$CADENAS_SITESETUP/3df/custom_config.json" (from V12.6).

Default configuration and additional code are merged.

When you update, save the file "custom_config.json" before or place them under $CADENAS_SITESETUP/3df. The file should only contain the changes.

The configuration file contains a main section with some default settings for 3Dfindit and then a toolbars section.

A toolbar button can be displayed above the table or above the 3D view. This is defined in the items viewer / table.

The buttons themselves and their functionality are defined in the Buttons section. Each button has a type that is either JS or VBS:

  • JS is executed directly in the browser. It can only access browser functions, e.g. call other websites or APIs.

  • VBS is executed on the server side and in the AppServer environment.

Each button has an icon and a name.

{
  "baseApiPath": "",
  "basename": "/webapps/3dfindit-enterprise",
  "erp": true,
  "startRoute": "CadBim",
  "isEnterprise": true,

  "toolbars": {
    "viewer": ["exampleButton"],
    "table": ["exampleVBSButton"],
    "buttons": {
      "exampleButton": {
        "type": "JS",
        "name": {
          "de-DE": "JS Beispiel",
          "en-GB": "JS Example"
        },
        "callback": "onExampleButtonClicked",
        "icon": "images/bell-solid.svg",
        "tooltip": {
          "de-DE": "JS Beispiel",
          "en-GB": "JS Example"
        }
      },
      "exampleVBSButton": {
        "type": "VBS",
        "icon": "images/bell-solid.svg",
        "name": {
          "de-DE": "VBS Beispiel",
          "en-GB": "VBS Example"
        },
        "script": "/plugins/vbb/wstest.vbs",
        "requestFromPdm": "currentuser",
        "tooltip": {
          "de-DE": "VBS Beispiel",
          "en-GB": "VBS Example"
        }
      }
    }
  }
}

Example result when using the above codeVBS-Example" button JS-Example" button

Example result when using the above code

Starting with V12.9 there are more possibilities. Buttons can also be added in the main bar and in the search results area (different if there are results or not).

  • In the main bar:

    Buttons in main bar

    Buttons in main bar

  • Above the search results:

    Buttons above the search results

    Buttons above the search results

  • In the search results area for existing results:

    Buttons in the search results area

    Buttons in the search results area

  • In the context menu of search results

    {
      "baseApiPath": "",
      "basename": "/webapps/3dfindit-enterprise/",
      "erp": true,
      "startRoute": "CadBim",
      "isEnterprise": true,
    
      "toolbars": {
        "viewer": ["exampleButton"],
        "table": ["exampleVBSButton"],
        "searchResultsContextMenu": ["exampleButton", "exampleVBSButton"],
        "buttons": {
          "exampleButton": {
            "type": "JS",
            "name": {
              "de-DE": "JS Beispiel",
              "en-GB": "JS Example"
            },
            "callback": "onExampleButtonClicked",
            "icon": "images/bell-solid.svg",
            "tooltip": {
              "de-DE": "JS Beispiel",
              "en-GB": "JS Example"
            }
          },
          "exampleVBSButton": {
            "type": "VBS",
            "icon": "images/bell-solid.svg",
            "name": {
              "de-DE": "VBS Beispiel",
              "en-GB": "VBS Example"
            },
            "script": "/plugins/vbb/wstest.vbs",
            "requestFromPdm": "currentuser",
            "tooltip": {
              "de-DE": "VBS Beispiel",
              "en-GB": "VBS Example"
            }
          }
        }
      }
    }
    Buttons in the context menu of search results

    Buttons in the context menu of search results

In the following code example, the new options are marked in blue.

{
  "defaultLoginMethod": "openid"
  
  "baseApiPath": "",
  "basename": "/webapps/3dfindit-enterprise",
  "erp": true,
  "startRoute": "CadBim",
  "isEnterprise": true,
  
  "toolbars": {
    "viewer": ["exampleButton"],
    "table": ["exampleVBSButton"],

    "mainMenuIcon": "./plugins/img/3dFinditEyeColor.svg",
    "mainMenu": [
      ["customButton1_Group1", "customButton2_Group1", "customButton3_Group1"],
      ["customButton1_Group2", "customButton2_Group2", "customButton3_Group2"]
    ],
    "noResults": ["customButton1", "customButton2", "customButton3"],
    "searchResults": ["customButton1", "customButton2", "customButton3"],

    "buttons": {
      "customButton1_Group1": {
        "type": "VBS",
        "icon": "./plugins/img/3dFinditEyeColor.svg",
        "name": {
          "de-DE": "custom button 1 de",
          "en-GB": "custom button 1 en"
        },
        "script": "/plugins/vbb/custom1_startup.vbs",
        "tooltip": {
          "de-DE": "custom button 1 de",
          "en-GB": "custom button 1 en"
        }
      },
      "customButton2_Group1": {
        "type": "VBS",
        "icon": "./plugins/img/3dFinditEyeColor.svg",
        "name": {
          "de-DE": "custom button 2 de",
          "en-GB": "custom button 2 en"
        },
        "script": "/plugins/vbb/custom2_startup.vbs",
        "tooltip": {

Complete example: The illustrations above show an example of the result.

{
  "defaultLoginMethod": "openid"
  
  "baseApiPath": "",
  "basename": "/webapps/3dfindit-enterprise",
  "erp": true,
  "startRoute": "CadBim",
  "isEnterprise": true,
  
  "toolbars": {
    "viewer": ["exampleButton"],
    "table": ["exampleVBSButton"],

    "mainMenuIcon": "./plugins/img/3dFinditEyeColor.svg",
    "mainMenu": [
      ["customButton1_Group1", "customButton2_Group1", "customButton3_Group1"],
      ["customButton1_Group2", "customButton2_Group2", "customButton3_Group2"]
    ],
    "noResults": ["customButton1", "customButton2", "customButton3"],
    "searchResults": ["customButton1", "customButton2", "customButton3"],

    "buttons": {
      "exampleButton": {
        "type": "JS",
        "name": {
          "de-DE": "JS Beispiel",
          "en-GB": "JS Example"
        },
        "callback": "onExampleButtonClicked",
        "icon": "images/bell-solid.svg",
        "tooltip": {
          "de-DE": "JS Beispiel",
          "en-GB": "JS Example"
        }
      },
      "exampleVBSButton": {
        "type": "VBS",
        "icon": "images/bell-solid.svg",
        "name": {
          "de-DE": "VBS Beispiel",
          "en-GB": "VBS Example"
        },
        "script": "/plugins/vbb/wstest.vbs",
        "requestFromPdm": "currentuser",
        "tooltip": {
          "de-DE": "VBS Beispiel",
          "en-GB": "VBS Example"
        }
      },

      "customButton1_Group1": {
        "type": "VBS",
        "icon": "./plugins/img/3dFinditEyeColor.svg",
        "name": {
          "de-DE": "custom button 1 de",
          "en-GB": "custom button 1 en"
        },
        "script": "/plugins/vbb/custom1_startup.vbs",
        "tooltip": {
          "de-DE": "custom button 1 de",
          "en-GB": "custom button 1 en"
        }
      },
      "customButton2_Group1": {
        "type": "VBS",
        "icon": "./plugins/img/3dFinditEyeColor.svg",
        "name": {
          "de-DE": "custom button 2 de",
          "en-GB": "custom button 2 en"
        },
        "script": "/plugins/vbb/custom2_startup.vbs",
        "tooltip": {
          "de-DE": "custom button 2 de",
          "en-GB": "custom button 2 en"
        }
      },
      "customButton3_Group1": {
        "type": "VBS",
        "icon": "./plugins/img/3dFinditEyeColor.svg",
        "name": {
          "de-DE": "custom button 3 de",
          "en-GB": "custom button 3 en"
        },
        "script": "/plugins/vbb/custom1_startup.vbs",
        "tooltip": {
          "de-DE": "custom button 3 de",
          "en-GB": "custom button 3 en"
        }
      },

      "customButton1_Group2": {
        "type": "VBS",
        "icon": "./plugins/img/3dFinditEyeColor.svg",
        "name": {
          "de-DE": "custom button 1 de",
          "en-GB": "custom button 1 en"
        },
        "script": "/plugins/vbb/custom1_startup.vbs",
        "tooltip": {
          "de-DE": "custom button 1 de",
          "en-GB": "custom button 1 en"
        }
      },
      "customButton2_Group2": {
        "type": "VBS",
        "icon": "./plugins/img/3dFinditEyeColor.svg",
        "name": {
          "de-DE": "custom button 2 de",
          "en-GB": "custom button 2 en"
        },
        "script": "/plugins/vbb/custom2_startup.vbs",
        "tooltip": {
          "de-DE": "custom button 2 de",
          "en-GB": "custom button 2 en"
        }
      },
      "customButton3_Group2": {
        "type": "VBS",
        "icon": "./plugins/img/3dFinditEyeColor.svg",
        "name": {
          "de-DE": "custom button 3 de",
          "en-GB": "custom button 3 en"
        },
        "script": "/plugins/vbb/custom1_startup.vbs",
        "tooltip": {
          "de-DE": "custom button 3 de",
          "en-GB": "custom button 3 en"
        }
      },

      "customButton1": {
        "type": "VBS",
        "icon": "./plugins/img/3dFinditEyeColor.svg",
        "name": {
          "de-DE": "custom button 1 de",
          "en-GB": "custom button 1 en"
        },
        "script": "/plugins/vbb/custom1_startup.vbs",
        "tooltip": {
          "de-DE": "custom button 1 de",
          "en-GB": "custom button 1 en"
        }
      },
      "customButton2": {
        "type": "VBS",
        "icon": "./plugins/img/3dFinditEyeColor.svg",
        "name": {
          "de-DE": "custom button 2 de",
          "en-GB": "custom button 2 en"
        },
        "script": "/plugins/vbb/custom2_startup.vbs",
        "tooltip": {
          "de-DE": "custom button 2 de",
          "en-GB": "custom button 2 en"
        }
      },
      "customButton3": {
        "type": "VBS",
        "icon": "./plugins/img/3dFinditEyeColor.svg",
        "name": {
          "de-DE": "custom button 3 de",
          "en-GB": "custom button 3 en"
        },
        "script": "/plugins/vbb/custom1_startup.vbs",
        "tooltip": {
          "de-DE": "custom button 3 de",
          "en-GB": "custom button 3 en"
        }
    }
  }
}
}