# VIKTOR Documentation > VIKTOR is a low-code platform for building and sharing engineering applications with Python. This documentation covers how to create, publish, and maintain VIKTOR apps using the Python SDK. ## docs ### api API - [VIKTOR API](https://docs.viktor.ai/docs/api.md): API #### sdk API - [SDK API](https://docs.viktor.ai/docs/api/sdk.md): API ##### handling-entity-data Read, create and modify entity data using the SDK API - [Handling entity data](https://docs.viktor.ai/docs/api/sdk/handling-entity-data.md): Read, create and modify entity data using the SDK API ##### running-entity-computation Run an entity computation using the SDK API - [Running an entity computation](https://docs.viktor.ai/docs/api/sdk/running-entity-computation.md): Run an entity computation using the SDK API ### app-builder Create apps in minutes using our AI-assisted App Builder - [App Builder](https://docs.viktor.ai/docs/app-builder.md): Create apps in minutes using our AI-assisted App Builder #### choosing-development-approach Compare the App Builder and local development using your preferred IDE and viktor-cli to choose the right approach for your VIKTOR app - [Two ways to build a VIKTOR app](https://docs.viktor.ai/docs/app-builder/choosing-development-approach.md): Compare the App Builder and local development using your preferred IDE and viktor-cli to choose the right approach for your VIKTOR app ### create-apps Develop apps - [Develop apps](https://docs.viktor.ai/docs/create-apps.md): Develop apps #### automated-testing Continuous testing using automated tests - [Automated testing](https://docs.viktor.ai/docs/create-apps/automated-testing.md): Continuous testing using automated tests ##### mocking How to use Mocking in tests - [Mocking](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking.md): How to use Mocking in tests #### development-tools-and-tips ##### ci Setting up CI/CD for automated testing/deploying of your VIKTOR app on the remote Git repository - [Continuous integration / deployment](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/ci.md): Setting up CI/CD for automated testing/deploying of your VIKTOR app on the remote Git repository ##### environment-variables Configuring app secrets through custom environment variables - [Environment variables](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/environment-variables.md): Configuring app secrets through custom environment variables ##### ide Configuring your favorite code editor for writing apps with VIKTOR - [Setting up code editor](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/ide.md): Configuring your favorite code editor for writing apps with VIKTOR ##### interactive-debugging Setting up and using interactive debugging in your code editor - [Interactive debugging](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging.md): Setting up and using interactive debugging in your code editor ##### keep-a-changelog Tracking app changes and versions by keeping a changelog - [Keeping a changelog](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/keep-a-changelog.md): Tracking app changes and versions by keeping a changelog ##### private-packages Use private packages in your published app - [Private packages](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/private-packages.md): Use private packages in your published app ##### system-dependencies Use system packages in your published app - [System dependencies](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/system-dependencies.md): Use system packages in your published app ##### use-python-packages Add Python packages to requirements.txt - [Using python packages](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/use-python-packages.md): Add Python packages to requirements.txt #### documents-and-spreadsheets Documents & spreadsheets - [Documents & spreadsheets](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets.md): Documents & spreadsheets ##### converting-to-pdf Converting Word, Excel or SVG files to PDF - [Converting to PDF](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/converting-to-pdf.md): Converting Word, Excel or SVG files to PDF ##### merging-pdf-files Merging PDFs into a single file - [Merging PDF files](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/merging-pdf-files.md): Merging PDFs into a single file ##### spreadsheet-calculator Performing a calculation using a spreadsheet without macros - [Spreadsheet calculator](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/spreadsheet-calculator.md): Performing a calculation using a spreadsheet without macros ##### spreadsheet-templater Filling a spreadsheet from a template - [Spreadsheet templater](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/spreadsheet-templater.md): Filling a spreadsheet from a template ##### text-file-templater Generating a text-file by filling variables in a template - [Text-file templater](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/text-file-templater.md): Generating a text-file by filling variables in a template ##### word-file-templater Filling a Word-file from a template - [Word-file templater](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/word-file-templater.md): Filling a Word-file from a template #### inform-end-user ##### dashboard Show a welcome text on the dashboard - [Dashboard welcome text](https://docs.viktor.ai/docs/create-apps/inform-end-user/dashboard.md): Show a welcome text on the dashboard ##### output-field Add an output field to the parametrization - [Output field](https://docs.viktor.ai/docs/create-apps/inform-end-user/output-field.md): Add an output field to the parametrization ##### show-message Raising an error or showing a message to the user - [Show a message to the user](https://docs.viktor.ai/docs/create-apps/inform-end-user/show-message.md): Raising an error or showing a message to the user ##### static-image Add static images to the parametrization - [Static image](https://docs.viktor.ai/docs/create-apps/inform-end-user/static-image.md): Add static images to the parametrization ##### text-blocks Add static text blocks to the parametrization - [Text blocks](https://docs.viktor.ai/docs/create-apps/inform-end-user/text-blocks.md): Add static text blocks to the parametrization ##### tooltips Tooltips - [Tooltips](https://docs.viktor.ai/docs/create-apps/inform-end-user/tooltips.md): Tooltips #### layout-and-styling Layout & styling - [Layout & styling](https://docs.viktor.ai/docs/create-apps/layout-and-styling.md): Layout & styling ##### adjust-parametrization-width Adjust the parametrization width - [Adjust the parametrization width](https://docs.viktor.ai/docs/create-apps/layout-and-styling/adjust-parametrization-width.md): Adjust the parametrization width ##### dashboard Dashboard - [Dashboard](https://docs.viktor.ai/docs/create-apps/layout-and-styling/dashboard.md): Dashboard ##### entity-navigation Navigation inside an app - [Navigation inside an app](https://docs.viktor.ai/docs/create-apps/layout-and-styling/entity-navigation.md): Navigation inside an app ##### manual-line-break Add a manual line break between fields in the parametrization - [Manual line break](https://docs.viktor.ai/docs/create-apps/layout-and-styling/manual-line-break.md): Add a manual line break between fields in the parametrization ##### pages Organizing the editor using pages - [Creating pages](https://docs.viktor.ai/docs/create-apps/layout-and-styling/pages.md): Organizing the editor using pages ##### steps Dictate a workflow in the editor using steps - [Creating steps](https://docs.viktor.ai/docs/create-apps/layout-and-styling/steps.md): Dictate a workflow in the editor using steps ##### style-text Style text using Markdown - [Style / format text using Markdown](https://docs.viktor.ai/docs/create-apps/layout-and-styling/style-text.md): Style text using Markdown ##### tabs-and-sections Organizing the editor using tabs & sections - [Creating tabs & sections](https://docs.viktor.ai/docs/create-apps/layout-and-styling/tabs-and-sections.md): Organizing the editor using tabs & sections #### managing-files How to use the correct method for your file - [Managing files](https://docs.viktor.ai/docs/create-apps/managing-files.md): How to use the correct method for your file ##### downloading-files Handling downloading of files by the user - [Downloading files](https://docs.viktor.ai/docs/create-apps/managing-files/downloading-files.md): Handling downloading of files by the user ##### modify-files How to use the correct method for your file - [Modifying files](https://docs.viktor.ai/docs/create-apps/managing-files/modify-files.md): How to use the correct method for your file ##### uploading-files Handling uploading of files by the user - [Uploading files](https://docs.viktor.ai/docs/create-apps/managing-files/uploading-files.md): Handling uploading of files by the user #### mcp Let an external AI agent discover and run your VIKTOR apps as tools over the Model Context Protocol - [Connect agents to your apps via MCP [BETA]](https://docs.viktor.ai/docs/create-apps/mcp.md): Let an external AI agent discover and run your VIKTOR apps as tools over the Model Context Protocol #### other-topics ##### date-dependent-params Using date-dependent params - [Using date-dependent params](https://docs.viktor.ai/docs/create-apps/other-topics/date-dependent-params.md): Using date-dependent params ##### processing-gef-files Using off-the-shelve geotechnical functions from the viktor.geo module - [Processing GEF files](https://docs.viktor.ai/docs/create-apps/other-topics/processing-gef-files.md): Using off-the-shelve geotechnical functions from the viktor.geo module ##### share-using-api Share data between entities using the API - [Share data between entities using the API](https://docs.viktor.ai/docs/create-apps/other-topics/share-using-api.md): Share data between entities using the API #### results-and-visualizations Show results and create visualizations - [Results & visualizations](https://docs.viktor.ai/docs/create-apps/results-and-visualizations.md): Show results and create visualizations ##### autodesk Visualize an Autodesk model from cloud storage in a view - [Visualize Autodesk model](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/autodesk.md): Visualize an Autodesk model from cloud storage in a view ##### data-and-tables Present data and tables in a view - [Show data & tables](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/data-and-tables.md): Present data and tables in a view ##### hide-view Hide a view depending on other fields - [Hide a view](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/hide-view.md): Hide a view depending on other fields ##### html Show HTML (web) content in a view - [Show HTML](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/html.md): Show HTML (web) content in a view ##### images Show an image in a view - [Show an image](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/images.md): Show an image in a view ##### map Displaying features on a map - [Display a map](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map.md): Displaying features on a map ##### optimization-routine Perform an optimization routine using the OptimizationButton - [Perform an optimization routine](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/optimization-routine.md): Perform an optimization routine using the OptimizationButton ##### plots-charts-graphs Show plots, charts & graphs in a view - [Show plots, charts & graphs](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/plots-charts-graphs.md): Show plots, charts & graphs in a view ##### report Display a report in a view - [Display a report](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/report.md): Display a report in a view ##### show-summary Summarizing an entity - [Show a summary](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/show-summary.md): Summarizing an entity ##### storing-results Storing results - [Storing results](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/storing-results.md): Storing results ##### threed-model Show a geometric 3D model in a view - [Show a 3D model](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model.md): Show a geometric 3D model in a view #### software-integrations VIKTOR's integrations with 3rd party software - [Types of integrations](https://docs.viktor.ai/docs/create-apps/software-integrations.md): VIKTOR's integrations with 3rd party software ##### autocad This guide explains how to drive AutoCAD from a VIKTOR app through the AutoCAD ActiveX Automation API. - [AutoCAD](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad.md): This guide explains how to drive AutoCAD from a VIKTOR app through the AutoCAD ActiveX Automation API. ##### autodesk-construction-cloud Integration with Autodesk Construction Cloud - [Autodesk Construction Cloud](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-construction-cloud.md): Integration with Autodesk Construction Cloud ##### autodesk-forma-site-design Connect a VIKTOR app to Autodesk Forma Site Design through Autodesk Platform Services - [Autodesk Forma Site Design](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-forma-site-design.md): Connect a VIKTOR app to Autodesk Forma Site Design through Autodesk Platform Services ##### autodesk-platform-services Connecting to Autodesk Platform Services using OAuth 2.0 - [Autodesk Platform Services](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-platform-services.md): Connecting to Autodesk Platform Services using OAuth 2.0 ##### axisvm Creating and running an AxisVM model - [AxisVM](https://docs.viktor.ai/docs/create-apps/software-integrations/axisvm.md): Creating and running an AxisVM model ##### boredm Integrating BoreDM data with VIKTOR apps - [BoreDM](https://docs.viktor.ai/docs/create-apps/software-integrations/boredm.md): Integrating BoreDM data with VIKTOR apps ##### civil3d This guide explains how to drive Civil 3D from a VIKTOR app through the Civil 3D COM (ActiveX) API. - [Civil 3D](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d.md): This guide explains how to drive Civil 3D from a VIKTOR app through the Civil 3D COM (ActiveX) API. ##### databricks Connecting to databricks - [Databricks](https://docs.viktor.ai/docs/create-apps/software-integrations/databricks.md): Connecting to databricks ##### dfoundations Creating and running a D-Foundations model - [D-Foundations](https://docs.viktor.ai/docs/create-apps/software-integrations/dfoundations.md): Creating and running a D-Foundations model ##### dgeostability Running a D-Geo Stability model - [D-Geo Stability](https://docs.viktor.ai/docs/create-apps/software-integrations/dgeostability.md): Running a D-Geo Stability model ##### dsettlement Creating and running a D-Settlement model - [D-Settlement](https://docs.viktor.ai/docs/create-apps/software-integrations/dsettlement.md): Creating and running a D-Settlement model ##### dsheetpiling Running a D-Sheet Piling model - [D-Sheet Piling](https://docs.viktor.ai/docs/create-apps/software-integrations/dsheetpiling.md): Running a D-Sheet Piling model ##### dstability Running a D-Stability model - [D-Stability](https://docs.viktor.ai/docs/create-apps/software-integrations/dstability.md): Running a D-Stability model ##### dynamo-nodes Integrate using VIKTOR nodes in Dynamo - [Dynamo Nodes [BETA]](https://docs.viktor.ai/docs/create-apps/software-integrations/dynamo-nodes.md): Integrate using VIKTOR nodes in Dynamo ##### dynamo Integrate with Dynamo Sandbox - [Dynamo Sandbox](https://docs.viktor.ai/docs/create-apps/software-integrations/dynamo.md): Integrate with Dynamo Sandbox ##### etabs-and-sap2000 This guide provides the necessary context and file templates to facilitate the integration process of ETABS and SAP2000. - [ETABS and SAP2000](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000.md): This guide provides the necessary context and file templates to facilitate the integration process of ETABS and SAP2000. ##### excel Running an Excel-sheet with macros - [Excel](https://docs.viktor.ai/docs/create-apps/software-integrations/excel.md): Running an Excel-sheet with macros ##### generic Running a Generic integration - [Other Software](https://docs.viktor.ai/docs/create-apps/software-integrations/generic.md): Running a Generic integration ##### geolib Using the GEOLIB package and running a model - [GEOLIB](https://docs.viktor.ai/docs/create-apps/software-integrations/geolib.md): Using the GEOLIB package and running a model ##### grlweap Running a GRLWEAP model - [GRLWEAP](https://docs.viktor.ai/docs/create-apps/software-integrations/grlweap.md): Running a GRLWEAP model ##### idea Creating and running a IDEA StatiCa Concrete model - [IDEA StatiCa Concrete](https://docs.viktor.ai/docs/create-apps/software-integrations/idea.md): Creating and running a IDEA StatiCa Concrete model ##### iTwin Integration with Bentley iTwin using OAuth 2.0 - [Bentley iTwin](https://docs.viktor.ai/docs/create-apps/software-integrations/iTwin.md): Integration with Bentley iTwin using OAuth 2.0 ##### matlab Running a Matlab integration - [Matlab](https://docs.viktor.ai/docs/create-apps/software-integrations/matlab.md): Running a Matlab integration ##### microsoft Integration with Microsoft services such as SharePoint using OAuth 2.0 - [Microsoft](https://docs.viktor.ai/docs/create-apps/software-integrations/microsoft.md): Integration with Microsoft services such as SharePoint using OAuth 2.0 ##### plaxis Using the PLAXIS package and running a model - [PLAXIS](https://docs.viktor.ai/docs/create-apps/software-integrations/plaxis.md): Using the PLAXIS package and running a model ##### revit Read and change an open Revit model or run batch scripts with pyRevit and a VIKTOR worker - [Autodesk Revit](https://docs.viktor.ai/docs/create-apps/software-integrations/revit.md): Read and change an open Revit model or run batch scripts with pyRevit and a VIKTOR worker ##### rfem Running an RFEM model - [RFEM 5](https://docs.viktor.ai/docs/create-apps/software-integrations/rfem.md): Running an RFEM model ##### rhino-grasshopper Running a Rhino / Grasshopper integration - [Rhino / Grasshopper](https://docs.viktor.ai/docs/create-apps/software-integrations/rhino-grasshopper.md): Running a Rhino / Grasshopper integration ##### robot Running an Autodesk Robot Structural Analysis model - [Robot Structural Analysis](https://docs.viktor.ai/docs/create-apps/software-integrations/robot.md): Running an Autodesk Robot Structural Analysis model ##### scia Creating and running a SCIA Engineer model - [SCIA Engineer](https://docs.viktor.ai/docs/create-apps/software-integrations/scia.md): Creating and running a SCIA Engineer model ##### staadpro Creating and running a Bentley STAAD.Pro integration with the Python worker - [STAAD.Pro](https://docs.viktor.ai/docs/create-apps/software-integrations/staadpro.md): Creating and running a Bentley STAAD.Pro integration with the Python worker ##### tablogs Integration TabLogs using OAuth 2.0 - [TabLogs](https://docs.viktor.ai/docs/create-apps/software-integrations/tablogs.md): Integration TabLogs using OAuth 2.0 ##### tekla Running a Tekla Structures integration - [Tekla Structures](https://docs.viktor.ai/docs/create-apps/software-integrations/tekla.md): Running a Tekla Structures integration ##### trimble-connect Integration with Trimble Connect - [Trimble Connect](https://docs.viktor.ai/docs/create-apps/software-integrations/trimble-connect.md): Integration with Trimble Connect ##### viktor-desktop Installing and managing personal workers with VIKTOR Desktop - [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop.md): Installing and managing personal workers with VIKTOR Desktop #### user-input User input, fields and buttons - [User input, fields & buttons](https://docs.viktor.ai/docs/create-apps/user-input.md): User input, fields and buttons ##### action-buttons Adding buttons to enable user actions - [Action buttons](https://docs.viktor.ai/docs/create-apps/user-input/action-buttons.md): Adding buttons to enable user actions ##### autodesk-files Select a file from Autodesk cloud storage - [Autodesk files](https://docs.viktor.ai/docs/create-apps/user-input/autodesk-files.md): Select a file from Autodesk cloud storage ##### entity-selection Selecting entities made easy with these fields - [Entity selection](https://docs.viktor.ai/docs/create-apps/user-input/entity-selection.md): Selecting entities made easy with these fields ##### geometry-selection Let the user select geometry objects from a geometry model - [Geometry selection](https://docs.viktor.ai/docs/create-apps/user-input/geometry-selection.md): Let the user select geometry objects from a geometry model ##### hide-field Hide a field depending on other fields - [Hide a field](https://docs.viktor.ai/docs/create-apps/user-input/hide-field.md): Hide a field depending on other fields ##### input-validation Validate user input and provide helpful guidance - [Input validation](https://docs.viktor.ai/docs/create-apps/user-input/input-validation.md): Validate user input and provide helpful guidance ##### llm-chat Enable the potential of LLM in your app - [LLM chat](https://docs.viktor.ai/docs/create-apps/user-input/llm-chat.md): Enable the potential of LLM in your app ##### map-features Let the user draw geo-objects on a map - [Map features](https://docs.viktor.ai/docs/create-apps/user-input/map-features.md): Let the user draw geo-objects on a map ##### numeric-input Adding number fields - [Numeric input](https://docs.viktor.ai/docs/create-apps/user-input/numeric-input.md): Adding number fields ##### options-and-selections Adding options & selection fields - [Options & selections](https://docs.viktor.ai/docs/create-apps/user-input/options-and-selections.md): Adding options & selection fields ##### other-fields DateField, toggle, and more... - [Other fields](https://docs.viktor.ai/docs/create-apps/user-input/other-fields.md): DateField, toggle, and more... ##### read-only-fields Provide additional context using non-editable fields - [Read-only fields](https://docs.viktor.ai/docs/create-apps/user-input/read-only-fields.md): Provide additional context using non-editable fields ##### set-params-using-button Setting params with a button - [Set params using a button](https://docs.viktor.ai/docs/create-apps/user-input/set-params-using-button.md): Setting params with a button ##### tables-and-arrays Group input fields using tables & arrays - [Tables & arrays](https://docs.viktor.ai/docs/create-apps/user-input/tables-and-arrays.md): Group input fields using tables & arrays ##### textual-input Adding text fields - [Textual input](https://docs.viktor.ai/docs/create-apps/user-input/textual-input.md): Adding text fields ##### upload-files Upload file(s) using a field - [Upload files](https://docs.viktor.ai/docs/create-apps/user-input/upload-files.md): Upload file(s) using a field #### viktor-llm Use VIKTOR's built-in LLM service directly in your apps — no API key required - [Integrating with LLMs](https://docs.viktor.ai/docs/create-apps/viktor-llm.md): Use VIKTOR's built-in LLM service directly in your apps — no API key required ##### tool-use Give the LLM access to your app's functions using tool calling - [Tool use](https://docs.viktor.ai/docs/create-apps/viktor-llm/tool-use.md): Give the LLM access to your app's functions using tool calling ##### vision Analyze images with the built-in vision model — no API key required - [Vision](https://docs.viktor.ai/docs/create-apps/viktor-llm/vision.md): Analyze images with the built-in vision model — no API key required ### faq Find answers to some common problems - [FAQs](https://docs.viktor.ai/docs/faq.md): Find answers to some common problems ### getting-started Get started with VIKTOR - [Get started with VIKTOR](https://docs.viktor.ai/docs/getting-started.md): Get started with VIKTOR #### fundamentals Explanations of fundamental VIKTOR concepts - [Fundamentals](https://docs.viktor.ai/docs/getting-started/fundamentals.md): Explanations of fundamental VIKTOR concepts ##### app-types Discover different types of apps - [App types](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types.md): Discover different types of apps ##### basic-app-structure Define a controller and parametrization in app.py - [Basic app structure](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure.md): Define a controller and parametrization in app.py ##### call-flow Understanding VIKTOR's app code execution flow - [App execution flow (Jobs)](https://docs.viktor.ai/docs/getting-started/fundamentals/call-flow.md): Understanding VIKTOR's app code execution flow ##### entities-and-entity-types Understanding the differences between an entity and an entity type - [Entity vs. entity type](https://docs.viktor.ai/docs/getting-started/fundamentals/entities-and-entity-types.md): Understanding the differences between an entity and an entity type ##### saving-and-revisions How entity data is saved, and how revisions can be named, reviewed and restored - [Saving and revisions](https://docs.viktor.ai/docs/getting-started/fundamentals/saving-and-revisions.md): How entity data is saved, and how revisions can be named, reviewed and restored #### how-is-viktor-organized In this page we will explain how VIKTOR is organized, how you can create and use your apps. - [How is VIKTOR organized?](https://docs.viktor.ai/docs/getting-started/how-is-viktor-organized.md): In this page we will explain how VIKTOR is organized, how you can create and use your apps. #### installation Install VIKTOR and activate your account - [Install VIKTOR](https://docs.viktor.ai/docs/getting-started/installation.md): Install VIKTOR and activate your account ##### cloud-based-development Installing VIKTOR using a cloud-based development environment - [Cloud-based setup (using GitHub codespaces)](https://docs.viktor.ai/docs/getting-started/installation/cloud-based-development.md): Installing VIKTOR using a cloud-based development environment ##### installation-using-docker Installing VIKTOR using the Docker isolation mode - [Install VIKTOR with Docker](https://docs.viktor.ai/docs/getting-started/installation/installation-using-docker.md): Installing VIKTOR using the Docker isolation mode ##### local-development-venv Install VIKTOR and activate your account - [Standard installation](https://docs.viktor.ai/docs/getting-started/installation/local-development-venv.md): Install VIKTOR and activate your account ##### local-development How to develop VIKTOR apps locally - [Local development](https://docs.viktor.ai/docs/getting-started/installation/local-development.md): How to develop VIKTOR apps locally ##### restart-install-workflow How to restart the installation flow when installing on new device VIKTOR - [Reinstall](https://docs.viktor.ai/docs/getting-started/installation/restart-install-workflow.md): How to restart the installation flow when installing on new device VIKTOR #### starter-guide Create your first VIKTOR app by following step-by-step instructions - [Starter guide](https://docs.viktor.ai/docs/getting-started/starter-guide.md): Create your first VIKTOR app by following step-by-step instructions #### what-is-viktor On this page you'll understand how VIKTOR revolutionizes engineering workflows. - [What is VIKTOR?](https://docs.viktor.ai/docs/getting-started/what-is-viktor.md): On this page you'll understand how VIKTOR revolutionizes engineering workflows. #### whats-next Learn more about VIKTOR or start developing your own app - [What's next?](https://docs.viktor.ai/docs/getting-started/whats-next.md): Learn more about VIKTOR or start developing your own app ### manage-apps Learn more about how to manage your apps - [Administrator](https://docs.viktor.ai/docs/manage-apps.md): Learn more about how to manage your apps #### access-management How to configure access and roles within VIKTOR - [User & access management](https://docs.viktor.ai/docs/manage-apps/access-management.md): How to configure access and roles within VIKTOR #### activity-dashboard Get insights into activity within your organization - [Activity dashboard](https://docs.viktor.ai/docs/manage-apps/activity-dashboard.md): Get insights into activity within your organization #### all-apps Manage every app in your organization from the All apps page in the Administrator panel - [All apps](https://docs.viktor.ai/docs/manage-apps/all-apps.md): Manage every app in your organization from the All apps page in the Administrator panel #### enterprise-it Using VIKTOR within an enterprise IT environment - [Enterprise IT](https://docs.viktor.ai/docs/manage-apps/enterprise-it.md): Using VIKTOR within an enterprise IT environment #### labels Organize and categorize your apps with labels - [Labels](https://docs.viktor.ai/docs/manage-apps/labels.md): Organize and categorize your apps with labels #### organization-setting Maintain brand consistency - [Customized appearances](https://docs.viktor.ai/docs/manage-apps/organization-setting.md): Maintain brand consistency #### regional-hosting Storing data in your desired region - [Regional hosting](https://docs.viktor.ai/docs/manage-apps/regional-hosting.md): Storing data in your desired region #### security-and-data-flow How your data flows through VIKTOR and how it is protected - [Security & data flow](https://docs.viktor.ai/docs/manage-apps/security-and-data-flow.md): How your data flows through VIKTOR and how it is protected #### single-sign-on Setting up single sign-on for (the users of) your VIKTOR app - [Single Sign On (SSO)](https://docs.viktor.ai/docs/manage-apps/single-sign-on.md): Setting up single sign-on for (the users of) your VIKTOR app #### software-integrations Installing and operating external integrations - [Integrations](https://docs.viktor.ai/docs/manage-apps/software-integrations.md): Installing and operating external integrations #### workspaces-and-apps This page guides you through finding existing apps, creating new ones, managing version history and variables, archiving apps, and adding labels to enhance discoverability. - [Managing your app](https://docs.viktor.ai/docs/manage-apps/workspaces-and-apps.md): This page guides you through finding existing apps, creating new ones, managing version history and variables, archiving apps, and adding labels to enhance discoverability. ### manage-projects Explains what projects are on VIKTOR, how they work, and who can create or manage these projects. - [Manage projects](https://docs.viktor.ai/docs/manage-projects.md): Explains what projects are on VIKTOR, how they work, and who can create or manage these projects. ### publish-apps Publish your VIKTOR app - [Publishing & sharing your app](https://docs.viktor.ai/docs/publish-apps.md): Publish your VIKTOR app #### backward-compatibility Making sure an update of your app does not break compatibility - [Backward compatibility](https://docs.viktor.ai/docs/publish-apps/backward-compatibility.md): Making sure an update of your app does not break compatibility #### continuous-deployment Setting up automated deployment of your VIKTOR app on the remote Git repository - [Continuous Deployment (CD)](https://docs.viktor.ai/docs/publish-apps/continuous-deployment.md): Setting up automated deployment of your VIKTOR app on the remote Git repository #### limits Understanding the limits applied on production environments - [Platform limits](https://docs.viktor.ai/docs/publish-apps/limits.md): Understanding the limits applied on production environments #### upgrade-viktor-version Upgrade the VIKTOR SDK version in requirements.txt - [Upgrade VIKTOR version](https://docs.viktor.ai/docs/publish-apps/upgrade-viktor-version.md): Upgrade the VIKTOR SDK version in requirements.txt ### tutorials Use one of our Tutorials to improve your skills - [Tutorials](https://docs.viktor.ai/docs/tutorials.md): Use one of our Tutorials to improve your skills #### app-type-editor Learn how to create an editor-type app - [Creating an editor-type app](https://docs.viktor.ai/docs/tutorials/app-type-editor.md): Learn how to create an editor-type app #### app-type-simple Learn how to create a simple-type app - [Creating a simple-type app](https://docs.viktor.ai/docs/tutorials/app-type-simple.md): Learn how to create a simple-type app #### app-type-tree Learn how to create an app implementing a more complex entity type hierarchy - [Creating a tree-type app](https://docs.viktor.ai/docs/tutorials/app-type-tree.md): Learn how to create an app implementing a more complex entity type hierarchy #### automatic-reporting Follow along and learn how to automatically generate a report in a VIKTOR app - [Tutorial - Automatic reporting](https://docs.viktor.ai/docs/tutorials/automatic-reporting.md): Follow along and learn how to automatically generate a report in a VIKTOR app #### basic-3d-model This tutorial shows an example of how to visualize 3D models in a VIKTOR application. - [Tutorial - Create an interactive 3D building](https://docs.viktor.ai/docs/tutorials/basic-3d-model.md): This tutorial shows an example of how to visualize 3D models in a VIKTOR application. #### integrate-autocad Learn how to create 2D details and 3D structural models in AutoCAD from a VIKTOR app - [Tutorial - AutoCAD](https://docs.viktor.ai/docs/tutorials/integrate-autocad.md): Learn how to create 2D details and 3D structural models in AutoCAD from a VIKTOR app #### integrate-autodesk-construction-cloud Learn how to visualize, quantify, and validate Revit models from Autodesk Forma and ACC - [Tutorial - Autodesk Forma / ACC](https://docs.viktor.ai/docs/tutorials/integrate-autodesk-construction-cloud.md): Learn how to visualize, quantify, and validate Revit models from Autodesk Forma and ACC #### integrate-civil3d Learn how to create road alignments, set-out points, profiles, and cross sections in Civil 3D with VIKTOR - [Tutorial - Civil 3D](https://docs.viktor.ai/docs/tutorials/integrate-civil3d.md): Learn how to create road alignments, set-out points, profiles, and cross sections in Civil 3D with VIKTOR #### integrate-dynamo This tutorial shows an example of how to parametrically influence Dynamo models in a VIKTOR app - [Tutorial - Integrate Dynamo](https://docs.viktor.ai/docs/tutorials/integrate-dynamo.md): This tutorial shows an example of how to parametrically influence Dynamo models in a VIKTOR app #### integrate-etabs-sap2000 This tutorial provides an example of generating and visualizing a 3D structure in ETABS and SAP2000, integrated within a VIKTOR app. - [Tutorial - Integrate ETABS and SAP2000](https://docs.viktor.ai/docs/tutorials/integrate-etabs-sap2000.md): This tutorial provides an example of generating and visualizing a 3D structure in ETABS and SAP2000, integrated within a VIKTOR app. #### integrate-forma-site-design Learn how to create VIKTOR apps that work with Autodesk Forma Site Design - [Tutorial - Autodesk Forma Site Design](https://docs.viktor.ai/docs/tutorials/integrate-forma-site-design.md): Learn how to create VIKTOR apps that work with Autodesk Forma Site Design #### integrate-grasshopper This tutorial shows an example of how to parametrically integrate Rhino/Grasshopper models in a VIKTOR app - [Tutorial - Integrate Rhino/Grasshopper](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper.md): This tutorial shows an example of how to parametrically integrate Rhino/Grasshopper models in a VIKTOR app #### integrate-plant3d Create equipment reports, valve highlights, quantity takeoffs and relationship diagrams from published Plant 3D data in ACC - [Tutorial - AutoCAD Plant 3D](https://docs.viktor.ai/docs/tutorials/integrate-plant3d.md): Create equipment reports, valve highlights, quantity takeoffs and relationship diagrams from published Plant 3D data in ACC #### integrate-scia Learn how to create and run a SCIA model within a VIKTOR app - [Tutorial - Creating and analyzing a SCIA model](https://docs.viktor.ai/docs/tutorials/integrate-scia.md): Learn how to create and run a SCIA model within a VIKTOR app #### integrate-staadpro This tutorial shows an example of how to parametrically integrate STAAD pro workflows in a VIKTOR app - [Tutorial - Integrate STAAD.Pro](https://docs.viktor.ai/docs/tutorials/integrate-staadpro.md): This tutorial shows an example of how to parametrically integrate STAAD pro workflows in a VIKTOR app #### interactive-maps This tutorial shows an example of how to visualize data an on interactive map using VIKTOR - [Tutorial - Create an interactive map](https://docs.viktor.ai/docs/tutorials/interactive-maps.md): This tutorial shows an example of how to visualize data an on interactive map using VIKTOR #### intermediate-3d-model This tutorial shows an example of how to generate and visualise 3D models in a VIKTOR app - [Tutorial - 3D models](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model.md): This tutorial shows an example of how to generate and visualise 3D models in a VIKTOR app #### plots-and-data Follow along and learn how to visualise and summarise data using Plotly and Pandas. - [Tutorial - Data Analysis with Plotly and Pandas](https://docs.viktor.ai/docs/tutorials/plots-and-data.md): Follow along and learn how to visualise and summarise data using Plotly and Pandas. #### process-etabs-data Follow along and learn how to automatically Post-Processing ETABS Data with Plotly and Pandas in a VIKTOR app. - [Tutorial - Post-process ETABS data](https://docs.viktor.ai/docs/tutorials/process-etabs-data.md): Follow along and learn how to automatically Post-Processing ETABS Data with Plotly and Pandas in a VIKTOR app. #### process-staad-data Follow along and learn how to automatically Post-Process STAAD.Pro Data with Pandas in a VIKTOR app. - [Tutorial - Post-process STAAD.Pro data](https://docs.viktor.ai/docs/tutorials/process-staad-data.md): Follow along and learn how to automatically Post-Process STAAD.Pro Data with Pandas in a VIKTOR app. #### python-script-to-app Follow along and learn how to convert your Python project to a VIKTOR app - [How to convert a Python Project to a VIKTOR app](https://docs.viktor.ai/docs/tutorials/python-script-to-app.md): Follow along and learn how to convert your Python project to a VIKTOR app #### spreadsheet-calculator Follow along and learn how to automatically generate an Excel spreadsheet in a VIKTOR app which will present the results of a simple beam analysis - [Tutorial - Spreadsheet Calculator](https://docs.viktor.ai/docs/tutorials/spreadsheet-calculator.md): Follow along and learn how to automatically generate an Excel spreadsheet in a VIKTOR app which will present the results of a simple beam analysis ### use-apps How to use VIKTOR apps - [Device compatibility](https://docs.viktor.ai/docs/use-apps.md): How to use VIKTOR apps #### integrate-app Integrate your VIKTOR app in other software using the API - [Integrate your app in other software](https://docs.viktor.ai/docs/use-apps/integrate-app.md): Integrate your VIKTOR app in other software using the API ### viktor-sdk Explains what is the VIKTOR SDK (Software Development Kit) - [VIKTOR SDK](https://docs.viktor.ai/docs/viktor-sdk.md): Explains what is the VIKTOR SDK (Software Development Kit) ### welcome VIKTOR is a platform that makes it easy to create powerful and user-friendly apps. Create apps to automate your workflow, integrate with different software packages, and get better insights into your project through interactive visualizations. - [Welcome to VIKTOR!](https://docs.viktor.ai/docs/welcome.md): VIKTOR is a platform that makes it easy to create powerful and user-friendly apps. Create apps to automate your workflow, integrate with different software packages, and get better insights into your project through interactive visualizations. ## sdk ### api VIKTOR SDK API reference - [SDK Reference](https://docs.viktor.ai/sdk/api.md): VIKTOR SDK API reference #### api-v1 viktor.api_v1 - [viktor.api_v1](https://docs.viktor.ai/sdk/api/api-v1.md): viktor.api_v1 #### core viktor.core - [viktor.core](https://docs.viktor.ai/sdk/api/core.md): viktor.core #### errors viktor.errors - [viktor.errors](https://docs.viktor.ai/sdk/api/errors.md): viktor.errors #### external ##### autocad viktor.external.autocad - [viktor.external.autocad](https://docs.viktor.ai/sdk/api/external/autocad.md): viktor.external.autocad ##### autodesk viktor.external.autodesk - [viktor.external.autodesk](https://docs.viktor.ai/sdk/api/external/autodesk.md): viktor.external.autodesk ##### axisvm viktor.external.axisvm - [viktor.external.axisvm](https://docs.viktor.ai/sdk/api/external/axisvm.md): viktor.external.axisvm ##### dfoundations viktor.external.dfoundations - [viktor.external.dfoundations](https://docs.viktor.ai/sdk/api/external/dfoundations.md): viktor.external.dfoundations ##### dgeostability viktor.external.dgeostability - [viktor.external.dgeostability](https://docs.viktor.ai/sdk/api/external/dgeostability.md): viktor.external.dgeostability ##### dsettlement viktor.external.dsettlement - [viktor.external.dsettlement](https://docs.viktor.ai/sdk/api/external/dsettlement.md): viktor.external.dsettlement ##### dsheetpiling viktor.external.dsheetpiling - [viktor.external.dsheetpiling](https://docs.viktor.ai/sdk/api/external/dsheetpiling.md): viktor.external.dsheetpiling ##### dstability viktor.external.dstability - [viktor.external.dstability](https://docs.viktor.ai/sdk/api/external/dstability.md): viktor.external.dstability ##### dynamo viktor.external.dynamo - [viktor.external.dynamo](https://docs.viktor.ai/sdk/api/external/dynamo.md): viktor.external.dynamo ##### etabs viktor.external.etabs - [viktor.external.etabs](https://docs.viktor.ai/sdk/api/external/etabs.md): viktor.external.etabs ##### excel viktor.external.excel - [viktor.external.excel](https://docs.viktor.ai/sdk/api/external/excel.md): viktor.external.excel ##### external-program viktor.external.external_program - [viktor.external.external_program](https://docs.viktor.ai/sdk/api/external/external-program.md): viktor.external.external_program ##### generic viktor.external.generic - [viktor.external.generic](https://docs.viktor.ai/sdk/api/external/generic.md): viktor.external.generic ##### grasshopper viktor.external.grasshopper - [viktor.external.grasshopper](https://docs.viktor.ai/sdk/api/external/grasshopper.md): viktor.external.grasshopper ##### grlweap viktor.external.grlweap - [viktor.external.grlweap](https://docs.viktor.ai/sdk/api/external/grlweap.md): viktor.external.grlweap ##### idea viktor.external.idea - [viktor.external.idea](https://docs.viktor.ai/sdk/api/external/idea.md): viktor.external.idea ##### matlab viktor.external.matlab - [viktor.external.matlab](https://docs.viktor.ai/sdk/api/external/matlab.md): viktor.external.matlab ##### plaxis viktor.external.plaxis - [viktor.external.plaxis](https://docs.viktor.ai/sdk/api/external/plaxis.md): viktor.external.plaxis ##### python viktor.external.python - [viktor.external.python](https://docs.viktor.ai/sdk/api/external/python.md): viktor.external.python ##### revit viktor.external.revit - [viktor.external.revit](https://docs.viktor.ai/sdk/api/external/revit.md): viktor.external.revit ##### rfem viktor.external.rfem - [viktor.external.rfem](https://docs.viktor.ai/sdk/api/external/rfem.md): viktor.external.rfem ##### robot viktor.external.robot - [viktor.external.robot](https://docs.viktor.ai/sdk/api/external/robot.md): viktor.external.robot ##### sap2000 viktor.external.sap2000 - [viktor.external.sap2000](https://docs.viktor.ai/sdk/api/external/sap2000.md): viktor.external.sap2000 ##### scia viktor.external.scia - [viktor.external.scia](https://docs.viktor.ai/sdk/api/external/scia.md): viktor.external.scia ##### spreadsheet viktor.external.spreadsheet - [viktor.external.spreadsheet](https://docs.viktor.ai/sdk/api/external/spreadsheet.md): viktor.external.spreadsheet ##### tekla viktor.external.tekla - [viktor.external.tekla](https://docs.viktor.ai/sdk/api/external/tekla.md): viktor.external.tekla ##### word viktor.external.word - [viktor.external.word](https://docs.viktor.ai/sdk/api/external/word.md): viktor.external.word #### geo viktor.geo - [viktor.geo](https://docs.viktor.ai/sdk/api/geo.md): viktor.geo #### geometry viktor.geometry - [viktor.geometry](https://docs.viktor.ai/sdk/api/geometry.md): viktor.geometry #### llm viktor.llm - [viktor.llm](https://docs.viktor.ai/sdk/api/llm.md): viktor.llm #### parametrization viktor.parametrization - [viktor.parametrization](https://docs.viktor.ai/sdk/api/parametrization.md): viktor.parametrization #### result viktor.result - [viktor.result](https://docs.viktor.ai/sdk/api/result.md): viktor.result #### testing viktor.testing - [viktor.testing](https://docs.viktor.ai/sdk/api/testing.md): viktor.testing #### utils viktor.utils - [viktor.utils](https://docs.viktor.ai/sdk/api/utils.md): viktor.utils #### views viktor.views - [viktor.views](https://docs.viktor.ai/sdk/api/views.md): viktor.views --- # Full Documentation Content # VIKTOR API Welcome to the VIKTOR API documentation. ## What is an API?[​](https://docs.viktor.ai/docs/api/.md#what-is-an-api "Direct link to What is an API?") An API, or Application Programming Interface, acts as a communication gateway between different software applications. It defines the rules and tools for building software and allows developers to access the functionality of a system, service, or platform. In simpler terms, an API enables interaction and data exchange between software components. ## When to Use?[​](https://docs.viktor.ai/docs/api/.md#when-to-use "Direct link to When to Use?") The API provides a standardized interface to access specific features of the VIKTOR platform. Our API can be used to extract or modify data from your environment, integrate apps into your own software and workflows or automate tasks. When accessing the VIKTOR in the browser, using the API is not required as the functionality is directly available through the user interface. If you want to exchange data with the VIKTOR platform by means of code you can use the API. ## REST API vs SDK[​](https://docs.viktor.ai/docs/api/.md#rest-api-vs-sdk "Direct link to REST API vs SDK") VIKTOR provides both a low-level **REST API** and an API module as part of the **SDK**. The [REST API](https://docs.viktor.ai/docs/api/rest) is the foundation for interaction and data exchange with the VIKTOR platform. Developers can use it to access app or organizational resources through HTTP requests. The REST API is programming-language agnostic and can be accessed by all popular programming languages such as Python, Javascript, Go(lang), Ruby, C#, etc. The VIKTOR [SDK API](https://docs.viktor.ai/docs/api/sdk/.md) is built on top of the REST API and provides access to many of the relevant requests through an even developer-friendlier Python interface. The SDK API takes care of more complicated parts such as 'pagination', 'filtering by reference', and 'object serialization'. **We therefore strongly recommend using the SDK API wherever possible**. ![](/assets/images/rest_api_vs_sdk_api-d3413d315a965b66bce16982cb842375.png) Connecting an AI agent instead? Both APIs are meant to be called from code you write. To let an external AI agent discover and run your apps as tools without writing any code, see [Connect agents via MCP](https://docs.viktor.ai/docs/create-apps/mcp/.md) (beta). ## Personal Access Token[​](https://docs.viktor.ai/docs/api/.md#personal-access-token "Direct link to Personal Access Token") When using the [SDK API](https://docs.viktor.ai/docs/api/sdk/.md) from within the context of a workspace, authentication is done automatically with the token of the current user performing the API call, which is valid within the workspace. When the SDK API is used [cross-workspace](https://docs.viktor.ai/docs/api/sdk/.md#cross-workspace) or [from an external script](https://docs.viktor.ai/docs/api/sdk/.md#from-an-external-script), or when using the [REST API](https://docs.viktor.ai/docs/api/rest) a *Personal Access Token* needs to be used for proper authentication. Your Personal Access Token is a personal unique token, that can be used to securely access the API without needing a username and password. The token looks something like: `vktrpat_●●●●●●●●●●●●●●_●●●●●●●●●●●●●●●●●●●●●●●●●●` and you can obtain it [through your profile settings page](https://docs.viktor.ai/docs/faq/.md#account). By authenticating using a Personal Access Token, you obtain the same rights as the user that holds the token. Storing your Personal Access Token Your Personal Access Token can be used to **access or alter your sensitive data**. You should therefore make sure to **securely store it** and never store it directly in source-code or other plain text formats. Consider using [Environment variables](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/environment-variables/.md). * SDK * REST 1. Set your Personal Access Token as an environment variable. 2. Create an `API` instance with your token to perform API requests. ``` import viktor as vkt import os api = vkt.api_v1.API(token=os.environ["TOKEN"], ...) ... workspace = api.get_workspace(3) entity = workspace.get_entity(1) ``` 1. Set your Personal Access Token as an environment variable. 2. Use your token in the `Authorization` header to perform API requests. ``` import requests import os # Replace 'my_environment' with your actual environment e.g. 'cloud' or 'cloud.us1' if you are in a region other than Frankfurt environment = 'my_environment' # To never expose your token in code, set your actual token as an environment variable or use `input()` and paste the token in the terminal token = os.environ["my_token"] # Must be set as environment variable # Sending a GET request with Bearer token to obtain the list of workspaces in your VIKTOR environment response = requests.get( url=f"https://{environment}.viktor.ai/api/workspaces/", headers={'Authorization': f'Bearer {token}'} ) response.raise_for_status() # Print the response print(response.json()) ``` --- # SDK API The VIKTOR SDK API can be accessed using the [api\_v1](https://docs.viktor.ai/sdk/api/api-v1/.md) module and is built on top of the REST API. It provides access to many of the relevant requests through an even developer-friendlier Python interface and takes care of more complicated parts such as 'pagination', 'filtering by reference', and 'object serialization'. **We therefore strongly recommend using the SDK API wherever possible**. The following resources are available in the SDK API: * `Workspaces` * `Entity types` * `Entities` * `Revisions` * `Current user` It is possible to use the SDK API in 3 scenarios: * [Within a workspace](https://docs.viktor.ai/docs/api/sdk/.md#within-a-workspace) (nothing needed) * [Cross-workspace](https://docs.viktor.ai/docs/api/sdk/.md#cross-workspace) (token needed) * [From an external script](https://docs.viktor.ai/docs/api/sdk/.md#from-an-external-script) (token and environment needed). ![](/assets/images/api_scenarios-d845a8b3505423b1bea850afff871f66.png) ## Within a workspace[​](https://docs.viktor.ai/docs/api/sdk/.md#within-a-workspace "Direct link to Within a workspace") If you want to use the SDK API module **from within the context of a workspace**, it is as simple as instantiating the `API` class using VIKTOR's [api\_v1](https://docs.viktor.ai/sdk/api/api-v1/.md) module: ``` import viktor as vkt api = vkt.api_v1.API() ... entity = api.get_entity(1) # the current workspace is automatically selected ``` ### Current workspace and entity[​](https://docs.viktor.ai/docs/api/sdk/.md#current-workspace-and-entity "Direct link to Current workspace and entity") The `workspace_id` of the **current** workspace, and `entity_id` and `entity_name` of the **current** entity are sent along within all view-methods and callback-functions. The `workspace_id` / `entity_id` can be used to construct the current workspace/entity object, from which you can, for example, navigate to relatives within a view-method: ``` import viktor as vkt class Controller(vkt.Controller): @vkt.DataView("Data") def calculate_view(self, params, entity_id, entity_name, workspace_id, **kwargs): current_entity = vkt.api_v1.API().get_entity(entity_id) parent = current_entity.parent() parent_params = parent.last_saved_params # do something with parent_params return vkt.DataResult(...) ``` Or a callback-function in the parametrization: ``` import viktor as vkt def get_options(params, entity_id, entity_name, workspace_id, **kwargs): current_entity = vkt.api_v1.API().get_entity(entity_id) parent = current_entity.parent() parent_params = parent.last_saved_params # do something with parent_params return [...] class Parametrization(vkt.Parametrization): field = vkt.OptionField(..., options=get_options) ``` ### Performance[​](https://docs.viktor.ai/docs/api/sdk/.md#performance "Direct link to Performance") Within a single job (see [app code execution flow](https://docs.viktor.ai/docs/getting-started/fundamentals/call-flow/.md) for the possible triggers of a job) the results of API calls are temporarily stored (memoized). This means that multiple calls to the same entity only require a single request in the background. This is particularly handy for option functions: ``` import viktor as vkt def get_options1_from_parent(params, entity_id, workspace_id, **kwargs): parent = vkt.api_v1.API().get_entity(entity_id).parent() parent_params = parent.last_saved_params # get options1 from parent_params ... def get_options2_from_parent(params, entity_id, workspace_id, **kwargs): parent = vkt.api_v1.API().get_entity(entity_id).parent() parent_params = parent.last_saved_params # get options2 from parent_params ... class Parametrization(vkt.Parametrization): option1 = vkt.OptionField('Option 1', options=get_options1_from_parent) option2 = vkt.OptionField('Option 2', options=get_options2_from_parent) ``` ### Bypassing user access restrictions[​](https://docs.viktor.ai/docs/api/sdk/.md#bypassing-user-access-restrictions "Direct link to Bypassing user access restrictions") caution If not used properly, (confidential) information which SHOULD NOT be accessible to a user may leak (e.g. by including confidential data in a view, the data is visible to users with access to that view). Please consider the following when using this flag: * Make sure the app's admin is aware that the code circumvents certain permissions at specific places. * Make sure to test the implementation thoroughly, to ensure no confidential data is leaked. Some applications have user restrictions that limit access to certain entities or entity types. For example, if a user does not have permission to read some entity data, the code will also **NOT** be able to reach this data through an API call when run by the same user. In some cases it is desirable to restrict user access to a certain entity but have access within the code nonetheless. An example is the case of a global settings entity that consists of confidential pricing data, which should be inaccessible for users but accessible for the code to calculate costs. For these cases a `privileged` flag can be used: 1. Configure `viktor.config.toml` to make use of the privileged api. This serves as an additional layer of security/awareness. ``` enable_privileged_api = true ``` 2. Use the `privileged` flag on the relevant API call. ``` settings_entity = api.get_root_entities(entity_type_names=['Settings'], privileged=True)[0] ``` ## Cross-workspace[​](https://docs.viktor.ai/docs/api/sdk/.md#cross-workspace "Direct link to Cross-workspace") If you want to use the SDK API module from one workspace to access data from a different workspace, you can instantiate the `API` class using VIKTOR's [api\_v1](https://docs.viktor.ai/sdk/api/api-v1/.md) module and include your [Personal Access Token](https://docs.viktor.ai/docs/api/.md#personal-access-token): ``` import viktor as vkt import os api = vkt.api_v1.API(token=os.environ["TOKEN"]) ... workspace = api.get_workspace(4) entity = workspace.get_entity(1) ``` ## From an external script[​](https://docs.viktor.ai/docs/api/sdk/.md#from-an-external-script "Direct link to From an external script") If you want to use the SDK API from an external python script (e.g. Jupyter Notebook), make sure to first install the VIKTOR SDK using pip: ``` pip install viktor ``` In your python script, you can now instantiate the `API` class using VIKTOR's [api\_v1](https://docs.viktor.ai/sdk/api/api-v1/.md) module. You will need to provide some additional authentication-related information: * Your VIKTOR environment url (the location where your data is stored, e.g. `cloud.viktor.ai` or `company.us1.viktor.ai`) * Your [Personal Access Token](https://docs.viktor.ai/docs/api/.md#personal-access-token) ``` import viktor as vkt import os api = vkt.api_v1.API(token=os.environ["TOKEN"], environment="cloud.us1.viktor.ai") ... workspace = api.get_workspace(3) entity = workspace.get_entity(1) ``` --- # Handling entity data The SDK API can be used to read, create and modify entity data. ## Navigating entities[​](https://docs.viktor.ai/docs/api/sdk/handling-entity-data/.md#navigating-entities "Direct link to Navigating entities") The starting point for navigating entities is an [`Entity`](https://docs.viktor.ai/sdk/api/api-v1/.md#_Entity) (or [`EntityList`](https://docs.viktor.ai/sdk/api/api-v1/.md#_EntityList)) object. An `Entity` object can be obtained in one of the following ways: * By means of an `entity_id`: ``` entity = api.get_workspace(workspace_id).get_entity(entity_id) entity = api.get_entity_children(entity_id) entity = api.get_entity_siblings(entity_id) entity = api.get_entity_parent(entity_id) ``` * By entity type: ``` entities = api.get_workspace(workspace_id).get_entities_by_type('MyType') ``` * Start from the root entities: ``` entities = api.get_workspace(workspace_id).get_root_entities() ``` * An `Entity` object that is returned from an [entity field](https://docs.viktor.ai/docs/create-apps/user-input/entity-selection/.md#entity-object): ``` entity = params.entity_field ``` tip When using the API to obtain entity data from the **current** workspace from within an app, you can drop the workspace part and the current workspace will automatically be selected. For example: ``` entity = api.get_entity(entity_id) # only works if entity with this id is in the current workspace ``` Having an `Entity` object, navigating to relatives is easy, by making use of the below methods: ``` entity.parent() entity.children() entity.siblings() ``` It's also possible to chain these methods, to navigate even further: ``` grand_parent = entity.parent().parent() ``` Or filter on entity type: ``` gef_children = entity.children(entity_type_names=['GEF']) ``` ### Exclude params[​](https://docs.viktor.ai/docs/api/sdk/handling-entity-data/.md#exclude-params "Direct link to Exclude params") By default, the `params` of an entity are obtained along with the entity, in all of the above mentioned API calls. In case only the id, name or type of an `Entity` is desired, the performance of the call can be improved by setting the `include_params` flag to `False`. This will exclude the params from being sent during the call: ``` gef_children = entity.children(entity_type_names=['GEF'], include_params=False) ``` ## Obtaining entity data[​](https://docs.viktor.ai/docs/api/sdk/handling-entity-data/.md#obtaining-entity-data "Direct link to Obtaining entity data") Historical revisions of an entity can be obtained by: ``` revisions = api.get_entity_revisions(entity_id) ``` ``` revisions = entity.get_revisions() ``` The params from a certain `Revision` can be obtained by: ``` revision = revisions[0] # e.g. first revision params = revision.params ``` Often, you only need the last saved params/summary of an entity. This can be obtained by directly reading the corresponding property on the `Entity` object: ``` params = entity.last_saved_params summary = entity.last_saved_summary ``` ### File-type entity[​](https://docs.viktor.ai/docs/api/sdk/handling-entity-data/.md#file-type-entity "Direct link to File-type entity") In case the entity is of file-type, the underlying `File` can be obtained by: ``` revisions = api.get_entity_file(entity_id) ``` ``` revisions = entity.get_file() ``` ## Modifying entity data[​](https://docs.viktor.ai/docs/api/sdk/handling-entity-data/.md#modifying-entity-data "Direct link to Modifying entity data") The API supports the following methods to create/modify entity data: ``` api.rename_entity(entity_id, new_name) api.delete_entity(entity_id) api.set_entity_params(entity_id, new_params) api.create_child_entity(parent_entity_id, entity_type_name, new_entity_name) ``` And corresponding methods on the `Entity` object: ``` entity.rename(new_name) entity.delete() entity.set_entity_params(new_params) entity.create_child(entity_type_name, new_entity_name) ``` ## List-object[​](https://docs.viktor.ai/docs/api/sdk/handling-entity-data/.md#list-object "Direct link to List-object") Some methods return a series of objects in a **list-object**, instead of an actual list of instances (e.g. `EntityList`, instead of `List[Entity]`). This has been done for performance reasons and has little effect on handling, as most normal list operations are still allowed: ``` children = entity.children() # children is of type `EntityList` len(children) # ok children[0] # positive indexing: ok children[-1] # negative indexing: ok for child in children: # iterating: ok # do something with child ``` note Slicing of a list-object (e.g. `children[0:5]`) is **not** supported. --- # Running an entity computation New in v14.12.0 Besides handling entity data, the SDK API can be used to run a computation on an entity. This can be used to, for example, utilize the entity as a calculation tool in other apps by remotely running the logic on the entity's Controller. ``` api.entity_compute(workspace_id=1, entity_id=2, method_name="my_calculation", params={...}) ``` ``` workspace = api.get_workspace(1) workspace.entity_compute(entity_id=2, method_name="my_calculation", params={...}) ``` ``` entity = api.get_entity(2) entity.compute(method_name="my_calculation", params={...}) ``` note * Not all methods on an entity can be called over the API. Currently, only [view methods](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md) and [button methods](https://docs.viktor.ai/docs/create-apps/user-input/action-buttons/.md) are supported * It is not possible to use `compute` on an entity within your own development workspace (it will return a TimeoutError) ## Example[​](https://docs.viktor.ai/docs/api/sdk/running-entity-computation/.md#example "Direct link to Example") The example below shows how to replicate a geometry-view from another entity (from another workspace) in the current entity, without copying any logic. For more information on how to set up the API for cross-workspace access, see [here](https://docs.viktor.ai/docs/api/sdk/.md#cross-workspace). ``` import viktor as vkt import os class Controller(vkt.Controller): @vkt.GeometryView("Geometry", duration_guess=5) def geometry_view_from_other_entity(self, params, **kwargs): api = vkt.api_v1.API(token=os.environ["TOKEN"]) entity = api.get_entity(other_entity_id, workspace_id=other_workspace_id) result = entity.compute("geometry_view", params=entity.last_saved_params) return vkt.GeometryResult(**result['geometry']) ``` --- # App Builder ## What is the App Builder?[​](https://docs.viktor.ai/docs/app-builder/.md#what-is-the-app-builder "Direct link to What is the App Builder?") The App Builder is your AI-powered coding agent for creating VIKTOR apps quickly, all from your browser. It combines a chat interface, a code editor, and a real-time preview, so there's no local software to install. You can go from an idea to a working app in minutes, with the agent as your pair-programmer. The agent updates your app based on your prompts, and you can also make manual changes directly in the code editor and see them in the preview instantly. Once you're satisfied, you can deploy the app to your environment with a single click. ## Building your app[​](https://docs.viktor.ai/docs/app-builder/.md#building-your-app "Direct link to Building your app") ### Getting started[​](https://docs.viktor.ai/docs/app-builder/.md#getting-started "Direct link to Getting started") You can start a new app directly from the Home page in the VIKTOR environment. 1. Describe the app you want to build in the prompt field at the top of the Home page. Make clear that you want to create a new app, for example "Create an app that calculates the bending moment of a beam". Specify the desired inputs, visualization, and logic. You can also click one of the example prompts below the field to fill it in. ![The VIKTOR Home page with the \"Talk to VIKTOR AI\" prompt field and example prompts](/assets/images/app-builder-1-55842f2349df2666acc78fb7b280c6c3.png) 2. The agent shows existing apps that match your request and offers **Start building**. Click **Start building** to open the App Builder with your prompt carried over. If an existing app already does what you need, you can open that app instead. You can also start a new app from the Develop page. In that case you enter your prompt in the App Builder itself. ![The App Builder prompt box where you describe the app you want to build](/assets/images/app-builder-2-34667146396c9acf0c7957c488c9b417.png) 3. When you send your prompt, the agent will begin generating your app. Once it's done generating the app code, it will provide an explanation of the actions performed on the left side of the screen. On the right, you will see a preview of your app. You can interact with the app in Preview mode to test its functionality. To view the underlying Python code, simply switch to Code mode. ![The App Builder with the agent\'s explanation on the left and a live app preview on the right](/assets/images/app-builder-ui-preview-f7f9b550c686b62ef0ca2450702b7b5b.png) ### The interface[​](https://docs.viktor.ai/docs/app-builder/.md#the-interface "Direct link to The interface") The App Builder brings together everything you need to build an app in one screen: * **Chat panel** (left): where you prompt the agent and read its explanation of the actions it performed. * **Preview** (Preview mode): an interactive, live preview of your app. Interact with it to test its functionality; it reloads automatically after each change. * **Code editor** (Code mode): view and edit the underlying Python code. You can switch between Preview and Code mode at any time. * **File tree** (Code mode): shows all files and folders in your app. See [Working with multiple files](https://docs.viktor.ai/docs/app-builder/.md#working-with-multiple-files) for details. * **Console** (Code mode): real-time logs from the Python process, described below. #### Console[​](https://docs.viktor.ai/docs/app-builder/.md#console "Direct link to Console") The console is part of Code mode, alongside the code editor and file tree. It displays real-time logs from the Python process at the bottom of the screen and shows: * Output from `print()` statements in your code * Python logs and errors * Runtime information from your app The console is particularly useful for debugging and understanding what's happening during app execution. Simply add `print()` statements to your code to inspect variable values and track execution flow. See [Troubleshooting and debugging](https://docs.viktor.ai/docs/app-builder/.md#troubleshooting-and-debugging) for how to use it when something goes wrong. ![The console at the bottom of the App Builder showing real-time Python logs](/assets/images/app-builder-code-console-35d1a0ea7f9f908c1ef6fbd32c684757.png) ### Iterating on your app[​](https://docs.viktor.ai/docs/app-builder/.md#iterating-on-your-app "Direct link to Iterating on your app") You can iteratively improve your app in two ways: * **Using the agent**: Describe the change you want in a follow-up prompt. The agent updates the app and shows you the result. To ask a question without changing the app, use [chat mode](https://docs.viktor.ai/docs/app-builder/.md#chat-mode). * **Manual editing**: Switch from Preview to Code mode, adjust any code in the editor, and after saving your changes, the preview will reload to show the updated app. #### Your input is preserved across code changes[​](https://docs.viktor.ai/docs/app-builder/.md#your-input-is-preserved-across-code-changes "Direct link to Your input is preserved across code changes") The input values you enter in the preview are remembered automatically. When the preview reloads after a code change, your last entered values are restored, so you can test the updated app without re-entering everything. This also works across sessions: if you close the App Builder and return later, the preview opens with your last used input. A few things to keep in mind: * To start over from the default values, click the **Clear changes** button in the preview. * If a code change removes or renames input fields, the values that no longer match are dropped and new fields are filled with their defaults. * The last used input is stored per app, not per user. When collaborating with other maintainers, you share the same remembered input: whoever entered values last determines what is restored after a reload. ### Working with multiple files[​](https://docs.viktor.ai/docs/app-builder/.md#working-with-multiple-files "Direct link to Working with multiple files") Your app code can be organized across multiple files and folders, following coding best practices. The agent decides when it makes sense to split code into separate files, for example by moving constants, helper functions, or integration logic out of `app.py`. You can also explicitly ask the agent to create, reorganize, or delete files and folders. In Code mode, a file tree shows all files in your app, with support for folders. Click a file to open it; open files appear as tabs, so you can quickly switch between them. You can edit the contents of any file directly in the editor. You can also manage the file structure yourself, without going through the agent. Open the three-dots menu on any file or folder in the tree to: * **Create** a new file or folder * **Rename** a file or folder * **Delete** a file or folder * **Upload** a file from your machine, including binary files such as Word or Excel templates Uploading binary files this way is useful for assets your app needs at runtime, such as a Word or Jinja template used to generate a report. This is separate from uploading a file to the chat as context for the agent (see [File support](https://docs.viktor.ai/docs/app-builder/.md#file-support)). If a file you uploaded to the chat should become part of your app, you can ask the agent to move it into your app's folder. ### Chat mode[​](https://docs.viktor.ai/docs/app-builder/.md#chat-mode "Direct link to Chat mode") Sometimes you want to talk to the agent without it changing your code, for example to understand what it did, question its assumptions, or brainstorm an approach before committing to a change. To do this, switch the mode selector next to the send button from **Build** to **Chat**. In chat mode, the agent responds with text only and is prevented from editing the app. ![The mode selector in the prompt input, with the options \"Build\" and \"Chat\"](/assets/images/app-builder-chat-mode-406ac4f3caf9d655e38b41f6e013ee24.png) For example, in chat mode you could ask: > How does the current pressure loss calculation handle non-circular pipes? A few things to keep in mind: * The selected mode stays active for your next messages, until you switch back to **Build**. When you leave the App Builder and come back, it starts in build mode again. * Chat mode is not available for the very first prompt in a new app, since that prompt is used to generate the initial app. * The agent still has access to your app's code, uploaded files, and the VIKTOR documentation, so it can answer questions grounded in your project. ### Managing changes[​](https://docs.viktor.ai/docs/app-builder/.md#managing-changes "Direct link to Managing changes") To inspect what changes have been made to your app, click the **Show changes** button. This will open a comparison of the current and previous revisions. If you are not happy with how the agent has changed your app, you can revert these changes by clicking the **Undo** button. ![The \"Show changes\" view comparing the current and previous app revisions](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXIAAABaCAYAAAClrN3mAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AABi2SURBVHic7d1/WFRl/v/xZ4kc9nJh/CDMbCCw0gVFhj8+NbKlGCWu34TVRNeuCTdBdsW1xB9RmlZ+/JmmKbJp0i6hboj5AzcW7etXSj4gFSKKCqJoGgi6zKBXI9FycNDvH4O/0pxBUJz1/biurqtm7nPPe+458zrn3OdmeuDSpUuXEEII4bAe7OgChBBCtI0EuRBCODgJciGEcHAS5EII4eAkyIUQwsFJkAshhIOTIBdCCAcnQS6EEA7O6XY2Kio6wKeffsbu3XuorDyFxdLc3nUJIcR9w8mpE35+PgwY0I8XXxyOXt+7Vds/0Nq/7ExMnMvatRtb9SJCCCHsN3bsaJYufcfu9q0K8tGj49m1q+C2ChNCCGG/Z5/tz8aNKXa1tXuOPDFxroS4EELcJbt2FZCYONeutnadkRcVHWDo0Og2FyaEEKJ1tm9PtzlnbtcZ+aefftYuBQkhhGgde/LXriDfvXtPm4sRQgjRevbkr11BXll5qs3FCCGEaD178teuIJd14kII0THsyV/5y04hhHBwEuRCCOHgJMgdmZMHkck7qN4zl3BtRxfTfjQhCXxZtok5Ya4dXYoQDuE/J8i7+DPy3VSKjxZjMhVTtmsViwxBKB1d121Sggykfb6YkT1u8Q4s9VTkbCF1fR5VDXevNiHEveW2fjSrPXX/XTc8+7ty4J1KLja16mdfrnJyJTRxMStiPDm4aS2pFc7oR44kbl4iVeVTWFVS375F3wUa3yACu9k6DKlUZH3E7LtSkRDiXtWhZ+Q+I7rRfZg7zf++yMULtxnigPLQQKKj/KnNmE/MtGRWfbCUCdFvk3rEhcAgz5azcgXfIeNJy8ul2lSK6egOMudFENilpRNNb2buzOXLZQkkbdpEwZ5cju9LZ5EhCM2Vw52NPrCeSWccyCIpK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dqFRlziem03kWvz6J1VFQVZLDwldSWLXbOi3C+W/ZvbeGOG01+UU1qA2Q/79HUH/jQdHeb7nZsVAtzWRyvMLieTHMSYlBUU+w5X/e5t0v6qDHrcqpI//DFLL1s4icNZfQY4UUldcTGOyJn7sznLv1e6nInM8Er7ks+nMiSeEnKDpcg4rnlb6z3xyHoeZ15oyLYuYQBYwHSH27kIoGFXVjMrMfe4tpf0hkdSyg1pA9P5n0I3dnL5HfIxdt9sYbE3nvvVUdXcY9yZ6xsXf8fvUrLZcuXbrhRvDPPS5aS0HjDuZzKqAQ/OrHfD7bm+z4aCZk3rhaqL3Y8/nb+j1yOSMXwkH861/GVj0uWkcTNomtKwZSmZlBzglPIv/UG8WYQ/4hO+fZO5AEuRBCAOb920j93xDmvDqLSFSq9m5j4dJkNh+7W5Not0+CXAghAMzlpCf8nvSEji6k9WTVihBCODgJctFmFy5YrvyeirjK2bkzFy7YWMiOjN/9zN59xBYJctFmlZXV9Oz5SEeXcc/p2fMRKiurbbaT8bt/2buP2CJBLtqsoKCIsLCn6dv3cTmzxHqW1bfv44SFPU1BQZHN9jJ+95/W7iO2yDpy0S50Ok/699fj59e9Xf5nso7swgULlZXVFBQU2b22W8bv/tLafcTWOnK7gvyhh3pjsTTbX6UQQoh24eTUiTNnDtyyjV1TK35+Pu1SkBBCiNaxJ3/tCvIBA/q1uRghhBCtZ0/+2hXkL744vM3FCCGEaD178teuINfrezN27Og2FySEEMJ+Y8eORq/vbbOdXTc7Lxs9Op5duwraVJgQQgjbnn22Pxs3ptjVtlXryDduTJEzcyGEuMPGjh1td4hDK8/ILysqOsCnn37G7t17qKw8JUsThRCiDZycOuHn58OAAf148cXhdk2nXOu2glwIIcS9Q/5EXwghHJwEuRBCODgJciGEcHAS5EII4eAkyIUQwsFJkAshhIOTIBdCCAcnQS6EEA5OglwIIRzc/wcTKBNB7SweiAAAAABJRU5ErkJggg==) Each change made to your app, whether by you or the agent, is automatically saved as a revision. This allows you to restore earlier versions of your app. To find a revision, scroll up in your chat history. You can restore that revision directly by clicking the **Restore** button. You may first want to see what the revision looked like by clicking the **Show revision** button, which will load the revision for your inspection before restoring. ![App revisions in the chat history, each with \"Show revision\" and \"Restore\" buttons](/assets/images/app-builder-revisions-70a479f34dcf7ca1127ea759eecfb3e6.png) ## Writing effective prompts[​](https://docs.viktor.ai/docs/app-builder/.md#writing-effective-prompts "Direct link to Writing effective prompts") The agent in the VIKTOR App Builder helps you transform ideas into working applications quickly. To get the most out of it, it's crucial to learn how to write effective prompts. Think of prompting as providing clear, concise instructions to the agent. The better your instructions, the better the result. ### Core prompting principles[​](https://docs.viktor.ai/docs/app-builder/.md#core-prompting-principles "Direct link to Core prompting principles") 1. **Structured input and output**
Clearly state what inputs you're providing and what outputs you expect, whether they are text, code, plots, tables, or 3D models. 2. **Clarity and specificity**
Provide enough context for the agent to understand the scope and capabilities. Describe exactly what calculations, formulas, or visualizations you need. 3. **Task decomposition**
Break complex tasks into smaller, manageable steps. For instance, first prompt for the UI, then the logic, and finally the visualization. These principles are also covered in our blog:
[Mastering LLMs: Essential Prompting Techniques for AEC Professionals](https://www.viktor.ai/blog/194/mastering-ll-ms-essential-prompting-techniques-for-aec-professionals) ### Tips for better prompts[​](https://docs.viktor.ai/docs/app-builder/.md#tips-for-better-prompts "Direct link to Tips for better prompts") Start with the goal: > I want an app that calculates pressure loss in a pipe based on user input. Mention input/output: > Inputs: diameter, flow rate, pipe length. Output: pressure loss in bar, shown as a table and line plot. Use engineering terms: > Use the Darcy‑Weisbach equation to calculate pressure loss. Break it down into steps: > First, generate the form UI. Then, write the calculation logic. Finally, render results. Guide the view/output: > Show pressure loss as a line plot versus pipe length, and include a summary table. Additionally, you can add some examples of inputs/outputs and expected behavior. This will allow the agent to understand your intentions. ## File support[​](https://docs.viktor.ai/docs/app-builder/.md#file-support "Direct link to File support") The App Builder allows you to upload a file to provide additional context for the agent. This is especially useful when your app idea is based on existing data, documentation, or visuals. The agent will automatically use the uploaded file to better understand your request and generate more relevant code. Only one file can be uploaded per prompt, and up to 20 files per conversation. Uploaded files remain available throughout the entire conversation even if you leave and return to the App Builder later. Supported file types: * Documents: .pdf, .csv, .doc, .docx, .xls, .xlsx, .xlsm, .html, .txt, .md, .py, .json, .yaml, .xml, .mcdx, .lsp (Max size: 4.5 MB) * Images: .png, .jpg, .jpeg, .gif, .webp (Max size: 3.75 MB, max resolution: 8000 × 8000 px) Below you can find a few supported use cases for the file upload functionality: * Uploading a CSV or Excel file to build an app that processes and visualizes the data. * Uploading a PDF report or specification document to extract relevant parameters or logic. * Uploading an image or schematic to guide the app's UI or calculations. Once uploaded, the file is automatically available to the agent and does not need to be referenced again manually, although doing so could improve accuracy. To view or remove the files you uploaded as context, click the paper clip icon in the chat to open the file manager. From there you can delete files that are no longer relevant to the conversation. Deleted files no longer count toward the limit of 20 files per conversation. note When creating an app that processes uploaded files, the example file you provide to the App Builder is used by the agent to generate the app code. However, to test the app functionality in the preview, you will still need to upload a file manually, as the example file is not automatically carried over to the preview environment. ### Best practices[​](https://docs.viktor.ai/docs/app-builder/.md#best-practices "Direct link to Best practices") * Be specific about what the agent should do with the file. For example: "Extract all material parameters from the uploaded PDF and use them to populate the form." * Mention the file or filename in your prompt. For example: "Use the uploaded Excel file to create an app that plots the temperature over time." * The agent examines the file to extract relevant information. If it struggles, you can help by providing additional context. For example: "The CSV has three columns: time, pressure, and velocity." ## App details[​](https://docs.viktor.ai/docs/app-builder/.md#app-details "Direct link to App details") From within the App Builder you can access the app details using the gear icon in the bottom left corner. Here you can configure several aspects that can be relevant during development or after publishing. ### Environment variables and secrets[​](https://docs.viktor.ai/docs/app-builder/.md#environment-variables-and-secrets "Direct link to Environment variables and secrets") Environment variables are fully supported in the App Builder. You can configure environment variables for your App Builder apps using the same process as for published apps: 1. Click on the gear icon in the bottom left corner inside the App Builder. 2. Select the **Variables** tab to create, update or remove environment variables. 3. Environment variables set here are automatically available within the App Builder environment during development. Environment variables can be accessed in your app code using the standard Python `os` module: ``` import os my_variable = os.getenv("MY_ENV_VAR") ``` For more detailed information on configuring and using environment variables, see the [Environment variables](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/environment-variables/.md) documentation. ### Saving functionality[​](https://docs.viktor.ai/docs/app-builder/.md#saving-functionality "Direct link to Saving functionality") On the Configuration tab you can configure your app's data persistence behavior by selecting an [app type](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md). This determines whether users can save their work or start fresh each time. #### Editor-only (default)[​](https://docs.viktor.ai/docs/app-builder/.md#editor-only-default "Direct link to Editor-only (default)") With this option, your app functions as a calculator without any data persistence. Every time a user opens the app, they start with a clean slate - no previous inputs or results are saved. This is ideal for: * Simple calculators or conversion tools * One-time analyses * Apps where users don't need to save or share their work #### Enable saving[​](https://docs.viktor.ai/docs/app-builder/.md#enable-saving "Direct link to Enable saving") This option allows users to save their inputs and results. They can create multiple saved instances (entities), return to edit them later, and share them with other users. This is suitable for: * Design tools where users want to save multiple design options * Analysis apps where users need to track and compare different scenarios * Collaborative workflows where users need to share their work warning The entity layer (saving functionality) is only available in the published app, not in the app preview inside the App Builder. To test saving functionality, you must publish your app first. For more information on the differences between app types, see [App types](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md) in the Getting Started section. ## Integrations[​](https://docs.viktor.ai/docs/app-builder/.md#integrations "Direct link to Integrations") Integrations allow your app to connect to services and software outside the VIKTOR platform. The App Builder supports two types of integrations: * **OAuth 2.0 integrations** connect your app to external services such as cloud storage providers, databases, or third-party APIs. This enables your app to fetch data from or push data to these services securely. * **Worker integrations** connect your app to desktop software such as engineering tools (for example SCIA Engineer, ETABS, or Rhino/Grasshopper) using a [worker](https://docs.viktor.ai/docs/create-apps/software-integrations/.md): a program that runs on your own machine or a server and executes jobs for your app. note Your administrator must configure and enable OAuth 2.0 integrations before they become available to you. If you don't see the integration you need, contact your administrator. Most worker integrations do not require an administrator: personal workers are allowed by default for newly created apps, so you can install and connect a worker yourself. The exception is [Python-based worker integrations](https://docs.viktor.ai/docs/app-builder/.md#python-based-worker-integrations), which your administrator must explicitly allow for your environment before you can select them. ### Setting up an integration[​](https://docs.viktor.ai/docs/app-builder/.md#setting-up-an-integration "Direct link to Setting up an integration") To add an integration to your App Builder app: 1. **Select the integration**: Click the gear icon in the bottom left corner and navigate to the **Integrations** tab. The dropdown lists the available OAuth 2.0 integrations and worker integrations. Select the integration(s) you want to use and save your selection. Alternatively, you can ask the agent to set up an integration. It can update the integration configuration of your app for you. 2. **Inform the agent**: Return to the App Builder chat and tell the agent which integration you want to use in your app. For example: > "I want to use the Autodesk Platform Services integration to access project data from ACC." > "Use the ETABS worker integration to run my structural analysis model." 3. **Connect the integration**: The agent will generate the necessary code. * For **OAuth 2.0 integrations**: when you interact with the app preview and trigger the integration, a pop-up will appear to guide you through the OAuth 2.0 login flow for the selected service. * For **worker integrations**: after your app reloads with a worker integration selected, an installation guide opens automatically that takes you through downloading, installing, and connecting the worker. You can check the connection status of your integrations at any time using the integration status icon in the App Builder toolbar. Clicking it opens an overview of all integrations of your app; a worker that is not connected yet shows a **Set up** button that launches the installation guide. ### Example use cases[​](https://docs.viktor.ai/docs/app-builder/.md#example-use-cases "Direct link to Example use cases") * Connect to Autodesk Platform Services (APS) to access project data from Autodesk Construction Cloud (ACC) or BIM 360 * Access external databases to fetch or update data * Integrate with cloud storage providers to read and write files * Pull data from third-party APIs for analysis or visualization * Run an analysis in desktop software such as SCIA Engineer, ETABS, or Rhino/Grasshopper and show the results in your app ### Worker integrations: things to keep in mind[​](https://docs.viktor.ai/docs/app-builder/.md#worker-integrations-things-to-keep-in-mind "Direct link to Worker integrations: things to keep in mind") * One worker can be selected per software type. The full list of software packages with a dedicated worker integration can be found on the [software integrations](https://docs.viktor.ai/docs/create-apps/software-integrations/.md) page. * The [generic worker](https://docs.viktor.ai/docs/create-apps/software-integrations/generic/.md) is not available in the App Builder. If your app requires a generic worker integration, we advise developing it locally using your preferred IDE and `viktor-cli`. * The agent might need additional context about the software you are integrating with. If the agent has trouble generating the right code, provide more details in your prompt or upload a relevant file in the chat, for example an input or output file of the software, the API specification, or a document describing the expected workflow. See [File support](https://docs.viktor.ai/docs/app-builder/.md#file-support) for the supported file types. ### Python-based worker integrations[​](https://docs.viktor.ai/docs/app-builder/.md#python-based-worker-integrations "Direct link to Python-based worker integrations") For some worker integrations, the App Builder generates a Python script and runs it through the worker on your own machine. Because this code is generated by the agent and runs without a review step in between, your administrator must explicitly allow these integrations for your environment before you can use them. This applies to the following worker integrations: * PLAXIS * Revit * Tekla * Python The opt-in is **off by default**. While it is off, these worker types do not appear in the integrations dropdown, and the agent will not generate or configure them. To enable them, an administrator turns on **Allow Python-based workers in the app builder** in the **App builder** section of the environment's permission settings. If you need one of these integrations and it is not available, contact your administrator. ## Collaborating and sharing[​](https://docs.viktor.ai/docs/app-builder/.md#collaborating-and-sharing "Direct link to Collaborating and sharing") ### Inviting maintainers[​](https://docs.viktor.ai/docs/app-builder/.md#inviting-maintainers "Direct link to Inviting maintainers") The **Invite** button in the top-right corner lets you invite colleagues to collaborate on building your app as maintainers. Add colleagues as maintainers when you want to build the app together. Maintainers have full access to: * Edit the app code * Chat with the agent * View the complete conversation history * Access all app revisions When multiple maintainers are collaborating, the App Builder uses an edit lock mechanism to prevent conflicts. When one maintainer is actively working in the App Builder, other maintainers cannot access it until the first user exits and the lock is released. ### Publishing[​](https://docs.viktor.ai/docs/app-builder/.md#publishing "Direct link to Publishing") Once you are satisfied with your app and wish to make it available to others, click the **Publish** button (rocket icon) in the top-right corner. You can choose between three visibility options: ![The Publish dialog with Private, Internal, and Public visibility options](/assets/images/app-builder-publish-e4fc222a975bcf7fbee2587020a0214e.png) * **Private**: The app is only accessible to people inside your company that you share the link with. Use this option to invite colleagues to test your app and provide feedback before a wider release. * **Internal**: The app is published to your internal Library and is discoverable by your whole organization. * **Public**: The app is accessible by your whole organization and anyone on the internet with the link. Only administrators can set public access. The dialog also asks where the version should go: the **Testing** line, the **Production** line, or both. Publishing to Testing only lets you try the version out in a testing workspace without changing what people in your projects run. See [testing and production versions](https://docs.viktor.ai/docs/publish-apps/.md#testing-and-production-versions). After the publishing process is completed, you can add the app to a project to start using it. You can point either line at a different version later, from the versions tab described in [Version history](https://docs.viktor.ai/docs/manage-apps/workspaces-and-apps/.md#version-history). ### Continuing development[​](https://docs.viktor.ai/docs/app-builder/.md#continuing-development "Direct link to Continuing development") Every change you make to your app within the App Builder is saved as a revision, so you can exit the App Builder without losing your progress. You can find your apps on the Develop page. Click the Develop button to re-enter the App Builder and continue enhancing your app! ![An app card on the Develop page with a \"Develop\" button to re-enter the App Builder](/assets/images/app-builder-app-card-90dd212ae42b50bc2ca2774981db5d00.png) ## Troubleshooting and debugging[​](https://docs.viktor.ai/docs/app-builder/.md#troubleshooting-and-debugging "Direct link to Troubleshooting and debugging") LLMs make mistakes, therefore, you might encounter issues or unexpected behavior. Here's how to approach troubleshooting and debugging your app within the App Builder. Keep an eye on the [console](https://docs.viktor.ai/docs/app-builder/.md#console). It shows real-time logs, `print()` output, and Python errors as your app runs. ### Understanding error messages[​](https://docs.viktor.ai/docs/app-builder/.md#understanding-error-messages "Direct link to Understanding error messages") When an error occurs, the App Builder displays an error message. Switch to Code mode to see the error with a Python traceback in the console. ![An error message in the App Builder with a Python traceback shown in the console](/assets/images/app-builder-error-aef62f26d2a3542353cb29e298eed7f5.png) This traceback is crucial for identifying the problem: * Location: Look for file names (e.g. app.py) and line numbers. This tells you exactly where the error occurred in your code. * Error type: The error type (e.g. NameError, AttributeError, TypeError, ValueError) indicates the kind of problem. * NameError: You are using a variable or function that hasn't been defined. * AttributeError: You are accessing an attribute or method that the object doesn't have, for example a misspelled method name. * TypeError: Occurs when an operation is performed on an object of an inappropriate type (e.g. trying to add a string and a number). * ValueError: Indicates that an operation received an argument that has the right type but an inappropriate value. * Description: Read the accompanying description carefully. It often provides specific details about why the error occurred. More information on Python Tracebacks can be found in [this Real Python](https://realpython.com/python-traceback/) article. You can ask the agent to fix the error for you by clicking the **Fix with VIKTOR.AI** button. The agent can also help explain why the error occurred. ### Debugging your Python code[​](https://docs.viktor.ai/docs/app-builder/.md#debugging-your-python-code "Direct link to Debugging your Python code") Besides adding `print()` statements and checking the [console](https://docs.viktor.ai/docs/app-builder/.md#console), you can: * Check Input Values: Verify that the inputs provided in the UI are what your code expects. Sometimes, a simple typo in the input can lead to unexpected results. * Inspect Intermediate Calculations: For complex calculations, break it down in smaller steps and visualize each sub-result. This helps pinpoint exactly where the calculation goes wrong. ### When the App Builder gets stuck or generates unexpected code[​](https://docs.viktor.ai/docs/app-builder/.md#when-the-app-builder-gets-stuck-or-generates-unexpected-code "Direct link to When the App Builder gets stuck or generates unexpected code") Sometimes the App Builder might struggle with a complex prompt, produce irrelevant code, or seem stuck in a loop. Here's how to help it: 1. Simplify Your Prompt: If your initial prompt was very broad or complex, try breaking it down into smaller, more specific steps (see [Core prompting principles](https://docs.viktor.ai/docs/app-builder/.md#core-prompting-principles)) * Instead of: "Create an app that calculates structural integrity and plots the results in 3D, allowing for material changes and load variations." * Try: "First, create a form with inputs for material properties (e.g., Young's Modulus, Poisson's Ratio) and dimensions. Next, add a view for a simple stress calculation based on these inputs." 2. Provide More Context: If the agent is missing information, provide it explicitly. This is especially true when trying to use uploaded files in your app. * If the agent struggles with a CSV: "The CSV file has three columns: Time (s), Force (kN), Displacement (mm)." 3. Rephrase or Reset: If the agent's response is consistently off-topic, try rephrasing your prompt with different keywords or a different approach. If it seems truly stuck, you can try reverting to an earlier revision of your app and trying a different prompting strategy. 4. Make Manual Edits: For small, specific issues, it might be faster and more efficient to switch to Code mode and fix the Python code yourself rather than trying to prompt the agent to fix it. ## The underlying large language model[​](https://docs.viktor.ai/docs/app-builder/.md#the-underlying-large-language-model "Direct link to The underlying large language model") The App Builder uses Anthropic's Claude models to generate VIKTOR code based on your prompts. See our [AI addendum](https://www.viktor.ai/ai-specific-addendum) for more information on how AI features are integrated into the VIKTOR platform. ## Limitations[​](https://docs.viktor.ai/docs/app-builder/.md#limitations "Direct link to Limitations") note The App Builder is under active development and is updated on a regular basis. The limitations listed here reflect the current version and will be updated as new features ship. Not all features supported in local development are currently available in the App Builder. When you run into one of these limitations, you can continue developing locally in your own IDE. To install VIKTOR for local development, go to your **Personal settings**, open **Local development** and click **Install VIKTOR**. See the [installation guide](https://docs.viktor.ai/docs/getting-started/installation/.md) for details, and [Migrating from App Builder to local development](https://docs.viktor.ai/docs/app-builder/choosing-development-approach/.md#migrating-from-app-builder-to-local-development) for how to move your app code. For a full side-by-side comparison of the App Builder and local development, see [Choosing your development approach](https://docs.viktor.ai/docs/app-builder/choosing-development-approach/.md). ### App types[​](https://docs.viktor.ai/docs/app-builder/.md#app-types "Direct link to App types") The current version of the App Builder supports creating `Editor` and `Simple` type apps. For more information on the different app types, please refer to [App types](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md) in the Getting Started section of the documentation. ### Python version[​](https://docs.viktor.ai/docs/app-builder/.md#python-version "Direct link to Python version") The App Builder runs on Python 3.13. Selecting a different Python version is not currently supported. ### Supported packages[​](https://docs.viktor.ai/docs/app-builder/.md#supported-packages "Direct link to Supported packages") The App Builder currently supports a fixed set of libraries that you can use in your apps. In the current version of the App Builder, it is not possible to install additional packages. Below you can find the full list of supported packages: ``` aiohttp==3.14.3 altair==6.3.0 anthropic==1.11.0 aps-viewer-sdk==0.1.4 beautifulsoup4==4.15.0 blue-prints==0.7.2 bokeh==3.10.0 chardet==7.6.0 databricks-sdk==0.146.0 ezdxf==1.4.4 fiona==1.10.1 folium==0.20.0 geopandas==1.2.0 geopy==2.5.0 google-genai==2.27.0 ifcopenshell==0.8.5 jinja2==3.1.6 kaleido==1.4.0 lxml==6.1.3 matplotlib==3.11.2 networkx==3.7 numpy==2.5.3 openai==3.24.0 opencv-python==4.14.0.94 openpyxl==3.1.5 openseespy==3.8.0.0 pandas==3.0.6 pdfplumber==0.11.10 pillow==12.3.0 pint==0.26.1 plotly==6.9.0 polars==1.44.2 pymupdf==1.28.2 pypdf==6.19.0 python-docx==1.2.0 python-pptx==1.0.2 reportlab==5.0.1 requests==2.34.2 rhino3dm==8.35.0 scikit-learn==1.9.1 scipy==1.18.1 seaborn==0.13.2 shapely==2.1.2 statsmodels==0.14.6 sympy==1.14.0 trimesh==5.1.1 urllib3==2.8.0 viktor==14.36.1 xarray==2026.9.0 yfinance==1.7.0 ``` ### Code size limit[​](https://docs.viktor.ai/docs/app-builder/.md#code-size-limit "Direct link to Code size limit") Each code file has a maximum file size of 450 KB. If a file is growing toward this limit, ask the agent to split the code across multiple files. If your app as a whole is becoming very large, consider splitting responsibilities into smaller focused apps, or migrate to local development. ### File upload[​](https://docs.viktor.ai/docs/app-builder/.md#file-upload "Direct link to File upload") Only one file can be uploaded per prompt, and up to 20 files per conversation. See the [File support](https://docs.viktor.ai/docs/app-builder/.md#file-support) section above for supported file types and size limits. ### Generic worker integrations[​](https://docs.viktor.ai/docs/app-builder/.md#generic-worker-integrations "Direct link to Generic worker integrations") The [generic worker](https://docs.viktor.ai/docs/create-apps/software-integrations/generic/.md), which runs any executable or script, is not available in the App Builder. Dedicated worker integrations are supported, see [Integrations](https://docs.viktor.ai/docs/app-builder/.md#integrations). ### Regional hosting[​](https://docs.viktor.ai/docs/app-builder/.md#regional-hosting "Direct link to Regional hosting") VIKTOR supports [regional hosting](https://docs.viktor.ai/docs/manage-apps/regional-hosting/.md), meaning apps are synced across multiple geographic regions. Apps created with the App Builder are also synced across regions. However, the content (chat history and app revisions) of the associated App Builder environment is not synced across regions. If you try to edit the app from a different region, VIKTOR will automatically redirect you to the correct region. --- # Two ways to build a VIKTOR app VIKTOR offers two ways to build apps: the **App Builder** and **local development**. Both produce the same kind of VIKTOR app — the difference is in how you write and manage the code. * **[App Builder](https://docs.viktor.ai/docs/app-builder/.md)** — a browser-based environment where an AI-powered coding agent helps you build apps without any local setup. Great for getting started quickly. * **[local development](https://docs.viktor.ai/docs/getting-started/installation/local-development/.md)** — write your app code in your preferred IDE (such as VS Code or PyCharm) on your own machine, using `viktor-cli` to connect to VIKTOR. Better suited when you want full control over your code, files, and environment. note The App Builder is under active development and updated regularly. The information on this page reflects the current version and will be updated as new features ship. For the most up-to-date list of App Builder limitations, see the [Limitations](https://docs.viktor.ai/docs/app-builder/.md#limitations) section of the App Builder documentation. ## Quick comparison[​](https://docs.viktor.ai/docs/app-builder/choosing-development-approach/.md#quick-comparison "Direct link to Quick comparison") | | App Builder | Local development | | ----------------------------- | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | | Setup required | None — works entirely in the browser | Python, an IDE, and `viktor-cli` installed on your machine | | Getting started | Fast — go from idea to app in minutes | Slower — requires initial setup | | Code structure | Multiple files and folders, managed by you or the agent | Multiple files and folders, full control | | Code size | 450 KB maximum per file | No practical limit | | Available packages | Fixed set of [pre-installed packages](https://docs.viktor.ai/docs/app-builder/.md#supported-packages) | Any Python package | | OAuth 2.0 integrations | Supported | Supported | | Desktop software integrations | Supported via workers (dedicated integrations only) | Supported via workers, including the generic worker | | Deployment | Automatic on publish | Manual publish step | | Version control | Built-in revision history | Git / any version control system | | Testing | Not supported | Write and run automated tests | | AI coding assistants | Built-in, VIKTOR-aware AI | Use your own — GitHub Copilot, Claude Code, Cursor, etc. | | Agent file context | 1 file per prompt, up to 20 per conversation (documents: 4.5 MB, images: 3.75 MB) | Limited by your AI coding assistant | ## App Builder[​](https://docs.viktor.ai/docs/app-builder/choosing-development-approach/.md#app-builder "Direct link to App Builder") ### When to choose the App Builder[​](https://docs.viktor.ai/docs/app-builder/choosing-development-approach/.md#when-to-choose-the-app-builder "Direct link to When to choose the App Builder") * You want to get from idea to working app as fast as possible * You have limited coding experience or are new to Python * You don't want to install or configure anything locally * Your app is self-contained and doesn't require complex code organisation ### Pros[​](https://docs.viktor.ai/docs/app-builder/choosing-development-approach/.md#pros "Direct link to Pros") * **No local setup required** — works entirely in the browser; no installation needed * **Fast prototyping** — go from idea to working app in minutes * **Built-in agent** — understands VIKTOR-specific patterns and helps you write code * **Instant deployment** — apps are easy to publish with a click of a button * **No environment management** — Python version, packages, and dependencies are all handled for you ### Cons[​](https://docs.viktor.ai/docs/app-builder/choosing-development-approach/.md#cons "Direct link to Cons") * **Code size limit** — each code file has a maximum file size of 450 KB * **Fixed package set** — only [pre-installed packages](https://docs.viktor.ai/docs/app-builder/.md#supported-packages) are available; you cannot add your own * **No generic worker** — desktop software integrations via workers are supported, but only for software with a [dedicated integration](https://docs.viktor.ai/docs/create-apps/software-integrations/.md); the generic worker is not available * **Limited context file uploads** — only one file (documents: 4.5 MB, images: 3.75 MB) can be uploaded per prompt, up to 20 per conversation ## Local development (IDE + viktor-cli)[​](https://docs.viktor.ai/docs/app-builder/choosing-development-approach/.md#local-development-ide--viktor-cli "Direct link to Local development (IDE + viktor-cli)") ### When to choose local development[​](https://docs.viktor.ai/docs/app-builder/choosing-development-approach/.md#when-to-choose-local-development "Direct link to When to choose local development") * You want full control over the file and folder structure of your app * You need a Python package that is not available in the App Builder * You want to integrate with desktop software that requires the [generic worker](https://docs.viktor.ai/docs/create-apps/software-integrations/generic/.md) * You want to use Git for version control and work in a team with branches and pull requests * You need automated testing or automated deployment * You are comfortable with Python, or are using an AI coding assistant to help you get started ### Pros[​](https://docs.viktor.ai/docs/app-builder/choosing-development-approach/.md#pros-1 "Direct link to Pros") * **Full code flexibility** — complete control over how your code is structured across files and folders * **Any Python package** — no restrictions on which libraries you can use * **Suitable for complex apps** — no limits on code size or structure * **Desktop software integrations** — connect VIKTOR to any local desktop software, including custom tools via the generic worker * **Git integration** — use branches, pull requests, and full version control history * **Automated testing** — write and run automated tests * **Automated deployment** — set up pipelines to automatically test and publish your app * **AI coding assistants** — tools like GitHub Copilot, Claude Code, and Cursor can understand your entire project; use as context to make them VIKTOR-aware ### Cons[​](https://docs.viktor.ai/docs/app-builder/choosing-development-approach/.md#cons-1 "Direct link to Cons") * **Setup required** — you need to install Python, an IDE (such as VS Code or PyCharm), and `viktor-cli` before you can start building apps * **Steeper learning curve** — requires familiarity with Python and working in a terminal * **Slower to get started** — more time from idea to running app compared to the App Builder * **VIKTOR SDK knowledge needed** — you need to understand how VIKTOR's SDK works to be productive, although AI coding assistants can help bridge this gap ## Migrating from App Builder to local development[​](https://docs.viktor.ai/docs/app-builder/choosing-development-approach/.md#migrating-from-app-builder-to-local-development "Direct link to Migrating from App Builder to local development") If you started with the App Builder and have outgrown its limits, you can continue developing locally: 1. In the App Builder, switch to **Code mode** and copy the contents of your app files. 2. Follow the [installation instructions](https://docs.viktor.ai/docs/getting-started/installation/.md) to set up `viktor-cli`. 3. Create a new local app and recreate your files, preserving the same file and folder structure. 4. From here you can freely restructure your code, add packages, and connect integrations. --- # Develop apps This section is your go-to place when you are developing. It gives you an overview of all tools you have at your disposal as a VIKTOR developer, including the different ways of creating apps, an overview of all VIKTOR components and tutorials on how to use them. ## Two ways to build a VIKTOR app[​](https://docs.viktor.ai/docs/create-apps/.md#two-ways-to-build-a-viktor-app "Direct link to Two ways to build a VIKTOR app") VIKTOR offers two ways to build apps: the **App Builder** and **local development**. Both produce the same kind of VIKTOR app — the difference is in how you write and manage the code. [![AI icon](/img/icons/icon-ai-sparkles.svg)](https://docs.viktor.ai/docs/app-builder/.md) ### [App Builder](https://docs.viktor.ai/docs/app-builder/.md) [* Browser-based environment* AI assitant* Great for getting started quickly.](https://docs.viktor.ai/docs/app-builder/.md) [![Code icon](/img/icons/icon-code-rounded.svg)](https://docs.viktor.ai/docs/getting-started/installation/local-development/.md) ### [Local development](https://docs.viktor.ai/docs/getting-started/installation/local-development/.md) [* Write your app code in your preferred IDE on your own computer* Better suited for larger or more complex apps.](https://docs.viktor.ai/docs/getting-started/installation/local-development/.md) See [Two ways to build a VIKTOR app](https://docs.viktor.ai/docs/app-builder/choosing-development-approach/.md) for a side-by-side comparison. ## Fundamentals[​](https://docs.viktor.ai/docs/create-apps/.md#fundamentals "Direct link to Fundamentals") Whether you start with the App Builder or develop your app locally. It’s good to know some basics. [![Layers icon](/img/icons/icon-layers.svg)](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure/.md) ### [Basic app structure](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure/.md) [* App file structure* Inputs (parametrization)* Results & visualizations](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure/.md) [![Category icon](/img/icons/icon-category.svg)](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md) ### [App types](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md) [* Editor type* Simple type* Tree type](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md) ### VIKTOR components[​](https://docs.viktor.ai/docs/create-apps/.md#viktor-components "Direct link to VIKTOR components") Learn about the different types of fields and visualizations VIKTOR has to offer. [![Inputs illustration](/img/illustrations/Illustration-inputs-frame.svg)](https://docs.viktor.ai/docs/create-apps/user-input/.md) ### [Inputs](https://docs.viktor.ai/docs/create-apps/user-input/.md) [Add fields, sliders, uploads, etc so users can give your app the information it needs.](https://docs.viktor.ai/docs/create-apps/user-input/.md) [![Results illustration](/img/illustrations/Illustration-results-frame.svg)](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md) ### [Results](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md) [Show plots, charts, 3D models, tables and maps to visualize the results.](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md) [![Layouts illustration](/img/illustrations/illustration-layouts-frame.svg)](https://docs.viktor.ai/docs/create-apps/layout-and-styling/.md) ### [Layouts](https://docs.viktor.ai/docs/create-apps/layout-and-styling/.md) [Arrange how inputs, results, and other elements appear to make your app easy and intuitive to use.](https://docs.viktor.ai/docs/create-apps/layout-and-styling/.md) ## Integrations[​](https://docs.viktor.ai/docs/create-apps/.md#integrations "Direct link to Integrations") Eliminate manual data transfers between different software packages and disciplines. * **Integrations** Learn more about the integration options VIKTOR offers. [Learn more](https://docs.viktor.ai/docs/create-apps/software-integrations/.md) [ ](https://docs.viktor.ai/docs/create-apps/software-integrations/.md) ## Collaboration[​](https://docs.viktor.ai/docs/create-apps/.md#collaboration "Direct link to Collaboration") Share your apps and collaborate with your team. * **Sharing your app** Learn how to collaborate with other users on your app. [Learn more](https://docs.viktor.ai/docs/publish-apps/.md) [ ](https://docs.viktor.ai/docs/publish-apps/.md) --- # Automated testing Writing tests is an essential part of application development. Whether the application is intended for self-use only or for distribution, it is important to test that all functionalities work as expected. The more thorough your application is tested, the more robust it will be and code changes can be made with more confidence. An application can be tested by manually clicking through the different entities and checking all functionalities for different scenarios. This, however, takes a lot of time and can easily be replaced by writing a few **automated** tests. Automated testing will prevent you from spending a lot of time trying to find and fix bugs in the application later on. There is a lot of documentation available on writing tests. The following webpages provide info on good practices for writing automated tests in Python: * * ## Testing frameworks[​](https://docs.viktor.ai/docs/create-apps/automated-testing/.md#testing-frameworks "Direct link to Testing frameworks") Python has its own builtin library available for writing automated tests: [unittest](https://docs.python.org/3/library/unittest.html). The CLI [`test`](https://docs.viktor.ai/docs/create-apps/references/cli#test) and [`ci-test`](https://docs.viktor.ai/docs/create-apps/references/cli#ci-test) commands works with the unittest library out-of-the-box. Other testing frameworks There are other third-party Python libraries for testing, such as `pytest`, `nose2`, or `robotframework`, but currently only `unittest` is directly supported by the CLI. ## Testing as part of the development lifecycle[​](https://docs.viktor.ai/docs/create-apps/automated-testing/.md#testing-as-part-of-the-development-lifecycle "Direct link to Testing as part of the development lifecycle") It is good practice to not only write a few tests for your application here and there, but make testing an integral part of your Software Development Life Cycle (SDLC). This allows you to worry less about you or your colleague introducing new bugs, so that you can focus more on developing interesting and impactful additions to your app. A good way to make testing an integral part of your development lifecycle, is through Continuous Integration (CI). Please refer to our [CI/CD guide](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/ci/.md) to set this up. ## Writing tests[​](https://docs.viktor.ai/docs/create-apps/automated-testing/.md#writing-tests "Direct link to Writing tests") When writing automated tests, two main types of tests can be considered: **unit** and **integration** tests. In short, a unit test is the test of a single specific module or function and shows that the individual parts are working correctly. An integration test is a test of an overall system of multiple modules or functions, and shows that the interfaces between the modules are working correctly. A unit test verifies that a certain input results in the expected output (for all cases of interest), but does not detect integration errors or other application-wide issues. On the other hand, an integration test may detect errors when functions or modules are incorrectly integrated but usually doesn't check intermediate results and specific cases. Integration tests tend to be much more complex than unit tests and often requires more [mocking](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) of certain parts of your application. In the context of a VIKTOR app you could consider asserting that a view method returns the expected result with an integration test. We have introduced functionality to make this easy to implement, see [mocking view functions](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md#mocking-view-functions) for an example implementation. A generic example of a unittest is shown below. In this example, a particular function is imported from the app code and tested using the unittest framework. It tests whether the function provides the correct output for a valid input, and it tests whether a correct error is raised when the input is incorrect. ``` import unittest from app.function_library.weight_functions import calculate_weight class TestWeightFunctions(unittest.TestCase): def test_calculate_weight_returns_correct_value(self): # Arrange volume = 10 density = 100 expected_weight = 1000 # Act weight = calculate_weight(volume, density) # Assert self.assertEqual(weight, expected_weight) def test_calculate_weight_raises_TypeError_with_incorrect_input(self): # Arrange volume = 10 density = 'one hundred' # Act & Assert with self.assertRaises(TypeError): weight = calculate_weight(volume, density) ``` ## Folder structure[​](https://docs.viktor.ai/docs/create-apps/automated-testing/.md#folder-structure "Direct link to Folder structure") Whether you are writing unit tests or integration tests, it is good-practice to separate the test code from the application code. We advise using the general folder structure described below. note the CLI [test](https://docs.viktor.ai/docs/create-apps/references/cli#test) and [`ci-test`](https://docs.viktor.ai/docs/create-apps/references/cli#ci-test) commands require all tests to reside in a folder named "tests". ``` my-app ├── app.py ├── tests │ ├── test_app.py <- you are free to split this file up into separate files within the tests folder │ └── __init__.py └── ... ``` Or for larger apps: ``` my-app ├── app │ ├── entity_type_1 │ │ ├── controller.py │ │ └── parametrization.py │ ├── entity_type_2 │ │ ├── controller.py │ │ └── parametrization.py │ ├── function_library │ │ └── weight_functions.py │ └── __init__.py ├── tests │ ├── entity_type_1 │ │ ├── test_controller.py │ │ └── __init__.py │ ├── entity_type_2 │ │ ├── test_controller.py │ │ └── __init__.py │ ├── function_library │ │ ├── test_weight_functions.py │ │ └── __init__.py │ └── __init__.py └── ... ``` caution Always make sure that each folder in the 'tests' directory contains an `__init__.py` and that the Python files start with `test_.py`! --- # Mocking Mocking is (temporary) replacing parts of your to-be-tested application with 'fake' objects within the scope of the test, so that you have full control over input and output within a certain test function. Python’s `unittest` library has built-in functionalities for mocking: Learn more? The topic of 'mocking in Python' is extensively covered on the website: When writing tests for your VIKTOR application, it is likely that you will **need** to mock certain VIKTOR functions. For example, `API` calls in your app encountered within a test will return a "OSError: Job token is not set" error, as the token is not available outside the app context. The [`viktor.testing`](https://docs.viktor.ai/sdk/api/testing/.md) module provides various mock-objects to simplify the process of mocking certain VIKTOR objects. VIKTOR components that require mocking: * [`API` calls](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md#mocking-api) * [Functions decorated with `@ParamsFromFile`](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md#mocking-paramsfromfile) * [View functions (e.g. functions decorated with `@GeometryView`)](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md#mocking-view-functions) * [Functions that call external worker](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md#mocking-functions-that-call-external-worker) * [Functions that call external servers](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md#mocking-functions-that-call-external-servers) ## Mocking `API`[​](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md#mocking-api "Direct link to mocking-api") API calls need to be mocked within the context of (automated) testing. There are two approaches you could take to achieve this: 1. By [using the `mock_API`](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md#testing-by-using-mock_api) decorator 2. By [isolating API actions](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md#testing-by-isolating-api-actions) in separate methods ### Testing by using `mock_API`[​](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md#testing-by-using-mock_api "Direct link to testing-by-using-mock_api") New in v13.3.0 ``` import unittest from viktor.testing import mock_API from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_API() def test_function(self): MyEntityTypeController().function(...) ``` For each method that is called on the `API` class, the decorator will return mock objects: * `MockedEntity` representing [`Entity`](https://docs.viktor.ai/sdk/api/api-v1/.md#_Entity) (e.g. when calling `API.get_entity()`) * `MockedEntityList` representing [`EntityList`](https://docs.viktor.ai/sdk/api/api-v1/.md#_EntityList) (e.g. when calling `API.get_root_entities()`) * `MockedEntityRevision` representing [`EntityRevision`](https://docs.viktor.ai/sdk/api/api-v1/.md#_EntityRevision) (e.g. when calling `API.get_entity_revisions()`) * `MockedEntityType` representing [`EntityType`](https://docs.viktor.ai/sdk/api/api-v1/.md#_EntityType) (e.g. when calling `Entity.entity_type`) * `MockedUser` representing [`User`](https://docs.viktor.ai/sdk/api/api-v1/.md#_User) (e.g. when calling `API.get_current_user()`) Each of these mock objects supports the properties and methods of their represented objects, for example, `MockedEntity.last_saved_params` mimics `Entity.last_saved_params`. Assume the `function()` of the example above performs an API call to retrieve the child entities to count the number of red, green, and blue entities: ``` import viktor as vkt class MyEntityTypeController(vkt.Controller): ... def function(self, entity_id): red, green, blue = 0, 0, 0 children = vkt.api_v1.API().get_entity_children(entity_id) for child in children: if child.last_saved_params.color == 'red': red += 1 if child.last_saved_params.color == 'green': green += 1 if child.last_saved_params.color == 'blue': blue += 1 return red, green, blue ``` By default, the [`mock_API`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_API) decorator returns a zero-length `MockedEntityList` when `get_entity_children()` is called. This means that, in the example above, `function` will return (0, 0, 0). However, the decorator allows you to specify the outcome of each individual method such that we can actually test what would happen if a VIKTOR app instance consists of specific entities. For example, let's pass the entities that `get_entity_children()` in the example above should return, by providing a sequence of `MockedEntity` objects in the decorator: ``` import unittest from viktor.testing import mock_API, MockedEntity from app.my_entity_type.controller import MyEntityTypeController CHILD_ENTITIES = [ MockedEntity(params={'color': 'red'}), MockedEntity(params={'color': 'green'}), MockedEntity(params={'color': 'green'}), MockedEntity(params={'color': 'blue'}), ] class TestMyEntityTypeController(unittest.TestCase): @mock_API(get_entity_children=CHILD_ENTITIES) def test_function(self): red, green, blue = MyEntityTypeController().function(...) self.assertEqual(red, 1) self.assertEqual(green, 2) self.assertEqual(blue, 1) ``` Instead of the default zero-length `MockedEntityList`, the decorator is now instructed to return the provided entities. Note that in this example the params are passed to `MockedEntity`, but you can define much more (e.g. parent / children / siblings etc.). ### Testing by isolating API actions[​](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md#testing-by-isolating-api-actions "Direct link to Testing by isolating API actions") Structuring the controller in such a way that each API action is isolated in a separate method makes it easier to maintain, debug, and reuse your code. Assume a controller that looks like this: ``` import viktor as vkt class MyEntityTypeController(vkt.Controller): def get_child_params(self, entity_id): # perform API actions return child_params def get_parent_params(self, entity_id): # perform API actions return parent_params @vkt.GeometryView("3D model", x_axis_to_right=True) def visualize(self, params, entity_id, **kwargs): parent_params = self.get_parent_params(entity_id) child_params = self.get_child_params(entity_id) visualization = self.create_visualisation(parent_params, child_params) return vkt.GeometryResult(visualization) def download_file(self, params, entity_id, **kwargs): parent_params = self.get_parent_params(entity_id) download_content = self.generate_download_result(parent_params) return vkt.DownloadResult(download_content) ``` If the `visualize` and `download_file` methods are now to be tested, we can make use of unittests `mock.patch.object` decorator in combination with `mock.MagicMock` to control the return value: ``` import unittest from unittest import mock from app.my_entity_type.controller import MyEntityTypeController # params dictionaries ENTITY_PARAMS = ... PARENT_PARAMS = ... CHILD_PARAMS = ... class TestMyEntityTypeController(unittest.TestCase): @mock.patch.object(MyEntityTypeController, 'get_child_params', mock.MagicMock(return_value=CHILD_PARAMS)) @mock.patch.object(MyEntityTypeController, 'get_parent_params', mock.MagicMock(return_value=PARENT_PARAMS)) def test_visualise(self): MyEntityTypeController().visualize(params=ENTITY_PARAMS) @mock.patch.object(MyEntityTypeController, 'get_child_params', mock.MagicMock(return_value=CHILD_PARAMS)) def test_generate_download_content(self): MyEntityTypeController().generate_download_content(params=ENTITY_PARAMS) ``` ## Mocking deserialized params[​](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md#mocking-deserialized-params "Direct link to Mocking deserialized params") The VIKTOR platform deserializes the raw params, such that they will enter the app code in their intuitive format. For example, an `EntityOptionField` will return an `Entity` object in the params instead of an entity\_id. However, when you are using raw params in your tests (e.g. a JSON file), you will need to deserialize the params yourself. This is necessary when any of the following fields is used in the parametrization of the corresponding entity type: * `DateField` * `EntityOptionField` * `ChildEntityOptionField` * `SiblingEntityOptionField` * `EntityMultiSelectField` * `ChildEntityMultiSelectField` * `SiblingEntityMultiSelectField` * `GeoPointField` * `GeoPolylineField` * `GeoPolygonField` * `FileField` * `MultiFileField` For example, when the parametrization consists of a `NumberField`, `ChildEntityOptionField`, and a `FileField`, the raw params could look like: ``` params = { 'number': 1, 'entity': 2, # corresponds to entity id 'file': 3, # corresponds to file resource id } ``` Let's assume `function()` to perform an API call to * retrieve the `last_saved_params` of the selected child entity * retrieve the content of the selected file ``` ... class MyEntityTypeController(vkt.Controller): ... def function(self, params): child_params = params.entity.last_saved_params file = params.file.file ... ``` The raw integers of `params_dict` should be converted to their corresponding mock objects (i.e. deserialized), in order for `function()` to succeed. There are two ways to achieve this: 1. By defining a dictionary consisting of the mock objects manually ``` from viktor import File from viktor.testing import MockedEntity, MockedFileResource params = { 'number': 1, 'entity': MockedEntity(name="My Entity"), 'file': MockedFileResource(file=File.from_data("content"), filename="file.txt"), } ``` 2. By using the [`mock_params`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_params) function, providing a JSON file consisting of the raw params along with the parametrization and (optionally) mocked resources ``` from viktor import File from viktor.testing import MockedEntity, MockedFileResource, mock_params params = mock_params( params=File.from_path("path to JSON file"), parametrization=MyEntityTypeController.parametrization, entities={2: MockedEntity(name="My Entity")}, file_resources={3: MockedFileResource(file=File.from_data("content"), filename="file.txt")}, ) ``` The `function()` can then be tested by providing the deserialized params: ``` ... class TestMyEntityTypeController(unittest.TestCase): def test_function(self): MyEntityTypeController().function(params=params) ``` ## Mocking `ParamsFromFile`[​](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md#mocking-paramsfromfile "Direct link to mocking-paramsfromfile") A file-type entity implements the `@ParamsFromFile` decorator on one of its controller methods. In order to test this method, the `ParamsFromFile` decorator (object) needs to be mocked (`ParamsFromFile` performs `API` calls internally). The `viktor.testing` module provides the [`mock_ParamsFromFile`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_ParamsFromFile) decorator to simplify this mocking: ``` import unittest from viktor.testing import mock_ParamsFromFile from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_ParamsFromFile(MyEntityTypeController) def test_process_file(self): file = File.from_data("abc") returned_dict = MyEntityTypeController().process_file(file) self.assertDictEqual(returned_dict, {...}) ``` ## Mocking View functions[​](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md#mocking-view-functions "Direct link to Mocking View functions") New in v13.3.0 `mock_View` decorator for easier testing of view methods [View](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md) functions can be tested by mocking the decorator using [`mock_View`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_View): ``` import unittest from viktor.testing import mock_View from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_View(MyEntityTypeController) def test_my_view(self): params = ... result = MyEntityTypeController().my_view(params=params) self.assertEqual(result, ...) ``` Please see each individual view guide for a specific example. ## Mocking functions that call external worker[​](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md#mocking-functions-that-call-external-worker "Direct link to Mocking functions that call external worker") When calling the `execute()` method on a class that inherits from [`ExternalProgram`](https://docs.viktor.ai/sdk/api/external/external-program/.md#_ExternalProgram), a job is sent to an external [worker](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#worker). These function calls need to be mocked within the context of (automated) testing. Currently, the `viktor.testing` module provides the following decorators that facilitate mocking of workers: * [`mock_AxisVMAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_AxisVMAnalysis) (>= v13.5.0) * [`mock_DFoundationsAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_DFoundationsAnalysis) (>= v13.5.0) * [`mock_DGeoStabilityAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_DGeoStabilityAnalysis) (>= v13.5.0) * [`mock_DSettlementAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_DSettlementAnalysis) (>= v13.5.0) * [`mock_DSheetPilingAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_DSheetPilingAnalysis) (>= v13.5.0) * [`mock_DStabilityAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_DStabilityAnalysis) (>= v13.5.0) * [`mock_Excel`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_Excel) (>= v13.5.0) * [`mock_GenericAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_GenericAnalysis) (>= v13.5.0) * [`mock_GRLWeapAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_GRLWeapAnalysis) (>= v13.5.0) * [`mock_IdeaRcsAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_IdeaRcsAnalysis) (>= v13.5.0) * [`mock_RFEMAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_RFEMAnalysis) (>= v13.5.0) * [`mock_RobotAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_RobotAnalysis) (>= v13.5.0) * [`mock_SciaAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_SciaAnalysis) (>= v13.3.0) The integrations that call a software API directly from your app open a session with `connect()` or `attach()` instead of inheriting from `ExternalProgram`. Those have a decorator each, which maps every API path to the result it should return, and mocks `connect()` and `attach()` both: * [`mock_AutoCADConnection`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_AutoCADConnection) (>= v14.35.0) * [`mock_Civil3DConnection`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_Civil3DConnection) (>= v14.36.0) * [`mock_ETABSConnection`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_ETABSConnection) (>= v14.31.0) * [`mock_SAP2000Connection`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_SAP2000Connection) (>= v14.32.0) See the [AutoCAD](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md#testing), [Civil 3D](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#testing) and [ETABS and SAP2000](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000/.md) guides for examples. ## Mocking functions that call external servers[​](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md#mocking-functions-that-call-external-servers "Direct link to Mocking functions that call external servers") There are various functions within the VIKTOR library that make use of (internal) services that are being processed on external servers. These external server calls cannot be performed outside the app-context and therefore these function calls need to be mocked within the context of (automated) testing. The complete list of all functions that call external servers (hence require mocking): * `viktor.external.dfoundations.BearingPilesModel.generate_input_file` * `viktor.external.dfoundations.TensionPilesModel.generate_input_file` * `viktor.external.dsettlement.Model1D.generate_input_file` * `viktor.external.dsettlement.Model2D.generate_input_file` * `viktor.external.idea_rcs.Model.generate_xml_input` * `viktor.external.idea_rcs.OpenModel.generate_xml_input` * `viktor.external.scia.Model.generate_xml_input` * `viktor.external.spreadsheet.SpreadsheetCalculation.evaluate` * `viktor.external.spreadsheet.SpreadsheetTemplate.render` * `viktor.external.spreadsheet.render_spreadsheet` * `viktor.external.word.WordFileTemplate.render` * `viktor.external.word.render_word_file` * `viktor.geo.GEFData.classify` * `viktor.geo.GEFFile.parse` * `viktor.utils.convert_excel_to_pdf` * `viktor.utils.convert_svg_to_pdf` * `viktor.utils.convert_word_to_pdf` * `viktor.utils.merge_pdf_files` * `viktor.utils.render_jinja_template` --- # Continuous integration / deployment This guide explains the necessary steps for continuous integration on your viktor application and provides some example files for frequently used CI/CD platforms. See [this article](https://realpython.com/python-continuous-integration/) for an introduction on the concepts of continuous integration if you're unfamiliar with the topic. ## Setting up the environment[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/ci/.md#setting-up-the-environment "Direct link to Setting up the environment") First you need to make sure that your CI environment is the same as the environment in which your app will run. This means: * Linux machine * Matching Python version * pip 26.2.2 or higher, because older pip versions trust distrusted certificate authorities. If your image has an older pip, upgrade it in the job before `ci-install` with `python -m pip install --upgrade "pip>=26.2.2"`. * Environment variables `VIKTOR_DEV` and `VIKTOR_TOKEN` should be set. Contact VIKTOR to receive CI-credentials (**don't use your personal developer credentials!**). * Environment variable `VIKTOR_ENV` should be set with the environment you are publishing to (e.g. `{company}.viktor.ai`). ## Continuous Integration[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/ci/.md#continuous-integration "Direct link to Continuous Integration") 1. Download the CLI, which will be used to perform CI commands: ``` curl -Lo viktor-cli 'https://developers.viktor.ai/api/v1/get-cli/?platform=linux&format=binary' && chmod +x viktor-cli ``` 2. Install the app and its dependencies: ``` ./viktor-cli ci-install ``` Make sure you only use `ci-install` in the CI job and `install` during local development: * The `ci-install` command is an alias for a very involved `pip install` command, which would otherwise pollute your local Python environment. * The `install` command does not work in your CI environment 3. Perform all tests (found in the 'tests' directory): ``` ./viktor-cli ci-test ``` ## Continuous Deployment[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/ci/.md#continuous-deployment "Direct link to Continuous Deployment") note Currently, publishing is supported for the following CI/CD platforms: * Azure Pipelines * GitHub Actions * GitLab CI/CD The CLI can be used to automate the publishing of apps in CI pipelines with the [`ci-publish`](https://docs.viktor.ai/docs/create-apps/references/cli#ci-publish) command. We recommended creating a Git tag to reference specific versions of the app code you are publishing on the platform. It is possible to conditionally trigger pipelines / workflows only when a tag is created. ``` ./viktor-cli ci-publish ``` The CLI determines which CI/CD platform is used based on platform-specific environment variables. Subsequently, all information required to publish your app is collected by the CLI and used to create a publication context. This context is stored together with the app version for later reference. The variables used to determine the publication context are shown in the table below. | | Azure Pipelines | GitHub Actions | GitLab CI/CD | | ----------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------- | -------------------- | | User name | `Build.RequestedFor` | `GITHUB_ACTOR` | `GITLAB_USER_NAME` | | User email | `Build.RequestedForEmail` | n.a. | `GITLAB_USER_EMAIL` | | Commit hash | `Build.SourceVersion` | `GITHUB_SHA` | `CI_COMMIT_SHA` | | Branch or tag ref | `Build.SourceBranchName` | `GITHUB_REF_NAME` | `CI_COMMIT_REF_NAME` | | Pipeline URL | `System.TeamFoundationCollectionUri`, `System.TeamProject`, `Build.BuildId`\* | `GITHUB_SERVER_URL`, `GITHUB_REPOSITORY`, `GITHUB_RUN_ID`\* | `CI_PIPELINE_URL` | | Tag | `Build.SourceBranchName` | `GITHUB_REF_NAME` | `CI_COMMIT_TAG` | \* These variables are combined into a URL to the pipeline / workflow that triggered the ci-publish command. ### Publish to testing only[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/ci/.md#publish-to-testing-only "Direct link to Publish to testing only") By default `ci-publish` releases the new version to both the Testing and the Production line, so every run of the pipeline changes what your end users work with. Add the `--skip-production` flag to publish to Testing only and leave the Production version untouched: ``` ./viktor-cli ci-publish --skip-production ``` This is worth doing deliberately: an existing pipeline keeps releasing to production until you add the flag. With the flag in place, your pipeline delivers every build to a testing workspace and you decide separately when to move the Production line, as described in [Version history](https://docs.viktor.ai/docs/manage-apps/workspaces-and-apps/.md#version-history). ## Example CI/CD files[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/ci/.md#example-cicd-files "Direct link to Example CI/CD files") Below are examples of configuration files for frequently used CI/CD platforms. In the examples below you should replace NAME with the name of the app as it is registered on the platform. * Azure Pipelines * GitHub Actions * GitLab CI/CD * CircleCI * TravisCI note Be sure to set the variables `VIKTOR_DEV`, `VIKTOR_TOKEN` and `VIKTOR_ENV` within a [variable group](https://learn.microsoft.com/en-us/azure/devops/pipelines/library/variable-groups?view=azure-devops\&tabs=classic#create-a-variable-group) with name (e.g. "VIKTOR"). ``` variables: - group: VIKTOR # variable group within DevOps library containing the variables VIKTOR_DEV VIKTOR_TOKEN & VIKTOR_ENV jobs: - job: test container: python:3.14-trixie steps: - bash: curl -Lo viktor-cli 'https://developers.viktor.ai/api/v1/get-cli/?platform=linux&format=binary' && chmod +x viktor-cli - bash: ./viktor-cli ci-install - bash: ./viktor-cli ci-test - job: publish container: python:3.14-trixie condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/')) # only run for a tag and when previous job completed successfully steps: - bash: curl -Lo viktor-cli 'https://developers.viktor.ai/api/v1/get-cli/?platform=linux&format=binary' && chmod +x viktor-cli - bash: ./viktor-cli ci-publish NAME # replace NAME with the actual name of the app ``` note Be sure to set the variables `VIKTOR_DEV`, `VIKTOR_TOKEN` and `VIKTOR_ENV` by creating [secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets). ``` name: viktor-test-publish on: push env: VIKTOR_DEV: ${{ secrets.VIKTOR_DEV }} VIKTOR_TOKEN: ${{ secrets.VIKTOR_TOKEN }} VIKTOR_ENV: ${{ secrets.VIKTOR_ENV }} jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: python-version: 3.14 - run: curl -Lo viktor-cli 'https://developers.viktor.ai/api/v1/get-cli/?platform=linux&format=binary' && chmod +x viktor-cli - run: ./viktor-cli ci-install - run: ./viktor-cli ci-test publish: runs-on: ubuntu-latest needs: test # start when job 'test' is finished if: ${{ success() && startsWith(github.ref, 'refs/tags/') }} # only run for a tag and when previous job completed successfully steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: python-version: 3.14 - run: curl -Lo viktor-cli 'https://developers.viktor.ai/api/v1/get-cli/?platform=linux&format=binary' && chmod +x viktor-cli - run: ./viktor-cli ci-publish NAME # replace NAME with the actual name of the app ``` note Be sure to set the variables `VIKTOR_DEV`, `VIKTOR_TOKEN` and `VIKTOR_ENV` to the [project's settings](https://docs.gitlab.com/ee/ci/variables/#add-a-cicd-variable-to-a-project). ``` stages: - test - publish image: python:3.14-trixie test: stage: test script: # download CLI - curl -Lo viktor-cli 'https://developers.viktor.ai/api/v1/get-cli/?platform=linux&format=binary' && chmod +x viktor-cli # install app and dependencies - ./viktor-cli ci-install # perform tests - ./viktor-cli ci-test publish: stage: publish script: # download CLI - curl -Lo viktor-cli 'https://developers.viktor.ai/api/v1/get-cli/?platform=linux&format=binary' && chmod +x viktor-cli # publish the app - ./viktor-cli ci-publish NAME # replace NAME with the actual name of the app only: - tags when: manual ``` caution Publishing of viktor apps using `ci-publish` is currently not supported for CircleCI ``` version: 2 jobs: test: docker: - image: python:3.14-trixie steps: - checkout # download CLI - run: curl -Lo viktor-cli 'https://developers.viktor.ai/api/v1/get-cli/?platform=linux&format=binary' && chmod +x viktor-cli # install app and dependencies - run: ./viktor-cli ci-install # perform tests - run: ./viktor-cli ci-test ``` caution Publishing of viktor apps using `ci-publish` is currently not supported for TravisCI ``` language: python python: - "3.14" script: # download CLI - curl -Lo viktor-cli 'https://developers.viktor.ai/api/v1/get-cli/?platform=linux&format=binary' && chmod +x viktor-cli # install app and dependencies - ./viktor-cli ci-install # perform tests - ./viktor-cli ci-test ``` --- # Environment variables Environment variables can be used for data that you don't want to store in plain text in your app. For example, when connecting to external APIs it is recommended to not use credentials in your app code directly, but pass them to the code as environment variables. This guide covers how to set environment variables for local development, App Builder apps, and published apps. This section ends with a short guide on how to access these environment variables in your app code. ## Defining environment variables for local development[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/environment-variables/.md#defining-environment-variables-for-local-development "Direct link to Defining environment variables for local development") Environment variables can be set with the CLI for your local development environment. You can set environment variables with the `--env`, `-e` flag when running the `install`, `start` and `run` commands. For example, the environment variable with key `FOO` and corresponding value `bar` can be used as follows: ``` viktor-cli start --env FOO=bar ``` The CLI will connect the local app code to your VIKTOR environment as usual, but with the addition that the environment variable has been set on the running Python process. ## Defining environment variables for app builder and published apps[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/environment-variables/.md#defining-environment-variables-for-app-builder-and-published-apps "Direct link to Defining environment variables for app builder and published apps") Maintainers and environment administrators can create, update or remove environment variables on apps. Maintainers do this from the **Develop** page, administrators from the **All apps** page in the Administrator panel. Environment variables are encrypted at rest in your organization's database using an AES encryption algorithm. For app builder apps, environment variables set on the app **Details** page are automatically available within the app builder environment during development. Follow the steps below to create, update or remove environment variables: 1. Navigate to the 'Develop' page in your VIKTOR environment (or the **All apps** page in the Administrator panel), find the app you want to set environment variables for and click 'Details'. 2. Select the 'Variables' tab to create, update or remove environment variables. ![app variables page](/assets/images/app_details_variables-d64e0def95e4d027d3ba9c6a408080b1.png) 3. New variables can be added with the 'Add Variable' button on the top right. It is possible to mark a variable as secret. By doing so, it is not possible to inspect the value of the variable at a later moment. Once created a secret variable can only be deleted. Regular variables can be inspected and modified after creation. ![app variables page](/assets/images/create_new_variable-b07783371c1411778556891b60692220.png) Variables in the publishing process If an environment variable is used in the app publication process, for example for authenticating with a [private Python package index](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/private-packages/.md), please make sure to add the variable before publishing the app. Reserved Variables Environment variables that start with `VIKTOR_` (with the exception of `VIKTOR_APP_SECRET`) are reserved for internal use by VIKTOR and cannot be set by the user. ## Accessing environment variables in your app code[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/environment-variables/.md#accessing-environment-variables-in-your-app-code "Direct link to Accessing environment variables in your app code") Environment variables can be accessed in your app code by using the built-in [`os`](https://docs.python.org/3/library/os.html) module. Consider the example mentioned earlier `FOO=bar`. After creating this variable on the 'Variables' tab it can be accessed using `os.environ` or `os.getenv()`. For example, the code below will assign the value `bar` to the variable `my_var` by retrieving the environment variable `FOO`. ``` import os my_var = os.getenv("FOO") ``` --- # Setting up code editor This guide covers setting up your code editor for developing VIKTOR apps. Below instructions assume the app resides in a folder called 'my-app-folder'. ## Configure the Python interpreter[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/ide/.md#configure-the-python-interpreter "Direct link to Configure the Python interpreter") * PyCharm * VS Code - Virtual environment - Docker Open the 'my-app-folder' directory. PyCharm will take this directory as the root directory from which imports are resolved. If you have not installed your app yet PyCharm will ask you to configure a virtual environment. You can click 'Cancel' as the CLI will create a virtual environment when you use the install command. If there is a 'requirements.txt' file you can run `viktor-cli install` to create a virtual environment and install the app's dependencies. Subsequently, open the settings to select a Python interpreter: ``` File > Settings > Project: {Project Name} > Python interpreter > Wheel icon > Add... ``` The virtual environment created by the CLI will be selected as the default existing environment. You can click 'OK', 'Apply' and 'OK' again to select the Python intepreter. Now you are ready to start development in PyCharm! note Using a WSL2 based interpreter in PyCharm is only available in PyCharm Professional Open the 'my-app-folder' directory. PyCharm will take this directory as the root directory from which imports are resolved. This works fine for the app specific code, but it cannot find the VIKTOR SDK code (and of all other dependencies). To solve this, add the 'pip-cache' folder as content root: ``` File > Settings > Project: {Project Name} > Project Structure > Add Content Root ``` Directory which should be added, in which `HOME` has to be replaced with `%USERPROFILE%` (usually `C:\Users\`) in case of Windows, or `$HOME` (usually `/home/`) in case of Linux: ``` HOME └── .viktor └── viktor-installs └── my-app-folder-specific └── pip-cache ``` note Since the folder to be added is within a hidden folder ('.viktor'), it must be made visible by clicking the "Show Hidden Files and Directories" button in the "Select Content Root Directory" window. * Virtual environment * Docker Make sure to install the "python" extension: ``` View > Extensions > Search for "python" by Microsoft ``` Open the 'my-app-folder' directory. If a virtual environment folder is already present you are ready to start developing your app. Otherwise, install your app with `viktor-cli install`. When the virtual environment is created Visual Studio Code detects the virtual environment and will ask you to select it for the workspace folder, click 'Yes'. Now you are ready to start development in Visual Studio Code! Make sure to install the "python" extension: ``` View > Extensions > Search for "python" by Microsoft ``` Within the app directory, add another directory named `.vscode` and add a file named `settings.json` ``` my-app-folder └── .vscode └── settings.json ``` On Windows add the following content to settings.json (replace `` with the value of the `%USERPROFILE%` environment variable (e.g. `C:/Users/`) and `` with the name of the app folder): ``` { "python.autoComplete.extraPaths": [ "/.viktor/viktor-installs/-specific/pip-cache" ], "python.analysis.extraPaths": [ "/.viktor/viktor-installs/-specific/pip-cache" ], } ``` On WSL2/Linux add the following content (replace `` with the name of the app folder): ``` { "python.autoComplete.extraPaths": [ "${env:HOME}/.viktor/viktor-installs/-specific/pip-cache" ], "python.analysis.extraPaths": [ "${env:HOME}/.viktor/viktor-installs/-specific/pip-cache" ], } ``` ## Automatically start your app[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/ide/.md#automatically-start-your-app "Direct link to Automatically start your app") By means of startup tasks, you are able to automatically start the application as soon as you open the project in your code editor. note The startup tasks assume the application is installed correctly. * PyCharm * VS Code Within the app directory, add the following files: ``` my-app-folder └── .idea ├── runConfigurations │ └── VIKTOR.xml └── startup.xml ``` with the following contents: my-app-folder/.idea/runConfigurations/VIKTOR.xml ``` ``` my-app-folder/.idea/startup.xml ``` ``` Within the app directory, add another directory named `.vscode` and add a file named `tasks.json`: ``` my-app-folder └── .vscode └── tasks.json ``` with the following content: my-app-folder/.vscode/tasks.json ``` { "version": "2.0.0", "tasks": [ { "label": "VIKTOR", "type": "shell", "command": "viktor-cli start", "runOptions": { "runOn": "folderOpen" } } ] } ``` Now re-open your project to check that the app starts in the terminal of the code editor. --- # Interactive debugging The goal of this page is to set up your code editor in such a way, that you will be able to start VIKTOR in debugging mode from your code editor, set breakpoints and inspect the values of variables in your code editor. Depending on your code editor, operating system and virtualization mode the instructions are different. We provide instructions for the following platforms, code editors and virtualization modes: Operating system: * Windows * Linux * [Cloud-based development](https://docs.viktor.ai/docs/getting-started/installation/cloud-based-development/.md) Code editor: * PyCharm * VS Code Virtualization mode: * Venv * Docker ## Configure the code editor[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#configure-the-code-editor "Direct link to Configure the code editor") info Before configuring the code editor for debugging, make sure you have installed your application by using `viktor-cli install`. The steps for configuring your editor depend on your operating system, VIKTOR isolation mode and editor. Below instructions assume the app resides in a folder called 'my-app-folder'. First, select your code editor and operating system: * Windows * Linux * Cloud-based development - PyCharm - VS Code * Virtual environment * Docker (Hyper-V) * Docker (WSL) #### Configure the Python interpreter[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#configure-the-python-interpreter "Direct link to Configure the Python interpreter") In the bottom right, add a Python interpreter by clicking the `Python 3.X` (or ``) button, followed by `add interpreter`. ![](/assets/images/debug_pycharm_add_interpreter_button-dc45e19af2ec27e709d820eb28013327.png) Then select "existing environment", usually this is selected automatically. Then select the Python interpreter `\venv\Scripts\python.exe` folder if it is not already selected. Click "ok" to save the settings. ![Add existing environment](/assets/images/debug_pycharm_add_interpreter_modal-2ed2cf3a2d2abed0715c574ee55d979a.png) #### Set up debugging[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#set-up-debugging "Direct link to Set up debugging") Next, in the top menu, click `Run > Edit configurations`. A modal will appear where you can create new debug configurations. Then follow these steps: 1. Click the `+` in the top-left and from the dropdown select `Python` to create a new debug configuration 2. Change `Script path` to `Module name` 3. Type `viktor_debugging` in the field for the module name 4. Select the Python interpreter you just configured 5. Change the working directory to the project directory. 6. (optionally) give the configuration a name, such as *"VIKTOR Debug"* 7. Click `OK` to save the debug configuration ![](/assets/images/debug_pycharm_configuration-791984eb109a82c2575ee9c4b777d1fb.png) PyCharm should now be configured for debugging. #### Set up unit tests[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#set-up-unit-tests "Direct link to Set up unit tests") Go to `Settings (Ctrl + Alt + S) > Tools > Python Integrated Tools`. Then under the header *"Testing"* change the *Default test runner* to `Unittests` (not PyTest nor Autodetect) and hit *"OK"* to save the changes. caution Debugging in a Docker container using PyCharm is only possible with the PyCharm Professional edition. #### Configure the Python interpreter[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#configure-the-python-interpreter "Direct link to Configure the Python interpreter") `Bottom right > add interpreter > Docker` * Server: `Docker` * image name: `python:3.14-trixie` (change the number if you use a different Python version) #### Set up debugging[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#set-up-debugging "Direct link to Set up debugging") Within the app directory, go to the `.idea` add another directory named `runConfigurations` and add a file named `VIKTOR_Debug.xml`: ``` my-app-folder └── .idea └── runConfigurations └── VIKTOR_Debug.xml ``` Inside this file, add the XML provided in the snippet below. Make sure to replace `` with the directory name of your app folder (e.g. `my-app-folder` in the example), this can be found on the highlighted line. my-app-folder/.idea/runConfigurations/VIKTOR\_Debug.xml ``` ``` PyCharm should now be configured for debugging. #### Set up unit tests[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#set-up-unit-tests "Direct link to Set up unit tests") Configure using *Unittests* (not PyTest nor Autodetect) in `Settings (Ctrl + Alt + S) > Tools > Python Integrated Tools > Testing > Default test runner` Within the app directory, go to the `.idea` add another directory named `runConfigurations` and create a file `_template__of_Unittests.xml`: ``` my-app-folder └── .idea └── runConfigurations ├── VIKTOR_Debug.xml └── _template__of_Unittests.xml ``` Inside this file, add the XML provided in the snippet below. Make sure to replace `` with the directory name of your app folder (e.g. `my-app-folder` in the example), this can be found on the highlighted line. my-app-folder/.idea/runConfigurations/\_template\_\_of\_Unittests.xml ``` ``` info Restart PyCharm to make sure the configuration is loaded properly. caution Debugging in a Docker container using PyCharm is only possible with the PyCharm Professional edition. #### Configure the Python interpreter[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#configure-the-python-interpreter "Direct link to Configure the Python interpreter") `Bottom right > add interpreter > Docker` * Server: `Docker` * image name: `python:3.14-trixie` (change the number if you use a different Python version) #### Set up debugging[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#set-up-debugging "Direct link to Set up debugging") Within the app directory, go to the `.idea` add another directory named `runConfigurations` and add a file named `VIKTOR_Debug.xml`: ``` my-app-folder └── .idea └── runConfigurations └── VIKTOR_Debug.xml ``` Inside this file, add the XML provided in the snippet below. Make sure to replace `` with the directory name of your app folder (e.g. `my-app-folder` in the example) and replace `` with the Windows path to the WSL user home directory (will look something like `//wsl$/Ubuntu/home/`). Both can be found on the highlighted line. my-app-folder/.idea/runConfigurations/VIKTOR\_Debug.xml ``` ``` PyCharm should now be configured for debugging. #### Set up unit tests[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#set-up-unit-tests "Direct link to Set up unit tests") Configure using *Unittests* (not PyTest nor Autodetect) in `Settings (Ctrl + Alt + S) > Tools > Python Integrated Tools > Testing > Default test runner` Within the app directory, go to the `.idea` add another directory named `runConfigurations` and create a file `_template__of_Unittests.xml`: ``` my-app-folder └── .idea └── runConfigurations ├── VIKTOR_Debug.xml └── _template__of_Unittests.xml ``` Inside this file, add the XML provided in the snippet below. Make sure to replace `` with the directory name of your app folder (e.g. `my-app-folder` in the example) and replace `` with the Windows path to the WSL user home directory (could be something like `/Ubuntu/home/username`). Both can be found on the highlighted line. my-app-folder/.idea/runConfigurations/\_template\_\_of\_Unittests.xml ``` ``` info Restart PyCharm to make sure the configuration is loaded properly. * Virtual environment * Docker (Hyper-V) * Docker (WSL) #### Configure the Python interpreter[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#configure-the-python-interpreter "Direct link to Configure the Python interpreter") Install the Python extension for VS Code (in extensions menu (`Ctrl+Shift+X`) you can search for `ms-python.python`) Open the command pallette (`Ctrl + Shift + P`), and search for `Python: Select Interpreter`. Then select `Python .\venv\Scripts\python.exe`. #### Set up debugging[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#set-up-debugging "Direct link to Set up debugging") In the top menu, click `Run > Add configuration...`. Select 1. `Python` 2. `Module` 3. Enter `viktor_debugging` Now a `launch.json` file should be created containing the following: (if you like, you can change the name to `VIKTOR Debug`) my-app-folder/.vscode/launch.json ``` { "version": "0.2.0", "configurations": [ { "name": "VIKTOR Debug", "type": "python", "request": "launch", "module": "viktor_debugging", "justMyCode": true } ] } ``` VS Code should now be configured for debugging. #### Unit tests[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#unit-tests "Direct link to Unit tests") Configure using unittest: Open command pallette: `Ctrl + Shift + P`, and search for `Python: Configure Tests`. Then select 1. `unittest` to configure the test runner 2. `tests` to configure what folder the tests can be found 3. `test*.py` to so that all files starting with "test" are selected #### Install extensions[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#install-extensions "Direct link to Install extensions") Install the Python and Docker extensions for VS Code (in extensions menu (`Ctrl+Shift+X`) you can search for `ms-python.python` and `ms-azuretools.vscode-docker`) #### Set up debugging[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#set-up-debugging "Direct link to Set up debugging") Within the app directory, add another directory named `.vscode` and add a two files named `launch.json` and `tasks.json`: ``` my-app-folder └── .vscode ├── launch.json └── tasks.json ``` Inside the `launch.json` file, add the following content: my-app-folder/.vscode/launch.json ``` { "version": "0.2.0", "configurations": [ { "name": "VIKTOR Debug", "type": "docker", "request": "launch", "preLaunchTask": "docker-run: debug", "python": { "pathMappings": [ { "localRoot": "${workspaceFolder}","remoteRoot": "/usr/src/app" } ], "projectType": "general", } }, { "name": "Unittest", "type": "docker", "request": "launch", "preLaunchTask": "docker-run: test", "python": { "pathMappings": [ { "localRoot": "${workspaceFolder}","remoteRoot": "/usr/src/app" } ], "projectType": "general", } } ] } ``` And inside the `tasks.json` add the following content. If you use a python version different from 3.14, change the number on the highlighted lines: my-app-folder/.vscode/tasks.json ``` { "version": "2.0.0", "tasks": [ { "label": "docker-run: debug", "type": "docker-run", "python": { "module": "viktor_debugging" }, "dockerRun": { "network": "host", "containerName": "viktor-container", "image": "python:3.14-trixie", "remove": true, "env": { "PYTHONPATH": "/usr/src/app:/usr/src/packages", "PYTHONUNBUGGERED": "1", "PYTHONDONTWRITEBYTECODE": "1" }, "customOptions": "-w /usr/src/app", "volumes": [ {"containerPath": "/usr/src/app", "localPath": "${workspaceFolder}"}, {"containerPath": "/root/.viktor", "localPath": "${env:USERPROFILE}/.viktor"}, {"containerPath": "/usr/src/packages", "localPath": "${env:USERPROFILE}/.viktor/viktor-installs/${workspaceFolderBasename}-specific/pip-cache"} ] } }, { "label": "docker-run: test", "type": "docker-run", "python": { "module": "unittest", "args": ["discover", "-s", "tests", "-v"] }, "dockerRun": { "network": "host", "containerName": "viktor-container", "image": "python:3.14-trixie", "remove": true, "env": { "PYTHONPATH": "/usr/src/app:/usr/src/packages", "PYTHONUNBUGGERED": "1", "PYTHONDONTWRITEBYTECODE": "1" }, "customOptions": "-w /usr/src/app", "volumes": [ {"containerPath": "/usr/src/app", "localPath": "${workspaceFolder}"}, {"containerPath": "/root/.viktor", "localPath": "${env:USERPROFILE}/.viktor"}, {"containerPath": "/usr/src/packages", "localPath": "${env:USERPROFILE}/.viktor/viktor-installs/${workspaceFolderBasename}-specific/pip-cache"} ] } } ] } ``` VS Code should now be configured for debugging and testing. #### Install extensions[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#install-extensions "Direct link to Install extensions") Install the "Remote - WSL", "Python" and "Docker" extensions for VS Code (in extensions menu (`Ctrl+Shift+X`) you can search for `ms-vscode-remote.remote-wsl`, `ms-python.python` and `ms-azuretools.vscode-docker`). Next, click the green "Remote window" button in the bottom left corner of the window (see image below) and click "New WSL Window" to connect VS Code to a WSL development environment. This may take a while. Once connected, you should see "WSL: Ubuntu" in the bottom left corner. ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAACSCAYAAAAATYUPAAABhGlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9TtaIVBzuICGaoThZERRy1CkWoEGqFVh1MLv0QmjQkKS6OgmvBwY/FqoOLs64OroIg+AHi6OSk6CIl/i8ptIjx4Lgf7+497t4BQq3ENKttDNB020wl4mImuyKGXhFCB7oBDMnMMmYlKQnf8XWPAF/vYjzL/9yfo0fNWQwIiMQzzDBt4nXiqU3b4LxPHGFFWSU+Jx416YLEj1xXPH7jXHBZ4JkRM52aI44Qi4UWVlqYFU2NeJI4qmo65QsZj1XOW5y1Uo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mCAZZexeuxLdBz+jfG/TFF1qBzWvHYeS+3lyTZCalVv5902tsXXvVm5n85rDFD3z9/xVvo+9zxwe4Rhvcrw9i+Lqu9V/d3yBQnw0vjZ8yxU7P0/6gXp+OdocQQ1v8vsDBu7YefcNnUuYvsRemBrzYMWMMnav/Tsyjv6Ev669cTmGDlZ8fN7To25f9Mw/sm5tFp1vv0v1jv20nur/xlc7Ch8sidD41C94dU/HVVuXvnfsdtTBKX6ct/6IXw7dZMkjbN29CE17B93XvAMdSn6Exode4NW/XMe5hBkmSP6jVC1wsb52YiLHeAUB+NzKciqfuJ3b8jVciiXvES62t/LOUxMx1CSTgr/JIz11rA0IXRz/w/Ehibzw2RRkgrkeQYYW5FmdJ2hskKEfwsQTG4v153cPJ+Dld9D6BxFDmAJBcuua5dMQhCHIC1OCMAr/D9c+h0z3CHfMAAAAAElFTkSuQmCC) Then, in the WSL Development environment, you should again install the "Python" and "Docker" extensions for VS Code (in extensions menu (`Ctrl+Shift+X`) you can search for `ms-python.python` and `ms-azuretools.vscode-docker`, or you can use the "Install in WSL: Ubuntu" button, see screenshot). ![](/assets/images/debug_vscode_install_in_wsl-8b310aa097571378dbcb6bcb8002f7b8.png) To check the extensions are installed in WSL, you may need to expand the "WSL: Ubuntu" section. ![](/assets/images/debug_vscode_extensions_are_installed-dad063a4ece0900bb7fe620dcdfaca11.png) Then open your project by chosing from the top menu: `File > Open Folder` and select the project. Do not use the recently opened links, as they will open the project ouside of the WSL development environment. Lastly, in a WSL terminal, run `sudo apt install python-is-python3` to make sure that the Python debugger of VS Code can find the correct python version in the WSL environment. #### Set up debugging[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#set-up-debugging "Direct link to Set up debugging") Within the app directory, add another directory named `.vscode` and add a two files named `launch.json` and `tasks.json`: ``` my-app-folder └── .vscode ├── launch.json └── tasks.json ``` Inside the `launch.json` file, add the following content: my-app-folder/.vscode/launch.json ``` { "version": "0.2.0", "configurations": [ { "name": "VIKTOR Debug", "type": "docker", "request": "launch", "preLaunchTask": "docker-run: debug", "python": { "pathMappings": [ { "localRoot": "${workspaceFolder}","remoteRoot": "/usr/src/app" } ], "projectType": "general", } }, { "name": "Unittest", "type": "docker", "request": "launch", "preLaunchTask": "docker-run: test", "python": { "pathMappings": [ { "localRoot": "${workspaceFolder}","remoteRoot": "/usr/src/app" } ], "projectType": "general", } } ] } ``` And inside the `tasks.json` add the following content. If you use a python version different from 3.14, change the number on the highlighted lines: my-app-folder/.vscode/tasks.json ``` { "version": "2.0.0", "tasks": [ { "label": "docker-run: debug", "type": "docker-run", "python": { "module": "viktor_debugging" }, "dockerRun": { "network": "host", "containerName": "viktor-container", "image": "python:3.14-trixie", "remove": true, "env": { "PYTHONPATH": "/usr/src/app:/usr/src/packages", "PYTHONUNBUGGERED": "1", "PYTHONDONTWRITEBYTECODE": "1" }, "customOptions": "-w /usr/src/app", "volumes": [ {"containerPath": "/usr/src/app", "localPath": "${workspaceFolder}"}, {"containerPath": "/root/.viktor", "localPath": "${userHome}/.viktor"}, {"containerPath": "/usr/src/packages", "localPath": "${userHome}/.viktor/viktor-installs/${workspaceFolderBasename}-specific/pip-cache"} ] } }, { "label": "docker-run: test", "type": "docker-run", "python": { "module": "unittest", "args": ["discover", "-s", "tests", "-v"] }, "dockerRun": { "network": "host", "containerName": "viktor-container", "image": "python:3.14-trixie", "remove": true, "env": { "PYTHONPATH": "/usr/src/app:/usr/src/packages", "PYTHONUNBUGGERED": "1", "PYTHONDONTWRITEBYTECODE": "1" }, "customOptions": "-w /usr/src/app", "volumes": [ {"containerPath": "/usr/src/app", "localPath": "${workspaceFolder}"}, {"containerPath": "/root/.viktor", "localPath": "${userHome}/.viktor"}, {"containerPath": "/usr/src/packages", "localPath": "${userHome}/.viktor/viktor-installs/${workspaceFolderBasename}-specific/pip-cache"} ] } } ] } ``` VS Code should now be configured for debugging and testing. * PyCharm * VS Code - Virtual environment - Docker #### Configure the Python interpreter[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#configure-the-python-interpreter "Direct link to Configure the Python interpreter") In the bottom right, add a Python interpreter by clicking the `Python 3.X` (or ``) button, followed by `add interpreter`. ![](/assets/images/debug_pycharm_add_interpreter_button-dc45e19af2ec27e709d820eb28013327.png) In the bottom right, add a Python interpreter by clicking the `Python 3.X` (or ``) button, followed by `add interpreter`. Then select "existing environment", usually this is selected automatically. Then select the Python interpreter in `/venv/bin/python` folder if it is not already selected. Click "ok" to save the settings. ![Add existing environment](/assets/images/debug_pycharm_add_interpreter_modal_linux-28419dd64703d442192d872c35e45451.png) #### Set up debugging[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#set-up-debugging "Direct link to Set up debugging") Next, in the top menu, click `Run > Edit configurations`. A modal will appear where you can create new debug configurations. Then follow these steps: 1. Click the `+` in the top-left and from the dropdown select `Python` to create a new debug configuration 2. Change `Script path` to `Module name` 3. Type `viktor_debugging` in the field for the module name 4. Select the Python interpreter you just configured 5. Change the working directory to the project directory. 6. (optionally) give the configuration a name, such as *"VIKTOR Debug"* 7. Click `ok` to save the debug configuration ![](/assets/images/debug_pycharm_configuration_linux-bf005f4dda274d64b75958dbfd957dd8.png) PyCharm should now be configured for debugging. #### Unit tests[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#unit-tests "Direct link to Unit tests") Go to `Settings (Ctrl + Alt + S) > Tools > Python Integrated Tools`. Then under the header *"Testing"* change the *Default test runner* to `Unittests` (not PyTest nor Autodetect) and hit *"OK"* to save the changes. caution Debugging in a Docker container using PyCharm is only possible with the PyCharm Professional edition. #### Configure the Python interpreter[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#configure-the-python-interpreter "Direct link to Configure the Python interpreter") `Bottom right > add interpreter > Docker` * Server: `Docker` (unix sock) * image name: `python:3.14-trixie` (change the number if you use a different Python version) #### Debug configuration[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#debug-configuration "Direct link to Debug configuration") Within the app directory, add another directory named `.run` and add a file named `debug.run.xml`: ``` my-app-folder └── .run └── debug.run.xml ``` Inside this file, add the XML provided in the snippet below. Make sure to replace `` with the directory name of your app folder (e.g. `my-app-folder` in the example), this can be found on the highlighted line. my-app-folder/.run/debug.run.xml ``` ``` PyCharm should now be configured for debugging, to start debugging. #### Unit tests[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#unit-tests "Direct link to Unit tests") Configure using *Unittests* (not PyTest nor Autodetect) in `Settings (ctrl + alt + s) > Tools > Python Integrated Tools > Testing > Default test runner` And create a `Template Python tests.run.xml` ``` my-app-folder └── .run ├── debug.run.xml └── Template Python tests.run.xml ``` Inside this file, add the XML provided in the snippet below. Make sure to replace `` with the directory name of your app folder (e.g. `my-app-folder` in the example), this can be found on the highlighted line. my-app-folder/.run/Template Python tests.run.xml ``` ``` info Restart PyCharm to make sure the configuration is loaded properly. * Virtual environment * Docker #### Configure the Python interpreter[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#configure-the-python-interpreter "Direct link to Configure the Python interpreter") Install the "Python" extension (in extensions menu (`Ctrl+Shift+X`) you can search for `ms-python.python`) Open command pallette: `Ctrl + Shift + P`, and search for `Python: Select Interpreter`. Then select `Python ('venv': venv) ./venv/bin/python`. #### Set up debugging[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#set-up-debugging "Direct link to Set up debugging") In the top menu, click `Run > Add configuration...`. Select 1. `Python` 2. `Module` 3. Enter `viktor_debugging` Now a `launch.json` file should be created containing the following: (if you like, you can change the name to `VIKTOR Debug`) my-app-folder/.vscode/launch.json ``` { "version": "0.2.0", "configurations": [ { "name": "VIKTOR Debug", "type": "python", "request": "launch", "module": "viktor_debugging", "justMyCode": true } ] } ``` The code editor should now be configured for debugging. #### Unit tests[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#unit-tests "Direct link to Unit tests") Configure using unittest: Open command pallette: `Ctrl + Shift + P`, and search for `Python: Configure Tests`. Then select 1. `unittest` to configure the test runner 2. `tests` to configure what folder the tests can be found 3. `test*.py` to so that all files starting with "test" are selected #### Install extensions[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#install-extensions "Direct link to Install extensions") Install the Python and Docker extensions for VS Code (in extensions menu (`Ctrl+Shift+X`) you can search for `ms-python.python` and `ms-azuretools.vscode-docker`) #### Set up debugging[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#set-up-debugging "Direct link to Set up debugging") Within the app directory, add another directory named `.vscode` and add a two files named `launch.json` and `tasks.json`: ``` my-app-folder └── .vscode ├── launch.json └── tasks.json ``` Inside the `launch.json` file, add the following content: my-app-folder/.vscode/launch.json ``` { "version": "0.2.0", "configurations": [ { "name": "VIKTOR Debug", "type": "docker", "request": "launch", "preLaunchTask": "docker-run: debug", "python": { "pathMappings": [ { "localRoot": "${workspaceFolder}", "remoteRoot": "/usr/src/app" } ], "projectType": "general", } }, { "name": "Unittest", "type": "docker", "request": "launch", "preLaunchTask": "docker-run: test", "python": { "pathMappings": [ { "localRoot": "${workspaceFolder}", "remoteRoot": "/usr/src/app" } ], "projectType": "general", } } ] } ``` And inside the `tasks.json` add the following content: If you use a python version different from 3.14, change the number on the highlighted lines. my-app-folder/.vscode/tasks.json ``` { "version": "2.0.0", "tasks": [ { "label": "docker-run: debug", "type": "docker-run", "python": { "module": "viktor_debugging" }, "dockerRun": { "network": "host", "containerName": "viktor-container", "image": "python:3.14-trixie", "remove": true, "env": { "PYTHONPATH": "/usr/src/app:/usr/src/packages", "PYTHONUNBUGGERED": "1", "PYTHONDONTWRITEBYTECODE": "1" }, "customOptions": "-w /usr/src/app", "volumes": [ {"containerPath": "/usr/src/app", "localPath": "${workspaceFolder}"}, {"containerPath": "/root/.viktor", "localPath": "${env:HOME}/.viktor"}, {"containerPath": "/usr/src/packages", "localPath": "${env:HOME}/.viktor/viktor-installs/${workspaceFolderBasename}-specific/pip-cache"} ] } }, { "label": "docker-run: test", "type": "docker-run", "python": { "module": "unittest", "args": ["discover", "-s", "tests", "-v"] }, "dockerRun": { "network": "host", "containerName": "viktor-container", "image": "python:3.14-trixie", "remove": true, "env": { "PYTHONPATH": "/usr/src/app:/usr/src/packages", "PYTHONUNBUGGERED": "1", "PYTHONDONTWRITEBYTECODE": "1" }, "customOptions": "-w /usr/src/app", "volumes": [ {"containerPath": "/usr/src/app", "localPath": "${workspaceFolder}"}, {"containerPath": "/root/.viktor", "localPath": "${env:HOME}/.viktor"}, {"containerPath": "/usr/src/packages", "localPath": "${env:HOME}/.viktor/viktor-installs/${workspaceFolderBasename}-specific/pip-cache"} ] } } ] } ``` VS Code should now be configured for debugging and running unit tests. #### Configure the Python interpreter[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#configure-the-python-interpreter "Direct link to Configure the Python interpreter") Install the "Python" extension (in extensions menu (`Ctrl+Shift+X`) you can search for `ms-python.python`) Open command pallette: `Ctrl + Shift + P`, and search for `Python: Select Interpreter`. Then select `Python ('venv': venv) ./venv/bin/python`. #### Set up debugging[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#set-up-debugging "Direct link to Set up debugging") In the top menu, click `Run > Add configuration...`. Select 1. `Python` 2. `Module` 3. Enter `viktor_debugging` Now a `launch.json` file should be created containing the following: (if you like, you can change the name to `VIKTOR Debug`) my-app-folder/.vscode/launch.json ``` { "version": "0.2.0", "configurations": [ { "name": "VIKTOR Debug", "type": "python", "request": "launch", "module": "viktor_debugging", "justMyCode": true } ] } ``` The code editor should now be configured for debugging. #### Unit tests[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#unit-tests "Direct link to Unit tests") Configure using unittest: Open command pallette: `Ctrl + Shift + P`, and search for `Python: Configure Tests`. Then select 1. `unittest` to configure the test runner 2. `tests` to configure what folder the tests can be found 3. `test*.py` to so that all files starting with "test" are selected ## Start the debugger[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#start-the-debugger "Direct link to Start the debugger") Before starting a debugging session, make sure that you are **not running** the app using the viktor-cli (close the connection using `Ctrl+C`). To start the debugging session, use: * **PyCharm:** In the top menu, click `Run > Debug... (Alt+Shift+F9)` and select the debug configuration we just made. If it is already selected you can also use `Run > Debug (VIKTOR Debug) (Shift+F9)`. * **Visual Studio Code:** In the top menu, click `Run > Start debugging... (F5)`. caution Auto-reload is not possible in debug mode. Code changes only take effect after restarting the debugging session. (pycharm: `Ctrl+F5`, vscode: `Ctrl+Shift+F5`) ## Setting breakpoints[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#setting-breakpoints "Direct link to Setting breakpoints") When the debugger is started, a terminal should appear at the bottom of your editor window, in which your app is started. You should be able to go to your personal dev url in a browser and use the app. You can set breakpoints in the code, and inspect the parameters at these points. You can read more about setting breakpoints, stepping through code and reading variables in the documentation of the specific editors: | PyCharm | VS Code | | ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | | [Set breakpoints in PyCharm](https://www.jetbrains.com/help/pycharm/using-breakpoints.html#set-breakpoints) | [Set breakpoints in VS Code](https://code.visualstudio.com/docs/editor/debugging#_breakpoints) | | [Stepping through code in PyCharm](https://www.jetbrains.com/help/pycharm/stepping-through-the-program.html) | [Stepping through code in VS Code](https://code.visualstudio.com/docs/editor/debugging#_debug-actions) | | [Reading variables in PyCharm](https://www.jetbrains.com/help/pycharm/examining-suspended-program.html#variables) | [Reading variables in VS Code](https://code.visualstudio.com/docs/editor/debugging#_data-inspection) | When writing a Python script, normally you will hit the breakpoints when you start the script. In a VIKTOR application however, the breakpoints will only be hit when the function is [triggered](https://docs.viktor.ai/docs/getting-started/fundamentals/call-flow/.md#triggering-actions) by the user. For example, the code in a view function runs when the view is opened in the web browser. Note that when debugging quick views or callback functions that are used for the parametrization, the editor will not respond when the call (including debugging time) takes longer than about 10 seconds. tip When debugging views, you can (temporarily) set the `duration_guess` to some high number to require manual triggering of the computation, leading to a nicer debug experience. This will also allow you to see the updated results in the web browser once the call is finished. ## Debugging tests[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#debugging-tests "Direct link to Debugging tests") We assume your tests are located in the "tests" folder. ### PyCharm[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#pycharm "Direct link to PyCharm") In the project explorer, right-click a test file or test directory and then *Debug "Python tests in test..."*. Alternatively, you can debug individual tests (or test classes) by opening a test file and clicking the play button in the gutter and then selecting *Debug "Python tests in test..."*. ![](/assets/images/debug_test_pycharm-252b85582a3330605391060ba730d080.png) ### Visual Studio Code - venv[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#visual-studio-code---venv "Direct link to Visual Studio Code - venv") In the left panel, choose tests (the Erlenmeyer flask icon). You should see your tests listed there. In this panel you can hover a test file and click the run or debug icon. Alternatively, you can debug individual tests by going to your test file and right-clicking the icon in the gutter next to the test function and selecting "Debug test". ![](/assets/images/debug_test_vscode-3f964f0be2ffbb0edb550b0dcf5e5211.png) ### Visual Studio Code - Docker[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/interactive-debugging/.md#visual-studio-code---docker "Direct link to Visual Studio Code - Docker") In the left menu, go to the debug panel (`Ctrl+Shift+D`) and at the top choose *"Unittest"*. Click on the green arrow next to it to debug the unit tests. This runs all unit tests. --- # Keeping a changelog It is advised to keep a list of all notable changes that have been made in the source code of an application. By doing so, current and future contributors have a concise and clear overview of what has changed between different versions of the app. The changelog is usually named `CHANGELOG.md` and written in [markdown](https://www.markdownguide.org/basic-syntax/) format. It should be easily accessible, therefore ideally be placed on the top level of the source code repository: ``` my-app ├── app ├── ... ├── CHANGELOG.md ``` ## Example changelog[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/keep-a-changelog/.md#example-changelog "Direct link to Example changelog") These are a couple of guidelines to keep in mind: * Add a small text on top to mention the type of versioning that is used (e.g. semantic) * Order the changelog entries chronologically with the latest changes on top * Group entries per type of change: * `Added`: new features * `Changed`: changes in existing features * `Removed`: removed features * `Fixed`: bug fixes * Add a date with each new version An example is provided below, which can also be used as template for your applications: ``` # Changelog All notable changes to this project will be documented in this file. Semantic versioning is used to denote different versions of this project. ## [Unreleased] - YYYY-MM-DD ### Added - EntityTypeA: Report download ### Changed ### Removed ### Fixed - EntityTypeB: Aspect ratio in SVG visualization ## [v0.1.0] - 2021-01-19 ### Added - Setup entity type structure with EntityTypeA and EntityTypeB - EntityTypeA: MapView visualization - EntityTypeB: SVG visualization ``` ## Semantic versioning[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/keep-a-changelog/.md#semantic-versioning "Direct link to Semantic versioning") [Semantic versioning](https://semver.org/) is commonly used to denote the different versions of an application. The convention that is used for the version number has format v**X**.**Y**.**Z** where: * **X** is the major: increments when a backwards incompatible change is introduced. * **Y** is the minor: increments when a new functionality is added, without breaking compatibility with older versions. * **Z** is the patch: increments when the code can drop-in-replace the previous code, or when documentation is added/changed. ## Referencing to issue number[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/keep-a-changelog/.md#referencing-to-issue-number "Direct link to Referencing to issue number") In case you develop and maintain your application code in a source-code hosting facility which has a ticketing system (e.g. GitHub, GitLab, BitBucket etc.), the changelog will often also be visible in the interface. It is possible to refer to a specific ticket (issue number), which is very helpful to easily trace back to the historic moment of a specific change. For example, in GitLab you can refer to the issue number using a "#" symbol: ``` - (#123) EntityTypeA: MapView visualization ``` --- # Private packages Packages that are publicly available on [PyPI](https://pypi.org/) can be specified in your app's `requirements.txt` file to become available in your app as dependency, as shown [here](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/use-python-packages/.md). But sometimes you might want to add a package that is only available privately (e.g. code stored on a centralized repository within the company to be reused in multiple apps). There are different options to make such a package available in a (published) app, without the need to copy the code manually into your app folder: * [Git submodule](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/private-packages/.md#git-submodule) * [Git repository](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/private-packages/.md#install-from-a-git-repository) * [Private PyPI](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/private-packages/.md#publish-your-package-on-a-private-pypi) ## Git submodule[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/private-packages/.md#git-submodule "Direct link to Git submodule") The easiest way to add an app-dependency is to copy the package code (as a sub-folder) into your app folder. A disadvantage of this approach is that if the package is maintained in a separate repository, the copied code needs to be manually updated to receive the latest additions or bugfixes. This problem can be resolved by adding the dependency as a Git *submodule* to your app. Obviously, this requires your app code itself to be a Git repository. Add an existing Git repository as a submodule to your app by: ``` git submodule add https://my-package-repository-url app/submodules/my-package ``` note All code, including the submodules, must reside (in a sub-folder) within the 'app' folder to be available in production. This will copy the repository's content in a sub-folder `submodules/my-package/` within your app folder, and creates a `.gitmodules` file in your project folder that stores the mapping between the package URL and local path. Updating your app including all submodules can be done with: ``` git pull --recurse-submodules ``` Cloning a project including all submodules to your local hard disk can be done by: ``` git clone --recurse-submodules https://my-project-repository-url ``` All ins and outs of using Git submodules can be found on the [Git website](https://git-scm.com/book/en/v2/Git-Tools-Submodules). ## Install from a Git repository[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/private-packages/.md#install-from-a-git-repository "Direct link to Install from a Git repository") Alternatively, it is possible to install a Python package directly from a (private) Git repository host. For example, it is possible to install `my-package` that is hosted on the URL `https://github.com/my-user-account/my-package` by adding the line below to `requirements.txt`. Additionally, you can install a specific branch or tag by appending an `@` followed by the reference to the url, for example `@v1.2.3`. ``` my-package@git+https://${MY_USER}:${MY_PASSWORD}@github.com/my-user-account/my-package ``` caution For security reasons, we advise against hard-coding the authentication credentials in `requirements.txt`, prefer to use [environment variables](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/environment-variables/.md) instead. ## Publish your package on a private PyPI[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/private-packages/.md#publish-your-package-on-a-private-pypi "Direct link to Publish your package on a private PyPI") Another way to make a private package available in an app is to publish it on a private PyPI. This way the code is not copied in your app, but handled as any other package dependency. Moreover, access can even be restricted by means of authentication credentials. Examples of platforms that allow for hosting your own packages, are: * GitLab - [Package Registry](https://docs.gitlab.com/ee/user/packages/pypi_repository/) * Microsoft Azure - [Azure Artifacts](https://learn.microsoft.com/en-us/azure/devops/pipelines/artifacts/pypi) Instructions on how to host your private package on each platform can be found in the corresponding links. The hosted package can then be added in your app's `requirements.txt` file, as follows: ``` --extra-index-url https://my-private-package-index-url my-private-package ``` If the private package index is protected by means of authentication credentials, this can be passed using [environment variables](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/environment-variables/.md): ``` --extra-index-url https://${MY_USER}:${MY_PASSWORD}@my-private-package-index-url my-private-package ``` caution For security reasons, we advise against hard-coding the authentication credentials in `requirements.txt`, prefer to use [environment variables](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/environment-variables/.md) instead. --- # System dependencies In some cases your application uses Python packages that depend on one or multiple packages that cannot be installed using `pip`. These system packages need to be installed with the package manager of the operating system. For example [`vtk`](https://pypi.org/project/vtk/) could be used for processing of images. When you try to publish an app, you may receive the following error: ``` ImportError: libGL.so.1: cannot open shared object file: No such file or directory ``` Above error happens because `vtk` is using an OpenGL-based program in the background which requires libGL. To annotate that such system dependencies should be installed when the application is being published, you can specify `packages` in your app's [viktor.config.toml file](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#packages): ``` packages = ["libgl1"] ``` The provided packages should be [apt-get compatible](https://linux.die.net/man/8/apt-get) as published VIKTOR apps run on Linux. ## Common system packages[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/system-dependencies/.md#common-system-packages "Direct link to Common system packages") The table below provides common use cases for Python package with their required system packages. | Python package | System package(s) | Use case | | ---------------------------------------------------------- | --------------------------------- | ------------------------------------------------------------------ | | [ffmpeg-python](https://pypi.org/project/python-ffmpeg/) | ffmpeg | Video file processing | | [kaleido](https://pypi.org/project/kaleido/) | chromium | Used by Plotly to convert interactive plots to static images | | [locale](https://docs.python.org/3/library/locale.html) | locales-all | Support localization with locales that are not included by default | | [opencv-python](https://pypi.org/project/opencv-python/) | python3-opencv | Image processing | | [pdf2docx](https://pypi.org/project/pdf2docx/) | libgl1 | PDF file processing | | [pyenchant](https://pypi.org/project/pyenchant/) | python3-enchant | Spelling check and correction suggestions | | [pyomo](https://pypi.org/project/pyomo/) (GLPK solver) | libglpk-dev, glpk-utils | Formulating, solving, and analyzing optimization models | | [pytesseract](https://pypi.org/project/pytesseract/) | tesseract-ocr | Image processing | | [python-poppler](https://pypi.org/project/python-poppler/) | poppler-utils, libpoppler-cpp-dev | PDF file processing | | [pyvista](https://pypi.org/project/pyvista/) | libgl1 | High-level API for Visualization Toolkit (VTK) | | [vtk](https://pypi.org/project/vtk/) | libgl1 | Image processing | Help us improve Do you have a use case which is not listed in the table above? Please contact `support@viktor.ai` or post a message on the [Community Forum](https://community.viktor.ai/) and help us improve this overview! --- # Using python packages App dependencies can be specified in your app's `requirements.txt` file. Besides the VIKTOR SDK version, this can include any Python package to be used in the app: ``` viktor==X.X.X drawSVG==1.3.1 ``` ## Pinning version number and version clashes[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/use-python-packages/.md#pinning-version-number-and-version-clashes "Direct link to Pinning version number and version clashes") Both the VIKTOR SDK and drawSVG package have an explicit version number defined (pinned version numbers). This is done to ensure that your app always uses the same version. If the package maintainers release a new version overnight, this does not break your app when re-installing. By pinning the versions, you decide when to upgrade to a newer version and this enables reading the CHANGELOG which might contain necessary actions for upgrading. It is possible that you are using a package which is also used by the VIKTOR SDK. The SDK defines a range of allowed versions. If the app specifies a version outside this range, an error will be logged: ``` ERROR: viktor X.X.X has requirement numpy>=1.15.3, but you'll have numpy 1.15.0 which is incompatible. ``` This might also happen when you don't have a pinned version number and the latest version has not yet been added to the SDK range. caution External packages that are internally used in the SDK are available in your app (e.g. `munch`), even when you don't add them to your app's `requirements.txt`. Nevertheless, **you are highly encouraged to explicitly define them in your app requirements**, as deletion of dependencies within the SDK will be done without prior notice and therefore may break your app! caution Some package licenses do not allow for commercial use, or requires you to open-source your implementation. Make sure the package licensing permits, before using it in your app. ## Use private packages[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/use-python-packages/.md#use-private-packages "Direct link to Use private packages") Instructions on how to use private packages in your app can be found [here](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/private-packages/.md). ## Use system packages[​](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/use-python-packages/.md#use-system-packages "Direct link to Use system packages") Instructions on how to use system packages in your app can be found [here](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/system-dependencies/.md). --- # Documents & spreadsheets VIKTOR offers several services that can be used to for example convert a file's extension (e.g. Word to PDF), or to dynamically fill a file where the content depends on other factors. caution Services need to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. ## Document conversion / merging[​](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/.md#document-conversion--merging "Direct link to Document conversion / merging") The following methods can be used to [convert a file to PDF](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/converting-to-pdf/.md): * Word to PDF ([`convert_word_to_pdf()`](https://docs.viktor.ai/sdk/api/utils/.md#_convert_word_to_pdf)). * Excel to PDF ([`convert_excel_to_pdf()`](https://docs.viktor.ai/sdk/api/utils/.md#_convert_excel_to_pdf)). * SVG to PDF ([`convert_svg_to_pdf()`](https://docs.viktor.ai/sdk/api/utils/.md#_convert_svg_to_pdf)). Multiple PDF documents can easily be [merged into a single document](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/merging-pdf-files/.md) using [`merge_pdf_files()`](https://docs.viktor.ai/sdk/api/utils/.md#_merge_pdf_files). ## Templating[​](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/.md#templating "Direct link to Templating") Dynamically filling a document can be achieved by using one of the available templaters: * [Word](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/word-file-templater/.md) ([`render_word_file()`](https://docs.viktor.ai/sdk/api/external/word/.md#_render_word_file)). * [Spreadsheet](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/spreadsheet-templater/.md) ([`render_spreadsheet()`](https://docs.viktor.ai/sdk/api/external/spreadsheet/.md#_render_spreadsheet)). * [Jinja](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/text-file-templater/.md) ([`render_jinja_template()`](https://docs.viktor.ai/sdk/api/utils/.md#_render_jinja_template)). Furthermore, a spreadsheet can be used as [calculator](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/spreadsheet-calculator/.md). --- # Converting to PDF caution Services need to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. Various formats can be converted to PDF using VIKTOR's built-in services. Converters for the following file types are currently supported: * [Word](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/converting-to-pdf/.md#word-to-pdf) * [Excel](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/converting-to-pdf/.md#excel-to-pdf) * [SVG](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/converting-to-pdf/.md#svg-to-pdf) ## Word to PDF[​](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/converting-to-pdf/.md#word-to-pdf "Direct link to Word to PDF") A Word file can be converted to PDF using the [`convert_word_to_pdf`](https://docs.viktor.ai/sdk/api/utils/.md#_convert_word_to_pdf) function: ``` from pathlib import Path import viktor as vkt # using File object file1 = vkt.File.from_path(Path(__file__).parent / "mydocument.docx") with file1.open_binary() as f1: pdf = vkt.convert_word_to_pdf(f1) # using built-in `open()` with open(Path(__file__).parent / "mydocument.docx", "rb") as f1: pdf = vkt.convert_word_to_pdf(f1) ``` ## Excel to PDF[​](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/converting-to-pdf/.md#excel-to-pdf "Direct link to Excel to PDF") An Excel file can be converted to PDF using the [`convert_excel_to_pdf`](https://docs.viktor.ai/sdk/api/utils/.md#_convert_excel_to_pdf) function: ``` from pathlib import Path import viktor as vkt # using File object file1 = vkt.File.from_path(Path(__file__).parent / "mydocument.xlsx") with file1.open_binary() as f1: pdf = vkt.convert_excel_to_pdf(f1) # using built-in `open()` with open(Path(__file__).parent / "mydocument.xlsx", "rb") as f1: pdf = vkt.convert_excel_to_pdf(f1) ``` ## SVG to PDF[​](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/converting-to-pdf/.md#svg-to-pdf "Direct link to SVG to PDF") An SVG image file can be converted to PDF using the [`convert_svg_to_pdf`](https://docs.viktor.ai/sdk/api/utils/.md#_convert_svg_to_pdf) function: ``` from pathlib import Path import viktor as vkt # using File object file1 = vkt.File.from_path(Path(__file__).parent / "mydocument.svg") with file1.open_binary() as f1: pdf = vkt.convert_svg_to_pdf(f1) # using built-in `open()` with open(Path(__file__).parent / "mydocument.svg", "rb") as f1: pdf = vkt.convert_svg_to_pdf(f1) ``` --- # Merging PDF files caution Services need to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. Merging PDF files can be done using the [`merge_pdf_files`](https://docs.viktor.ai/sdk/api/utils/.md#_merge_pdf_files) function: ``` from pathlib import Path import viktor as vkt # using File object file1 = vkt.File.from_path(Path(__file__).parent / "pdf1.pdf") file2 = vkt.File.from_path(Path(__file__).parent / "pdf2.pdf") with file1.open_binary() as f1, file2.open_binary() as f2: merged_pdf = vkt.merge_pdf_files(f1, f2) # using built-in `open()` with open(Path(__file__).parent / "pdf1.pdf", "rb") as f1, open(Path(__file__).parent / "pdf2.pdf", "rb") as f2: merged_pdf = vkt.merge_pdf_files(f1, f2) ``` --- # Spreadsheet calculator tip This guide is an informative piece to help you if you have questions about the Spreadsheet calculation functionality. If you would like a more instructive lesson, take a look at the [Spreadsheet calculator tutorial](https://docs.viktor.ai/docs/tutorials/spreadsheet-calculator/.md) we have available. caution Services need to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. The [`SpreadsheetCalculation`](https://docs.viktor.ai/sdk/api/external/spreadsheet/.md#_SpreadsheetCalculation) object can be used to utilize a spreadsheet **without macros** as an external calculator. If you want to use an Excel sheet **with macros** as a calculation tool, you can use VIKTOR's [Excel integration](https://docs.viktor.ai/docs/create-apps/software-integrations/excel/.md). ## Calculation sheet set-up[​](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/spreadsheet-calculator/.md#calculation-sheet-set-up "Direct link to Calculation sheet set-up") 1. Add two sheets inside the Excel calculation document named "viktor-input-sheet" and "viktor-output-sheet". caution Note that these names must match in order for VIKTOR to find the correct sheet! 2. In the input and output sheets specify the following four columns: * A1 = Parameters, * B1 = Unit, * C1 = Comment, * D1 = Values 3. In "viktor-input-sheet": add input identifiers in the "Parameters" column and optionally specify default values in the "Values" column ![](/assets/images/evaluate-spreadsheet-input-429d897bc162c0f247a83a9c2748e8b4.png) *viktor-input-sheet example* 4. Link to these values as a source for the calculation in the calculation sheet 5. In "viktor-output-sheet": add output identifiers in the "Parameters" column ![](/assets/images/evaluate-spreadsheet-output-393652ff75e083c9131a57af0d09c661.png) *viktor-output-sheet example* 6. In "viktor-output-sheet": point to the relevant cell(s) in the calculation sheet ![](/assets/images/evaluate-spreadsheet-calculation-61c33d3ed2c8de632d68a98661f1b375.png) *calculation sheet example* ## Implementation in app[​](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/spreadsheet-calculator/.md#implementation-in-app "Direct link to Implementation in app") 7. Import `SpreadsheetCalculation` and `SpreadsheetCalculationInput` from the `viktor.external` package 8. Evaluate the spreadsheet and obtain a SpreadsheetResult with a dictionary of the `output_key` parameters with corresponding values ``` import viktor as vkt def calculation_result(a, b): input_list = [ vkt.spreadsheet.SpreadsheetCalculationInput('input_key1', a), vkt.spreadsheet.SpreadsheetCalculationInput('input_key2', b) ] spreadsheet = vkt.File.from_path('calculation_sheet.xlsx') sheet = vkt.spreadsheet.SpreadsheetCalculation(spreadsheet, input_list) result = sheet.evaluate() return result.values calculation_values = calculation_result(3, 6) print(calculation_values['output_key1']) ``` ## Using lists as input or output[​](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/spreadsheet-calculator/.md#using-lists-as-input-or-output "Direct link to Using lists as input or output") To pass a list of values as **input** for the calculation spreadsheet, one can pass a (e.g. semicolon) separated string ("value1;value2;value3;...") using `SpreadsheetCalculationInput` and write code logic in the spreadsheet to 'parse' and use the values. It is also possible to store a range of cells to a list as output. Simply link the cells in the columns behind "Values" to the desired cells using an **array formula**. ![](/assets/images/evaluate-spreadsheet-output-list-6029e441a03fa4b92b5c1b3aa8d44293.png) *output list example* In the example `output_list1` and `output_list2` will return the same range of results. caution Currently a list can have a maximum of 47 values. A temporary workaround to make use of longer lists is by using a `TEXTJOIN` function in the calculation sheet. This function returns a joined string of the results separated by a user specified separator (e.g. ";"). In the client code, this list can then be converted back to a list of the results by using the `split()` function. --- # Spreadsheet templater caution Services need to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. This guide will assume the template (represented by bytes) is available. Either named cells (cells which can be found using a certain key) or direct cells (cell which can be found by a direct address `{sheet, column, row}`) can be used to fill the template. An example implementation of how a spreadsheet template can be filled can be found below. ``` import viktor as vkt cells = [ vkt.spreadsheet.DirectInputCell('sheet1', 'A', 1, 5), vkt.spreadsheet.NamedInputCell('named_cell_1', 'text_to_be_placed'), ] template_path = Path(__file__).parent / 'my' / 'relative' / 'path' / 'template.xlsx' with open(template_path, 'rb') as template: filled_spreadsheet = vkt.spreadsheet.render_spreadsheet(template, cells) ``` When large blocks of cells need to be filled, an [`InputCellRange`](https://docs.viktor.ai/sdk/api/external/spreadsheet/.md#_InputCellRange) can be used. --- # Text-file templater caution Services need to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. Templating can be a very powerful tool for creating input dependent content. Packages like [jinja2](https://jinja.palletsprojects.com/) greatly simplify the process of creating and rendering these templates: ``` >>> from jinja2 import Template >>> template = Template('Hello {{ name }}!') >>> template.render({'name': 'John Doe'}) 'Hello John Doe!' ``` It consists of two parts: * the template: `'Hello {{ name }}!'` * the context: `{'name': 'John Doe'}` In some situations, both the template and the context will be strictly controlled by the developer: the template is a file in the repository and the developer creates a dictionary with the context from his own code. In others, it might be beneficial to give the user more flexibility and let them create either the template or the context. An example use-case could be user defined reports in which the format varies a lot. Instead of figuring out all the logic, the user can create its own template. This increase in flexibility however comes with a significant security risk which should be addressed. ## Security risks[​](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/text-file-templater/.md#security-risks "Direct link to Security risks") A templating engine combines the template with the context by defining a syntax. In the case of jinja2 this syntax is very extensive. It has for-loops, if-statements, variable assignment, to name a few. All these possibilities make it very versatile and easy to for instance dump complete Python objects into the template and handle complex relations. This however also makes it possible to execute random Python logic. In more generic terms: jinja2 is turing complete, meaning that it is possible to write a complete computer program by just using the template and the context. In the case of a developer controlled template and context, there is no problem: it is guaranteed that there will be no weird code injections taking place. This becomes problematic however when the template or the context is directly provided by the user or not strictly sanitized by the developer (e.g. inserting an input field directly into the template). We do not want the user to execute its own created scripts directly on the server as it can do all sorts of harm. ## `render_jinja_template`[​](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/text-file-templater/.md#render_jinja_template "Direct link to render_jinja_template") Because of the possibility of code injection, it is necessary to run the rendering of the template in an isolated environment, often called a sandbox. Jinja2 provides such a sandbox in the library, but is has been circumvented a few times already. Instead, VIKTOR provides a [`render_jinja_template`](https://docs.viktor.ai/sdk/api/utils/.md#_render_jinja_template) function which makes jinja templating easy and safe: ``` import viktor as vkt with open("path/to/template.jinja", 'rb') as template: result = vkt.render_jinja_template(template, {'name': 'John Doe'}) ``` This has the added benefit of not needing an extra dependency in your app. note This sandboxing has also been applied to the [Word-file templater](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/word-file-templater/.md) --- # Word-file templater tip This guide is an informative piece to help you if you have questions about the Word-file templating functionality. If you would like a more instructive lesson, take a look at the [Reporting tutorial](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md) we have available. caution Services need to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. The following steps are to be performed to implement a Word template. A more elaborate example of the individual components will be shown in the sections below. 1. Template a Word (.docx) file using the [jinja notation](https://jinja.palletsprojects.com/templates) (e.g. `{{ tag }`}) note The extension of the Word template should be of type .docx (not .doc). 2. Create a sequence of [`WordFileTag`](https://docs.viktor.ai/sdk/api/external/word/.md#_WordFileTag) and/or [`WordFileImage`](https://docs.viktor.ai/sdk/api/external/word/.md#_WordFileImage) objects 3. Execute [`render_word_file`](https://docs.viktor.ai/sdk/api/external/word/.md#_render_word_file) with the word template from step 1 and the components from step 2 ## Example Word template[​](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/word-file-templater/.md#example-word-template "Direct link to Example Word template") The figure below shows an example of a quotation document, in which the contact details of the customer is filled in as well as listing the components that he or she has selected. ![](/assets/images/word-template-example-2dd703bdd53cfcadc1e50971efa97fd5.png) *Word template* Also note that styling as defined in the original .docx file will be inherited by the rendered document. For example, the 'date' tag is bold in the template, which results in a bold rendered date in the resulting file. ## `WordFileTag`[​](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/word-file-templater/.md#wordfiletag "Direct link to wordfiletag") In the application you need to refer to the created tags in the word file components. In case of textual data the [`WordFileTag`](https://docs.viktor.ai/sdk/api/external/word/.md#_WordFileTag) can be used: ``` components = [] components.append(WordFileTag('client', params.client)) components.append(WordFileTag('date', datetime.datetime.today().strftime('%d-%m-%Y'))) ``` The `WordFileTag` values can also be of type `list` or `dict`, to make it possible to iterate within the template. In the example template above, the `products` is a list of dictionaries: ``` products = [ {'qty': 1, 'desc': 'Product A', 'price': 100, 'total': 150}, {'qty': 3, 'desc': 'Product B', 'price': 150, 'total': 450}, ... ] components.append(WordFileTag('products', products)) ``` Using the `{%tr for p in products %}` notation in the template allows for looping through the products, printing each product on a new line in the defined table. Please consult the [jinja](https://jinja.palletsprojects.com/) documentation for more detail on jinja templating. ## `WordFileImage`[​](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/word-file-templater/.md#wordfileimage "Direct link to wordfileimage") note SVG is not supported as image type. An image can be inserted using the [`WordFileImage`](https://docs.viktor.ai/sdk/api/external/word/.md#_WordFileImage) object, which requires a binary image file handle. This can either be a static image (path), an uploaded image (file entity), or a dynamically created image of, for example, a result plot. ``` from pathlib import Path image_path = Path(__file__).parent / 'my' / 'relative' / 'path' / 'static_image.png' with open(image_path, 'rb') as image: word_file_image = WordFileImage(image, 'img_tag') components.append(word_file_image) ``` The *static\_image.png* in this case will be placed on the position of *image\_tag* in the Word template, in its original size. The image can be scaled by defining a width and/or height (pt). When only one is provided, the other is scaled. When both are provided, both are used and the original aspect ratio might be changed. ``` WordFileImage(img, 'img_tag', width=30) ``` ## `render_word_file`[​](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/word-file-templater/.md#render_word_file "Direct link to render_word_file") Now that all the Word file components are defined, the Word file can be rendered using [`render_word_file`](https://docs.viktor.ai/sdk/api/external/word/.md#_render_word_file). The template can also be either a static file (path) or an uploaded file (file entity): ``` template_path = Path(__file__).parent / 'my' / 'relative' / 'path' / 'template.docx' with open(template_path, 'rb') as template: word_file = render_word_file(template, components) ``` The document can then be passed to for example a [`DownloadResult`](https://docs.viktor.ai/sdk/api/result/.md#_DownloadResult): ``` return DownloadResult(word_file, f'quotation_{params.quotation_id}.docx') ``` --- # Dashboard welcome text A custom welcome message that will be shown to the user upon entering the dashboard, can be set in the [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#welcome_text) file. --- # Output field note For larger sections of text in the parametrization, see [`Text`](https://docs.viktor.ai/docs/create-apps/inform-end-user/text-blocks/.md) An [`OutputField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_OutputField) can be used to display a textual or numeric value to the user within a parametrization that cannot be modified by the user. The `value` must be set in the parametrization and can be a static value or obtained dynamically. ``` import viktor as vkt class Parametrization(vkt.Parametrization): output = vkt.OutputField('Output', value=3.1415) ``` note The value of the `OutputField` field is not included in the params. ## Dynamic value[​](https://docs.viktor.ai/docs/create-apps/inform-end-user/output-field/.md#dynamic-value "Direct link to Dynamic value") ### Depending on another field[​](https://docs.viktor.ai/docs/create-apps/inform-end-user/output-field/.md#depending-on-another-field "Direct link to Depending on another field") If the value depends on another field, the easiest solution is to use a `Lookup`: ``` import viktor as vkt class Parametrization(vkt.Parametrization): param_x = vkt.NumberField('X') output = vkt.OutputField('X (read only)', value=vkt.Lookup('param_x')) ``` ### Inside a DynamicArray[​](https://docs.viktor.ai/docs/create-apps/inform-end-user/output-field/.md#inside-a-dynamicarray "Direct link to Inside a DynamicArray") If the value depends on the result of another field within a [`DynamicArray`](https://docs.viktor.ai/docs/create-apps/user-input/tables-and-arrays/.md#dynamicarray), a `RowLookup`can be used. Using the `RowLookup`, the value of a field in a specific row can be made read-only: ``` import viktor as vkt class Parametrization(vkt.Parametrization): array = vkt.DynamicArray('Array') array.param_x = vkt.NumberField('X') array.output = vkt.OutputField('X (read only)', value=vkt.RowLookup('param_x')) ``` ### Using a function[​](https://docs.viktor.ai/docs/create-apps/inform-end-user/output-field/.md#using-a-function "Direct link to Using a function") The most generic way to dynamically set the value is to use a **callback function**. Upon evaluation of the value, the platform passes the `params`, `entity_id`, `entity_name`, and `workspace_id` (>= v14.7.1) to the custom function: ``` import viktor as vkt def sum_x_y(params, **kwargs): return params.param_x + params.param_y class Parametrization(vkt.Parametrization): param_x = vkt.NumberField('X') param_y = vkt.NumberField('Y') output = vkt.OutputField('X + Y', value=sum_x_y) ``` If the `OutputField` is defined within a `DynamicArray`, make sure that the callback function returns a list of values, one for each row in the array. The length of this list must be equal to the number of rows in the array, otherwise (a warning is logged and) the field will be empty: ``` import viktor as vkt def sum_x_y(params, **kwargs): return [row.param_x + row.param_y for row in params.array] class Parametrization(vkt.Parametrization): array = vkt.DynamicArray('Array') array.param_x = vkt.NumberField('X') array.param_y = vkt.NumberField('Y') array.output = vkt.OutputField('X + Y', value=sum_x_y) ``` tip All individual `kwargs` can be added explicitly in the signature if needed: ``` def sum_x_y(params, entity_id, entity_name, workspace_id, **kwargs): ... ``` When the value depends on data of another entity, the `entity_id` can be used to navigate and obtain data using the [SDK API](https://docs.viktor.ai/docs/api/sdk/handling-entity-data/.md). --- # Show a message to the user This guide explains how to send a message to the VIKTOR interface to inform/warn users. It will cover aspects as in what scenarios such messages come in handy, what steps to take to achieve this, and examples are given. ## Job log[​](https://docs.viktor.ai/docs/create-apps/inform-end-user/show-message/.md#job-log "Direct link to Job log") All messages (except for [progress messages](https://docs.viktor.ai/docs/create-apps/inform-end-user/show-message/.md#progress-message)) are logged in the "Job log", which can be accessed from the editor toolbar: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASQAAAAtCAYAAAAHgRaQAAABg2lDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9TpUUrgnYQcchQneyiIo5ahSJUCLVCqw4ml35Bk4YkxcVRcC04+LFYdXBx1tXBVRAEP0BcXZwUXaTE/yWFFjEeHPfj3b3H3TtAaFSYZnXNAppum+lkQszmVsXQK4IIoRdhDMjMMuYkKQXf8XWPAF/v4jzL/9yfo0/NWwwIiMSzzDBt4g3i6U3b4LxPHGUlWSU+Jx436YLEj1xXPH7jXHRZ4JlRM5OeJ44Si8UOVjqYlUyNeIo4pmo65QtZj1XOW5y1So217slfGMnrK8tcpzmCJBaxBAkiFNRQRgU24rTqpFhI037Cxz/s+iVyKeQqg5FjAVVokF0/+B/87tYqTE54SZEE0P3iOB+jQGgXaNYd5/vYcZonQPAZuNLb/moDmPkkvd7WYkdA/zZwcd3WlD3gcgcYejJkU3alIE2hUADez+ibcsDgLdCz5vXW2sfpA5ChrlI3wMEhMFak7HWfd4c7e/v3TKu/HxCVcn9yxxiuAAAABmJLR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W6rTXOlEnXbdFr0ivIZucql/At1b//jaZpNPVmx2tfzUBAGL/TUq+ns1+Qjpd8JSUDN0m7sxKejnLwQ1MOIfLNrQKojQ7/08sa+CFXASkeo+qhXrFc5rnM7DZrIrnllz3H5ZV8uot+1u6zfL2r9abQyremKp2y72csLKe+9R4L7lcvmoTZK0k3x0r2gYghG5SFDyjR5LVtMIEfaRZJagYqTK1Hppgi+dcwLdWtSrJ8xl43Ut4EX4FhjU2nJupBam2gvh+AlxoT3KMpZ51o8+/riqb4BUV55D04inJDSsbvbdWUof8uUJSyTM6K2xH7zPouswqHrpdpP1sxTxbf47OTgY9PYUwbYfbU6xMLYftTQ7x+BuE915icMiBnt7rJaX9F+FX2NrkxA24Hu+0ajv+pVgJbiDDn2Bg6OYX+3cUG09Zx48ICs+yDNZ/XlTAKnWO/FDLltPTz4i/bu6+Ocu1LkXbAHg+UzF0qxeTqUuRZGkjx48obVtVL1fi9AEpbDYrJu4Oq7LTXy/jKfs8JCHzr0iysImCVDzIsgarSYL0OnHYtFCrrc2Aa+bLivclCVtBGjkjRygFK3VAm39xVbZ9StpWq/1caBfRSEx8DxbLVVi6zXD092lzQJvG46nYAW16ESRhkAHIGyw9eWsE0eK0vCC1lC0E0eLQfx0hCIIEiSAIggSJIAjdcnH+DZLBQE+LIMhDIgiCIEEiCIIEiSAIggTpN/Tc50M9SAShGO208AmCIA+JIAiCBIkgCL3yf8tcNAQk2jkeAAAAAElFTkSuQmCC) ## Interruptive (error) message[​](https://docs.viktor.ai/docs/create-apps/inform-end-user/show-message/.md#interruptive-error-message "Direct link to Interruptive (error) message") New in v13.7.0 `UserException` is replaced by `UserError` which supports marking invalid fields in the interface. Sometimes it is desirable to inform the user about incorrect (or missing) input, and interrupt the job flow so that the user is forced to fix the problem before continuing. For example, when input is not (yet) defined but required at some point within the code, the user does not always know how to fix the problem, while the developer does. We can guide the user in the right direction by providing an error message in the interface, by raising a [`UserError`](https://docs.viktor.ai/sdk/api/errors/.md#_UserError). ### Implementation[​](https://docs.viktor.ai/docs/create-apps/inform-end-user/show-message/.md#implementation "Direct link to Implementation") 1. Identify at what point in the code an event may occur where the user should be informed and forced to fix 2. Catch this event (e.g. with if-else statements) 3. Raise a `UserError` with the desired message, along with fields that should be marked as invalid ``` import viktor as vkt def calculate_block_volume(params): width = params.width length = params.length height = params.height violations = [] if width is None: violations.append(vkt.InputViolation("Input 'width' cannot be empty!", fields=['width'])) if length is None: violations.append(vkt.InputViolation("Input 'length' cannot be empty!", fields=['length'])) if height is None: violations.append(vkt.InputViolation("Input 'height' cannot be empty!", fields=['height'])) if violations: raise vkt.UserError("Cannot calculate block volume", input_violations=violations) return width * length * height ``` tip For more information on input validation, please see [this guide](https://docs.viktor.ai/docs/create-apps/user-input/input-validation/.md). ## Non-interruptive message[​](https://docs.viktor.ai/docs/create-apps/inform-end-user/show-message/.md#non-interruptive-message "Direct link to Non-interruptive message") New in v14.0.0 `UserMessage` to show a (non-interruptive) message to the end-user. Sometimes it is desirable to show a message to the user without interrupting the running app job, such as an informative or warning message. This can be done by using the [`UserMessage`](https://docs.viktor.ai/sdk/api/core/.md#_UserMessage). Three different types of messages can be sent with the `UserMessage`: a **warning**, an **info** and a **success** message, each of them having a slightly different look within the interface. ### Implementation[​](https://docs.viktor.ai/docs/create-apps/inform-end-user/show-message/.md#implementation-1 "Direct link to Implementation") ``` import viktor as vkt def calculate(params): if not is_params_recommended(params): vkt.UserMessage.warning("The current set of params is not recommended") vkt.UserMessage.info("The calculation will be run with the following input: ...") result = run_calculation(...) vkt.UserMessage.success("Analysis successfully finished!") ... ``` ## Progress message[​](https://docs.viktor.ai/docs/create-apps/inform-end-user/show-message/.md#progress-message "Direct link to Progress message") Sometimes it is useful to keep the user informed during a long-running job (e.g. processing of analysis, optimization or downloadable content when working with large files or complex calculations), by showing one or more [progress messages](https://docs.viktor.ai/sdk/api/core/.md#_progress_message). ### Implementation[​](https://docs.viktor.ai/docs/create-apps/inform-end-user/show-message/.md#implementation-2 "Direct link to Implementation") ``` import viktor as vkt def process_files(my_files): for file in my_files: vkt.progress_message(message=f'Processing {file}') ... # process file ``` The progress\_message also accepts a percentage. The platform will render the progress with your progress message and a progress bar showing the progress. ``` import viktor as vkt def process_files(my_files): n = len(my_files) for i, file in enumerate(my_files): vkt.progress_message(message=f'Processing {file}', percentage=(i/n)*100) ... # process file ``` note * Progress messages are only shown to the user during long-running jobs and don't show up during short-running jobs. * Progress messages are not logged in the [Job log](https://docs.viktor.ai/docs/create-apps/inform-end-user/show-message/.md#job-log). ### Extending a previous message[​](https://docs.viktor.ai/docs/create-apps/inform-end-user/show-message/.md#extending-a-previous-message "Direct link to Extending a previous message") Whenever a progress message is invoked, the progress window will be "refreshed" with the specified text (i.e. old messages will be dropped). In some cases this is not desired, and new messages should be "appended" to the already existing ones. This can be implemented by using line breaks within the message: ``` import viktor as vkt def process_files(my_files): n = len(my_files) for i, file in enumerate(my_files): p_message = f'Reading {file}' ... # read file vkt.progress_message(message=p_message) p_message += f'\n Processing {file}' ... # process file vkt.progress_message(message=p_message) p_message += f'\n Export result of {file}' ... # export results vkt.progress_message(message=p_message) ``` --- # Static image New in v14.3.0 A static image (JPEG / PNG) can be displayed in the parametrization of an editor to, for example, provide additional context to help users fill in certain input fields. ![](/assets/images/image-e9c9788520f58ca0c4de36eb0271c430.png) ## Minimal implementation[​](https://docs.viktor.ai/docs/create-apps/inform-end-user/static-image/.md#minimal-implementation "Direct link to Minimal implementation") Assume a folder structure as shown below: ``` my-folder ├── app.py ├── assets │ └── viktor.png ├── requirements.txt └── viktor.config.toml ``` The image `viktor.png` can be displayed in the parametrization by referencing to it in the app code using an [`Image`](https://docs.viktor.ai/sdk/api/parametrization/.md#_Image) field: ``` class Parametrization(vkt.Parametrization): img = vkt.Image(path="viktor.png") ``` The image `path` is relative with respect to the **assets\_path** which can be named arbitrarily and should be defined in the viktor.config.toml: ``` ... assets_path = "assets" ``` note Note that the assets directory does not support nesting of directories. Restart your app You will need to restart your app after adding the 'assets' directory. ## Image customization[​](https://docs.viktor.ai/docs/create-apps/inform-end-user/static-image/.md#image-customization "Direct link to Image customization") You can tweak the visual by specifying one or multiple of the following attributes: * `align`: Alignment within the parametrization component ("left" | "center" | "right") * `caption`: A caption which is shown underneath the image * `flex`: Width of the image as percentage of the total parametrization width * `max_width`: A maximum width (pixels) can be set to make sure an image is not stretched beyond illegible boundaries ## Show/hide an image depending on user selection[​](https://docs.viktor.ai/docs/create-apps/inform-end-user/static-image/.md#showhide-an-image-depending-on-user-selection "Direct link to Show/hide an image depending on user selection") There may be cases where the user needs to be informed differently depending on a previous choice. An `Image` cannot have a dynamic source, however it is possible to use its [visibility to show/hide](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) a specific image. --- # Text blocks A [`Text`](https://docs.viktor.ai/sdk/api/parametrization/.md#_Text) field that can be used to display a static text (max. 1800 characters) as follows: ``` class Parametrization(vkt.Parametrization): not_in_params = vkt.Text('My static text') ``` note The value of the `Text` field is not included in the params. The value of the `Text` fields can be [styled using Markdown](https://docs.viktor.ai/docs/create-apps/layout-and-styling/style-text/.md): ![](/assets/images/formatting-text-52e47329c02925c8c5455788b9704af4.png) ``` import viktor as vkt class Parametrization(vkt.Parametrization): info1 = vkt.Text(""" Please select the wing model below ✈️ - 2D: Select 2D to model an **infinite wing** - 3D: Select 3D to model a *finite wing*, along with the aspect ratio 1. High AR for slender wings 2. Low AR for delta wings """) model = vkt.OptionField("Wing model", options=["2D", "3D"]) ar = vkt.NumberField("AR", variant="slider", min=1, max=30) info2 = vkt.Text(""" ### Block / in-line math #### Lift Coefficient $$ L = \\frac{1}{2} \\rho v^2 S C_L $$ where $\\rho = \\frac{m}{v}$. Read more about this equation on [this page](https://en.wikipedia.org/wiki/Lift_coefficient). ### Horizontal rules --- --- and another... --- # Heading level 1 ## Heading level 2 """) ``` --- # Tooltips Tooltips can be created by setting the `description` argument (max. 200 characters) on any of the [input fields](https://docs.viktor.ai/docs/create-apps/user-input/.md), [tabs and sections](https://docs.viktor.ai/docs/create-apps/layout-and-styling/tabs-and-sections/.md), [pages](https://docs.viktor.ai/docs/create-apps/layout-and-styling/pages/.md), [steps](https://docs.viktor.ai/docs/create-apps/layout-and-styling/steps/.md), or [views](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md) as follows: ``` class Parametrization(vkt.Parametrization): number = vkt.NumberField("My number", description="This text is shown in the field's tooltip") ``` ``` class Parametrization(vkt.Parametrization): tab = vkt.Tab("My tab", description="This text is shown in the tab's tooltip") tab.section = vkt.Section("My section", description="This text is shown in the section's tooltip") ``` ``` class Parametrization(vkt.Parametrization): page = vkt.Page("My page", description="This text is shown in the page's tooltip") ``` ``` class Parametrization(vkt.Parametrization): step = vkt.Step("My step", description="This text is shown in the step's tooltip") ``` ``` class Controller(vkt.Controller): ... @vkt.MapView("My map view", description="This text is shown in the view's tooltip") def my_map_view(self, params, **kwargs): ... ``` The value of `description` can be [styled using Markdown](https://docs.viktor.ai/docs/create-apps/layout-and-styling/style-text/.md). Descriptions are also read by agents when your app is [connected over MCP](https://docs.viktor.ai/docs/create-apps/mcp/.md). --- # Layout & styling New in v14.2.0 Simplify [navigation inside the app](https://docs.viktor.ai/docs/create-apps/layout-and-styling/entity-navigation/.md) by using a `ChildEntityManager` There are multiple ways to adjust the layout & styling of an entity's editor. * Divide the parametrization in [Tabs and Sections](https://docs.viktor.ai/docs/create-apps/layout-and-styling/tabs-and-sections/.md), [Pages](https://docs.viktor.ai/docs/create-apps/layout-and-styling/pages/.md), or [Steps](https://docs.viktor.ai/docs/create-apps/layout-and-styling/steps/.md). * [Adjust the width](https://docs.viktor.ai/docs/create-apps/layout-and-styling/adjust-parametrization-width/.md) of individual fields within the parametrization, a page or step, or the parametrization as a whole. * [Add manual line breaks](https://docs.viktor.ai/docs/create-apps/layout-and-styling/manual-line-break/.md) between fields within a parametrization to obtain a cleaner looking parametrization. * [Style text](https://docs.viktor.ai/docs/create-apps/layout-and-styling/style-text/.md) using Markdown. Furthermore you are able to tweak the: * [dashboard](https://docs.viktor.ai/docs/create-apps/layout-and-styling/dashboard/.md) * [navigation inside the app](https://docs.viktor.ai/docs/create-apps/layout-and-styling/entity-navigation/.md) ## Tabs & sections[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/.md#tabs--sections "Direct link to Tabs & sections") ![](/img/docs/cards/tabs.svg) ## [Tab](https://docs.viktor.ai/docs/create-apps/layout-and-styling/tabs-and-sections/.md) Represents a collapsible tab ![](/img/docs/cards/sections.svg) ## [Section](https://docs.viktor.ai/docs/create-apps/layout-and-styling/tabs-and-sections/.md) Represents a collapsible section ## Pages & steps[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/.md#pages--steps "Direct link to Pages & steps") ![](/img/docs/cards/pages.svg) ## [Page](https://docs.viktor.ai/docs/create-apps/layout-and-styling/pages/.md) Can be used to construct a combination of inputs and outputs ![](/img/docs/cards/steps.svg) ## [Step](https://docs.viktor.ai/docs/create-apps/layout-and-styling/steps/.md) Similar to Page, but dictates a page order ## Parametrization width[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/.md#parametrization-width "Direct link to Parametrization width") ![](/img/docs/cards/parametrization_width.svg) ## [Parametrization width](https://docs.viktor.ai/docs/create-apps/layout-and-styling/adjust-parametrization-width/.md) Adjust the default width of the parametrization ## Line break[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/.md#line-break "Direct link to Line break") ![](/img/docs/cards/linebreak.svg) ## [Line break](https://docs.viktor.ai/docs/create-apps/layout-and-styling/manual-line-break/.md) Force input fields to be placed on the next line --- # Adjust the parametrization width When a user enters an editor, the parametrization and views (if present) are shown with a default width ratio of 40% / 60%. For some entity types it may be desirable to adjust this ratio, for example when the input side needs to be a bit wider because of large tables. Or when the output side needs to be wider to put more emphasize on a view. ![](/assets/images/editor-parametrization-width-60-21cab3a32804495c0a6e4dddfe94dda8.png) To adjust the default width, the `width` argument can be set on your parametrization class. Its value is the percentage of the complete width of the editor (input + output) and should be an integer between 20 and 80: ``` class Controller(vkt.Controller): parametrization = Parametrization(width=60) ``` Note that besides this width, each field can have its own `flex` to adjust the width w\.r.t. the parametrization side. Defining both a `width` and a `flex` results in a multiplication of the two. As an example, the following combination results in a full-width field taking up 30% of the editor: ``` class Parametrization(vkt.Parametrization): number = vkt.NumberField("Number", flex=100) class Controller(vkt.Controller): parametrization = Parametrization(width=30) ``` ![](/assets/images/editor-parametrization-width-30-3d652744464045670a16e9d4b2ffd556.png) It may be possible that you will see no difference on certain screens between a width of, for example, 20 and 25. Depending on the screen resolution and pixel density, some widths can result in an input / output window which is too small to be readable. Therefore, a minimum width is implemented in the platform to prevent such behavior. ## Specific width per Page / Step[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/adjust-parametrization-width/.md#specific-width-per-page--step "Direct link to Specific width per Page / Step") New in v14.7.0 In case your editor consists of Page or Step elements, separate widths can be provided if desired: * [Page](https://docs.viktor.ai/docs/create-apps/layout-and-styling/pages/.md#adjust-the-parametrization-width) * [Step](https://docs.viktor.ai/docs/create-apps/layout-and-styling/steps/.md#adjust-the-parametrization-width) --- # Dashboard The dashboard is an overview page with data on the current app instance, such as a [welcome text](https://docs.viktor.ai/docs/create-apps/layout-and-styling/dashboard/.md#welcome-text), activity data, and quick links to [top-level entities](https://docs.viktor.ai/docs/create-apps/layout-and-styling/dashboard/.md#top-level-entity-cards). This page explains the possibilities of tweaking the dashboard page. ![](/assets/images/dashboard-88175c1d986aa90421542fc225f3ecfd.png) tip For a [tree-type app](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md#tree-type-app), the dashboard is the start page by default. It is possible to use an [entity as start page](https://docs.viktor.ai/docs/create-apps/layout-and-styling/entity-navigation/.md#entity-as-start-page) instead. ## Welcome text[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/dashboard/.md#welcome-text "Direct link to Welcome text") The welcome text is shown on the top of the page and can be set in the [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#welcome_text) file. ## Top-level entity cards[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/dashboard/.md#top-level-entity-cards "Direct link to Top-level entity cards") Just below the welcome text, cards are shown that link to entities on the highest level (top-level entities), to enable quick and easy access. By default, all top level entities are shown. The `show_on_dashboard` attribute can be set on one or more [initial entities](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md#initial-entities) to only show a subset. --- # Navigation inside an app New in v14.2.0 This page describes ways to adjust the navigation flow, to improve user experience, within a [tree-type app](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md#tree-type-app). ## Entity as start page[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/entity-navigation/.md#entity-as-start-page "Direct link to Entity as start page") By default, users start on the [dashboard](https://docs.viktor.ai/docs/create-apps/layout-and-styling/dashboard/.md) when entering an app instance: ![](/assets/images/entity-navigation-dashboard-79d2c620e557712386f1dce43d5c325c.png) For some apps, users might have a better experience if they immediately land on some **entity**, instead of the dashboard, upon entering the app instance. This can be achieved by setting the `use_as_start_page` argument on one of the [initial entities](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md#initial-entities): ``` import viktor as vkt initial_entities = [ vkt.InitialEntity("Top-level entity", use_as_start_page=True, ...), ... ] ``` note If redirection of the user to the assigned starting entity fails, he/she will be redirected to the dashboard instead. ## Manage child entities within editor[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/entity-navigation/.md#manage-child-entities-within-editor "Direct link to Manage child entities within editor") By default, when a user then clicks on an entity in the side navigation menu ("My Folder" in the below example), he/she will be directed to the entity browser view: ![](/assets/images/entity-navigation-browser-37039f9ad1425d71c95720f7ecdebdf7.png) The entity browser view can, in some cases, be confusing, as the user is left with the choice: do I need to create a child entity or open the editor of the current entity? By implementing the [`ChildEntityManager`](https://docs.viktor.ai/sdk/api/parametrization/.md#_ChildEntityManager), management of child entities (e.g. creation, deletion, navigation) is moved **within the editor of the parent entity**. By doing so, the browser view is automatically skipped, and users will directly enter the editor when navigating to the parent entity. This way a developer can guide the user better throughout the application: ``` import viktor as vkt class Parametrization(vkt.Parametrization): manager = vkt.ChildEntityManager('MyEntityType') ``` ![](/assets/images/entity-navigation-manager-be71f27d88033c317a0f678dcbcf19d7.png) --- # Manual line break A [`LineBreak`](https://docs.viktor.ai/sdk/api/parametrization/.md#_LineBreak) can be used to force [input fields](https://docs.viktor.ai/docs/create-apps/user-input/.md) to be placed on the next 'line' to obtain a cleaner looking parametrization within an editor. ``` import viktor as vkt class Parametrization(vkt.Parametrization): n1 = vkt.NumberField('N1') n2 = vkt.NumberField('N2') lb = vkt.LineBreak() # split the fields in 2 pairs n3 = vkt.NumberField('N3') n4 = vkt.NumberField('N4') ``` --- # Creating pages A [`Page`](https://docs.viktor.ai/sdk/api/parametrization/.md#_Page) can be used to construct a combination of inputs (e.g. tabs / sections) and outputs (views). This grouping allows for specific views to become visible, depending on the page a user has selected. Assume an editor with a `GeometryView` and a `DataView`: ``` import viktor as vkt class Controller(vkt.Controller): @vkt.GeometryView(...) def geometry_view(...): ... @vkt.DataView(...) def data_view(...): ... ``` Now we would like to have an editor with 2 pages. When a user is working on "Page 1", no views will be visible. When the user switches to "Page 2", a geometry view and a data view will become visible. A `Page` is defined in the parametrization similar to [tabs and sections](https://docs.viktor.ai/docs/create-apps/layout-and-styling/tabs-and-sections/.md): ``` import viktor as vkt class Parametrization(vkt.Parametrization): page_1 = vkt.Page('Page 1 - without views') page_1.input_1 = vkt.TextField('This is a text field') page_1.input_2 = vkt.NumberField('This is a number field') page_2 = vkt.Page('Page 2 - with views', views=['geometry_view', 'data_view']) page_2.input_1 = vkt.TextField('This is a text field') page_2.input_2 = vkt.NumberField('This is a number field') ``` ![](/assets/images/editor-pages-without-views-fa73a44476562de7f1415671bd9864a3.png) *Page 1 with no views* When navigating to page 2, you will see that the two views will be present: ![](/assets/images/editor-pages-with-views-a80adf9b7210329d42299c9afc75eced.png) *Page 2 with a GeometryView and a DataView* All the layered structures of `Tab` / `Section` / fields can be encapsulated in a `Page`: ``` # fields directly as input fields on a page class Parametrization(vkt.Parametrization): page = vkt.Page(...) page.number = vkt.NumberField(...) ... # tabs on a page class Parametrization(vkt.Parametrization): page = vkt.Page(...) page.tab = vkt.Tab(...) ... # sections on a page class Parametrization(vkt.Parametrization): page = vkt.Page(...) page.section = vkt.Section(...) ... ``` ## Hide a Page[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/pages/.md#hide-a-page "Direct link to Hide a Page") New in v14.7.0 Hiding a Page can be done in a similar way as [hiding a field](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md), by setting the `visible` argument: ``` vkt.Page("Page 2", visible=vkt.Lookup("page_1.param_x")) ``` or using a callback function: ``` vkt.Page("Page 2", visible=get_visible) ``` ## Adjust the parametrization width[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/pages/.md#adjust-the-parametrization-width "Direct link to Adjust the parametrization width") New in v14.7.0 A separate parametrization width per Page can be defined by specifying the `width` argument: ``` import viktor as vkt class Parametrization(vkt.Parametrization): page_1 = vkt.Page("Page 1", width=30) ... page_2 = vkt.Page("Page 2", width=70) ... ``` When the `width` is defined both on the Parametrization class **and** a Page, the width of the Page will take precendence while the global width is used for pages that have not defined a specific width. For more detail on the global parametrization width and rules with respect to a field's `flex` argument, please refer to [this page](https://docs.viktor.ai/docs/create-apps/layout-and-styling/adjust-parametrization-width/.md). --- # Creating steps Similar to a [`Page`](https://docs.viktor.ai/docs/create-apps/layout-and-styling/pages/.md), grouping can be achieved by using the [`Step`](https://docs.viktor.ai/sdk/api/parametrization/.md#_Step) class. Other than with pages, with steps the developer can dictate the order of pages to be visited: the user is not able to move freely between pages but moves to the next/previous step with a next/previous button. `Page` and `Step` cannot be combined within a single parametrization. A `Step` is defined in the parametrization similar to a `Page`. The labels of the next and previous buttons can be set per step: ``` import viktor as vkt class Parametrization(vkt.Parametrization): step_1 = vkt.Step('Step 1 - without views') step_1.input_1 = vkt.TextField('This is a text field') step_1.input_2 = vkt.NumberField('This is a number field') step_2 = vkt.Step('Step 2 - with views', views=['geometry_view', 'data_view']) step_2.input_1 = vkt.TextField('This is a text field') step_2.input_2 = vkt.NumberField('This is a number field') ``` ![](/assets/images/editor-steps-without-views-070ba83309146042cdc39f8f15588fd3.png) *Step 1 with no views* When navigating to step 2, you will see that the two views will be present: ![](/assets/images/editor-steps-with-views-d6d93863dcebca337434c25e18245c73.png) *Step 2 with a GeometryView and a DataView* ## Button labels[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/steps/.md#button-labels "Direct link to Button labels") The labels of the previous and next buttons can be set per step: ``` vkt.Step('Step 2', previous_label='Go to step 1', next_label='Go to step 3') ``` ## Validation of user input[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/steps/.md#validation-of-user-input "Direct link to Validation of user input") New in v13.7.0 When implementing the `on_next` argument, the corresponding function is called when a user clicks the 'next' button to move to the next step. This can be used to, for example, validate the input of the current active step. Please note that the validation function cannot take longer than 3 seconds! ``` import viktor as vkt def validate_step_1(params, **kwargs): if params.step_1.width > params.step_1.height: raise vkt.UserError("The design is not feasible") class Parametrization(vkt.Parametrization): step_1 = vkt.Step('Step 1', on_next=validate_step_1) step_1.width = vkt.NumberField('Width') step_1.height = vkt.NumberField('Height') ``` ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfYAAABDCAYAAABumyfOAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAAtdEVYdENyZWF0aW9uIFRpbWUATW9uIDMxIE9jdCAyMDIyIDExOjA2OjI1IEFNIENFVLl5iUQAABvtSURBVHic7d17fBT1vf/x1+w9G5LNbQlsQkK4RyFaMaKAXB9qrFJ4UH+iFqyXU2lFUXoEeooXvNCiqLRYsHi8oPITYj0US2upHlBREYxQCWISSMiFZCFsSFhCNtnd7O75Y7NhAxvCZSGb8Hk+HvtI2Jn9zpfMzrzn+53vzCg+n8+HEEIIIboFVWdXQAghhBDhI8EuhBBCdCMS7EIIIUQ3IsEuhBBCdCMS7EIIIUQ3IsEuhBBCd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9RUXLJaHd3unUcCJLhSQ3tziMurMDfPnLPsRsN0moXIhIoin977IDJZJJWezemKAomU+j7SiqKgqIoqNVq7h50FJ3KG3I+ceHoVF7uHnQUtVrduj7CIax3ngPwNTeDowmfyw3hLVoI0RFF8bfUjQYUzZndpsLlcmG322lsbCTMuwPRSRRFISoqCpPJhE536pMPA3ef83g8NDU1Ybfb2V7m4O0iEwUOM25fN3+0YCfTKh4yjTZ+PtjOiL5GTCYTBoMBtVp93nedgwsQ7EIIISKbz+drDXeXy0VDQwN2u53Dhw9z9OhRXC4XXq9XDvTCTFEUVCoVOp2OuLg4evbsiclkIjo6uvV2suFouXfJO88JIYQ4P4GQ0Wg0refhtVot8fHxNDc3A0iwh1kgsDUaDUajEaPRSFRUFBqNJiwt9dblSItdCCEuPYFdv8/nw+Px0Nzc3Pryer0h5xXn5uTADhxQBV6Bc+yh5j2n5UmwCyHEpSk43ANhHvgp0XBhBIJbpVK1/gxnqIMEuxBCXNKCIyBUHEhEhEeo0A5+L5xXp0iwCyGEkADvJBficlMZPCeEEELuZ9CNyL3ihRBCiG5Egl0IIYToRiTYhRBCiG5Egl0IIYToRiTYhRBCiG5Egl0IIYToRiTYhRBCiG5Egl0IIYToRv4PUxsxluMZCUUAAAAASUVORK5CYII=) Generic constraints (e.g. `min` on a `NumberField`) are [automatically validated](https://docs.viktor.ai/docs/create-apps/user-input/input-validation/.md#generic-field-constraints) by the platform. Additionally, fields can be [marked as invalid](https://docs.viktor.ai/docs/create-apps/user-input/input-validation/.md#specific-input-validation). tip All individual `kwargs` can be added explicitly in the signature if needed: ``` def validate_step_1(params, entity_id, entity_name, workspace_id, **kwargs): ... ``` ## Disabling a step[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/steps/.md#disabling-a-step "Direct link to Disabling a step") New in v14.11.0 Disabling a Step can be done by setting the `enabled` argument, similar to [hiding a field](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md): * By using a BooleanField ``` vkt.Step("Step 2", enabled=vkt.Lookup("step_1.param_x")) ``` * By using a callback function ``` def get_enabled(params, **kwargs): return params.step_1.param_y > 5 vkt.Step("Step 2", enabled=get_enabled) ``` * Depending on other field(s) ``` _step_enabled = vkt.And( vkt.IsFalse(vkt.Lookup('step_1.param_x')), vkt.IsEqual(vkt.Lookup('step_1.param_y'), 5) ) step = vkt.Step("Step 2", enabled=_step_enabled) ``` When a step is disabled, it will be skipped when the user clicks the "next step" button. The step number will remain visible, as a visual cue that there is a skipped step. In some cases you may have steps that depend on user input. For example, "Step 2(a)" for calculations about a stone house, and "Step 2(b)" for calculations about a glass house. In such cases, we recommend to merge them into one step (e.g. "Calculations") and use [tab visibility](https://docs.viktor.ai/docs/create-apps/layout-and-styling/tabs-and-sections/.md#hide-a-tab--section) to hide the tab/fields that you do not need, within the step. This will lead to a more consistent flow through the steps for the end user. ## Adjust the parametrization width[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/steps/.md#adjust-the-parametrization-width "Direct link to Adjust the parametrization width") New in v14.7.0 A separate parametrization width per Step can be defined by specifying the `width` argument: ``` import viktor as vkt class Parametrization(vkt.Parametrization): step_1 = vkt.Step("Step 1", width=30) ... step_2 = vkt.Step("Step 2", width=70) ... ``` When the `width` is defined both on the Parametrization class **and** a Step, the width of the Step will take precendence while the global width is used for steps that have not defined a specific width. For more detail on the global parametrization width and rules with respect to a field's `flex` argument, please refer to [this page](https://docs.viktor.ai/docs/create-apps/layout-and-styling/adjust-parametrization-width/.md). --- # Style / format text using Markdown In certain parts of the platform, user-defined text can be styled using Markdown, a simple and easy-to-use markup language. See the [basic Markdown syntax guide](https://www.markdownguide.org/basic-syntax/) or try the [10-minute interactive Markdown tutorial](https://commonmark.org/help/tutorial/) to learn more. ## Where styled text is supported[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/style-text/.md#where-styled-text-is-supported "Direct link to Where styled text is supported") * [Parametrization field labels](https://docs.viktor.ai/sdk/api/parametrization/.md#_Field), including `prefix` and `suffix`. (inline) * [Text](https://docs.viktor.ai/sdk/api/parametrization/.md#_Text) (block) * All parametrization descriptions * [Field descriptions](https://docs.viktor.ai/sdk/api/parametrization/.md#_Field) (block) * [Tab descriptions](https://docs.viktor.ai/sdk/api/parametrization/.md#_Tab) (block) * [Section descriptions](https://docs.viktor.ai/sdk/api/parametrization/.md#_Section) (block) * [Page descriptions](https://docs.viktor.ai/sdk/api/parametrization/.md#_Page) (block) * All [View descriptions](https://docs.viktor.ai/sdk/api/views/.md#_View) (block) * [DataItem](https://docs.viktor.ai/sdk/api/views/.md#_DataItem) `explanation_label`, `prefix` and `suffix` (inline) * [SummaryItem](https://docs.viktor.ai/sdk/api/views/.md#_SummaryItem) labels, including `prefix` and `suffix` (inline) * Descriptions of all types of [MapFeature](https://docs.viktor.ai/sdk/api/views/.md#_MapFeature) (block) * [MapPoint](https://docs.viktor.ai/sdk/api/views/.md#_MapPoint) * [MapLine](https://docs.viktor.ai/sdk/api/views/.md#_MapLine) * [MapPolyline](https://docs.viktor.ai/sdk/api/views/.md#_MapPolyline) * [MapPolygon](https://docs.viktor.ai/sdk/api/views/.md#_MapPolygon) * [TableResult](https://docs.viktor.ai/sdk/api/views/.md#_TableResult) cell content and column/row headers, as returned by a [TableView](https://docs.viktor.ai/sdk/api/views/.md#_TableView) (block) * [Welcome text](https://docs.viktor.ai/docs/create-apps/inform-end-user/dashboard/.md) on the dashboard of an app instance ### Block vs inline text[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/style-text/.md#block-vs-inline-text "Direct link to Block vs inline text") In certain places, styled text will be displayed *inline*. Inline text renders as a single line, hence newlines and horizontal rules are ignored, lists are collapsed, and tables are not rendered. Because text is rendered inline in field labels, [LaTeX text](https://docs.viktor.ai/docs/create-apps/layout-and-styling/style-text/.md#rendering-math-symbols-with-latex) might not appear as intended. In these cases, it is recommended to move the LaTeX expression to the `description`. ### Use cases[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/style-text/.md#use-cases "Direct link to Use cases") Here are some examples of how you can apply styled text: * Add an equation to a parametrization field description tooltip: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASoAAAC0CAYAAAAjIWGoAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAAudEVYdENyZWF0aW9uIFRpbWUARnJpIDE2IFNlcCAyMDIyIDA5OjMzOjQ3IEFNIENFU1Q6Q6otAAAcs0lEQVR4nO3de1TUdf7H8Scz3Bkuy10EwRtoeEuT1hSMQEyNvKWpWXZxy9bacjvtpTbtpNV2Oru6bZdjW+vuppk3Vg03Ickb4EEtARXEIEEuykWQOwwM8/uD4/fnyFVD5ou8H+d4jvOdz/f7eX+H4TWfz2e+M1gYjUYjQgihYhpzFyCEEF2RoBJCqJ4ElRBC9SSohBCqJ0ElhFA9CSohhOpJUAkhVE+CSgihehJUQgjVk6ASQqieBJUQQvUkqIQQqidBJYRQPUtzF/Bz5OfnEx8fT1ZWFk1NTeYuR4jbysrKiqCgIKKiovDz8zN3Ob3Koq9+zUt+fj5///vfJaBEv2NlZcWLL77Yr8Kqz0794uPjJaREv9TU1ER8fLy5y+hVfTaosrKyzF2CEGbT357/fTaoZDQl+rP+9vzvs0ElhOg/JKiEEKonQSWEUD0JKiGE6klQCSFUT4JKCKF6ElRCCNWToBJCqJ4ElRBC9SSohBCqJ0ElhFA9CSohhOpJUAkhVE+CSgihev02qJ588kkmT578s44xduxYVq5c2UMV/b9169bh6enZ48ftyOTJk1m3bh2LFy8GQKfT8eKLL/Lee+/h7u7ea3Xc6Xr753on6dPfmd6Z5557jhEjRrTZXllZyZtvvtn7BamUlZUVc+bM4cMPP6SgoACA0NBQamtreeONN2hqaiI6Opra2lq+++67To/V3Xad8fDwYNiwYRw7dqzd+1966SX27t3LhQsXbrmP6911111MnjyZf/zjHz1yPHF73LFBtXHjRuX/77//Pu+99x5lZWVmrEidnJycaG5uJi8vT9nm6upKTk4Oer0egOTkZJqbm7s8VnfbdcbT05NJkyZ1G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oqIYT42SSohBCqJ1M/IYTqyYhKCKF6ElRCCNWToBJCqJ4ElRBC9SSohBCqJ0ElhFA9s357wkcffWTO7oUQPWDlypW3vQ+5jkoIoXoy9RNCqJ4ElRBC9SSohBCqJ0ElhFA9CSohhOpJUAkhVE+CSgihehJUQgjVk6ASQqieBJUQQvUkqIQQqidBJYRQPQkqIYTqSVAJIVRPgkoIoXr/B+0sXEAdRPMSAAAAAElFTkSuQmCC) * Add a subscript to a parametrization field label: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASoAAABWCAYAAAB4rdshAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAAudEVYdENyZWF0aW9uIFRpbWUARnJpIDE2IFNlcCAyMDIyIDA5OjM1OjMxIEFNIENFU1REuG0+AAAFAUlEQVR4nO3dy0tUfRzH8c843oY0Q01KMyMvedmoEVEbceEiaBGBhS2FNvkfuPI/aCXYpkW7IMGNihouJEjQdDGUlOMkjFoqEyrjoE3OaRGdh3nG51Jezrd6v3b+5oznezZvzjmecXyO4zgCAMMyvB4AAP4LoQJgHqECYB6hAmAeoQJgHqECYB6hAmAeoQJgHqECYB6hAmAeoQJgHqECYB6hAmAeoQJgHqECYB6hAmAeoQJgHqECYB6hAmAeoQJgHqECYB6hAmAeoQJgHqECYB6hAmAeoQJgXqbXA0hSNBrVkydP9OnTJ+3u7qq4uFh+v1+JREKZmZlqbGxUa2ur/H6/16MC8IDPcRzH6yG+e/TokaLRqLq7u9215eVl9fX1qb6+Xh0dHR5OB8ArZi79ksmkIpGIampqUtbLysqUk5OjYDDo0WQAvGYmVCsrK/r8+bOqqqpS1j9+/KitrS2VlpZ6NBkAr5kJ1fv37+Xz+VRdXe2ura6u6unTpyooKNCdO3c8nA6Al0zcTJekcDisnJwcPXv2TMlkUmtra4rH47p27ZpaWloUCAS8HhGAR0yEynEcLS4uqrGxUbdv35YkbWxs6OHDhyopKSFSwB/ORKj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8QgXAPEIFwDxCBcC8r0ODYakDJj+LAAAAAElFTkSuQmCC) * Add a unit suffix to a parametrization field label: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASoAAABWCAYAAAB4rdshAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAAudEVYdENyZWF0aW9uIFRpbWUARnJpIDE2IFNlcCAyMDIyIDA5OjM2OjEwIEFNIENFU1QgqHuwAAAJuElEQVR4nO3dX0zV9R/H8SdwOPI36Bz+CJ6wEDA5iOIhG4Utqda/6VrNaViuWt2kN66tC+dqa97UTWUrF7ML18ZcLRhuWcPcmpZUo4EcwGNQyJke+ZMKAcejcji/C+b5RXKAUOKDez2uDuf7OZ/P53wvXvt8Pud9OFGhUCiEiIjBoud7AiIi01FQiYjxFFQiYjwFlYgYT0ElIsZTUImI8RRUImI8BZWIGE9BJSLGU1CJiPEUVCJiPAWViBhPQSUixlNQiYjxFFQiYjwFlYgYT0ElIsZTUImI8RRUImI8BZWIGE9BJSLGU1CJiPEUVCJiPAXVf+zChQt88sknfPHFF/M9FZEFQ0E1B7xeL4cOHZr0mt1uJzMzk6VLl86q74GBAaqrqxkbG7uZKYosKAqqW2xoaIja2loee+yxiG06OzvJzc2dVf+pqakUFBTw9ddfz3aKIguOguoWO3ToEOXl5cTHx096/dKlS1y7do3U1FR+/vln9u3bx/DwMABXr17l8OHDnDhxgq+++ora2tpJ+ygtLaWrq4vu7u45ex8iJrHM5+DNzc1UV1cDEB0djd1u57777uOhhx4iOnruM/TXX3+loaGBHTt23JL++vv76ezsZPPmzRHbdHR0kJ6ejtvtxuVyce7cOeLi4gCoqakhPz8fl8vF4cOHsdlsEft54IEHOHr0KK+88sotmbuIyeY1qABiYmLYuXMnoVCI3t5evvnmG86ePcsLL7ww52Pn5ORM+LumpoaRkRFefPHFWfXX1NTE8uXLsVgi39bOzk6Sk5M5deoUGRkZPPvsswAMDg7idrt57rnnAOjq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taReT/VJ4gIsbT1k9EjKegEhHjKahExHgKKhExnoJKRIynoBIR4ymoRMR4CioRMZ6CSkSMp6ASEeMpqETEeAoqETGegkpEjKegEhHjKahExHgKKhExnoJKRIynoBIR4ymoRMR4CioRMZ6CSkSMp6ASEePN6+/6ffzxx/M5vIjcAtu3b5/zMfS7fiJiPG39RMR4CioRMZ6CSkSMp6ASEeMpqETEeAoqETGegkpEjKegEhHjKahExHgKKhExnoJKRIynoBIR4ymoRMR4CioRMZ6CSkSM9z9No+oGzD+XxQAAAABJRU5ErkJggg==) * Refine an editor with clarifying, styled text and formulae: ![](/assets/images/formatting-text-52e47329c02925c8c5455788b9704af4.png) * Add a heading and a list to [MapPoint](https://docs.viktor.ai/sdk/api/views/.md#_MapPoint) description: ![](/assets/images/formatting-map-popup-52fe14b36fa97017c4fac3ca14c9362d.png) * Style the welcome message in the dashboard: ![](/assets/images/formatting-welcome-text-6b965a61bd4526c48897e1f2973c8aff.png) ## Supported Markdown syntax[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/style-text/.md#supported-markdown-syntax "Direct link to Supported Markdown syntax") All of [CommonMark](https://commonmark.org/help/) Markdown is supported except for images, which are ignored. [Markdown tables](https://www.markdownguide.org/extended-syntax/#tables) are also supported in block contexts (see [Block vs inline text](https://docs.viktor.ai/docs/create-apps/layout-and-styling/style-text/.md#block-vs-inline-text)). Using HTML tags in Markdown-styled text is not supported, all HTML tags are automatically stripped for security reasons. Markdown links will always open in a new tab. ### Tables[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/style-text/.md#tables "Direct link to Tables") Tables are defined using pipes (`|`) to separate columns and a row of hyphens (`-`) to separate the header from the body. Colons in the separator row control column alignment (`:---` left, `:---:` center, `---:` right). ``` import viktor as vkt class Parametrization(vkt.Parametrization): info = vkt.Text(""" | Wing model | Aspect ratio | Typical use | | :--------- | :----------: | ------------: | | 2D | ∞ | Airfoil study | | 3D (high) | 10–30 | Gliders | | 3D (low) | 1–4 | Delta wings | """) ``` ## Rendering math symbols with LaTeX[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/style-text/.md#rendering-math-symbols-with-latex "Direct link to Rendering math symbols with LaTeX") Rendering math symbols is supported using LaTeX syntax. See [KaTeX Supported functions](https://katex.org/docs/supported.html) or [KaTeX Support Table](https://katex.org/docs/support_table.html) for all supported LaTeX functions. To render LaTeX inline, wrap a LaTeX expression in dollar signs. For example: ``` $x=\\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}$ ``` To render LaTeX as a block, wrap a LaTeX expression in double dollar signs and a newline: ``` $$ L = \\frac{1}{2} \\rho v^2 S C_L $$ ``` Block LaTeX text is centered by default. tip A nifty webapp to find the right LaTeX symbol by drawing is [Detexify: LaTeX handwritten symbol recognition](http://detexify.kirelabs.org/classify.html) ### Escape strings in Python[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/style-text/.md#escape-strings-in-python "Direct link to Escape strings in Python") While writing LaTeX you may encounter the following warning on the command-line: ``` DeprecationWarning: invalid escape sequence \p ``` When certain characters (for example `\u`, `\f`, `\b`, `\r`, `\v`, `\x`) are preceded by a backslash they are viewed as 'escape sequences' by Python. To resolve this deprecation warning simply add another backslash in front of the LaTeX function to make the warning go away, for example `$\\xi = \\gamma \\times \\epsilon^3$`. ### My LaTeX equation is showing as plain text, what's wrong?[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/style-text/.md#my-latex-equation-is-showing-as-plain-text-whats-wrong "Direct link to My LaTeX equation is showing as plain text, what's wrong?") 1. Check if your LaTeX expression is wrapped in dollar signs `$` 2. If it is colored red, the math expression is not valid KaTeX. Check your LaTeX functions and check if they are supported by [KaTeX](https://katex.org/docs/supported.html). Try entering it in [online KaTeX editor](https://katex.org/#demo) and see if it renders ok in there. 3. Check if there's an invalid escape sequence in your LaTeX expression ## Line breaks[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/style-text/.md#line-breaks "Direct link to Line breaks") In block-styled (non-inline) text, line breaks can be defined in two ways: using the newline control character `\n` or using multiline strings. ### 1. Using the newline control character[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/style-text/.md#1-using-the-newline-control-character "Direct link to 1. Using the newline control character") Use `\\\n` or `\n` preceded by two spaces to add a newline to a regular string: ``` description="This description \n is multiline" ``` ``` description="This description \\\n is multiline" ``` ![single newline](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALAAAACqCAYAAAAN+sWjAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAAudEVYdENyZWF0aW9uIFRpbWUARnJpIDE2IFNlcCAyMDIyIDA5OjM5OjE1IEFNIENFU1QYq6GOAAAOvklEQVR4nO3df0zU9R/A8edxd/wQEOQQITQtMUxTlynGhAotdCH9sPxRWLama9M5a7qyaGSYLmrNNVNso9Q2Sixp0mrjskBBK7EEzQpFUSxCRAS8E7g75PtHX27h3aHIj7s3vR7/JPd58/m8j3vy6XOfuw+naW9vb0cIRXm5ewJC9IQELJQmAQulScBCaRKwUJoELJQmAQulScBCaRKwUJoELJQmAQulScBCaRKwUJoELJQmAQulScBCaRKwUJoELJQmAQulScBCaRKwUJquL1Z67tw5jEYj5eXlWK3WvtiEuEl6vZ7o6GgSExMZMWKEu6fTY5revqz+3LlzbNq0ScL1cHq9nhUrVigfca8fQhiNRolXAVarFaPR6O5p9FivB1xeXt7bqxR9ZCA8Vr0esOx91TEQHis5CyGUJgELpUnAQmkSsFCaBCyUJgELpUnAQmkSsFCaBCyUJgELpUnAQmkSsFCaBCyUJgELpXlcwM899xzTp0/vs/XHxcWxePHiPlu/6F99ck1cV1544QXGjh3rcHtjYyNr167t8nuTk5Mxm818//33fTS73tedOcfGxlJRUcGFCxcAWLlyJXl5eVRWVvb1NJXV7wF/+OGH9n+/++67ZGRkUFdXd0Pfe/DgQWw2W19NrVdpNBra29u7NefY2FiamprsAefm5nL+/Pm+nKby+j3gGxEeHs6qVasIDQ2lpKSE3NxcAB544AFMJhP5+f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vU6dOZebMmU4/I7mhoYGcnByqqqoIDw9n5MiRLrdTU1PjsOd1dtxrs9moqalh+PDhPbxnoieUCfhaO3fupLW1lWXLlmE2m9m5cyeBgYHce++9DmN37dpFa2srS5cuxWq1snv3bpfrvXjxosNtNTU1LsdKwO7lUQHbbDZee+21TretXr2akJCQTrddunSJX3/9ldTUVAYPHgxAXFwcR44ccQi4rq6OiooKVq5cSWRkJAAJCQnd+jT5jj322bNnu32fRN/yqIC1Wi0vvvhip9uCgoIcxlVXV9Pe3s4777xjv+3q1atOn1TV1dWh1Wq55ZZbOm1HDAweFXBXT+KupdPpHM5YODv+7bhdo9Hc0HoNBoPDqbOuxgr3UvKVuLCwMGw2G83NzRgMBgwGA0OGDHG6Bx46dChWq5X6+vobWnd4eLjDmYXGxkYaGxs73abT6QgPD7/5OyF6hZIBDx06lHHjxpGTk0NlZSW1tbVkZ2fz9ddfO4w1GAxERUWxZ88eTCYT9fX1HDhwwOW6dTodkyZN6hRxQ0NDp72yszHCPZQMGGDBggVERkaybds2Nm3ahFardfmnkubPn4/FYmHDhg1s376d2267rct1BwQEMGnSJPv5338LDg6WFzE8iFzUeR3yXgjPJgELpSl7CCEESMBCcRKwUJqcBxIANDU13fT3dryc7w6yBxZKk4CF0iRgcV2LFy929xRckoBFlzri9dSIJWDh0rXRemLEErBwylWsnhaxvJQsADmNJoRbSMBCaRKwUJq8lCyc6urJ2o4dO/pxJl2TPbBwylWknhQvSMCiC9fG6mnxggQsrqMjWk+MF+Q8sPg/OQ8shBtIwEJpcgghlCZ7YKE0CVgoTQIWSpOAhdIkYKE0CVgozWPejbZ582Z3T0HcpOXLl7tt23IeWChNDiGE0iRgoTQJWChNAhZKk4CF0iRgoTQJWChNAhZKk4CF0iRgoTQJWChNAhZKk4CF0iRgoTQJWChNAhZKk4CF0iRgobT/AdmQBP5O1gNtAAAAAElFTkSuQmCC) ### 2. Using multiline strings[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/style-text/.md#2-using-multiline-strings "Direct link to 2. Using multiline strings") Multiline strings are strings that are wrapped in three quotes (single or double): `"""a multiline string"""` or `'''a multiline string'''`. To add a newline in between lines, just add an empty line in between. ``` description="""This description is multiline""" ``` ![multi newline](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALAAAADUCAYAAAA80qkSAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAAudEVYdENyZWF0aW9uIFRpbWUARnJpIDE2IFNlcCAyMDIyIDA5OjQwOjE3IEFNIENFU1TWh7XBAAAPzElEQVR4nO3dfVST9f/H8dfYJuDQIUPFBpqJYZJ68ihmwglvQjumxyxvjlRoN6eO5qGOnu7wmGF6jnXO19Oxws7RxDwYWOLJU50DaaCgpyOmoKmtEBDTYCIM3GTsRn5/9HNH3ECIwfam1+MvuK6Lzz7bnlxeXHPXFK2tra0gEirA1xMg6g4GTKIxYBKNAZNoDJhEY8AkGgMm0RgwicaASTQGTKIxYBKNAZNoDJhEY8AkGgMm0RgwicaASTQGTKIxYBJN1RODXr58Gfn5+TAYDLDb7T1xE/QvqdVqxMTEICkpCVFRUb6eTrcpvP2mzsuXL2Pbtm0M18+p1WqsXr1afMReP4TIz89nvALY7Xbk5+f7ehrd5vWADQaDt4ekHtIXniuvB8y9rxx94bniWQgSjQGTaAyYRGPAJBoDJtEYMInGgEk0BkyiMWASjQGTaAyYRGPAJBoDJtEYMInmdwEvX74c06ZN67Hx4+PjkZKS0mPjU+/qkffEdeTVV1/FmDFj3JY3NjZiw4YNHf7svHnzYLFY8PPPP/fQ7LyvK3OeOnUqysvLce3aNQBAamoqDh48iMrKyp6epli9HvAXX3zh+vrjjz/Gli1bUFdX16mfPX78OBwOR09NzasUCgVaW1u7NOepU6eiqanJFXBubi5qa2t7cpri9XrAnREREYE1a9YgPDwcJSUlyM3NBQAkJibCbDYjLy8PwD9P+Jw5c6BWq1FWVoZvv/0WTqfTbbwnnngCjz/+OCwWC65cudJm3Y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k0vpRMHnX0x9ru3bt7cSYd4x6YPGovUn+KF2DA1IG7Y/W3eAEGTPdwO1p/jBfgeWD6fzwPTOQDDJhE4yEEicY9MInGgEk0BkyiMWASjQGTaAyYRPOb/4322Wef+XoK9C+tWrXKZ7fN88AkGg8hSDQGTKIxYBKNAZNoDJhEY8AkGgMm0RgwicaASTQGTKIxYBKNAZNoDJhEY8AkGgMm0RgwicaASTQGTKL9H/mvFBYemwS7AAAAAElFTkSuQmCC) To make a single newline in a multiline string, add `\\` to the end of a line: ``` description="""This description \\ is multiline""" ``` Or use the newline control character with three backslashes or preceded by two spaces: ``` description="""This description \\\n is multiline""" ``` ``` description="""This description \n is multiline""" ``` ![single newline](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALAAAACqCAYAAAAN+sWjAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAAudEVYdENyZWF0aW9uIFRpbWUARnJpIDE2IFNlcCAyMDIyIDA5OjM5OjE1IEFNIENFU1QYq6GOAAAOvklEQVR4nO3df0zU9R/A8edxd/wQEOQQITQtMUxTlynGhAotdCH9sPxRWLama9M5a7qyaGSYLmrNNVNso9Q2Sixp0mrjskBBK7EEzQpFUSxCRAS8E7g75PtHX27h3aHIj7s3vR7/JPd58/m8j3vy6XOfuw+naW9vb0cIRXm5ewJC9IQELJQmAQulScBCaRKwUJoELJQmAQulScBCaRKwUJoELJQmAQulScBCaRKwUJoELJQmAQulScBCaRKwUJoELJQmAQulScBCaRKwUJquL1Z67tw5jEYj5eXlWK3WvtiEuEl6vZ7o6GgSExMZMWKEu6fTY5revqz+3LlzbNq0ScL1cHq9nhUrVigfca8fQhiNRolXAVarFaPR6O5p9FivB1xeXt7bqxR9ZCA8Vr0esOx91TEQHis5CyGUJgELpUnAQmkSsFCaBCyUJgELpUnAQmkSsFCaBCyUJgELpUnAQmkSsFCaBCyUJgELpXlcwM899xzTp0/vs/XHxcWxePHiPlu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582Z3T0HcpOXLl7tt23IeWChNDiGE0iRgoTQJWChNAhZKk4CF0iRgoTQJWChNAhZKk4CF0iRgoTQJWChNAhZKk4CF0iRgoTQJWChNAhZKk4CF0iRgobT/AdmQBP5O1gNtAAAAAElFTkSuQmCC) caution **Do not include indentation in multiline strings.** Be sure to remove indentation at the start of each line, **any line with indentation in a multiline string is ignored**. If you want to add indentation to a line you can do so by making it a blockquote by prefixing it with `>`. Alternately, you can add the special character ` ` at the start of line to add a space. ``` description="""Line 1 > Indented blockquote line    2 spaces indented line Space indented lines will be ignored Line 3""" ``` --- # Creating tabs & sections In some cases, the parametrization becomes quite big which requires a more structured layout. This can be achieved by making use of a [`Tab`](https://docs.viktor.ai/sdk/api/parametrization/.md#_Tab) and [`Section`](https://docs.viktor.ai/sdk/api/parametrization/.md#_Section), which represent a tab and collapsible section in the interface respectively. A 2-layered structure using `Tab` objects looks like this: ``` import viktor as vkt class Parametrization(vkt.Parametrization): tab_1 = vkt.Tab('Tab 1') tab_1.input_1 = vkt.TextField('This is a text field') tab_1.input_2 = vkt.NumberField('This is a number field') tab_2 = vkt.Tab('Tab 2') tab_2.input_1 = vkt.TextField('Text field in Tab 2') tab_2.input_2 = vkt.NumberField('Number field in Tab 2') ``` ![](/assets/images/editor-two-layered-tabs-c1e7f01a0cb38e9b8dc09d1a94cc6c3d.png) *Parametrization with tabs, no sections* Using `Section` objects results in the following: ``` import viktor as vkt class Parametrization(vkt.Parametrization): section_1 = vkt.Section('Section 1') section_1.input_1 = vkt.TextField('This is a text field') section_1.input_2 = vkt.NumberField('This is a number field') section_2 = vkt.Section('Section 2') section_2.input_1 = vkt.TextField('Text field in Section 2') section_2.input_2 = vkt.NumberField('Number field in Section 2') ``` ![](/assets/images/editor-two-layered-sections-2b17116cfe559fdd6036e6ad5705d110.png) *Parametrization with sections, no tabs* A parametrization with a maximum depth of 3 layers consists of `Tab`, `Section`, and `Field` objects: ``` import viktor as vkt class Parametrization(vkt.Parametrization): tab_1 = vkt.Tab('Tab 1') tab_1.section_1 = vkt.Section('Section 1') tab_1.section_1.input_1 = vkt.TextField('This is a text field') tab_1.section_1.input_2 = vkt.NumberField('This is a number field') tab_1.section_2 = vkt.Section('Section 2') ... tab_2 = vkt.Tab('Tab 2') ... ``` ![](/assets/images/editor-three-layered-a034d1717eac4f117e16564eec58ab2b.png) *Parametrization with sections and tabs* ## Hide a Tab / Section[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/tabs-and-sections/.md#hide-a-tab--section "Direct link to Hide a Tab / Section") New in v14.7.0 Hiding a Tab or Section can be done in a similar way as [hiding a field](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md), by setting the `visible` argument: ``` vkt.Tab("Tab 2", visible=vkt.Lookup("tab_1.param_x")) ``` or using a callback function: ``` vkt.Tab("Tab 2", visible=get_visible) ``` ## Expand a Section[​](https://docs.viktor.ai/docs/create-apps/layout-and-styling/tabs-and-sections/.md#expand-a-section "Direct link to Expand a Section") New in v14.21.0 As a developer, you can define which sections should be expanded and which should be collapsed (default) when a user enters the editor, by setting the `initially_expanded` parameter: ``` vkt.Section("Section", initially_expanded=True) ``` note If `initially_expanded` is not set on any section within a parametrization, the default behavior is triggered with the first section being expanded and the others collapsed. --- # Managing files When starting out coding with python, you could probably copy file paths from the File Explorer. However, when developing apps with VIKTOR, it's crucial to understand that these file paths don't function the same way as the apps are deployed on the cloud. VIKTOR apps are stateless, meaning they reset with each session, files uploaded (via a `FileField`) to the cloud are only available for that session. Any files that are part of the app (such as an excel sheet integration) will reset for the next session. Additionally, VIKTOR applications follow a standardized structure, making them easy to move, store, and deploy on the cloud, a concept known as "containerized" development. However, any additions to the application are uploaded separately and are not part of the standardized package. Therefore, it's essential to consider these factors when handling files on the VIKTOR platform. Understanding the file's intended actions are crucial for choosing the correct methods for file manipulation. ## File paths[​](https://docs.viktor.ai/docs/create-apps/managing-files/.md#file-paths "Direct link to File paths") In most apps the code uses information from files on the hard drive. In order to access such files, a path must be provided. Python's built-in `pathlib` module can be used for this purpose. caution Never use a **static** path to access a file (e.g. '/home/users/foo/app/entity/file.txt', '../file.txt', or 'file.txt')! This might work fine when testing on your local machine, but will most likely crash when the app is published and runs on a server (different username, folder structure and operating system). Assume an application with the following structure of the `app` directory: ``` app ├── entity_type_a │ ├── __init__.py │ ├── controller.py │ └── parametrization.py ├── __init__.py └── file.txt ``` We can make use of `Path(__file__)` as a starting point, which points to the file in which the code is invoked. On this path object, we can easily navigate to the parent directory by calling `Path(__file__).parent`. In the structure above, getting the file `file.txt` in the controller of entity\_type\_a can thus be done by: ``` # entity_type_a/controller.py from pathlib import Path entity_folder_path = Path(__file__).parent # entity_type_a file_path = entity_folder_path.parent / 'file.txt' with file_path.open() as f: content = f.read() ``` This implementation allows your application/project/module to be portable. For example, the folder `entity_type_a` (and even `controller.py`!) can be renamed without breaking the link to `file.txt`, because the navigation is relative to the source file (`controller.py`). ## Large files, storage and memory issues[​](https://docs.viktor.ai/docs/create-apps/managing-files/.md#large-files-storage-and-memory-issues "Direct link to Large files, storage and memory issues") For large files and calculations, it may be desirable to store some data in your application. VIKTOR offers a `storage` which can be used to store and retrieve files within an app instance and the files will remain available. This can be very helpful in cases where (intermediate) results need to be shared between jobs. For more information on storage visit our [storing results page](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/storing-results/.md). For processing large files, it is suggested to look into working with [VIKTOR file objects in binary mode](https://docs.viktor.ai/docs/create-apps/managing-files/modify-files/.md#using-a-viktor-file-object-in-binary-mode)). ## Production hosting and limits[​](https://docs.viktor.ai/docs/create-apps/managing-files/.md#production-hosting-and-limits "Direct link to Production hosting and limits") When your application runs on production environments, a few things can be different than running it on development. Make sure you read up on [files persistence between jobs](https://docs.viktor.ai/docs/getting-started/fundamentals/call-flow/.md#local-files-persistence-between-jobs) and [disk limits](https://docs.viktor.ai/docs/publish-apps/limits/.md#disk-storage-limit-of-5-gb). --- # Downloading files A [download action](https://docs.viktor.ai/docs/create-apps/user-input/action-buttons/.md#download-action) enables the user to download a file to hard disk upon clicking a button. In order to do so, the following steps need to be taken: 1. Add a [`DownloadButton`](https://docs.viktor.ai/sdk/api/parametrization/.md#_DownloadButton) in the parametrization class of the corresponding entity type: ``` import viktor as vkt class Parametrization(vkt.Parametrization): download = vkt.DownloadButton('Download', method='download_file') ``` 2. Add the download method (in this case `download_file`) on the corresponding controller class of the entity type to link the `DownloadButton`, and return the file (content) as [`DownloadResult`](https://docs.viktor.ai/sdk/api/result/.md#_DownloadResult): ``` import viktor as vkt class Controller(vkt.Controller): def download_file(self, params, **kwargs): return vkt.DownloadResult('file content', 'filename.txt') ``` ## Downloading a File object[​](https://docs.viktor.ai/docs/create-apps/managing-files/downloading-files/.md#downloading-a-file-object "Direct link to Downloading a File object") `DownloadResult` directly accepts a `File` object as input. This type is often returned by VIKTOR functions such as utils' document conversions and external analyses. This allows for easy handling of result files: ``` import viktor as vkt class Controller(vkt.Controller): def download_spreadsheet(self, params, **kwargs): ... filled_spreadsheet = vkt.spreadsheet.render_spreadsheet(...) return vkt.DownloadResult(filled_spreadsheet, 'filled_spreadsheet.xlsx') def download_word_file(self, params, **kwargs): ... word_file = vkt.word.render_word_file(...) return vkt.DownloadResult(word_file, 'word_file.docx') def download_scia_result(self, params, **kwargs): ... result_file = scia_analysis.get_xml_output_file(as_file=True) return vkt.DownloadResult(result_file, 'scia_result.xml') ``` ## Downloading other file types[​](https://docs.viktor.ai/docs/create-apps/managing-files/downloading-files/.md#downloading-other-file-types "Direct link to Downloading other file types") It is also possible to download any other type of document (e.g. `.txt`, `.xml`, `.json`, etc.). In these cases, the `DownloadResult` should be passed the file content as type `str` or `bytes`. Since VIKTOR does not offer specific template for these file types, you will have to write the logic that generates the desired file content yourself. ## Downloading multiple files[​](https://docs.viktor.ai/docs/create-apps/managing-files/downloading-files/.md#downloading-multiple-files "Direct link to Downloading multiple files") Downloading multiple files in one go is easy when using the `zipped_files` argument in a `DownloadResult`. The files will be bundled in a zip-file with given `file_name`: ``` DownloadResult(zipped_files={'my_file_1.txt': my_file_1, 'my_file_2.txt': my_file_2}, file_name="my_file.zip") ``` Alternatively, you can use the [zipfile](https://docs.python.org/3/library/zipfile.html) module from Python's standard library to create your own zip-file manually: ``` import viktor as vkt import zipfile class Controller(vkt.Controller): def download_zip(self, params, **kwargs): ... file = vkt.File() with zipfile.ZipFile(file.source, 'w', zipfile.ZIP_DEFLATED) as z: z.writestr('my_file_1.txt', my_file_1_content) z.writestr('my_file_2.txt', my_file_2_content) return vkt.DownloadResult(file, file_name="my_file.zip") ``` --- # Modifying files ## Open, read, write and remove files[​](https://docs.viktor.ai/docs/create-apps/managing-files/modify-files/.md#open-read-write--and-remove-files "Direct link to Open, read, write and remove files") In general python, the function you use to work in files most is `open()`. It takes two parameters as inputs; *filename* and *mode*. For the mode you have **four** options: **1. read a file ("r"):** This is the default value, it will open and read the file and returns an error if the file does not exist. **2. write to a file ("w"):** This opens a file for writing data to. If the file does not exist this will create one with the given filename. **3. create a file ("x"):** This will create a new file with the given filename. If a file with that name already exists then this will return an error. **4. append to a file ("a"):** This will open a file for appending data. If the file does not exist, it will make a file with the given filename. Each mode also lets you specify if you would like to handle the file as **text ("t")** or **binary ("b")**. (You can also open a file for **updating ("+")** which lets you read and write). All of the above can be applied in this example below. Note that in this example we are opening a text file to write to: ``` file_path = "path/to/text_file.txt" with open(file_path_, "wt") as file: # do something with the file ``` ## Using a VIKTOR file object in binary mode[​](https://docs.viktor.ai/docs/create-apps/managing-files/modify-files/.md#using-a-viktor-file-object-in-binary-mode "Direct link to Using a VIKTOR file object in binary mode") One of the features of the VIKTOR platform is the VIKTOR `File` object. This file like object can be used for files and opens a door to file handling that you can apply. The important thing to understand is that this method will open and/or read the files in binary mode. As binary mode is consistent across packages, there is no extra encoding or decoding that you may encounter when dealing with non-text files. On that note, using a binary method you can open file formats that may get corrupted by a text mode. Another advantage of the binary mode is that it allows for efficient stream based processing. This allows for working with larger files without loading the entire contents into memory. The basic way to open a VIKTOR file object in binary mode is to use `open_binary()`. You may refer to the example below: ``` my_file = #path to a csv file as VIKTOR File object with my_file.open_binary() as fp: df.read_csv(fp) ``` If you would like to save a figure like those created by Matplotlib, you can also use `open_binary()`. ``` fig = Figure() ... my_svg = File() with my_svg.open_binary() as fp: fig.savefig(fp, "svg") ``` Be mindful of big files When using the method above, the entire file gets opened meaning large files will use a lot of memory. On these files it is better to use the previous method. In case you would like to extract data, you may use: ``` # binary mode some_bytes = my_file.getvalue_binary() #limited by memory # text mode (only for text-based data types) some_strings = my_other_file.getvalue() ``` In summary, using the VIKTOR file object is the most versatile way to handle your files. The code will only require up to 3 lines, it keeps the code clean and is compatible across platforms reliably. ## Using packages[​](https://docs.viktor.ai/docs/create-apps/managing-files/modify-files/.md#using-packages "Direct link to Using packages") In some cases it is possible to use a package to read the content of a file. An easy example is turning a .csv document into a Pandas dataframe. Dataframes are a commonly used way to store structured data because they are easy to modify and analyse. See the package documentation to see the possibilities. --- # Uploading files Autodesk files Files residing on Autodesk cloud storage do not have to be downloaded and uploaded to VIKTOR, you can use the [AutodeskFileField](https://docs.viktor.ai/docs/create-apps/user-input/autodesk-files/.md) to reference a file on cloud directly instead. There are two ways for the user to upload a file in the VIKTOR interface: 1. By defining a `FileField` in the parametrization, a user can upload a file through an upload modal and directly attach it to a specific field. This way, the developer can easily use the file (content) which will be present in the `params` of a job. This method is encouraged due to its simplicity and the possibility for users to stay within the current entity in which the `FileField` resides. 2. By creating a [file-like entity type](https://docs.viktor.ai/docs/create-apps/managing-files/uploading-files/.md#upload-using-file-like-entity-type). When a user creates a new entity of this type, he or she will be prompted with an upload modal instead of just the entity name. This method is a bit more cumbersome for users, since it requires more actions (clicks) to be performed and navigation between entities. This method can be used to isolate a file with, for example, attached views. ## Upload using `FileField`[​](https://docs.viktor.ai/docs/create-apps/managing-files/uploading-files/.md#upload-using-filefield "Direct link to upload-using-filefield") Adding a [`FileField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_FileField) (or [`MultiFileField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_MultiFileField)) is as easy as adding any other field: ``` import viktor as vkt class Parametrization(vkt.Parametrization): csv_file = vkt.FileField('CSV file') ``` These fields will be generated in the VIKTOR interface as dropdown fields, with the possibility to upload one or multiple files. When the user has made a selection, the file resource will be available in the `params` of every job as [`FileResource`](https://docs.viktor.ai/sdk/api/api-v1/.md#_FileResource) object: In this example we use the `.file` property to get the file contents of the uploaded file as a VIKTOR `File` object. You can also use the `.filename` property to get the file name, these two properties make up a VIKTOR `File` object. After that you can use it as a regular `File` object in your app, for example by loading the csv in a pandas DataFrame and visualizing it in a `TableView`. ``` import viktor as vkt import pandas as pd class Parametrization(vkt.Parametrization): csv_file = vkt.FileField('CSV file') class Controller(vkt.Controller): parametrization = Parametrization @vkt.TableView("Table") def show_csv(self, params, **kwargs): csv_file = params.csv_file.file # Retrieve the File object from the FileResource with csv_file.open() as r: df = pd.read_csv(r) return vkt.TableResult(df) ``` tip `FileResource` objects originating from a `FileField` or `MultiFileField` are [memoizable](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/storing-results/.md#memoize) ### Temporary files[​](https://docs.viktor.ai/docs/create-apps/managing-files/uploading-files/.md#temporary-files "Direct link to Temporary files") Although not recommended, it is possible to use temporary files. This module creates temporary files that get deleted after closing. You can use this as a temporary storage solution as the file is created securely and on completion is removed. For a `NamedTemporaryFile` the returned object is always a file-like object that can be used in a `with` statement, just like a normal file. ## Upload using file-like entity type[​](https://docs.viktor.ai/docs/create-apps/managing-files/uploading-files/.md#upload-using-file-like-entity-type "Direct link to Upload using file-like entity type") In short, the following steps should be implemented. A more elaborate example is shown in the following sections. 1. Add a new entity type by defining a [controller](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure/.md#the-controller). 2. Implement a process method (can be named arbitrarily) on the controller class, decorated by [`ParamsFromFile`](https://docs.viktor.ai/sdk/api/core/.md#_ParamsFromFile). ``` import viktor as vkt class Controller(vkt.Controller): @vkt.ParamsFromFile() def process_file(self, file: vkt.File, **kwargs): return {} # nothing to store ``` In the example above, the `process_file` method does not contain any logic. However, this method can also be used to parse certain information from the file, which can be stored in the parametrization of the entity. See the example below if this is desired. ### File processing[​](https://docs.viktor.ai/docs/create-apps/managing-files/uploading-files/.md#file-processing "Direct link to File processing") caution Prevent storing the complete file content on the properties if the file is large, as this may cause speed and/or stability issues. The file content can be retrieved at all times using the API whenever necessary. The processed content can **only** be stored on fields that are defined in the entity's parametrization. These can be input fields (e.g. [`NumberField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_NumberField)), but also read-only ([`OutputField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_OutputField)) or even a [`HiddenField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_HiddenField). Let's assume the following parametrization and text file to be uploaded: ``` class Parametrization(vkt.Parametrization): number_of_entries = vkt.NumberField('Number of entries') project_name = vkt.TextField('Project') ``` ``` Project=Super nice project Entry1 Entry2 Entry3 ``` The decorated process method should return the data in a dictionary format. The structure of this dictionary should match with the structure of the parametrization fields: ``` import viktor as vkt class Controller(vkt.Controller): @vkt.ParamsFromFile() def process_file(self, file: vkt.File, **kwargs): # viktor.core.File # app specific parse logic number_of_entries = 0 project_name = '' with file.open(encoding='utf-8') as f: for lineno, line in enumerate(f): if lineno == 0: _, project_name = line.split('=') elif line.startswith('Entry'): number_of_entries += 1 # linking the parsed output to the parametrization fields (names in database) return { 'number_of_entries': number_of_entries, 'project_name': project_name } ``` In case of a nested parametrization structure, the return value is a nested dictionary: ``` class Controller(vkt.Controller): @vkt.ParamsFromFile() def process_file(self, file: vkt.File, **kwargs): ... return { 'tab': { 'section' : { 'number_of_entries': number_of_entries, 'project_name': project_name } } } ``` tip The file entity can be retrieved and the file (content) can be extracted (from either the current entity or another) [using the API](https://docs.viktor.ai/docs/api/sdk/.md). ## File restrictions[​](https://docs.viktor.ai/docs/create-apps/managing-files/uploading-files/.md#file-restrictions "Direct link to File restrictions") A limit is set on the file size of an upload to protect the developer for potential memory issues and/or instability of the application when handled incorrectly. Sometimes however, it is required to deal with large files. In this case the limit can be increased using the `max_size` argument: ``` file = vkt.FileField('CPT file', max_size=100_000_000) # 100 MB ``` ``` @vkt.ParamsFromFile(max_size=100_000_000) # 100 MB ``` Keep in mind that reading the complete content of a large file in memory will lead to memory issues. We therefore recommend reading the file in chunks (see [`File`](https://docs.viktor.ai/sdk/api/core/.md#_File)). Similarly, you are able to restrict the file type(s) that may be uploaded, by means of `file_types`: ``` file = vkt.FileField('CPT file', file_types=['.png', '.jpg', '.jpeg']) ``` ``` @vkt.ParamsFromFile(file_types=['.png', '.jpg', '.jpeg']) ``` ## Excel vs CSV[​](https://docs.viktor.ai/docs/create-apps/managing-files/uploading-files/.md#excel-vs-csv "Direct link to Excel vs CSV") If you want to upload an Excel file, the preferred method is to convert it to a plain-text CSV (comma-separated values) format (extension ".csv"). Excel files (".xls", ".xlsx") are not plain-text and special characters are not always imported correctly. An additional advantage of a CSV file is that, being plain-text, they can be compared using version control software (e.g. Git). info A CSV file does not support 'sheets' as an Excel file does, meaning that a CSV file must be created for each sheet in a multi-sheet Excel file. --- # Connect agents to your apps via MCP \[BETA] caution MCP support is currently in **BETA**, which means we reserve the right to make breaking changes without providing an upgrade strategy. Feedback is welcome on the [Community Forum](https://community.viktor.ai/). MCP lets you run your VIKTOR apps from an AI assistant such as Claude or ChatGPT. Instead of opening an app, filling in a form and reading the result yourself, you ask the assistant: "check this beam against the load table", or "generate the foundation report for this site". It runs the app and reports back. You connect the assistant to VIKTOR once and log in with your VIKTOR account. From then on it can see the apps you have access to, fill in their inputs, run them, and read the results. This is the reverse direction of [Integrating with LLMs](https://docs.viktor.ai/docs/create-apps/viktor-llm/.md): there, your app code calls a language model. Here, an external agent calls your apps. No app code is needed, as any published app that meets the [requirements](https://docs.viktor.ai/docs/create-apps/mcp/.md#which-apps-and-views-are-exposed) is exposed automatically. note Once you have approved the consent screen shown at login, the agent can run the apps you have access to and read their results on your behalf. It cannot change your account or credentials. As with any MCP server, only connect agents and clients you trust. ## Supported clients[​](https://docs.viktor.ai/docs/create-apps/mcp/.md#supported-clients "Direct link to Supported clients") * **Claude, ChatGPT and Gemini** work out of the box. * **Clients that run on your own machine**, such as Claude Code or an IDE extension, work as well. Another web-based client needs to be added by VIKTOR before it can log in. [Let us know](https://community.viktor.ai/) if you would like to use one. ## Connect an agent[​](https://docs.viktor.ai/docs/create-apps/mcp/.md#connect-an-agent "Direct link to Connect an agent") The MCP endpoint for your environment is: ``` https://.viktor.ai/mcp ``` Replace `` with your own environment, for example `acme.viktor.ai` or `acme.eu2.viktor.ai` if you are in a region other than Frankfurt. The server uses streamable HTTP transport and authenticates with OAuth: your agent opens a browser window and you log in to VIKTOR as usual. VIKTOR then asks you to confirm the access you are granting, which is to see who you are logged in as, see the available tools, and run them on your behalf. Click **Allow** to authorize the agent, or **Deny** to stop there. Adding the server differs per client, so follow their instructions and use the URL above as the server URL: | Client | Instructions | | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- | | Claude (web and desktop) | [Getting started with custom connectors](https://support.claude.com/en/articles/11175166-getting-started-with-custom-connectors-using-remote-mcp) | | Claude Code | [Connect Claude Code to tools via MCP](https://code.claude.com/docs/en/mcp) | | ChatGPT and Codex | [Extend with MCP](https://learn.chatgpt.com/docs/extend/mcp) | | Cursor | [Model Context Protocol](https://cursor.com/docs/context/mcp) | | Gemini | [Connect and manage custom apps](https://support.google.com/gemini/answer/17209137) | In Claude Code, for example, that is: ``` claude mcp add --transport http viktor https://.viktor.ai/mcp ``` To check that the connection works, ask the agent to call the `whoami` tool. It reports the VIKTOR user and environment the agent is authenticated as: ``` { "domain": "acme.viktor.ai", "user": { "name": "Jane Doe", "email": "jane.doe@acme.com" } } ``` ## Which apps and views are exposed[​](https://docs.viktor.ai/docs/create-apps/mcp/.md#which-apps-and-views-are-exposed "Direct link to Which apps and views are exposed") Each view or download button in an app becomes one **tool** the agent can run, such as "calculate the cross-section" or "generate the PDF report", with the app's input fields as that tool's inputs. The agent reads the list of available tools, picks the one that matches your request, fills in the inputs, and runs it. After authenticating, the agent receives a tool for every exposable view in every app you have access to. There is no selection step, so you cannot yet choose which apps to expose. An app is exposed when it is published, visible to you, and has at least one exposable view. A view is exposed when all of its required inputs and its result type are supported. What is supported today The lists below reflect what MCP supports today, and they are expected to grow. A view that is not exposed today may become available in a later release without any change to your app. **Inputs supported today** | Field | Becomes | | ------------------------------------- | --------------------------- | | `NumberField`, `IntegerField` | number, integer | | `TextField`, `TextAreaField` | string | | `ToggleButton` | boolean | | `OptionField`, `AutocompleteField` | single choice | | `MultiSelectField` | list of choices | | `ColorField`, `DateField` | string | | `GeoPointField` | `{lat, lon}` | | `GeoPolylineField`, `GeoPolygonField` | list of `{lat, lon}` points | | `Table`, `DynamicArray` | list of rows | Layout containers (`Section`, `Tab`, `Page`, `Step`) are passed through as nested structure and do not affect eligibility. **Not supported yet:** `FileField`, `AutodeskFileField` and `EntityOptionField`. For map inputs, the agent is instructed to ask you for the coordinates rather than invent them, so expect it to ask before running a view that needs a point, line or polygon. **Results supported today** * Results the agent can use in further steps: `DataView`, `TableView`, and the `…AndDataView` composites (the agent uses the `data` part). * Results the agent returns as a file: `DownloadButton`, `PDFView`, and `ImageView`. **Not supported yet:** purely visual views with no file to download (`PlotlyView`, `GeometryView`, `MapView`, `WebView`, `IFCView`, `GeoJSONView`, `AutodeskView`), and `SetParamsButton`, `OptimizationButton` and generic `ActionButton`. Views that fall outside this set are left out of the tool list without an error. If an app you expected is missing entirely, none of its views are exposable yet. ## Tool names[​](https://docs.viktor.ai/docs/create-apps/mcp/.md#tool-names "Direct link to Tool names") Each tool is named after the app, entity type, and method it runs: ``` ____ ``` For example, a `get_forecast` view on a `Location` entity type in an app named `weather-app` becomes `weather_app__Location__get_forecast`. A short suffix is added if two tools would otherwise share a name. ## Writing apps that work well as tools[​](https://docs.viktor.ai/docs/create-apps/mcp/.md#writing-apps-that-work-well-as-tools "Direct link to Writing apps that work well as tools") The agent chooses a tool and fills its inputs based only on the app name and description, the view label, and the input labels and descriptions. A few habits make that much more reliable: * Give views clear, descriptive labels, as the label is what the agent reads to decide whether to call the tool. * Add a `description` to input fields, especially where a label alone is ambiguous. Include the unit in the label or description, because a unit set with `prefix` or `suffix` is not passed to the agent. * State constraints the agent cannot infer from the field type in the field's `description`. Rules that span rows or fields ("rows must sum to 100", "start must precede end") and visibility conditions are not visible to the agent otherwise. * Keep unsupported fields out of entity types whose views you want an agent to reach, since one such field hides all of them. Expect the agent to also see fields a given view ignores, because a tool's inputs are the whole parametrization of its entity type. ## Limits[​](https://docs.viktor.ai/docs/create-apps/mcp/.md#limits "Direct link to Limits") * **Number of tools.** An environment exposes at most 128 tools. If it has more, the list is cut off and the agent will not see every app. * **Number of clients.** At most 1000 clients can authenticate within a 30-day window. Each client a user connects counts separately, so someone connecting two agents uses two of them. * **Duration.** A tool call is given 10 minutes to complete. In practice the agent often gives up sooner, because a running app does not report progress back and most clients stop waiting after a shorter period. The app may still finish its run in the background. For long calculations, split them into smaller views or run them from the app interface instead. * **No tool selection.** Every app you have access to is exposed and you cannot pick a subset. * **Fixed tool list per session.** Apps published or shared after your agent connected only appear once the agent reconnects. * **No access to your saved work.** Each call runs the app from scratch with the inputs the agent supplies. The agent cannot open the projects and data you already have in a workspace, and nothing it runs is saved back into one. * **Units set as a prefix or suffix are not passed on.** The agent only reads a field's label and description, so a unit defined with `prefix` or `suffix` is invisible to it. Put the unit in the label or the description as well if the agent needs to know it. ## Administrators[​](https://docs.viktor.ai/docs/create-apps/mcp/.md#administrators "Direct link to Administrators") Agents connect with the same access controls as the VIKTOR interface. Every user authenticates as themselves, so an agent can only reach the apps its user already has access to, and the user approves the access on a consent screen before the agent is authorized. The agent only runs apps with the inputs it supplies, and cannot read from or write to projects. Admin controls, such as choosing which apps are exposed, are not available yet. See [agent access via MCP](https://docs.viktor.ai/docs/manage-apps/access-management/.md#agent-access-via-mcp) for more details. --- # Using date-dependent params Projects that make use of a database with prices are often invoiced with prices that may change over the years. If such prices are changed and the project is re-opened, the latest revision of the price-database is used by default. However, this could influence resulting data (e.g. a quotation) of an old project that the user would like to review. In such cases it is very helpful to select or specify a date at which the database settings were applicable. Selecting a date can be implemented in different ways. Note that in case a [`DateField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_DateField) is used to pick a date you should account for possible UTC offsets. Assume a revision is created in Los Angeles at 17:00 local time (UTC-8), this will result in a UTC time stamp at 1:00 the **next day** so the latter date should be selected. The user does not know this will happen, so depending on the UTC zone of the user, the possible 1-day fluctuation should be taken into account. Steps: 1. From the backend API, call the revisions of the 'settings' entity (e.g. `API().get_entity_revisions(entity_id)`). 2. Get the dates of the revisions, stored under ['created\_date'](https://docs.viktor.ai/sdk/api/api-v1/.md#_EntityRevision) property. 3. Get the user-specified date. 4. Since both dates are datetime objects, comparison can easily be done. 5. Filter the revision that was applicable at the user-specified date. The last step can vary depending on the way you would like to filter the revisions. For example if multiple revisions are created on the specified date, you can write an algorithm to select the correct revision of that day (e.g. the latest or first created). Make sure to notify the user whether the specified date is within the bounds of the possible revisions or not. --- # Processing GEF files Classes have been created to simplify usage of GEF files such as a data access class (`GEFData`) that includes visualization of GEF measurement data, or classification of soil layout. All classes and functions can be imported from the [`viktor.geo`](https://docs.viktor.ai/sdk/api/geo/.md) module. For more detailed examples, please check the docstring of the functions. ## `GEFFile` class[​](https://docs.viktor.ai/docs/create-apps/other-topics/processing-gef-files/.md#geffile-class "Direct link to geffile-class") The [`GEFFile`](https://docs.viktor.ai/sdk/api/geo/.md#_GEFFile) object is used to parse the file content of GEF files and convert the data to dictionary or `GEFData` object. The data is split into 'measurement\_data' and 'headers' category. For 'measurement\_data' the compulsory fields are 'Rf', 'qc' and 'elevation'. These are automatically always returned and stored when parsing a GEF file. Additional columns can be requested from the controller by specifying them in the parse call using the keyword "additional\_columns". The height reference- and coordinate system are parsed from the gef file and return in the properties "height\_system" and "coordinate\_system". Any property relating with a reference relates to the height\_system value. In general the following definitions (taken from the norm) are used: * depth is always a positive number, denoting vertical distance from start of measurement to end * length is always a positive number, denoting distance measured along path of measurement * elevation is the vertical position of a measurement wrt to a reference datum. (so reference\_datum\_height - depth), can be partially positive and negative caution `GEFFile.parse` needs to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. ## `GEFData` class[​](https://docs.viktor.ai/docs/create-apps/other-topics/processing-gef-files/.md#gefdata-class "Direct link to gefdata-class") [`GEFData`](https://docs.viktor.ai/sdk/api/geo/.md#_GEFData) is a data class to simplify the usage of GEF data. A `GEFData` object can directly be initiated with the dictionary that is created by the `GEFFile` class. All keys from 'measurement\_data' and 'headers' are set as attributes of the `GEFData` object, and are therefore directly accessible. The measurement data can be used to determine the soil types with `classify(method: Type[ClassificationMethod], return_soil_layout_obj: bool = True)`. Currently, the [`RobertsonMethod`](https://docs.viktor.ai/sdk/api/geo/.md#_RobertsonMethod) and [`TableMethod`](https://docs.viktor.ai/sdk/api/geo/.md#_TableMethod) are supported for soil classification. The properties of all possible soil types need to be provided when calling the `classify` method in order to create a [`SoilLayout`](https://docs.viktor.ai/sdk/api/geo/.md#_SoilLayout). caution `GEFData.classify` needs to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. ## GEF visualization[​](https://docs.viktor.ai/docs/create-apps/other-topics/processing-gef-files/.md#gef-visualization "Direct link to GEF visualization") For easy visualization of GEF data, a helper function is created. A code example is provide below: ``` import viktor as vkt class Controller(vkt.Controller): @vkt.ImageView("GEF plot", duration_guess=5) def visualize(self, params, **kwargs): gef_data = ... soil_layout_original = ... soil_layout_user = ... svg_image = vkt.geo.gef_visualization(self.gef_data, self.soil_layout_original, self.soil_layout_user, as_file=True) return vkt.ImageResult(svg_image) ``` If the standard helper function does not satisfy the requirements, it is possible to create your own matplotlib. `GEFData` has `get_resistance_visualization(axes: matplotlib.pyplot.Axes)` and `get_cone_visualization(axes: matplotlib.pyplot.Axes)` functions, while `SoilLayout` has `get_visualization(axes: matplotlib.pyplot.Axes)`. All functions require a matplotlib `Axes` object that are stateful, and therefore the visualization functions do not return. Example to use one of the visualization functions is shown below: ``` import viktor as vkt import matplotlib.pyplot as plt class Controller(vkt.Controller): @vkt.ImageView("GEF plot", duration_guess=5) def visualize(self, params, **kwargs): gef_data = ... # Create main figure fig = plt.figure(figsize=(8.27, 11.69)) # Define contour (rectangle) for cone visualization, and create Axes object that can be modified by functions rect_cone = [0.1, 0.1, 0.4, 0.9] # [left, bottom, width, height] cone_axes = plt.axes(rect_cone) # Modify created Axes objects gef_data.get_cone_visualization(cone_axes) # Convert to SVG for visualization svg_data = StringIO() fig.savefig(svg_data, format='svg', bbox_inches='tight', pad_inches=0.8) plt.close() return vkt.ImageResult(svg_data) ``` ## Soil structure[​](https://docs.viktor.ai/docs/create-apps/other-topics/processing-gef-files/.md#soil-structure "Direct link to Soil structure") A general purpose soil structure has been introduced that is being used by the GEF parser, namely `Soil`, `SoilLayer` and `SoilLayout`. A `SoilLayout` is a collection of `SoilLayer` objects, which contain a `Soil`, top and bottom of layer as attributes. Extra properties can be added to the `Soil` class to provide more (geotechnical) information. Properties can be stored on `Soil` and `SoilLayer` object by calling `update_properties` and providing a dict with the relevant parameters. A `SoilLayout` can be manually created using the `__init__(self, soil_layers: List[SoilLayer])` function, but in order to simplify storage of the object in the database class methods have been created. To store the object in the database the function `serialize()` can be used. For re-initialization of `SoilLayout` the function `from_dict(cls, soil_layout_dict: Dict[str, List])` can be used. --- # Share data between entities using the API ## Sharing data between entities using the API[​](https://docs.viktor.ai/docs/create-apps/other-topics/share-using-api/.md#sharing-data-between-entities-using-the-api "Direct link to Sharing data between entities using the API") tip If the selection of an entity needs to be done by the user, you can make use of the [entity selection fields](https://docs.viktor.ai/docs/create-apps/user-input/entity-selection/.md) Sometimes information is needed from another entity. For example, when you want to show all the child locations on a `MapView`. Or when you require general settings, which are specified on the parent entity. Please refer to our [SDK API documentation](https://docs.viktor.ai/docs/api/sdk/.md) for examples on how to set this up. caution Please keep in mind that API requests are relatively slow, so make sure you only execute them when necessary. --- # Results & visualizations Within an editor, results are shown in so-called **views**. VIKTOR support various view classes for different type of results. For information on how to define a view, see [how to create an editor](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure/.md#defining-a-view). ## Plots, charts & graphs[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md#plots-charts--graphs "Direct link to Plots, charts & graphs") ![](/img/docs/cards/plotly.svg) ## [Plot](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/plots-charts-graphs/.md#using-plotly) Show (interactive) plots, graphs and charts ![](/img/docs/cards/plotly+data.svg) ## [Plot & data](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/plots-charts-graphs/.md#using-plotly) Combined plot & data view ## Geometry[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md#geometry "Direct link to Geometry") ![](/img/docs/cards/geometry.svg) ## [3D model](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md) Show a geometric 3D model, glTF/GLB, 3DM, or IFC file ![](/img/docs/cards/geometry+data.svg) ## [3D model & data](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md) Combined 3D & data view ## Maps[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md#maps "Direct link to Maps") ![](/img/docs/cards/map.svg) ## [Map](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#mapview) Display features on a map ![](/img/docs/cards/map+data.svg) ## [Map & data](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#mapview) Combined map & data view
![](/img/docs/cards/GeoJSON.svg) ## [GeoJSON](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#geojsonview) Display GeoJSON primitives on a map ![](/img/docs/cards/GeoJSON+data.svg) ## [GeoJSON & data](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#geojsonview) Combined GeoJSON map & data view ## Data & tables[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md#data--tables "Direct link to Data & tables") ![](/img/docs/cards/table-view.svg) ## [Table](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/data-and-tables/.md#tableview) Present data in a table ![](/img/docs/cards/data.svg) ## [Grouped data](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/data-and-tables/.md#dataview) Present results in data groups ## Images[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md#images "Direct link to Images") ![](/img/docs/cards/png.svg) ## [PNG image](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/images/.md) Show a PNG image ![](/img/docs/cards/png+data.svg) ## [PNG & data](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/images/.md) Combined PNG & data view
![](/img/docs/cards/jpg.svg) ## [JPG image](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/images/.md) Show a JPG image ![](/img/docs/cards/jpg+data.svg) ## [JPG & data](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/images/.md) Combined JPG & data view
![](/img/docs/cards/svg.svg) ## [SVG image](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/images/.md) Show an SVG image ![](/img/docs/cards/svg+data.svg) ## [SVG & data](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/images/.md) Combined SVG & data view
New in v13.7.0 ![](/img/docs/cards/gif.svg) ## [GIF image](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/images/.md) Show a GIF image New in v13.7.0 ![](/img/docs/cards/gif+data.svg) ## [GIF & data](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/images/.md) Combined GIF & data view ## Documents & reports[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md#documents--reports "Direct link to Documents & reports") ![](/img/docs/cards/pdf.svg) ## [PDF report](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/report/.md) Present a PDF file directly in a view ## HTML[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md#html "Direct link to HTML") ![](/img/docs/cards/html.svg) ## [HTML](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/html/.md) Present interactive visualizations or other HTML (web) content ![](/img/docs/cards/html+data.svg) ## [HTML & data](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/html/.md) Combined HTML & data view ## Autodesk[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md#autodesk "Direct link to Autodesk") ![](/img/docs/cards/autodesk.svg) ## [Autodesk](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/autodesk/.md) Visualize an Autodesk model from cloud storage --- # Visualize Autodesk model New in v14.25.0 This guide explains how to add an [`AutodeskView`](https://docs.viktor.ai/sdk/api/views/.md#_AutodeskView), to visualize a model from Autodesk cloud storage directly in the editor. For the `AutodeskView` an access token is required, meaning that an [Autodesk integration should be set up](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#oauth-20) beforehand. ![](/assets/images/acc-integration-2-4889c859fd9fa2568d2ea9e623806692.png) ## Implementation[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/autodesk/.md#implementation "Direct link to Implementation") The [`AutodeskView`](https://docs.viktor.ai/sdk/api/views/.md#_AutodeskView) both accepts an [`AutodeskFile`](https://docs.viktor.ai/sdk/api/external/autodesk/.md#_AutodeskFile) (e.g. from an [`AutodeskFileField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_AutodeskFileField)), or a version URN (of the form `"urn:XXX?version=Y"`) directly: ``` import viktor as vkt class Parametrization(vkt.Parametrization): title = vkt.Text("# AutodeskView Sample App") autodesk_file = vkt.AutodeskFileField( "Select model from ACC", oauth2_integration="autodesk-integration", ) class MyEntityTypeController(vkt.Controller): parametrization = Parametrization @vkt.AutodeskView("Autodesk") def autodesk_view(self, params, **kwargs): integration = vkt.external.OAuth2Integration("autodesk-integration") token = integration.get_access_token() autodesk_file = params.autodesk_file if not autodesk_file: raise vkt.UserError("Please select a model in the Autodesk file field") return vkt.AutodeskResult(autodesk_file, access_token=token) ``` The AutodeskView allows you to perform measurements, navigate model properties, and, in a typical workflow, it helps collect inputs or verify outputs for more complex applications. ## Testing[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/autodesk/.md#testing "Direct link to Testing") Methods decorated with a view like `@AutodeskView` must be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/) within the context of (automated) testing. ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_View(MyEntityTypeController) def test_autodesk_view(self): params = ... result = MyEntityTypeController().autodesk_view(params=params) self.assertEqual(result._autodesk_file, ...) ``` --- # Show data & tables There are two different ways to present data in a view: * For a table-like presentation of data, you can use the [TableView](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/data-and-tables/.md#tableview) * For a tree-like presentation of grouped data (flat or nested), you can use the [DataView](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/data-and-tables/.md#dataview) ## TableView[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/data-and-tables/.md#tableview "Direct link to TableView") New in v14.13.0 note The `TableView` is a trade-off between simplicity and flexibility. If you need more control on styling, [this package](https://github.com/viktor-platform/viktor_table_view) might suit your needs. It uses a `WebView` under the hood. The [`TableView`](https://docs.viktor.ai/sdk/api/views/.md#_TableView) provides means to present data in a tabular form. The view has a button to download the data as CSV. ![](/assets/images/view-table-746ed1cbfa21465b02b03787057ea62b.png) *Example TableView* A table view can be created by passing data to a [`TableResult`](https://docs.viktor.ai/sdk/api/views/.md#_TableResult) in a view-method decorated with `@TableView`: ``` from datetime import date import viktor as vkt class Controller(vkt.Controller): @vkt.TableView("Student Grades") def table_view(self, params, **kwargs): data = [ [128, "John", 6.9, False, date(1994, 6, 3)], [129, "Jane", 8.1, True, date(1995, 1, 24)], [130, "Mike", 7.5, False, date(1989, 12, 4)], ] return vkt.TableResult(data) ``` ### Custom headers[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/data-and-tables/.md#custom-headers "Direct link to Custom headers") Custom headers can be set on both rows and columns by passing respectively `row_headers` and `column_headers` in the `TableResult`: ``` @vkt.TableView("Student Grades") def table_view(self, params, **kwargs): ... return vkt.TableResult( data, row_headers=["Person 1", "Person 2", "Person 3"], column_headers=["Student nr.", "Name", "Grade", "Cum laude", "Date of birth"] ) ``` If no headers are provided, the default headers (1, 2, 3, ...) will be shown. #### Hiding the index[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/data-and-tables/.md#hiding-the-index "Direct link to Hiding the index") New in v14.34.0 The auto-generated index (1, 2, 3, ...) shown on an axis without headers can be hidden by setting `show_index=False`: ``` return vkt.TableResult(..., show_index=False) ``` Explicitly provided `row_headers` / `column_headers` are always shown regardless; this flag only suppresses the auto-generated index on an axis that has no headers. ### Sorting & filtering[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/data-and-tables/.md#sorting--filtering "Direct link to Sorting & filtering") Sorting & filtering is automatically enabled on the columns if each of the columns contains data of homogeneous type. You can disable sorting & filtering by setting `enable_sorting_and_filtering=False` on the `TableResult`: ``` return vkt.TableResult(..., enable_sorting_and_filtering=False) ``` ### Styling[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/data-and-tables/.md#styling "Direct link to Styling") Styling on a per-cell basis can be applied by replacing the value in data with a [`TableCell`](https://docs.viktor.ai/sdk/api/views/.md#_TableCell) instance. The following styling can be applied on a per-cell basis: * `text_color`: color of the text. Can be any [`Color`](https://docs.viktor.ai/sdk/api/core/.md#_Color) * `background_color`: color of the cell background. Can be any [`Color`](https://docs.viktor.ai/sdk/api/core/.md#_Color) * `text_style`: style of the text. Can be one of: 'bold', 'italic' ``` import viktor as vkt class Controller(vkt.Controller): @vkt.TableView("Table") def table_view(self, params, **kwargs): data = [ [1, 2, 1], [2, TableCell(3, background_color=vkt.Color.green()), 2], [1, 2, 1], ] return vkt.TableResult(data) ``` Styling on a per-column/row basis can be applied by setting a [`TableHeader`](https://docs.viktor.ai/sdk/api/views/.md#_TableHeader) on respectively `column_headers` or `row_headers` within `TableResult`. The following styling can be applied on a per-column/row basis: * `num_decimals`: number of decimals to which the value is rounded (numbers only) * `align`: alignment of the text within the column/row. Can be one of: 'left', 'center', 'right' ``` import viktor as vkt class Controller(vkt.Controller): @vkt.TableView("Student Grades") def table_view(self, params, **kwargs): data = [ ["John", 6.9], ["Jane", 8.1], ["Mike", 7.5], ] return vkt.TableResult(data, column_headers=[ "Name", vkt.TableHeader("Grade", num_decimals=0) ]) ``` ### Column sizing[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/data-and-tables/.md#column-sizing "Direct link to Column sizing") New in v14.34.0 By default the columns share the available width equally. There are two ways to change this: let the table fit each column to its content, or set the widths yourself. To fit every column (including its header) to its content on render, set `enable_column_autosizing=True` on the `TableResult`. Any per-column `min_width` / `max_width` is still honoured: ``` return vkt.TableResult(..., enable_column_autosizing=True) ``` For explicit control, set sizing properties on a `TableHeader`: * `width` / `flex` - mutually exclusive: * `width`: fixed width of the column in pixels * `flex`: width as a ratio relative to other columns that use `flex` (e.g. a column with `flex=2` becomes twice as wide as a column with `flex=1`) * `min_width`: minimum width of the column in pixels * `max_width`: maximum width of the column in pixels ``` import viktor as vkt class Controller(vkt.Controller): @vkt.TableView("Student Grades") def table_view(self, params, **kwargs): data = [ ["John", 6.9], ["Jane", 8.1], ["Mike", 7.5], ] return vkt.TableResult(data, column_headers=[ vkt.TableHeader("Name", flex=2), vkt.TableHeader("Grade", num_decimals=0, width=80), ]) ``` The index column (the leftmost column that shows the row headers) can be sized through `index_header`. Only the sizing properties (`width`, `flex`, `min_width`, `max_width`) of the provided `TableHeader` take effect; `title`, `align`, etc. are ignored: ``` return vkt.TableResult(..., index_header=vkt.TableHeader("", width=120)) ``` ### Transposing the data[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/data-and-tables/.md#transposing-the-data "Direct link to Transposing the data") Sometimes it is preferred to present data in a transposed table (with homogeneous types on rows instead of columns), for example when the number of columns would otherwise be much larger than the number of rows. This can simply be achieved by transposing the data yourself, and exchanging `row_headers` and `column_headers` in the `TableResult`, as shown in the following example: note Sorting & filtering is disabled if one or more columns contain mixed-type data. ``` from datetime import date import viktor as vkt class Controller(vkt.Controller): @vkt.TableView("Student Grades") def table_view(self, params, **kwargs): data = [ [128, "John", 6.9, False, date(1994, 6, 3)], [129, "Jane", vkt.TableCell(8.1, background_color=vkt.Color.green()), True, date(1995, 1, 24)], [130, "Mike", 7.5, False, date(1989, 12, 4)], ] transposed_data = [list(d) for d in zip(*data)] return vkt.TableResult( transposed_data, row_headers=["Student nr.", "Name", "Grade", "Cum laude", "Date of birth"], column_headers=["Person 1", "Person 2", "Person 3"], ) ``` ![](/assets/images/view-table-transposed-5cd5293370b74629fb24c55d3c1a66c6.png) *Example of transposed table* ### Using pandas[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/data-and-tables/.md#using-pandas "Direct link to Using pandas") It is possible to pass a [pandas](https://pypi.org/project/pandas/) `DataFrame` or `Styler` object directly into a `TableResult`. The column and index names of the `DataFrame` will be taken as `columns_headers` and `row_headers` respectively: note Setting explicit `columns_headers` and `row_headers` in `TableResult` will override the column and index names of the pandas `DataFrame`. ``` from datetime import date import pandas as pd import viktor as vkt class Controller(vkt.Controller): @vkt.TableView("Table") def table_view(self, params, **kwargs): df = pd.DataFrame( data=[ [128, "John", 6.9, False, date(1994, 6, 3)], [129, "Jane", 8.1, True, date(1995, 1, 24)], [130, "Mike", 7.5, False, date(1989, 12, 4)], ], columns=["Student nr.", "Name", "Grade", "Cum laude", "Date of birth"], index=["Person 1", "Person 2", "Person 3"], ) return vkt.TableResult(df) ``` The following styling properties of a pandas `Styler` object are supported: * Background color (per cell) * Text color (per cell) * Text style (per cell, bold or italic) * Align (per column/row, only if all cells in a row/column have the same alignment) note To make use of pandas styling, you need to add the `pandas[output-formatting]` package to your `requirements.txt` ``` from datetime import date import pandas as pd import viktor as vkt class Controller(vkt.Controller): @vkt.TableView("Table") def table_view(self, params, **kwargs): df = pd.DataFrame( data=[ [128, "John", 6.9, False, date(1994, 6, 3)], [129, "Jane", 8.1, True, date(1995, 1, 24)], [130, "Mike", 7.5, False, date(1989, 12, 4)], ], columns=["Student nr.", "Name", "Grade", "Cum laude", "Date of birth"], index=["Person 1", "Person 2", "Person 3"], ) df = df.transpose() styler = df.style.highlight_max(color="green", axis='columns', subset=pd.IndexSlice[['Grade'], :]) return vkt.TableResult(styler) ``` ## DataView[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/data-and-tables/.md#dataview "Direct link to DataView") With a [`DataView`](https://docs.viktor.ai/sdk/api/views/.md#_DataView), results can be grouped and be presented in a tree-like form. The data can be flat, or nested up to a maximum of 3 levels. ![](/assets/images/view-data-9bcd199b897b465b7fa34be0e08972ba.png) *Example DataView* The following steps have to be performed to visualize the desired results: 1. Create the data group(s) consisting of [`DataItem`](https://docs.viktor.ai/sdk/api/views/.md#_DataItem)s for visualization. 2. Pass the group(s) to a decorated view method that returns a [`DataResult`](https://docs.viktor.ai/sdk/api/views/.md#_DataResult). ``` import viktor as vkt class Controller(vkt.Controller): @vkt.DataView("Results") def visualize_data(self, params, **kwargs): data = vkt.DataGroup( vkt.DataItem('Data item 1', 123) ) return vkt.DataResult(data) ``` ### Multilayered DataGroup[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/data-and-tables/.md#multilayered-datagroup "Direct link to Multilayered DataGroup") Below an example is given of a multilayered output group (maximum of three layers deep): ``` import viktor as vkt class Controller(vkt.Controller): @vkt.DataView("Results") def visualize_data(self, params, **kwargs): value_a = 1 value_b = 2 * value_a value_total = value_a + value_b data = vkt.DataGroup( group_a=vkt.DataItem('Group A', 'some result', subgroup=vkt.DataGroup( sub_group=vkt.DataItem('Result', 1, suffix='N') )), group_b=vkt.DataItem('Group B', '', subgroup=vkt.DataGroup( sub_group=vkt.DataItem('Sub group', value_total, prefix='€', subgroup=vkt.DataGroup( value_a=vkt.DataItem('Value A', value_a, prefix='€'), value_b=vkt.DataItem('Value B', value_b, prefix='€', explanation_label='this value is a result of multiplying Value A by 2') )) )) ) return vkt.DataResult(data) ``` The `explanation_label` can be used to inform the user. The output result will look like this: ![](/assets/images/data-view-example-1-65c4d7593a0a51aa5bc081853619dbff.png) *Example DataView* ### Positional or key-worded DataItem?[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/data-and-tables/.md#positional-or-key-worded-dataitem "Direct link to Positional or key-worded DataItem?") In previous examples, we saw a DataGroup created with and without the use of keyword arguments. Using keywords is necessary to link the corresponding `DataItem` to the `Summary`. A detailed guide of the `Summary` can be found [here](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/show-summary/.md). ### Dynamic group length[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/data-and-tables/.md#dynamic-group-length "Direct link to Dynamic group length") The structure of `DataGroup`s allows for dynamic creation/addition of data to the overall result, as long as the maximum number of items is not exceeded. An example of dynamically creating data items is shown below: ``` import viktor as vkt class Controller(vkt.Controller): @vkt.DataView("Results") def visualize_data(self, params, **kwargs): dynamic_dict = { "item 1": 1, "item 2": 2, # etc. } # loop through items total_value = 0 data_items = [] for item, value in dynamic_dict.items(): data_items.append( vkt.DataItem(item, value) ) total_value += value # construct data group data = vkt.DataGroup(*data_items) return vkt.DataResult(data) ``` ### Setting warning/error statuses[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/data-and-tables/.md#setting-warningerror-statuses "Direct link to Setting warning/error statuses") Sometimes it is desired to warn a user when a result exceeds a certain values. For these cases, the `status` and `status_message` arguments of a `DataItem` can be considered. Suppose we want to warn the user if our shopping cart of the example above exceeds 5 euros, we can add the following: ``` import viktor as vkt class Controller(vkt.Controller): @vkt.DataView("Results") def visualize_data(self, params, **kwargs): shopping_cart = { 'Apple': 0.20, 'Pineapple': 1.80, 'Milk': 1, 'Cheese': 2.50 } # loop through products total_cost = 0 data_items = [] for item, price in shopping_cart.items(): data_items.append( vkt.DataItem(item, price, prefix='€') ) total_cost += price # construct data group if total_cost <= 5: status = vkt.DataStatus.SUCCESS status_msg = '' else: status = vkt.DataStatus.WARNING status_msg = 'Mind your wallet!' data = vkt.DataGroup( vkt.DataItem('Shopping cart', total_cost, prefix='€', status=status, status_message=status_msg, subgroup=vkt.DataGroup(*data_items)) ) return vkt.DataResult(data) ``` ![](/assets/images/data-view-example-2-a711f1319846127779c99ae12be0d68f.png) *Example status message* ## Testing[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/data-and-tables/.md#testing "Direct link to Testing") New in v13.3.0 `mock_View` decorator for easier testing of view methods Methods decorated with `@TableView` and `@DataView` need to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing: ``` import unittest from viktor.testing import mock_View from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_View(MyEntityTypeController) def test_data_view(self): params = ... result = MyEntityTypeController().data_view(params=params) self.assertEqual(result.data, ...) ``` --- # Hide a view New in v14.22.0 A view can be hidden (or shown) based on other input fields by assigning a callback function to the `visible` argument within the view. The callback function needs to return a **boolean**: ``` def get_visibility(params, **kwargs): return params.param_x class Controller(vkt.Controller): ... @vkt.TableView("Results", visible=get_visibility) def my_table_view(self, params, **kwargs): ... ``` If a [`Page`](https://docs.viktor.ai/docs/create-apps/layout-and-styling/pages/.md) or [`Step`](https://docs.viktor.ai/docs/create-apps/layout-and-styling/steps/.md) is used, views will only be visible in the editor if they are both visible **and** defined in the page/step's `views`. When the visibility depends on data of another entity, the `entity_id` can be used to navigate and obtain data using the [SDK API](https://docs.viktor.ai/docs/api/sdk/handling-entity-data/.md). tip Upon evaluation of the visibility constraint, the platform passes the `params`, `entity_id`, `entity_name`, and `workspace_id` to the callback function. All individual `kwargs` can be added explicitly in the signature if desired: ``` def get_visibility(params, entity_id, entity_name, workspace_id, **kwargs): ... ``` --- # Show HTML Plotly For visualizations using [Plotly](https://github.com/plotly/plotly.py), it is recommended to use the dedicated [`PlotlyView`](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/plots-charts-graphs/.md#using-plotly). This guide explains how to add a [`WebView`](https://docs.viktor.ai/sdk/api/views/.md#_WebView) to an editor. This could for instance be used to incorporate [interactive visualizations](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/html/.md#interactive-visualizations) or present other dynamic or static HTML (web) content: ## Implementation[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/html/.md#implementation "Direct link to Implementation") ![](/assets/images/plotly-example-7cc2c057d48c72d55f332639cf4e3707.png) *Example of how an interactive visualization in a web view could look like (source: plot.ly)* There are 3 ways to pass the HTML content to a [`WebResult`](https://docs.viktor.ai/sdk/api/views/.md#_WebResult): 1. From a [URL](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/html/.md#from-a-url) 2. From a [static HTML file](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/html/.md#from-a-static-html-file) 3. From a [dynamic HTML content](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/html/.md#from-dynamic-html-content) ### From a URL[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/html/.md#from-a-url "Direct link to From a URL") You can point to a live URL and use that HTML page: ``` import viktor as vkt class Controller(vkt.Controller): @vkt.WebView('Python wiki') def get_web_view(self, params, **kwargs): return vkt.WebResult(url='https://en.wikipedia.org/wiki/Python_(programming_language)') ``` ### From a static HTML file[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/html/.md#from-a-static-html-file "Direct link to From a static HTML file") If the HTML page is always the same (it is not necessary to generate it on every call), use the `from_path` method to construct a `WebResult`: ``` import viktor as vkt from pathlib import Path class Controller(vkt.Controller): @vkt.WebView('Hello page') def get_web_view(self, params, **kwargs): static_html_path = Path(__file__).parent / 'page.html' return vkt.WebResult.from_path(static_html_path) ``` `page.html` (in this example next to controller.py): ``` Hello Everyone! ``` ### From dynamic HTML content[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/html/.md#from-dynamic-html-content "Direct link to From dynamic HTML content") If the HTML page is dependent on some input (so needs to be generated on every call), use the `html` argument in `WebResult`: ``` import viktor as vkt from io import StringIO class Controller(vkt.Controller): @vkt.WebView('Hello page') def get_web_view(self, params, **kwargs): name = 'John Doe' html_text = f'Hello {name}' return vkt.WebResult(html=html_text) ``` A web view can be combined with a data view using a [`WebAndDataView`](https://docs.viktor.ai/sdk/api/views/.md#_WebAndDataView). ## Interactive visualizations[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/html/.md#interactive-visualizations "Direct link to Interactive visualizations") A very useful application of the web view is for interactive visualizations (for instance maps/graphs). ### VIKTOR JavaScript SDK[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/html/.md#viktor-javascript-sdk "Direct link to VIKTOR JavaScript SDK") VIKTOR provides a JavaScript SDK which can be used directly in a web view. With this SDK it is possible to fill the parametrization with inputs when a user clicks on a button in the view. To achieve this, you will need to import the SDK using `` and subsequently call the function `viktorSdk.sendParams`. This function accepts a dictionary of field names and corresponding values which are applied on the parametrization. An example HTML file looks like this: ``` ``` In the example above the source of the JavaScipt SDK is set by means of the variable `VIKTOR_JS_SDK`. You set it using the environment variable `VIKTOR_JS_SDK_PATH`, that is available automatically in your app's logic. This means dat you do not need to set it using the viktor-cli (`>v0.41.0`) or in your app settings. Replace the `VIKTOR_JS_SDK` placeholder with `os.environ["VIKTOR_JS_SDK_PATH"] + "v1.js"`, as the example below shows: ``` import viktor as vkt import os from pathlib import Path class Parametrization(vkt.Parametrization): hello = vkt.TextField("Hello") class Controller(vkt.Controller): parametrization = Parametrization @vkt.WebView('Web View') def get_web_view(self, params, **kwargs): html = (Path(__file__).parent / 'example.html').read_text() html = html.replace("VIKTOR_JS_SDK", os.environ["VIKTOR_JS_SDK_PATH"] + "v1.js") return vkt.WebResult(html=html) ``` Above `example.html` and app code will result in the following interactive view: ![](/assets/images/webview-interaction-8dce68fd01ac3b2a1e0163b2998e5939.gif) By default, a confirmation pop-up is shown. To **bypass the confirmation pop-up** and set parameters immediately, add an extra argument set to `true`: ``` ... function sendName() { viktorSdk.sendParams({ hello: "VIKTOR" }, true); } ... ``` caution * To set fields nested under a `Page`, `Step`, `Tab` or `Section` you can either return a nested object or use the dotted path (e.g. `"tab.section.hello"`) in the `sendParams` method. * Keep in mind that the `sendParams` function only accepts the **serialized** values. For example, the value of a `ColorField` is sent as: ``` viktorSdk.sendParams({ color: {r: 30, g: 144, b: 255} }); ``` Show all fields ``` viktorSdk.sendParams({ number: 12.3, integer: 12, text: "abcd", textarea: "defg", date: "2006-01-02", bool: true, select: "Green", autocomp: "Green", multiselect: ["Red", "Green"], table: [{c1: 1, c2: 2}, {c1: 3, c2: 4}], geopoint: {lat: 25.7617, lon: -80.1918}, geopolyline: [{lat: 25.7617, lon: -80.1918}, {lat: 18.4655, lon: -66.1057}], geopolygon: [{lat: 25.7617, lon: -80.1918}, {lat: 18.4655, lon: -66.1057}, {lat: 32.3078, lon: -64.7505}], entity: 123, // entity id color: {r: 30, g: 144, b: 255} }); ``` ### Python libraries[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/html/.md#python-libraries "Direct link to Python libraries") The following Python libraries offer the functionality to export interactive visualizations as an HTML page: * [Bokeh](https://github.com/bokeh/bokeh) * [Folium](https://github.com/python-visualization/folium) * [Geoplotlib](https://github.com/andrea-cuttone/geoplotlib) * [mpld3](https://github.com/mpld3/mpld3) * [altair-viz](https://github.com/altair-viz/altair) * [pygal](https://github.com/Kozea/pygal) ## Testing[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/html/.md#testing "Direct link to Testing") New in v13.3.0 `mock_View` decorator for easier testing of view methods Methods decorated with `@WebView` or `@WebAndDataView` need to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. ``` import unittest from viktor.testing import mock_View from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_View(MyEntityTypeController) def test_web_view(self): params = ... result = MyEntityTypeController().web_view(params=params) self.assertEqual(result.html, ...) ``` --- # Show an image New in v13.7.0 `ImageView` and `ImageAndDataView` as replacement for the specific image views. Currently, the following image types are supported: * PNG * JPG * SVG * GIF (>= v13.7.0) ## Implementation[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/images/.md#implementation "Direct link to Implementation") The easiest way to show an image in the [`ImageView`](https://docs.viktor.ai/sdk/api/views/.md#_ImageView) is by using a static file: 1. Add an image to your app repository. ``` my-app ├── app.py ├── image.png └── ... ``` 2. Create a view method on the controller decorated with `ImageView` which returns an [`ImageResult`](https://docs.viktor.ai/sdk/api/views/.md#_ImageResult): ``` from pathlib import Path import viktor as vkt class Controller(vkt.Controller): @vkt.ImageView("Image") def create_img_result(self, params, **kwargs): image_path = Path(__file__).parent / 'image.png' return vkt.ImageResult.from_path(image_path) ``` The image can also be dynamically created, for example using Matplitlib, svgwrite, drawSvg, etc. An example of Matplotlib is shown below: ``` import matplotlib.pyplot as plt import numpy as np import viktor as vkt from io import StringIO class Controller(vkt.Controller): @vkt.ImageView("Plot") def create_result(self, params, **kwargs): # initialize figure fig = plt.figure() # create plot data x = np.random.randn(10) plt.plot(x) # save figure svg_data = StringIO() fig.savefig(svg_data, format='svg') plt.close() return vkt.ImageResult(svg_data) ``` The `ImageView` is only suitable for static visualizations. See [`WebView`](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/html/.md) if interactivity is desired. An image view can be combined with data using an [`ImageAndDataView`](https://docs.viktor.ai/sdk/api/views/.md#_ImageAndDataView). ## Testing[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/images/.md#testing "Direct link to Testing") New in v13.3.0 `mock_View` decorator for easier testing of view methods Methods decorated with `@ImageView`, `@ImageAndDataView`, `@PNGView`, `@PNGAndDataView`, `@JPGView`, `@JPGAndDataView`, `@SVGView`, or `@SVGAndDataView` need to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. ``` import unittest from viktor.testing import mock_View from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_View(MyEntityTypeController) def test_img_view(self): params = ... result = MyEntityTypeController().img_view(params=params) self.assertEqual(result.image.getvalue(), ...) ``` --- # Display a map A lot of VIKTOR applications (especially in the infra sector) are strongly related to locations on a map. In those cases it can be helpful to display locations in a map visualization. This guide explains how to add an OpenStreetMap view to a VIKTOR entity. There are 2 different VIKTOR objects to realize this: * If you want to build map elements using simple map geometry objects use the [`MapView`](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#mapview) object * If you want to use exports from external software to generate a geojson format (e.g. GIS), please see if the [`GeoJSONView`](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#geojsonview) is a better fit. ![](/assets/images/visualization-map-18a9f2daf418b5f76cb14cee043099eb.png) *Map view* note All features in the `MapView` and `GeoJSONView` expect coordinates in the WGS system. In case you are using the RD-system you can make use of the [`RDWGSConverter`](https://docs.viktor.ai/sdk/api/geometry/.md#_RDWGSConverter) to obtain the corresponding WGS coordinates: ``` lat, lon = RDWGSConverter.from_rd_to_wgs((x, y)) ``` ## MapView[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#mapview "Direct link to MapView") In the `MapView` the following map primitives (features) can be used: * `MapPoint`, to draw markers * `MapLine`, to draw a line between 2 points * `MapPolyline`, to draw a multi-segment line * `MapPolygon`, to draw a polygon surface * `MapCircle`, to draw a circular surface (New in v14.22.0) ### Example implementation[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#example-implementation "Direct link to Example implementation") ``` import viktor as vkt class Controller(vkt.Controller): @vkt.MapView('Map view') def get_map_view(self, params, **kwargs): # Create some points using coordinates markers = [ vkt.MapPoint(25.7617, -80.1918, description='Miami'), vkt.MapPoint(18.4655, -66.1057, description='Puerto Rico'), vkt.MapPoint(32.3078, -64.7505, description='Bermudas') ] # Create a polygon polygon = vkt.MapPolygon(markers) # Visualize map features = markers + [polygon] return vkt.MapResult(features) ``` A map view can be combined with data using a [`MapAndDataView`](https://docs.viktor.ai/sdk/api/views/.md#_MapAndDataView) ### Styling the map elements[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#styling-the-map-elements "Direct link to Styling the map elements") VIKTOR supports the following arguments for styling the map elements: * title: Title of a clickable map feature. * description: Description of a clickable map feature. Supports [styling with Markdown](https://docs.viktor.ai/docs/create-apps/layout-and-styling/style-text/.md). * color: Specifies the color of the map feature. * entity\_links: When clicking on the map feature, links towards multiple entities can be shown. * icon: Icon to be shown (`MapPoint` only). See [MapPoint](https://docs.viktor.ai/sdk/api/views/.md#_MapPoint) for all available icons. * size: Marker size (`MapPoint` only). (>= v14.5.0) * fill\_opacity: Opacity of the interior, between 0.0 and 1.0 (`MapPolygon` and `MapCircle` only). (>= v14.30.0) * stroke\_opacity: Opacity of the line/border, between 0.0 and 1.0 (line and polygon features). (>= v14.30.0) * stroke\_width: Width of the line/border, >= 0 (line and polygon features). (>= v14.30.0) * dash\_size: Size of the dashes of a dashed line, relative to the path width (line and polygon features). (>= v14.30.0) * gap\_size: Size of the gaps of a dashed line, relative to the path width (line and polygon features). (>= v14.30.0) ``` import viktor as vkt link_1 = vkt.MapEntityLink('First entity', first_entity_id) link_2 = vkt.MapEntityLink('Second entity', second_entity_id) vkt.MapPoint( 51.99311570849245, 4.385752379894256, title='Location', description='I am blue', icon="pin", size="small", color=vkt.Color(90, 148, 230), entity_links=[link_1, link_2] ) ``` Semi-transparent fills and styled borders are set the same way on polygons: ``` vkt.MapPolygon( markers, color=vkt.Color(90, 148, 230), fill_opacity=0.3, stroke_width=2, ) ``` ### Linking geo-fields to the view[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#linking-geo-fields-to-the-view "Direct link to Linking geo-fields to the view") When geo-fields (`GeoPointField`, `GeoPolylineField`, etc.) are used in the parametrization of an entity, corresponding geo-objects (`GeoPoint`, `GeoPolyline`, etc.) will be directly available in the `params`. These can easily be used in a `MapView`, by converting to the corresponding map feature (e.g. `GeoPointField` -> `GeoPoint` -> `MapPoint`). Assume the following `params`: ``` params = { 'geo_point': , 'geo_polyline': , 'geo_polygon': } ``` ``` @vkt.MapView(...) def get_map_view(self, params, **kwargs): features = [] if params.geo_point: features.append(vkt.MapPoint.from_geo_point(params.geo_point)) if params.geo_polyline: features.append(vkt.MapPolyline.from_geo_polyline(params.geo_polyline)) if params.geo_polygon: features.append(vkt.MapPolygon.from_geo_polygon(params.geo_polygon)) return vkt.MapResult(features) ``` Additional styling as explained in the previous section can be added via the class methods as well: ``` vkt.MapPoint.from_geo_point(params.geo_point, color=vkt.Color(90, 148, 230)) ``` ## GeoJSONView[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#geojsonview "Direct link to GeoJSONView") In the `GeoJSONView` GeoJSON primitives can be used to construct markers, lines and surfaces on this map, to add user relevant information. Another possibility is an export from an existing GIS program which you want to show to the user. note GeoJSON is a standard format for encoding geographic data structures such as points, lines and polygons ([geojson.org](https://geojson.org/)). [geojson.io](https://geojson.io) is a good tool for quick experiments with geojson. ### Example implementation[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#example-implementation-1 "Direct link to Example implementation") ``` import viktor as vkt class Controller(vkt.Controller): @vkt.GeoJSONView('GeoJSON view') def get_geojson_view(self, params, **kwargs): geojson = { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": {}, "geometry": { "type": "Point", "coordinates": [ 4.385747015476227, 51.993107450558156 ] } } ] } return vkt.GeoJSONResult(geojson) ``` A GeoJSON view can be combined with data using a [`GeoJSONAndDataView`](https://docs.viktor.ai/sdk/api/views/.md#_GeoJSONAndDataView) ### Styling the map elements - simplestyle-spec GeoJSON properties[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#styling-the-map-elements---simplestyle-spec-geojson-properties "Direct link to Styling the map elements - simplestyle-spec GeoJSON properties") GeoJSON defines the geometrical properties of the map elements and not the styling. It does however allow to convey such information under the "properties" key of the respective element. Roughly following the [simplestyle-spec](https://github.com/mapbox/simplestyle-spec/tree/master/1.1.0), VIKTOR supports the following arguments for styling the map elements: * icon (geometry type 'Point' only): icon to be shown (default: "pin"). See [MapPoint](https://docs.viktor.ai/sdk/api/views/.md#_MapPoint) for all available icons. * marker-symbol (geometry type 'Point' only): same as icon * marker-color: the color of a marker \* * marker-size: size of the marker ("small", "medium", "large") * title: A title to show when this item is clicked * description: text to show when this item is clicked. Supports [styling with Markdown](https://docs.viktor.ai/docs/create-apps/layout-and-styling/style-text/.md) * stroke: the color of a line as part of a polygon, polyline, or multigeometry \* * fill: the color of the interior of a polygon \* * stroke-opacity: the opacity of the line component of a polygon, polyline, or multigeometry \*\* * fill-opacity: the opacity of the interior of a polygon \*\* * stroke-width: the width of the line component of a polygon, polyline, or multigeometry (value must be a floating point number greater than or equal to 0) * dash-size: size of the dashes of a dashed line, relative to the width of the path * gap-size: size of the gaps of a dashed line, relative to the width of the path - color rules; Colors can be in short form "#ace" or long form "#aaccee", and should contain the "#" prefix. Colors are interpreted the same as in CSS, in #RRGGBB and #RGB order
\*\* opacity rules: Opacity value must be a floating point number greater than or equal to zero and less or equal to than one ## Additional map elements[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#additional-map-elements "Direct link to Additional map elements") Apart from geometrical features, the map can be enriched by passing the following VIKTOR specific elements in the `MapResult` or `GeoJSONResult`: * [`MapLegend`](https://docs.viktor.ai/sdk/api/views/.md#_MapLegend) * [`MapLabel`](https://docs.viktor.ai/sdk/api/views/.md#_MapLabel) (text directly printed on the map) ``` import viktor as vkt @vkt.MapView(...) def get_map_view(...): ... legend = vkt.MapLegend(...) labels = [ vkt.MapLabel(...), ... ] return vkt.MapResult(features, labels=labels, legend=legend) # or GeoJSONResult ``` ## Interaction with map: selecting objects[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#interaction-with-map-selecting-objects "Direct link to Interaction with map: selecting objects") New in v13.2.0 Map view interaction enables the user to provide extra input by selecting features within a `MapView`, `GeoJSONView`, `MapAndDataView` or `GeoJSONAndDataView`. The interaction can be bound to all [action buttons](https://docs.viktor.ai/docs/create-apps/user-input/action-buttons/.md). ### Implementation[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#implementation "Direct link to Implementation") To setup an interaction on an map view, the following parts need to be implemented: * create an action button in the parametrization and assign an `interaction` * add unique `identifier`s on the map features that you want to be selectable * an `InteractionEvent` is inserted in the action method under the `event` argument. This event can be used to process the selection. The selection is not automatically stored (since you can also combine this with a DownloadButton and don't store anything on the entity). Choose the approriate button for processing the selection. For example selecting an option in an [`OptionField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_OptionField) by means of selection in a `MapView` is achieved by: * adding a [`SetParamsButton`](https://docs.viktor.ai/sdk/api/parametrization/.md#_SetParamsButton) with `interaction=MapSelectInteraction` pointing to the correct view * add unique identifiers on [`MapFeature`](https://docs.viktor.ai/sdk/api/views/.md#_MapFeature)s which are selectable * adding a controller method which processes the interaction event and returns a `SetParamsResult`. This makes sure the selection persists on the params. ``` import viktor as vkt class Parametrization(vkt.Parametrization): city = vkt.OptionField('City', ['Miami', 'Puerto Rico', 'Bermudas']) select_button = vkt.SetParamsButton('Select city from map', method='set_city_from_selection', interaction=vkt.MapSelectInteraction('get_map_view', max_select=1)) class Controller(vkt.Controller): parametrization = Parametrization @vkt.MapView('Map view') def get_map_view(self, params, **kwargs): # Create some points using coordinates miami_point = vkt.MapPoint(25.7617, -80.1918, description='Miami', identifier='Miami') puerto_rico_point = vkt.MapPoint(18.4655, -66.1057, description='Puerto Rico', identifier='Puerto Rico') bermudas_point = vkt.MapPoint(32.3078, -64.7505, description='Bermudas', identifier='Bermudas') # Create a polygon polygon = vkt.MapPolygon([miami_point, puerto_rico_point, bermudas_point]) # Add label of selected location labels = [] if params.city == 'Miami': labels = [vkt.MapLabel(miami_point.lat, miami_point.lon, "Miami", scale=3)] elif params.city == 'Puerto Rico': labels = [vkt.MapLabel(puerto_rico_point.lat, puerto_rico_point.lon, "Puerto Rico", scale=3)] # Visualize map features = [miami_point, puerto_rico_point, bermudas_point, polygon] return vkt.MapResult(features, labels) def set_city_from_selection(self, params, event, **kwargs): selected_city = event.value[0] return vkt.SetParamsResult({'city': selected_city}) ``` ### MapSelectInteraction settings[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#mapselectinteraction-settings "Direct link to MapSelectInteraction settings") The following settings are available: * `min_select`: minimum number of selected objects by user (default 1) * `max_select`: maximum number of selected objects by user (optional) ### Interaction groups[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#interaction-groups "Direct link to Interaction groups") Sometimes you want to select certain features for one action and other features for another action in the same view. This can be achieved by defining `interaction_groups` on the view result and define a `selection` on the action button. When `selection` is used, only the objects in the chosen `interaction_group` are considered. Objects which only have an identifier will not be selectable. An `interaction_group` is a dictionary with the following structure: * key (`str`), matching the `selection` filter as defined on the button * value: sequence of `MapFeature`s which are part of the group. They can be referenced using the `identifier` or you can use the variable itself ``` import viktor as vkt class Parametrization(vkt.Parametrization): btn1 = vkt.SetParamsButton('Select from European cities', method='set_city_from_selection', interaction=vkt.MapSelectInteraction('visualize_map', selection=['eu_cities'], max_select=1)) btn2 = vkt.SetParamsButton('Select from US cities', method='set_city_from_selection', interaction=vkt.MapSelectInteraction('visualize_map', selection=['us_cities'], max_select=1)) class Controller(vkt.Controller): parametrization = Parametrization @vkt.MapView("Cities", 2) def visualize_map(self, params, **kwargs): ... amsterdam = vkt.MapPoint(52.377956, 4.897070, identifier='Amsterdam') rotterdam = vkt.MapPoint(51.924419, 4.477733) berlin = vkt.MapPoint(52.520008, 13.404954, identifier='Berlin') new_york = vkt.MapPoint(40.712776, -74.005974, identifier='New York') ... my_interaction_groups = { 'eu_cities': [amsterdam, berlin], # or point to the identifier: ['Amsterdam', 'Berlin'] 'us_cities': [new_york], # or point to the identifier: ['New York'] } return vkt.MapResult(..., interaction_groups=my_interaction_groups) ``` ## Testing[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#testing "Direct link to Testing") New in v13.3.0 `mock_View` decorator for easier testing of view methods Methods decorated with `@MapView`, `@MapAndDataView`, `@GeoJSONView`, or `@GeoJSONAndDataView` need to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. ``` import unittest from viktor.testing import mock_View from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_View(MyEntityTypeController) def test_map_view(self): params = ... result = MyEntityTypeController().map_view(params=params) self.assertEqual(result.features, ...) self.assertEqual(result.labels, ...) ``` --- # Perform an optimization routine An [optimization action](https://docs.viktor.ai/docs/create-apps/user-input/action-buttons/.md#optimization-action) enables the user to perform an optimization routine upon clicking a button, in which different combinations of input parameters are linked to a specific result. The optimization routine should be defined in the app logic and this can either be a brute-force approach or a more sophisticated algorithm if desired. In this guide a brute-force example is demonstrated, to optimize the cost of a sphere. The input variable is the radius of a sphere, and the to be optimized result is the cost which is a function of the volume. ## Implementation[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/optimization-routine/.md#implementation "Direct link to Implementation") Usually an optimization can be split into the following steps: 1. Create an [`OptimizationButton`](https://docs.viktor.ai/sdk/api/parametrization/.md#_OptimizationButton) in the parametrization 2. Add an optimization method on the corresponding controller class 3. Define and return the desired [`OptimizationResult`](https://docs.viktor.ai/sdk/api/result/.md#_OptimizationResult) ### `parametrization.py`[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/optimization-routine/.md#parametrizationpy "Direct link to parametrizationpy") Create an `OptimizationButton` which refers to the controller method `optimize_cost`: ``` class Parametrization(vkt.Parametrization): ... button = vkt.OptimizationButton('Optimize', 'optimize_cost', longpoll=True) ``` ### `controller.py`[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/optimization-routine/.md#controllerpy "Direct link to controllerpy") In the `optimize_cost` method, each possible combination of input parameters with corresponding analysis result should be processed and stored in an `OptimizationResult`: ``` import viktor as vkt from math import pi class Controller(vkt.Controller): parametrization = Parametrization def optimize_cost(self, params, **kwargs): r_min = 5 r_max = 10 results = [] for radius in range(r_min, r_max): # override the existing radius for each loop params = {'radius': radius} # compute the cost volume = 4 / 3 * pi * radius ** 3 cost = volume * params.price_per_m3 # store input params with corresponding result dict results.append(vkt.OptimizationResultElement(params, {'optimized_cost': cost})) output_headers = {'optimized_cost': 'Cost'} return vkt.OptimizationResult(results, output_headers=output_headers) ``` When the optimization routine has finished, a result window like this will pop up: ![](/assets/images/optimization-window-1-232909132ef41c46e5b91a02bb5f3d01.png) Each analysis of the defined loop is listed, and when the result is selected, its corresponding input(s) will be set in the parametrization. It is convenient to link these optimization entries to the input radius. This can be passed to the `OptimizationResult` as follows: ``` def optimize_cost(self, params, **kwargs): ... input_columns = ['radius'] return vkt.OptimizationResult(results, input_columns, output_headers=output_headers) ``` ![](/assets/images/optimization-window-2-95bd362f6b39d0ea2ffc95dc17dc555a.png) Also notice the "Results" button just beneath the OptimizationButton, which can be clicked to switch to a different optimization result. It is recommended to keep the amount of results in the optimization overview limited, and provide a complete overview using an insightful plot which is explained in the next section. ## Add an image[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/optimization-routine/.md#add-an-image "Direct link to Add an image") Next to the table, an image can be shown to visualize the results. This can be done by using the `image` argument in the `OptimizationResult`: ``` def optimize_cost(self, params, **kwargs): ... image = vkt.ImageResult(...) # create image with matplotlib, pygal, plotly, etc. return vkt.OptimizationResult(results, input_columns, image=image, output_headers=output_headers) ``` This renders as follows in the interface: ![](/assets/images/optimization-with-graph-f5d968c4066973d970859b3296310c9d.png) See [how to create an image view](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/images/.md) for more information on how to create an image-result. --- # Show plots, charts & graphs ## Using Plotly[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/plots-charts-graphs/.md#using-plotly "Direct link to Using Plotly") [Plotly](https://github.com/plotly/plotly.py) is a free and open source package that simplifies the creation of interactive graphs, such as line plots, scatter plots, histograms, etc. A Plotly graph can be incorporated in your VIKTOR app by making use of a [`PlotlyView`](https://docs.viktor.ai/sdk/api/views/.md#_PlotlyView). ![](/assets/images/plotly-example-7cc2c057d48c72d55f332639cf4e3707.png) *Example of how an interactive visualization in the PlotlyView could look like (source: plot.ly)* The Plotly graph can either be passed to a [`PlotlyResult`](https://docs.viktor.ai/sdk/api/views/.md#_PlotlyResult) as a `go.Figure` object, or as a valid Plotly `dict`: ``` import viktor as vkt import plotly.graph_objects as go class Controller(vkt.Controller): @vkt.PlotlyView("Plotly view") def get_plotly_view(self, params, **kwargs): fig = go.Figure( data=[go.Bar(x=[1, 2, 3], y=[1, 3, 2])], layout=go.Layout(title=go.layout.Title(text="A Figure Specified By A Graph Object")) ) return vkt.PlotlyResult(fig) ``` ``` import viktor as vkt class Controller(vkt.Controller): @vkt.PlotlyView("Plotly view") def get_plotly_view(self, params, **kwargs): fig = { "data": [{"type": "bar", "x": [1, 2, 3], "y": [1, 3, 2]}], "layout": {"title": {"text": "A Figure Specified By Python Dictionary"}} } return vkt.PlotlyResult(fig) ``` A Plotly view can be combined with data using a [`PlotlyAndDataView`](https://docs.viktor.ai/sdk/api/views/.md#_PlotlyAndDataView) ### Testing[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/plots-charts-graphs/.md#testing "Direct link to Testing") New in v13.3.0 `mock_View` decorator for easier testing of view methods Methods decorated with `@PlotlyView` or `@PlotlyAndDataView` need to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. ``` import unittest from viktor.testing import mock_View from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_View(MyEntityTypeController) def test_plotly_view(self): params = ... result = MyEntityTypeController().plotly_view(params=params) self.assertEqual(result.figure, ...) ``` ## Using Matplotlib[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/plots-charts-graphs/.md#using-matplotlib "Direct link to Using Matplotlib") You can show Matplotlib figures as static images using [`ImageView`](https://docs.viktor.ai/sdk/api/views/.md#_ImageView). If you want an interactive graph and have a more sophisticated data visualisation tool, we recommend using Plotly. Here is an example of how to use Matplotlib: ``` import viktor as vkt import numpy as np import matplotlib.pyplot as plt from io import StringIO class Parametrization(vkt.Parametrization): introduction = vkt.Text("Fill in values for A, B and C to plot the following equation: $y = Ax^2 + Bx + C$") constant_a = vkt.NumberField('A',default=1) constant_b = vkt.NumberField('B', default=1) constant_c = vkt.NumberField('C', default=1) class Controller(vkt.Controller): parametrization = Parametrization @vkt.ImageView("Plot") def createPlot(self, params, **kwargs): fig = plt.figure() x = np.arange(-10, 10, 1) y = params.constant_a*x**2 + params.constant_b*x + params.constant_c plt.plot(x, y) svg_data = StringIO() fig.savefig(svg_data, format='svg') plt.close() return vkt.ImageResult(svg_data) ``` --- # Display a report PDF files can directly be presented in a view using the [`PDFView`](https://docs.viktor.ai/sdk/api/views/.md#_PDFView). ![](/assets/images/view-pdf-2d85cc0a2f99de62de4e63dcd6c9d5d6.png) *PDF view* ## Implementation[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/report/.md#implementation "Direct link to Implementation") There are 3 ways to create a PDF view: 1. [From a File-object](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/report/.md#from-a-file-object) 2. [From a URL](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/report/.md#from-a-url) 3. [From a path](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/report/.md#from-a-path) ### From a `File`-object[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/report/.md#from-a-file-object "Direct link to from-a-file-object") The easiest way to show a PDF document in the `PDFView` is by using a `File` object: ``` import viktor as vkt class Controller(vkt.Controller): @vkt.PDFView("PDF Viewer") def get_pdf_view(self, params, **kwargs): ... return vkt.PDFResult(file=my_pdf_file) ``` note If `File.from_url` is used, the file will always be downloaded first and not rendered from the website, as in the case with the [direct URL](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/report/.md#from-a-url). ### From a URL[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/report/.md#from-a-url "Direct link to From a URL") If a PDF is located on the internet one can also use the URL directly. This does not download the file locally, but renders it directly from the hosting website: ``` import viktor as vkt class Controller(vkt.Controller): @vkt.PDFView("PDF Viewer") def get_pdf_view(self, params, **kwargs): return vkt.PDFResult(url="https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf") ``` Some websites don't allow files to be shared this way. This will result in the PDF not showing up in the view. If that is the case, the `PDFView` can be created from a 'file from url', which will download the file locally first and display it subsequently: ``` import viktor as vkt class Controller(vkt.Controller): @vkt.PDFView("PDF Viewer") def get_pdf_view(self, params, **kwargs): file = vkt.File.from_url(url="https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf") return vkt.PDFResult(file=file) ``` ### From a path[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/report/.md#from-a-path "Direct link to From a path") Finally, it is possible to create a `PDFView` directly from a path (for convenience, to skip creating a `File` from path first): ``` from pathlib import Path import viktor as vkt class Controller(vkt.Controller): @vkt.PDFView("PDF Viewer") def get_pdf_view(self, params, **kwargs): file_path = Path(__file__).parent / 'sample.pdf' return vkt.PDFResult.from_path(file_path) ``` ## Testing[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/report/.md#testing "Direct link to Testing") New in v13.3.0 `mock_View` decorator for easier testing of view methods Methods decorated with `@PDFView` need to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. ``` import unittest from viktor.testing import mock_View from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_View(MyEntityTypeController) def test_pdf_view(self): params = ... result = MyEntityTypeController().pdf_view(params=params) self.assertEqual(result.file.getvalue_binary(), ...) ``` --- # Show a summary A [`Summary`](https://docs.viktor.ai/sdk/api/views/.md#_Summary) is used to store important parameters of an entity. This enables easy sorting and comparing of different entities in an overview. A `Summary` can be defined per entity type (controller), and is optional. A summary can have a maximum of 6 summary items. ## Implementation: from parametrization[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/show-summary/.md#implementation-from-parametrization "Direct link to Implementation: from parametrization") One source of summary items is the parametrization. You can point to a field in the parametrization and the value of this field will be shown in the summary. The following fields can be used in a summary: * [`NumberField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_NumberField) * [`IntegerField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_IntegerField) * [`TextField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_TextField) Adding a summary is done with the following steps: 1. Add a controller `summary` attribute: ``` import viktor as vkt class Controller(vkt.Controller): summary = vkt.Summary() ... ``` 2. Add a SummaryItem and link to the parametrization: ``` import viktor as vkt class Controller(vkt.Controller): summary = vkt.Summary( item_1=vkt.SummaryItem('Length', float, 'parametrization', 'geometry.input.length', prefix='m') ) ... ``` Above example assumes the following parametrization: ``` import viktor as vkt class Parametrization(vkt.Parametrization): geometry = vkt.Tab(...) geometry.input = vkt.Section(...) geometry.input.length = vkt.NumberField(...) ``` ## Implementation: from results[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/show-summary/.md#implementation-from-results "Direct link to Implementation: from results") When a view contains data (e.g. `DataView`, `GeometryAndDataView`, etc.), that data can be used in the summary. note `SummaryItem`s can only be obtained from a "quick" view (i.e. without manual update button). 1. Add a controller `summary` attribute: ``` import viktor as vkt class Controller(vkt.Controller): summary = vkt.Summary() ... ``` 2. Create a `DataView` which returns the result(s) that should be shown on the summary: ``` import viktor as vkt class Controller(vkt.Controller): @vkt.DataView("Cost") def calculate_cost(self, params, **kwargs): # app specific cost calculation material_cost = ... total_cost = material_cost + ... data = vkt.DataGroup( total_cost=vkt.DataItem('Total cost', total_cost, prefix='€', subgroup=vkt.DataGroup( material_cost=vkt.DataItem('Material', material_cost, prefix='€') )) ) return vkt.DataResult(data) ``` 3. Add a `SummaryItem` and link to the `DataItem` (in this example the material cost): ``` import viktor as vkt class Controller(vkt.Controller): summary = vkt.Summary(item_1=vkt.SummaryItem('Materials', float, 'calculate_cost', 'total_cost.material_cost', prefix='€')) ... ``` Keep in mind that when creating a `DataGroup` you can pass a list or dict of data items. When you use a list however, the items can not be used in the `Summary`, because there is no keyword that functions as link between the result and the summary. ## Prefix/suffix[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/show-summary/.md#prefixsuffix "Direct link to Prefix/suffix") The prefix/suffix that is defined on the `SummaryItem` is stored in the database and has to be static, such that it can be used to for example sort entities of a certain entity type. This means that there cannot be any inconsistency between prefix/suffix definitions of an entity type and they **should not be changed**. The prefix/suffix of a `DataItem` however can in most cases be dynamic. A good example is when the result of an analysis is a reaction force in Newtons. Since this result is dynamic and can potentially be extremely large, a user could find it more convenient to show this result in kN. This unit can switch with every call and this dynamic behavior holds for all `DataItem`s. However, when the result is used in the `Summary`, the prefix/suffix of the `DataItem` should be equal to the prefix/suffix of the `SummaryItem` and **static** as explained above. --- # Storing results ## Persistent storage[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/storing-results/.md#persistent-storage "Direct link to Persistent storage") VIKTOR offers a [`Storage`](https://docs.viktor.ai/sdk/api/core/.md#_Storage) which can be used to store and retrieve files within an app instance in a project. The storage is persistent, meaning that the data will remain available with no time limit. This can be very helpful in cases where (intermediate) results need to be shared between jobs. For example, a long-running task is performed in job 'A', of which the results can be accessed in job 'B' without the need to rerun the task. ### Supported operations[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/storing-results/.md#supported-operations "Direct link to Supported operations") The storage can be accessed from an app with the `Storage` methods as shown below: ``` import viktor as vkt # Setting data on a key vkt.Storage().set('data_key_1', data=vkt.File.from_data('abc'), scope='entity') vkt.Storage().set('data_key_2', data=vkt.File.from_data('def'), scope='entity') # Retrieve the data by key vkt.Storage().get('data_key_1', scope='entity') # List available data keys (by prefix) vkt.Storage().list(scope='entity') # lists all files in current entity scope vkt.Storage().list(prefix='data_key_', scope='entity') # lists 'data_key_1', 'data_key_2', ... etc. # Delete data by key vkt.Storage().delete('data_key_1', scope='entity') ``` ### Storage scopes[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/storing-results/.md#storage-scopes "Direct link to Storage scopes") With the `scope` argument the 'accessibility' of the stored data can be set. The following scopes are available: * **entity**: when data needs to be accessed within a specific entity (usable in 'simple' and 'tree' type apps) * **workspace**: when data needs to be accessed workspace-wide (usable in 'simple' and 'tree' type apps) * **session** (>= v14.28.0): when data needs to be accessed within an editor session (usable in all app types) #### scope 'entity'[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/storing-results/.md#scope-entity "Direct link to scope 'entity'") The entity scope means that the data is assigned to a specific entity. A common use-case for this scope is to store results of a long-running task (analysis, file parsing, etc.) and retrieve it without the need to rerun the task. For example, data is stored in entity A1 on key `entity_data`. VIKTOR stores the data in a zone in the storage designated for entity A1: ``` vkt.Storage().set('entity_data', data=vkt.File.from_data('content set by A1'), scope='entity') ``` This data can then be retrieved in entity A1 using the `get` operation: ``` vkt.Storage().get('entity_data', scope='entity') # File content: 'content set by A1' ``` When we would try to perform this `get` operation in entity A2, a `FileNotFound` error will be raised because the file does not (yet) exist in the storage zone designated for entity A2. This also means that we can re-use the same key to set data, without overwriting the data stored in entity A1: ``` vkt.Storage().set('entity_data', data=vkt.File.from_data('content set by A2'), scope='entity') ``` It is also possible to store/retrieve data from one entity in another (even with entities of different type). This cross-entity referencing can be achieved by passing the relevant `Entity` object as `entity` argument: ``` entity = ... # retrieve entity A1 vkt.Storage().get('entity_data', scope='entity', entity=entity) # File content: 'content set by A1' ``` tip See [this guide](https://docs.viktor.ai/docs/api/sdk/handling-entity-data/.md) on how to navigate to the correct entity using the API. #### scope 'workspace'[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/storing-results/.md#scope-workspace "Direct link to scope 'workspace'") The workspace scope means that the data is accessible workspace-wide. All entities of all types will point towards the same section in the storage with this scope. This scope can be seen as an extension of the [`memoize`](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/storing-results/.md#memoize) functionality, with the difference that the stored results are permanent. In entity A1 the following data is stored on key `workspace_data` using the workspace scope: ``` vkt.Storage().set('workspace_data', data=vkt.File.from_data('content set by A1'), scope='workspace') ``` Storing data in entity A2 on the same key using the workspace scope overwrites the previously stored data: ``` vkt.Storage().set('workspace_data', data=vkt.File.from_data('content set by A2'), scope='workspace') ``` When we retrieve this key in either entity A1, entity A2, or even an entity from TypeB, the returned file content will be the data which is stored last (in this case 'content set by A2'). #### scope 'session'[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/storing-results/.md#scope-session "Direct link to scope 'session'") New in v14.28.0 The session scope means that data is accessible within a user's current session. This is particularly useful in editor-type apps, but can also be used in simple and tree-type apps. Data stored with session scope is automatically deleted when the session closes (e.g., the user closes the tab). This differs from 'entity' and 'workspace' scopes where data persists indefinitely. Sessions are unique to each user and not shared. This means person 1 cannot access data stored by person 2, even when using the same app simultaneously. For example, data stored in session A on key `session_data`: ``` vkt.Storage().set('session_data', data=vkt.File.from_data('content set in session A'), scope='session') ``` This data can be retrieved in the same session A using the `get` operation: ``` vkt.Storage().get('session_data', scope='session') # File content: 'content set in session A' ``` ## Memoize[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/storing-results/.md#memoize "Direct link to Memoize") To store (long-running) results temporarily you can also make use of the [`memoize`](https://docs.viktor.ai/sdk/api/utils/.md#_memoize) function. A practical use-case of `memoize` is when a function call has input and output that is relatively small compared to the time required for its evaluation. Cached results are kept for a maximum of 24 hours. In below example, a `DataView` performs a long-running calculation when calling `func`. When the user changes input in the editor and updates the view again, `func` will only be evaluated again if either one of `param_a`, `param_b`, or `param_c` is changed in-between jobs: ``` import viktor as vkt @vkt.memoize def func(*, param_a, param_b, param_c): # perform lengthy calculation return result class Controller(vkt.Controller): @vkt.DataView("Results", duration_guess=30) def get_data_view(self, params, **kwargs): ... result = func(param_a=..., param_b=..., param_c=...) ... return vkt.DataResult(...) ``` caution When using `memoize` on your **development workspace** the cache is stored locally. The local storage is limited to 50 function calls for practical reasons. If the limit is exceeded, cached results are cleared based on the first-in-first-out principle. In production the storage is unlimited. --- # Show a 3D model This guide explains how to visualize 3D models. There are multiple ways to achieve this: 1. From [geometry elements](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#geometry-elements) from the `viktor.geometry` module 2. From a [glTF/GLB file](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#gltfglb-file) 3. From a [3DM file](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#rhinoceros-3dm-file) (>= v14.4.0) 4. From an [IFC file](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#ifcview) (>= v14.6.0) Depending on the method above, either a [`GeometryView`](https://docs.viktor.ai/sdk/api/views/.md#_GeometryView) or an [`IFCView`](https://docs.viktor.ai/sdk/api/views/.md#_IFCView) needs to be used. Both views can be combined with data using a [`GeometryAndDataView`](https://docs.viktor.ai/sdk/api/views/.md#_GeometryAndDataView) and [`IFCAndDataView`](https://docs.viktor.ai/sdk/api/views/.md#_IFCAndDataView). ![](/assets/images/view-geometry-c4890a2c034a8ebc6e476bd8367e66e9.png) ## GeometryView[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#geometryview "Direct link to GeometryView") ### Geometry elements[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#geometry-elements "Direct link to Geometry elements") New in v13.5.0 `Arc`, `Line`, and `Polyline` can be visualized in the `GeometryView` A [`GeometryResult`](https://docs.viktor.ai/sdk/api/views/.md#_GeometryResult) can be constructed using geometry elements (`TransformableObject`) from the [`viktor.geometry`](https://docs.viktor.ai/sdk/api/geometry/.md) module. The created 3D visualization uses a right-handed axis system with Z pointing upwards by default (see [view settings](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#view-settings) to overwrite this). #### Groups[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#groups "Direct link to Groups") A visualization group ([`Group`](https://docs.viktor.ai/sdk/api/geometry/.md#_Group)) can be used to combine multiple visualization elements. A `Group` can contain two types of objects: `Group`, `TransformableObject`. This enables a hierarchical construction of visualization elements. Example: ``` import viktor as vkt class Controller(vkt.Controller): @vkt.GeometryView("Geometry", x_axis_to_right=True) def get_geometry_view(self, params, **kwargs): # Define Materials glass = vkt.Material("Glass", color=vkt.Color(150, 150, 255)) facade = vkt.Material("Facade", color=vkt.Color.white()) # Create one floor width = 30 length = 30 number_of_floors = 20 floor_glass = vkt.SquareBeam(width, length, 2, material=glass) floor_facade = vkt.SquareBeam(width + 1, length + 1, 1, material=facade) floor_facade.translate([0, 0, 1.5]) # Pattern (duplicate) the floor to create a building floor = vkt.Group([floor_glass, floor_facade]) building = vkt.LinearPattern(floor, direction=[0, 0, 1], number_of_elements=number_of_floors, spacing=3) return vkt.GeometryResult(building) ``` #### Specifying color[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#specifying-color "Direct link to Specifying color") Every `TransformableObject` has an assigned default material. This material can be overwritten with your own, specifying, for example, the color: ``` glass = vkt.SquareBeam(..., material=vkt.Material("Glass", color=vkt.Color(150, 150, 255))) # or glass = vkt.SquareBeam(...) glass.material = vkt.Material("Glass", color=vkt.Color(150, 150, 255)) ``` #### Transformations[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#transformations "Direct link to Transformations") Transformation methods can be called on a `TransformableObject`, to position and orientate the object. The [`Vector`](https://docs.viktor.ai/sdk/api/geometry/.md#_Vector) object can come in handy if your visualization requires vector transformations. The following methods are available on all geometric objects (through inheritance of `TransformableObject`): * [translate](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#translate) * [rotate](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#rotate) * [mirror](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#mirror) * [scale](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#scale) For each type of transformation an example is provided below. Chaining of transformations is possible, however be careful with the specified order. ##### translate[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#translate "Direct link to translate") ``` sphere = vkt.Sphere(vkt.Point(0, 0, 0), radius=10) # sphere is now centered around (0, 0, 0) sphere.translate([10, 0, 0]) # sphere is now centered around (10, 0, 0) ``` ##### rotate[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#rotate "Direct link to rotate") ``` import math box = vkt.RectangularExtrusion(1, 1, line=vkt.Line(vkt.Point(0, 0, -0.5), vkt.Point(0, 0, 0.5))) # box is now centered around (0, 0, 0) box.rotate(math.pi / 4, direction=[0, 0, 1]) # box is now rotated 45 degrees around the z-axis according to the right-hand-rule ``` ##### mirror[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#mirror "Direct link to mirror") ``` sphere = vkt.Sphere(vkt.Point(0, 0, 1), radius=10) # sphere is now centered around (0, 0, 1) sphere.mirror(vkt.Point(0, 0, 0), [0, 0, 1]) # sphere is a now mirrored in the x-y plane (normal vector in z-direction), centered around (0, 0, -1) ``` ##### scale[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#scale "Direct link to scale") ``` sphere = vkt.Sphere(vkt.Point(0, 0, 1), radius=10) # sphere is now centered around (0, 0, 1) sphere.scale([2, 2, 1]) # sphere is stretched in x- and y-direction, centered around (0, 0, 1) ``` ### glTF/GLB file[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#gltfglb-file "Direct link to glTF/GLB file") A `GeometryResult` can also be constructed from a [glTF/GLB (v2.0)](https://en.wikipedia.org/wiki/GlTF#glTF_2.0) file. This can be an existing local model: ``` from pathlib import Path import viktor as vkt class Controller(vkt.Controller): @vkt.GeometryView('Geometry view', x_axis_to_right=True) def get_geometry_view(self, params, **kwargs): geometry = vkt.File.from_path(Path(__file__).parent / "my_model.gltf") # or .glb return vkt.GeometryResult(geometry) ``` Or one available on the internet: ``` geometry = vkt.File.from_url("https://github.com/KhronosGroup/glTF-Sample-Models/raw/master/2.0/CesiumMilkTruck/glTF-Binary/CesiumMilkTruck.glb") return vkt.GeometryResult(geometry) ``` Or can be generated by means of [trimesh](https://trimsh.org/) (or any other Python geometry package that allows for exporting to glTF/GLB): ``` import trimesh import viktor as vkt class Controller(vkt.Controller): @vkt.GeometryView('Geometry view', x_axis_to_right=True) def get_geometry_view(self, params, **kwargs): sphere = trimesh.creation.uv_sphere(10) scene = trimesh.Scene(geometry={'sphere': sphere}) geometry = vkt.File() # create a writable file with geometry.open_binary() as w: w.write(trimesh.exchange.gltf.export_glb(scene)) return vkt.GeometryResult(geometry) ``` note glTF/GLB models are defined with the Y-axis up. In VIKTOR the default up-axis is the Z-axis, resulting in the model to be shown on its side. In order to overwrite this, you can set the `up_axis` manually in the [view settings](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#view-settings): ``` @vkt.GeometryView("My glTF View", up_axis='Y') ``` ### Rhinoceros 3DM file[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#rhinoceros-3dm-file "Direct link to Rhinoceros 3DM file") New in v14.4.0 Similar to a glTF/GLB file, a 3DM file can be visualized by specifying the `geometry_type` argument (default: "gltf"): ``` geometry = vkt.File.from_url("https://github.com/mrdoob/three.js/raw/master/examples/models/3dm/Rhino_Logo.3dm") return vkt.GeometryResult(geometry, geometry_type="3dm") ``` ### Labels[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#labels "Direct link to Labels") Regardless of how the geometry is defined (geometry elements, glTF/GLB, or 3DM), additional labels can be added to the visualization: ``` import viktor as vkt labels = [ vkt.Label(vkt.Point(0, 0, 0), "Origin"), vkt.Label(vkt.Point(1, 0, 0), "x=1") ] return vkt.GeometryResult(solar_system, labels=labels) ``` ### View settings[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#view-settings "Direct link to View settings") The following settings can be applied to a `GeometryView`: * view\_mode: str value to switch between '3D' (default) and '2D'. The created 2D visualization shows the xy-plane. * default\_shadow: bool value to define whether shadow is turned off (default) or on when entering the editor. User can still overrule. * up\_axis: str value ('Y' or 'Z') to define the upwards pointing axis (view\_mode = '3D' only, default: 'Z'). Example: ``` @vkt.GeometryView("Top view", view_mode='2D', default_shadow=False) ``` ## IFCView[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#ifcview "Direct link to IFCView") New in v14.6.0 An IFC file can be visualized by using the [`IFCView`](https://docs.viktor.ai/sdk/api/views/.md#_IFCView). This can be an existing local model: ``` import viktor as vkt class Controller(vkt.Controller): @vkt.IFCView('IFC view') def get_ifc_view(self, params, **kwargs): ifc = vkt.File.from_path(Path(__file__).parent / 'sample.ifc') return vkt.IFCResult(ifc) ``` Or one available on the internet: ``` ifc = vkt.File.from_url("https://raw.githubusercontent.com/buildingSMART/Sample-Test-Files/master/IFC%202x3/Duplex%20Apartment/Duplex_A_20110907.ifc") return vkt.IFCResult(ifc) ``` New in v14.6.1 In order to improve performance it is possible to use the value of a FileField (i.e. FileResource) directly: ``` IFCResult(params.file_field) ``` ## Selecting geometries[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#selecting-geometries "Direct link to Selecting geometries") New in 14.10.0 It is possible to let the user [select geometries](https://docs.viktor.ai/docs/create-apps/user-input/geometry-selection/.md) directly in an `IFCView` or `GeometryView`. ## Testing[​](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#testing "Direct link to Testing") New in v13.3.0 `mock_View` decorator for easier testing of view methods Methods decorated with `@GeometryView`, `@GeometryAndDataView`, `@IFCView`, or `@IFCAndDataView` need to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. ``` import unittest from viktor.testing import mock_View from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_View(MyEntityTypeController) def test_geometry_view(self): params = ... result = MyEntityTypeController().geometry_view(params=params) self.assertEqual(result.geometry, ...) self.assertEqual(result.labels, ...) ``` --- # Types of integrations VIKTOR allows you to perform analyses using third-party software directly from your app interface. This guide explains how to integrate external software into your VIKTOR application. There are various ways to connect to third-party tools. Some software runs locally on the user's machine, while others are accessed through online servers. Each approach requires a different integration method, which will be covered in this guide. Summarizing the different methods to integrate with third-party software: | Integration | Installation | Usage | Admin required | | ------------------- | ------------ | -------- | -------------- | | Personal worker | local | personal | no | | Organization worker | local | shared | yes | | API tokens | cloud | shared | no | | OAuth 2.0 | cloud | personal | yes | ## Supported software[​](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#supported-software "Direct link to Supported software") Currently, we provide dedicated integrations for the software packages listed in the table below. If the software package that you want to interact with is not listed below, you can make use of our [generic integrations](https://docs.viktor.ai/docs/create-apps/software-integrations/generic/.md). tip Whether or not the software package you want to integrate with is listed, please reach out to us if you need help setting up an integration through the [Community Forum](https://community.viktor.ai/)! | Software package | API reference | Worker name\* | | --------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------- | | [AutoCAD](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md) | [`viktor.external.autocad`](https://docs.viktor.ai/sdk/api/external/autocad/.md) | `autocad` | | [Autodesk Construction Cloud](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-construction-cloud/.md) | [ACC Documentation](https://aps.autodesk.com/en/docs/acc/v1/overview/) | - | | [Autodesk Forma Site Design](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-forma-site-design/.md) | [Forma API Documentation](https://aps.autodesk.com/en/docs/forma/v1/overview/getting-started) | - | | [Autodesk Platform Services](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-platform-services/.md) | [APS Documentation](https://aps.autodesk.com/developer/documentation) | - | | [AxisVM](https://docs.viktor.ai/docs/create-apps/software-integrations/axisvm/.md) | [`viktor.external.axisvm`](https://docs.viktor.ai/sdk/api/external/axisvm/.md) | `axisvm` | | [BoreDM](https://docs.viktor.ai/docs/create-apps/software-integrations/boredm/.md) | [website](https://boredm.com) | - | | [Bentley iTwin](https://docs.viktor.ai/docs/create-apps/software-integrations/iTwin/.md) | [iTwin Platform API](https://developer.bentley.com/apis/) | - | | [Civil 3D](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md) | [`viktor.external.civil3d`](https://docs.viktor.ai/sdk/api/external/civil3d) | `civil3d` | | [Databricks](https://docs.viktor.ai/docs/create-apps/software-integrations/databricks/.md) | [Databrick SDK for python](https://databricks-sdk-py.readthedocs.io/en/latest/) | - | | [D-Foundations](https://docs.viktor.ai/docs/create-apps/software-integrations/dfoundations/.md) | [`viktor.external.dfoundations`](https://docs.viktor.ai/sdk/api/external/dfoundations/.md) | `dfoundations` | | [D-Geo Stability](https://docs.viktor.ai/docs/create-apps/software-integrations/dgeostability/.md) | [`viktor.external.dgeostability`](https://docs.viktor.ai/sdk/api/external/dgeostability/.md) | `dgeostability` | | [D-Settlement](https://docs.viktor.ai/docs/create-apps/software-integrations/dsettlement/.md) | [`viktor.external.dsettlement`](https://docs.viktor.ai/sdk/api/external/dsettlement/.md) | `dsettlement` | | [D-Sheet Piling](https://docs.viktor.ai/docs/create-apps/software-integrations/dsheetpiling/.md) | [`viktor.external.dsheetpiling`](https://docs.viktor.ai/sdk/api/external/dsheetpiling/.md) | `dsheetpiling` | | [D-Stability](https://docs.viktor.ai/docs/create-apps/software-integrations/dstability/.md) | [`viktor.external.dstability`](https://docs.viktor.ai/sdk/api/external/dstability/.md) | `dstability` | | [Dynamo Nodes](https://docs.viktor.ai/docs/create-apps/software-integrations/dynamo-nodes/.md) | [website](https://primer.dynamobim.org/index.html) | - | | [Dynamo Sandbox](https://docs.viktor.ai/docs/create-apps/software-integrations/dynamo/.md) | [`viktor.external.dynamo`](https://docs.viktor.ai/sdk/api/external/dynamo/.md) | `dynamo` | | [ETABS](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000/.md#calling-the-api-directly-from-your-app) | [`viktor.external.etabs`](https://docs.viktor.ai/sdk/api/external/etabs/.md) | `etabsconnect` | | [ETABS (Legacy)](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000/.md#sending-a-python-script-to-the-worker) | [`viktor.external.etabs`](https://docs.viktor.ai/sdk/api/external/etabs/.md) | `etabs` | | [Excel](https://docs.viktor.ai/docs/create-apps/software-integrations/excel/.md) | [`viktor.external.excel`](https://docs.viktor.ai/sdk/api/external/excel/.md) | `excel` | | [GEOLIB](https://docs.viktor.ai/docs/create-apps/software-integrations/geolib/.md) | [website](https://github.com/Deltares/GEOLib) | - | | [Grasshopper / Rhino](https://docs.viktor.ai/docs/create-apps/software-integrations/rhino-grasshopper/.md) | [`viktor.external.grasshopper`](https://docs.viktor.ai/sdk/api/external/grasshopper/.md) | `grasshopper` | | [GRLWEAP](https://docs.viktor.ai/docs/create-apps/software-integrations/grlweap/.md) | [`viktor.external.grlweap`](https://docs.viktor.ai/sdk/api/external/grlweap/.md) | `grlweap` | | [IDEA StatiCa Concrete](https://docs.viktor.ai/docs/create-apps/software-integrations/idea/.md) | [`viktor.external.idea_rcs`](https://docs.viktor.ai/sdk/api/external/idea/.md) | `idearcs` | | [Matlab](https://docs.viktor.ai/docs/create-apps/software-integrations/matlab/.md) | [`viktor.external.matlab`](https://docs.viktor.ai/sdk/api/external/matlab/.md) | `matlab` | | [Microsoft](https://docs.viktor.ai/docs/create-apps/software-integrations/microsoft/.md) | [Microsoft Graph API](https://learn.microsoft.com/en-us/graph/overview) | - | | [PLAXIS](https://docs.viktor.ai/docs/create-apps/software-integrations/plaxis/.md) | [`viktor.external.plaxis`](https://docs.viktor.ai/sdk/api/external/plaxis/.md) | `plaxis` | | Python | [`viktor.external.python`](https://docs.viktor.ai/sdk/api/external/python/.md) | `python` | | [Revit](https://docs.viktor.ai/docs/create-apps/software-integrations/revit/.md) | [`viktor.external.revit`](https://docs.viktor.ai/sdk/api/external/revit/.md) | `revit` | | [RFEM](https://docs.viktor.ai/docs/create-apps/software-integrations/rfem/.md) | [`viktor.external.rfem`](https://docs.viktor.ai/sdk/api/external/rfem/.md) | `rfem` | | [Robot Structural Analysis](https://docs.viktor.ai/docs/create-apps/software-integrations/robot/.md) | [`viktor.external.robot`](https://docs.viktor.ai/sdk/api/external/robot/.md) | `robot` | | [SAP2000](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000/.md#calling-the-api-directly-from-your-app) | [`viktor.external.sap2000`](https://docs.viktor.ai/sdk/api/external/sap2000/.md) | `sap2000connect` | | [SAP2000 (Legacy)](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000/.md#sending-a-python-script-to-the-worker) | [`viktor.external.sap2000`](https://docs.viktor.ai/sdk/api/external/sap2000/.md) | `sap2000` | | [SCIA Engineer](https://docs.viktor.ai/docs/create-apps/software-integrations/scia/.md) | [`viktor.external.scia`](https://docs.viktor.ai/sdk/api/external/scia/.md) | `scia` | | [Bentley STAAD.Pro](https://docs.viktor.ai/docs/create-apps/software-integrations/staadpro/.md) | [`website`](https://docs.bentley.com/LiveContent/web/STAAD.Pro%20Help-v13/ja/GUID-576C4246-6A58-41D4-9F9A-9909FD744524.html) | `python` | | [TabLogs](https://docs.viktor.ai/docs/create-apps/software-integrations/tablogs/.md) | [`website`](https://tablogs.com/) | - | | [Tekla](https://docs.viktor.ai/docs/create-apps/software-integrations/tekla/.md) | [`viktor.external.tekla`](https://docs.viktor.ai/sdk/api/external/tekla/.md) | `tekla` | | [Trimble Connect](https://docs.viktor.ai/docs/create-apps/software-integrations/trimble-connect/.md) | [`website`](https://developer.trimble.com/docs/connect/) | - | \* Name of the worker integration in [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#worker_integrations) ## Workers[​](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#workers "Direct link to Workers") A lot of engineering software runs locally on your machine. While you could integrate with this software during development (the code runs on the same computer), this will break if your app is used by others in production. In production your app runs on a server and this server does not have access to your machine. Workers solve this issue. A worker is a small application (executable) that is installed on the computer with access to the local software. It creates a secure connection with the VIKTOR platform, enabling the web applications to integrate with the local software and execute tasks. A worker is always assigned to one or multiple apps and when executed will run in the background and wait for a 'task'. This task consists of the input(s) required for the software. When the worker receives the task, it will call the software and perform an analysis with the provided input(s). Meanwhile, the application from which the task is sent waits until the worker finishes the calculation and sends back the results. The following schematic shows this concept: ![](/assets/images/explanation-worker-flow-6ece47d1b104d4472c8d1825c7b350e6.png) *VIKTOR worker flow* Personal workers are installed, run, and monitored with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md): a single Windows app in which you log in once with your VIKTOR account and start the workers you need. Workers that were installed with the previous per-worker installers [keep running](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#migrate-existing-workers-to-viktor-desktop), but new personal workers are added exclusively through VIKTOR Desktop. ### Installation[​](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#installation "Direct link to Installation") * **Personal workers**: install and enable the worker with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md). * **Organization workers**: follow the steps listed in [installation](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#installation). ### Implementation example[​](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#implementation-example "Direct link to Implementation example") Each worker integration makes use of [`viktor.ExternalProgram`](https://docs.viktor.ai/sdk/api/external/external-program/.md#_ExternalProgram). The [`ExternalProgram.execute`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute) method is the trigger to send a task to the worker on the external machine. The following piece of code shows an example implementation of an integration with SCIA Engineer: ``` import viktor as vkt input_esa = ... input_xml = ... input_xml_def = ... scia_analysis = vkt.scia.SciaAnalysis(input_xml, input_xml_def, input_esa) scia_analysis.execute(timeout=300) # triggers the worker, wait until complete results = scia_analysis.get_xml_output_file() ``` ### Multiple worker instances[​](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#multiple-worker-instances "Direct link to Multiple worker instances") The VIKTOR - worker interaction is configured such that it can easily be scaled up (or down). For example, the worker application can execute multiple instances (processes) of the software package. ![](/assets/images/explanation-worker-flow-multiple-1789277e5960b77830644948d7feebeb.png) *Worker running multiple processes on single machine* note Running parallel routines requires a worker version of at least v4.7.1 and should **not** be a generic worker. A worker can also be executed multiple times across multiple different machines. Tasks are distributed randomly over the running worker instances, and thus multiple users can make use of the external integration at the same time. ![](/assets/images/explanation-worker-flow-multiple-machines-0aee0d9e7f546151e6c9465db01cd8f9.png) *Multiple workers across multiple machines* caution Parallel execution has to be supported by the software. Often each job will require an individual license of the software. So when 2 jobs run in parallel, this will probably require 2 software licenses as well. If no license is available, the worker will fail to execute the program and the external analysis will return a LicenseError to the VIKTOR application (unless a TimeoutError is returned first). ### Worker status[​](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#worker-status "Direct link to Worker status") Within the VIKTOR interface, a user can see the status of the connected workers via the icon in the top right corner: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA0kAAACACAYAAADediKhAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAACM6SURBVHhe7d17cFTXnSfwb7/UarXUQgIJEN22kSiTSJA1XuJI3qQSwIMclxG1WxbY2FuVMnKtNzWTAN5Ure3Ei0ns/OEC2ZmUx1kLV6Y2kICmJgu4HJMx2K5JLMXxgjcgTWAREu5G6NmCK7VarX5o/7j9PHq3+nHv7e+n6lbU51w16ZYL+qvfOb+ju3PnzhSIiIiIiIgIAKAXB4iIiIiIiHIZQxIREREREVEchiQiIiIiIqI4DElERERERERxGJKIiIiIiIji6NjdjohINjqpw5BXBwBYWxyKjv/VrceVYUP08X+wB7DCEvur869uPWx5UzAbgOVx40RERKRODElElJN8QR3Mhthff/+rIw+jk3JAKsqbwn+umYzO/XVYj/NfmKKPd66bxJqi2Pe+edEc/XptcRDfrgxEHxMREZH6MCQRUU7wBXUY9gLXbxtwxa3H+tIQvm6PhZnzN4zwBYGiPMCWN4WvlAcTvncyLvfkGRENWL6gDn8Z0MMXlKtQawqn8NXVsZt/d92E0UkdKgpDqFwWREUh/8olIiJSOoYkIsoJvqAOv+owwReUq0VfKg1i693pr/j87/9nQu+YvP1TrFARERGRMjEkEZHm+II6XHHrsNwyhTVxlZtPbxmwwjKFNUVTCUvt0k2a1KF3VA9fEPh3cRWqvwwakGeYwpdKY/ufiIiIKPt0w8PDmfuk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U1YAfOue2FxrZ7jldj5gy0uc8wXk740oK4jtGfIF5GV90qR8plFVSeL3fnQjPF4KrCvJbAWLiIgo1zEkEREtwekrQNeI/LXNDOzdFJvrGAR+3xV73FgdO5fJFwDe/Cw2V10mn9tERERE2ceQRES0RL6AXBGaCCTuE+pyA9fCAQoANq0GyuPadV9zy3udzAZ2pSMiIlIShiQiIiIiIqI4yYYktgAnIiIiIiKKw5BEREREREQUhyGJiIiIiIgoDkMSERERERFRHJ3L5WLjBiIiIiIi0pxAIJBU4wZdT08PQxIREREREWlSUiGJLcCJiIiIiEiLJEkShxaEe5KIiIiIiIjiMCQRERERERHFYUgiIiIiIiKKw5BEREREREQUhyGJiIiIiIgoDkMSERERERFRHIYkIiIiIiKiOAxJREREREREcf4/TNvNz1X12fYAAAAASUVORK5CYII=) This gives a user insights in: * which workers are connected and available * how many workers per external package are connected * whether a worker is currently running a job or not ![](/assets/images/integration-status-modal-f7d09827c33ddb70153eed903abec6b0.png) *Worker status* Note that the worker status does not provide information about licenses being available or not. For personal workers, the editor also shows whether your worker is online or offline. If a worker is offline, the editor can open [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#worker-status-in-the-editor) for you, where you can look up the worker and start it. #### What does the status of my worker mean?[​](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#what-does-the-status-of-my-worker-mean "Direct link to What does the status of my worker mean?") The status shown for each worker or integration has the following meaning: * **Connected**: the connection status applies to a cloud connection. This status means that a connection is successfully established. * **Connected (idle)**: the idle connection status applies to a worker. This status means that the connection is ready to execute app code. * **Busy**: when the connection is busy it is executing app code. * **Offline**: when a connection is offline it cannot be used to execute app code. * **Requires setup**: the connection has not yet been set up. * **Blocked**: the integration has been blocked by your administrator. ![](/assets/images/integration-status-modal-with-work-status-7c286e706c54479491e684ff45979bc7.png) *The meaning of each status, as explained in the integration status modal* ### Personal workers vs Organization workers[​](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#personal-workers-vs-organization-workers "Direct link to Personal workers vs Organization workers") Personal workers connect software running on your personal computer to the VIKTOR cloud. This allows your own local tools to interact with VIKTOR securely. Organization workers connect software running on your organization or cloud servers to the VIKTOR cloud. This allows for centralized, scalable, and shared connections that mutliple users within your VIKTOR environment can access. | Integration | Installed on | Installed by | Purpose | | ------------------- | --------------------- | ---------------- | ---------------------------------- | | Personal worker | Personal computer | Individual users | Connect local software | | Organization worker | Organization's server | Admins | Connect organization-wide software | Personal workers are installed and managed with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md); organization workers use the [existing installation flow](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#installation). ## API tokens[​](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#api-tokens "Direct link to API tokens") When you want to integrate with online software, you don't need a worker, but you do need to take care of authentication. Most online programms support the use of API tokens for external access. An API token is a substitute for the username and password in a manual login flow. This token (sort of password) should be kept secret and not stored in the source code. In VIKTOR you can insert these tokens through [environment variables](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/environment-variables/.md). This environment variable is available for all instances of this app and all users using this app. ## OAuth 2.0[​](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#oauth-20 "Direct link to OAuth 2.0") Some online software supports (or requires) a more elaborate authentication flow, called OAuth 2.0. OAuth 2.0 is a widely supported authorization protocol that allows users to grant third-party applications limited access to their data, without requiring them to share their passwords. In this type of integration, users are directed to an external login page to authenticate. The authentication is personalized and will only give access to parts of the external software that this specific user has access to. Setting up and using an OAuth 2.0 integration is done as follows: 1. Creating an OAuth 2.0 integration (admin) 2. Implementing the integration in an app (developer) 3. Using the integration by logging in (user) VIKTOR provides both specific OAuth 2.0 integrations as well as a generic OAuth 2.0 integration, giving you the possibility to connect to any external software package that supports this protocol. ### 1. Creating an OAuth 2.0 integration (admin)[​](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#1-creating-an-oauth-20-integration-admin "Direct link to 1. Creating an OAuth 2.0 integration (admin)") A VIKTOR admin creates an OAuth 2.0 integration on the integrations page of the environment. This integration defines the connection between VIKTOR and the external software and needs to be assigned to specific applications that can use this integration. Each integration will get a unique name (e.g. `databricks-workspace-1`), which is used by the developer in the next step. More information on creating an OAuth 2.0 integration by the admin can be found [here](https://docs.viktor.ai/docs/create-apps/software-integrations/generic/.md#generic-oauth-20-integration). ### 2. Implementing the integration in an app (developer)[​](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#2-implementing-the-integration-in-an-app-developer "Direct link to 2. Implementing the integration in an app (developer)") With the integration name, the developer can start the implementation. First the integration is added in the config file. This is used by the platform to know that this app needs an integration and to trigger a login button for the user. `viktor.config.toml` ``` oauth2_integrations = [ "databricks-workspace-1" ] ``` Secondly the logic that uses the integration can be implemented in the app. Often external software will provide examples and/or a Python SDK, making it easier to implement. In order to obtain the necessary token for authentication, you instantiate the `OAuth2Integration` class with the integration name and call the method `get_access_token`. ``` integration = vkt.external.OAuth2Integration('databricks-workspace-1') access_token = integration.get_access_token() # Example for Databricks (https://docs.databricks.com/aws/en/dev-tools/sdk-python#authenticate-the-databricks-sdk-for-python-with-your-databricks-account-or-workspace) from databricks.sdk import WorkspaceClient client = WorkspaceClient( host="http://myworkspace.cloud.databricks.com/", token=access_token ) for cluster in client.clusters.list(): print(cluster.cluster_name) ``` For more information about the configuration in app code refer to [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#oauth2_integrations). ### 3. Using the integration by logging in (user)[​](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#3-using-the-integration-by-logging-in-user "Direct link to 3. Using the integration by logging in (user)") With everything properly setup, the app is ready to be used. When a user enters the app for the first time, a pop-up will be shown, explaining that the user needs to login before the app can be used. The user logs in, thereby allowing the app to access the external software and the integration can be used. After a period of inactivity, the user needs to re-login to reactivate the integration. This duration is configurable per integration by the admin. ![](/assets/images/integration-connection-dialog-2c6ce841f9bf5556bcdc4a2a5e1136cf.png) *User asked to connect their account(s) when entering an app* --- # AutoCAD This guide explains how to integrate AutoCAD with a VIKTOR app. Your app calls the AutoCAD ActiveX Automation API directly, so you can draw parametric geometry into a drawing, read an existing drawing, and annotate it, all from your app code. note `vkt.autocad.connect()` and `vkt.autocad.attach()` are a **BETA** feature and require **viktor >= 14.35.0**. `vkt.autocad.connect()` starts an AutoCAD instance on the worker for the session. `vkt.autocad.attach()` binds the session to the instance the user already has open instead of starting a new one; see [Attaching to a running instance](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md#attaching-to-a-running-instance). ## The worker[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md#the-worker "Direct link to The worker") A worker is a program that connects the VIKTOR platform to third-party software running outside the platform. For AutoCAD it belongs on the machine where you use AutoCAD, as a [personal worker](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md#install-the-worker): AutoCAD must be installed where the worker is, and a session drives the real desktop application. Your VIKTOR app handles the communication between the web app and the worker. Here is what happens during the integration: 1. The user performs an action that requires an AutoCAD analysis. 2. Your app opens a session, and each ActiveX call it makes is sent to the worker as a task. 3. The worker executes that one call against the live AutoCAD instance and returns its result. 4. Your app uses the returned values to build its views, or draws the next piece of geometry. 5. (Optional) **VIKTOR UI** displays the result. Unlike the integrations that send a file or a script to the worker, there is no drawing script to write and ship: all of your code stays in your app, and the worker machine needs no Python environment. AutoCAD cannot run headless The worker drives the real desktop application, so the machine it runs on needs a **logged-in, interactive Windows session** (a service running in Session 0 cannot start AutoCAD). The licence must not prompt on startup either: nobody is there to answer an Autodesk sign-in or activation dialog, so the app would only see a timeout. Activate the licence once by launching AutoCAD by hand on that machine, as the same user the worker runs as. ## Calling the API directly from your app[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md#calling-the-api-directly-from-your-app "Direct link to Calling the API directly from your app") Open a session with `vkt.autocad.connect()` and navigate the AutoCAD object model from the `acad` object it gives you: app.py ``` import viktor as vkt class Controller(vkt.Controller): parametrization = Parametrization def draw_in_autocad(self, params, **kwargs): with vkt.autocad.connect(timeout=60) as acad: document = acad.ActiveDocument model_space = document.ModelSpace line = model_space.AddLine([0, 0, 0], [params.span, 0, 0]) line.Layer = "STRUCTURE" # property write: plain assignment length = line.Length() # property read: call syntax (note the parentheses) document.Regen(vkt.autocad.AcRegenType.acAllViewports) ``` Please consider the following: * **A property is read with parentheses and written without them.** `line.Length()` gives you the value; `line.Layer = "STRUCTURE"` sets it. This is the convention that catches people out most often, so it is worth checking first when a call behaves unexpectedly. * **Objects that calls return are session-scoped handles.** Use them as the start of further calls and as arguments, exactly like the COM objects they stand for. They are released when the session closes, so read the values you need before the `with` block ends. * **Navigate down from `acad`.** The back-references `Application`, `Document` and `Parent` are refused, so keep your own reference to `acad.ActiveDocument` instead of walking back up. * **Every call is a round trip** to the worker; navigating attributes to reach it is free. `acad.ActiveDocument.ModelSpace.AddLine(...)` is one round trip, not three. Bound loops that call or read properties per entity, and prefer the ActiveX calls that work in bulk over a loop that touches every entity of a large drawing. * **Filenames are confined to the session's working directory.** Give `SaveAs`, `Import`, `Export`, `PlotToFile` and `InsertBlock` a relative filename rather than an absolute path. In this release a drawing cannot be returned from the session to your app, so read the values you need through ActiveX while the session is open. * **Some members are refused by the worker** and raise `vkt.ExecutionError`: those that execute arbitrary code (`SendCommand`, `RunMacro`, `LoadArx`), those that wait for input at the command line (`Utility.GetPoint` and the other prompting `Get*`, `Prompt`, `SelectOnScreen`), those that change settings outliving the session (`Preferences`, `SetVariable`), and `Save`, `Close` and `Quit`. Save with `SaveAs` and a relative filename instead. * **The enumerations live on `vkt.autocad`**, and their member names mirror ActiveX exactly: `vkt.autocad.AcRegenType.acAllViewports`. `from viktor.external.autocad import AcRegenType` gives you the same object under a shorter name. Note that they are **not** on the top-level `vkt` namespace, so `vkt.AcRegenType` raises `AttributeError`. The ActiveX members you call on `acad` mirror the AutoCAD Object Model and are not listed in the SDK reference. Look them up in the [AutoCAD ActiveX Reference Guide](https://www.autodesk.com/developer-network/platform-technologies/autocad), or in the `acadauto.chm` help file in your AutoCAD installation. ### Attaching to a running instance[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md#attaching-to-a-running-instance "Direct link to Attaching to a running instance") `vkt.autocad.attach()` opens the same kind of session against the AutoCAD that is **already running** on the worker machine, rather than starting a fresh instance. The app then reads and writes the drawing the user has on screen, and what it draws appears in their window. This is what you want when the point is to act on the drawing in front of the user, which in practice means a personal worker on their own machine. app.py ``` def draw_in_autocad(self, params, **kwargs): try: with vkt.autocad.attach(timeout=120) as acad: self.draw(acad, params) except vkt.WorkerSessionAttachError as err: if err.reason == "error_attach_no_instance": raise vkt.UserError( "No AutoCAD instance was found on your worker. Open your drawing in AutoCAD on the " "machine running your personal worker, then try again." ) from err raise vkt.UserError(f"Could not attach to AutoCAD ({err.reason or 'unknown reason'}).") from err ``` The two are strictly separate: * `attach()` fails when nothing is running on the worker machine; it never starts AutoCAD for you. * `connect()` always starts a fresh instance. If AutoCAD is already open on the worker machine the session is refused — close it there, or use `attach()`. * There is no automatic fallback in either direction. If you want one, write it yourself by catching `vkt.WorkerSessionAttachError` and calling `connect()`. What changes once the session is attached: * The drawing is **not empty**. Do not assume the model space is blank, that layer names are free, or that the coordinate system is at its defaults. * Closing the session **detaches without exiting AutoCAD**. The instance and the drawing stay as they were, including everything your app drew. * **Nothing rolls back.** Your app's changes are real edits in the user's drawing, and undoing them is their call. Draw onto layers with a recognisable prefix so the result is easy to isolate. * The user's file on disk is still never overwritten: `Save` is refused, and `SaveAs` writes into the session's working directory. Trigger it from an action button, not a download button An attached session produces edits in the drawing already open on the user's screen — they watch the geometry appear, and saving the file is theirs to do. A `DownloadButton` promises a file that is never coming, and a save dialog is not what anyone expects after editing a model in front of them. Use a [`vkt.ActionButton`](https://docs.viktor.ai/sdk/api/parametrization/.md#_ActionButton) when your app only draws, and a [`vkt.SetParamsButton`](https://docs.viktor.ai/sdk/api/parametrization/.md#_SetParamsButton) when it also writes values back into the parametrization. Keep `DownloadButton` for output your app builds itself, such as a report or a CSV of values read through ActiveX. [`vkt.errors.WorkerSessionAttachError`](https://docs.viktor.ai/sdk/api/errors/.md#_WorkerSessionAttachError) carries a `reason`: `"error_attach_no_instance"` when nothing is running on the worker machine, and `"error_attach_refused"` when an instance was found but would not accept the connection, typically because it is busy or waiting on a dialog. Others come from the worker connection itself rather than AutoCAD — for example `"no_worker_online"` (no worker is connected) and `"worker_kind_not_allowed"` (this worker kind is disabled for the organization) are usually the first ones a user hits; see the reference page for the full set of eight. Handle an unrecognised `reason` as a generic attach failure. Note that `WorkerSessionAttachError` is a subclass of `vkt.WorkerSessionError`, so catch it first if you handle both. ### Add integration to app config[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md#add-integration-to-app-config "Direct link to Add integration to app config") To make the worker integration available through the interface, add the following to your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#worker_integrations): ``` worker_integrations = [ "autocad", ] ``` ### Install the worker[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md#install-the-worker "Direct link to Install the worker") Install an AutoCAD worker as a **personal worker**, on the machine where you use AutoCAD. It calls the AutoCAD API directly, so it needs no Python environment. A personal worker connects the software that is installed on your own machine, for your own use. Personal workers are installed and managed with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md): 1. [Download and install VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#download-and-install-viktor-desktop) and log in with your VIKTOR account, if you haven't done so already 2. In VIKTOR Desktop, click "Add" and select **AutoCAD** ![](/assets/images/viktor-desktop-add-worker-list-01993b58665874f7b82e3e76d84dd9b9.webp) 3. Start the worker. You can view its [logs](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#view-logs) inside VIKTOR Desktop, and the editor shows when your worker is online note Personal workers that were installed with the previous per-worker installer keep running, but new personal workers can only be added through [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#migrate-existing-workers-to-viktor-desktop): the per-worker installer download and connection-key flow are no longer available for personal use. Why there is no organization worker here An organization worker shares one machine between the users of a workspace, which does not suit AutoCAD. The session drives the real desktop application, so every concurrent user needs their own interactive Windows session and their own licence, and [attaching](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md#attaching-to-a-running-instance) to "the instance already running" on a shared machine would reach whatever drawing the previous job left open. To offer AutoCAD capability across your organization instead of per user, use [Autodesk Platform Services](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-platform-services/.md) and its [Design Automation API](https://aps.autodesk.com/en/docs/design-automation/v3/developers_guide/overview/), which runs AutoCAD workloads in Autodesk's cloud with no worker and no local install. ### Testing[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md#testing "Direct link to Testing") `vkt.autocad.connect` needs to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. The `vkt.testing` module provides the [`mock_AutoCADConnection`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_AutoCADConnection) decorator, which maps each ActiveX path to the result it should return. The same decorator also mocks `vkt.autocad.attach`: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_AutoCADConnection(results={ # a result shaped {"__handle__": n} is decoded into an object handle, as in production 'ActiveDocument.ModelSpace.AddLine': [{"__handle__": 1}], 'Length': [6.0], }) def test_draw_in_autocad(self): MyEntityTypeController().draw_in_autocad() ``` Paths that are not in the dictionary return `None`. For a result that depends on the call, pass a function of the ActiveX path and its arguments instead of a dictionary. ## Troubleshooting the worker installation[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md#troubleshooting-the-worker-installation "Direct link to Troubleshooting the worker installation") ### How the worker finds the application[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md#how-the-worker-finds-the-application "Direct link to How the worker finds the application") The `autocad` and [`civil3d`](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md) worker kinds both use AutoCAD's automation registration, `AutoCAD.Application`. Civil 3D has no separate registration: it is AutoCAD started with Civil 3D's product switches, so both kinds start and connect to the same `acad.exe`. That shared registration is why an installation problem on either product can surface in the other. At worker start, the worker checks that this registration points to an installed executable. If the version-independent entry is stale, the worker falls back to the newest versioned entry, such as `AutoCAD.Application.26`, and logs a warning. If no entry points to an installed executable, the kind refuses to start and asks you to install or repair the product. ### Installation conflicts[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md#installation-conflicts "Direct link to Installation conflicts") Every AutoCAD-family product registers two entries: a versioned one per release, such as `AutoCAD.Application.26` for the 2027 release, and the shared version-independent `AutoCAD.Application`. The shared entry is owned by whichever installer wrote it last, and uninstallers do not always clean it up. This is what can leave it stale or pointing at the wrong product: * **An older release was removed after a newer one was installed.** The shared entry keeps pointing at the removed release. The newer install registered its own versioned entry but did not rewrite the shared one. Without the fallback this shows as "cannot find the file specified" on `connect()` and "no running instance" on `attach()` while the product is visibly open. With the fallback the worker binds through the newest versioned entry and logs a warning. No action is needed, but repairing the installation cleans the entry up. * **Several releases installed side by side.** The worker starts the newest registered release. Install one AutoCAD-family release per worker machine, or make sure the newest one is the release you want to automate. * **Per-user registry overrides.** Entries under the current user's classes take precedence over the machine-wide ones for a worker that runs without elevation. A leftover per-user entry can shadow a healthy machine-wide registration. Remove it, or repair the installation. * **No registration at all.** A failed or trial installation may not register the automation server, and the worker refuses to start the kind. In all cases the fix is on the machine, not in the worker. Repair the installation from Apps & Features, restart the worker, and check the worker log for the stale-registration warning. ### Create mode[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md#create-mode "Direct link to Create mode") `connect()` starts a private instance for the session. Only one AutoCAD-family application can be automated on a machine at a time, so create mode refuses to start while **any** AutoCAD or Civil 3D window is already open on the worker machine. Close the open application, or use [attach mode](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md#attach-mode) to work with it. This also means create sessions on one worker run one at a time. ### Attach mode[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md#attach-mode "Direct link to Attach mode") `attach()` connects to the instance the engineer already has open. Keep exactly one instance open. With several open, the worker reaches only the first one started and cannot pick another. * **Nothing open.** The session fails with `reason` `"error_attach_no_instance"`. Open the drawing on the worker machine and retry. * **Civil 3D open, AutoCAD requested.** Accepted. Civil 3D exposes the full AutoCAD API, so the `autocad` kind binds it happily — but remember the drawing is a Civil 3D drawing, and the app is reaching only its AutoCAD surface. To reach surfaces, alignments or COGO points, use the [`civil3d`](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md) kind instead. * **Product started as administrator.** An elevated instance is invisible to a worker that runs without elevation, and the session reports no running instance. Run the product and the worker as the same Windows user at the same elevation. The worker never closes, hides, or saves the engineer's instance in attach mode. The `autocad` kind has no release gate: any installed AutoCAD release that registers the automation server can be automated. The [`civil3d`](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#supported-releases) kind does gate on the release, and also on a units profile. ## FAQs[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md#faqs "Direct link to FAQs") **Why does reading a property need parentheses?** Every attribute you touch on `acad` is forwarded to AutoCAD, and the connection cannot tell "give me this value" from "give me this object to keep navigating" without the call. So a property is read with call syntax, `line.Length()`, and written by plain assignment, `line.Layer = "STRUCTURE"`. A method is called the same way, which makes the rule simple in practice: anything you want a value back from gets parentheses. **My app fails with "No AutoCAD instance was found on your worker"** That is `vkt.WorkerSessionAttachError` with `reason` `"error_attach_no_instance"`: `vkt.autocad.attach()` binds only to an AutoCAD that is already running, and never starts one. Open the drawing in AutoCAD on the machine running the worker and try again, or use `vkt.autocad.connect()` if the app does not need the user's own drawing. **Why are `Save` and `SendCommand` refused?** The worker refuses members that let a session reach outside itself. `Save` would overwrite the user's file in place, so `SaveAs` with a relative filename is offered instead, which writes into the session's working directory. `SendCommand`, `RunMacro`, `LoadArx` and `Eval` execute arbitrary code on the worker machine. The object model covers essentially everything in the AutoCAD UI, so there is a supported member for what you need. **Can I download the DWG my app drew?** Not in this release: no file can be returned from the session to the app, and the session's working directory goes away with the session. Where the point is to produce drawn output, use `vkt.autocad.attach()` so the geometry lands in the drawing the user has open and they save it themselves. Where the point is a calculation, read the values you need through ActiveX while the session is open and build your views from those. **How do I roll this out to everyone in my organization?** Not with an organization worker: it shares one machine between the users of a workspace, and each concurrent AutoCAD session needs its own interactive Windows session and licence. Give each engineer a personal worker if they each work in their own drawings. If what you need is AutoCAD capability without a per-user install, that is a different integration: [Autodesk Platform Services](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-platform-services/.md) offers a [Design Automation API](https://aps.autodesk.com/en/docs/design-automation/v3/developers_guide/overview/) that runs AutoCAD workloads in Autodesk's cloud, reached from a VIKTOR app through an OAuth 2.0 integration rather than through `vkt.autocad`. **Every session times out and AutoCAD never appears** Check the two requirements in [The worker](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md#the-worker) before looking at your app code. The worker machine needs a logged-in, interactive Windows session, and AutoCAD must open straight to a drawing without an Autodesk sign-in or activation dialog. There is no way to check a licence up front, so a prompting licence surfaces only as a start-up failure. **My app is slow when it draws many entities** Every call, property read, or property write is one round trip to the worker; navigating attributes to reach it is free. Two things usually account for slowness: per-entity property reads in a loop that could be bounded or replaced with a `SelectionSet` filter, and per-entity work where a bulk ActiveX call would do (`AddLightWeightPolyline` with a flat coordinate array, or `Copy` on a block reference). Note also that about 65,000 object handles are available per session, so a job larger than that has to be split across several sessions. --- # Autodesk Construction Cloud Autodesk Construction Cloud (ACC) integrates with VIKTOR using OAuth 2.0 through Autodesk Platform Services (APS) integration. Within VIKTOR, you can access the full set of ACC APIs. The following sections describe the main guidelines, requirements, and limitations. ## Preliminary steps[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-construction-cloud/.md#preliminary-steps "Direct link to Preliminary steps") The first step is to set up an OAuth 2.0 integration, which provides token-based authentication and authorization. A VIKTOR administrator must configure this integration in both APS and VIKTOR, following these [steps](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-platform-services/#creating-an-oauth-20-integration-admin). After this, your **VIKTOR–APS** integration can connect to Autodesk Construction Cloud using **Custom integrations**. A custom integration links your ACC account to your APS application, and you can query your hubs and projects as shown [here](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-platform-services/#integration-with-autodesk-construction-cloud-acc). ## Requirements and guidelines for using ACC APIs[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-construction-cloud/.md#requirements-and-guidelines-for-using-acc-apis "Direct link to Requirements and guidelines for using ACC APIs") After setting up the APS and ACC integration, you can take advantage of VIKTOR building blocks and focus on what you want to create instead of worrying about OAuth workflows, tokens, and authentication. In the following sections we cover the most used APIs and the considerations you should keep in mind when integrating them in VIKTOR. The most common way to integrate your models in your own applications is by using the **Data Management API**, **AEC Data Model API**, and **Data Exchange API**. These APIs allow you to navigate your project structure, manage files and their versions, and query elements from your Revit models to access their properties. With this information, you can build quantity takeoff workflows, quality assurance and compliance checks, or generate dashboards to get the most out of your BIM models. | Family | Purpose | | ----------------------- | ------------------------------------------------------------------------------------------------------------ | | **Data Management API** | Manage hubs, projects, folders, and files. Retrieve folder contents, get file versions, and access metadata. | | **AEC Data Model API** | Query design data across hubs, projects, element groups, and elements with region-aware GraphQL requests. | | **Data Exchange API** | Query and manage data stored in a Data Exchange, such as elements, properties, and relationships. | ### Data Management API[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-construction-cloud/.md#data-management-api "Direct link to Data Management API") The [Data Management API](https://aps.autodesk.com/data-management-api) lets you navigate through the content of your ACC hub. You can get the list of hubs linked to your account, the projects inside each hub, and the files in every project. You can also select a file and read its information. With this API you can: * **Access your ACC structure**: Navigate through hubs, projects, folders, and items to understand your project organization. * **Manage file versions**: Retrieve version history, download specific versions, and track changes over time. * **Upload and update files**: Programmatically upload new files or create new versions of existing files. * **Search and filter**: Find files and folders using search queries and filters to quickly locate the data you need. * **Work with metadata**: Read and update custom attributes and metadata associated with your files. * **Manage permissions**: Check user access and collaborate with team members by understanding who has access to which resources. Typically, you would build a user interface to let users pick a file and then open it with the [APS Viewer](https://aps.autodesk.com/apis-and-services/viewer) to explore the BIM model. However, these functions work out of the box with the VIKTOR SDK, and we will see how in the later sections. ### AEC Data Model API[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-construction-cloud/.md#aec-data-model-api "Direct link to AEC Data Model API") The [AEC Data Model API](https://aps.autodesk.com/developer/overview/aec-data-model-api) exposes a [GraphQL](https://graphql.org/learn/) interface that gives direct cloud access to granular design data. You do not need to write application plugins or perform extra processing to retrieve the data. Here are the main things you can do: * Navigate projects and designs: Access hubs, projects, and design models to retrieve detailed data such as elements and their parameters. * Work with versions: Retrieve design versions and query elements at a specific version. * Search elements: Find elements in one design or across multiple designs using filters. * List properties: Get all property definitions available in a design or project. * Query by property: Filter elements by categories (doors, windows, pipes) or by parameter name and value (area, volume). #### Activating the AEC Data Model[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-construction-cloud/.md#activating-the-aec-data-model "Direct link to Activating the AEC Data Model") Before using the AEC Data Model API, it must be activated in your ACC account by your ACC Account Administrator. Contact your admin and request that they activate the AEC Data Model for your account. The admin can do this by going to **Settings** in the Account Admin page and toggling the **"Enable AEC Data Model capabilities"** option. It is not active by default. You can follow the complete [onboarding guide](https://aps.autodesk.com/en/docs/aecdatamodel/v1/developers_guide/onboarding/) for detailed steps. ![](/assets/images/acc-integration-1-c2034b4ec677ac01f3caa344b90def45.png) #### AEC Data Model limitations[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-construction-cloud/.md#aec-data-model-limitations "Direct link to AEC Data Model limitations") The following are known limitations that should be considered when working with the AEC Data Model API and VIKTOR: * Supported regions: **US**, **EMEA**, and **AUS**. See the [regions guide](https://aps.autodesk.com/en/docs/aecdatamodel/v1/developers_guide/regions/). * Linked Revit models are not supported. * Full geometry queries are not yet available. See the [list of limitations](https://aps.autodesk.com/en/docs/aecdatamodel/v1/developers_guide/knownlimitations/). * Only works with Revit 2024 and later. Check your version and review the [FAQ](https://aps.autodesk.com/en/docs/aecdatamodel/v1/developers_guide/faq/). ### Data Exchange API[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-construction-cloud/.md#data-exchange-api "Direct link to Data Exchange API") The [Data Exchange API](https://aps.autodesk.com/developer/overview/data-exchange) lets you share only the parts of a model that you need for your work. A Data Exchange is created from a 3D view in your software (such as Revit) and published to ACC. This allows you to share a Revit view that shows only the structural elements of a building instead of sharing the entire model. This makes it easier to focus on what matters, improves performance, and enables you to share data with the right team. With the Data Exchange API you can: * Navigate to your ACC hub(s), project(s), and folder(s to retrieve a Data Exchange and its detailed data such as elements, properties, and their values * Retrieve only the data you need through GraphQL queries * Retrieve a list of property definitions within a Data Exchange * Retrieve a specific version of a Data Exchange ### Creating a Data Exchange[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-construction-cloud/.md#creating-a-data-exchange "Direct link to Creating a Data Exchange") You can create a Data Exchange directly in ACC and then use the API. Follow the [official guide](https://help.autodesk.com/view/DOCS/ENU/?guid=Create_Manage_Data_Exchanges) to set this up. A Data Exchange can also be created through connectors. You can see the list of available connectors on this [page](https://help.autodesk.com/view/DATAEXCHANGE/ENU/). For example, with Revit you can create a Data Exchange by following this [guide](https://help.autodesk.com/view/DATAEXCHANGE/ENU/?guid=revit-create-data-exchanges). ### Limitations[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-construction-cloud/.md#limitations "Direct link to Limitations") The following are known limitations of the Data Exchange API: * Supported in the same regions as the AEC Data Model API * Full geometry information about the model is not yet fully supported * See the complete [list of limitations](https://help.autodesk.com/view/DATAEXCHANGE/ENU/?guid=pwrbi-known-limitations) ## Working with ACC in VIKTOR apps[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-construction-cloud/.md#working-with-acc-in-viktor-apps "Direct link to Working with ACC in VIKTOR apps") VIKTOR supports OAuth2 workflows out of the box with the [OAuth2Integration](https://docs.viktor.ai/sdk/api/external/external-program/?_highlight=oauth2integration/sdk/api/external/external-program/#_OAuth2Integration). This means you can request a token inside your VIKTOR app with a single method call. In addition, you have the [`vkt.AutodeskFileField`](https://docs.viktor.ai/docs/create-apps/user-input/autodesk-files/), which lets you navigate through your hubs. Under the hood this component uses the Data Management API and gives you key information such as the file URN, version, and file downloads. You also have the [`vkt.AutodeskView`](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/autodesk/), which makes it simple to work with the APS Viewer so you can explore BIM models directly in your app. To set up the integration in your VIKTOR app, the developer must add the integration name to the app configuration. The platform then shows a login button when the user opens the app. Make sure your `viktor.config.toml` contains the name exactly as configured in the Administrator panel, and include an `oauth2_integrations` entry with the integration name, for example: `viktor.config.toml`: ``` app_type = "editor" python_version = "3.14" registered_name = "your-app-name" oauth2_integrations = [ "aps-integration-1" ] ``` With just a few lines of code you can create an app that lets you select a file from your ACC hub and view the Revit model: ``` import viktor as vkt class Parametrization(vkt.Parametrization): revit_file = vkt.AutodeskFileField( "Select Revit File from ACC", oauth2_integration="aps-integration-1" ) class Controller(vkt.Controller): parametrization = Parametrization @vkt.AutodeskView("File Visualization") def visualize_file(self, params, **kwargs): if not params.revit_file: raise vkt.UserError("Please select a Revit file from ACC") integration = vkt.external.OAuth2Integration("aps-integration-1") access_token = integration.get_access_token() return vkt.AutodeskResult(params.revit_file, access_token=access_token) ``` ![](/assets/images/acc-integration-2-4889c859fd9fa2568d2ea9e623806692.png) note The integration name in `OAuth2Integration` must match the value in `viktor.config.toml`. The ACC custom integration must be added in Account Admin, and the user must have access to projects in that account. ## Example - Data Management API[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-construction-cloud/.md#example---data-management-api "Direct link to Example - Data Management API") While VIKTOR's building blocks like `AutodeskFileField` and `AutodeskView` provide the easiest way to work with ACC, you can also create custom implementations using the Data Management API directly. This example shows how to retrieve a list of all hubs linked to your ACC account and display them in a table. You can use this approach when you need more control or want to build custom workflows beyond what the built-in components offer. ``` import viktor as vkt import requests class Parametrization(vkt.Parametrization): pass class Controller(vkt.Controller): parametrization = Parametrization @vkt.TableView("Hubs Overview") def view_hubs_table(self, params, **kwargs): # Get access token from OAuth2 integration integration = vkt.external.OAuth2Integration("aps-integration-1") access_token = integration.get_access_token() # Fetch hubs data from APS Data Management API base_url = "https://developer.api.autodesk.com" endpoint = f"{base_url}/project/v1/hubs" headers = { "Authorization": f"Bearer {access_token}", "Content-Type": "application/json" } response = requests.get(endpoint, headers=headers) if response.status_code != 200: raise Exception(f"Failed to fetch hubs: {response.status_code} - {response.text}") data = response.json() hubs_data = data.get('data', []) # Prepare table data table_data = [] column_headers = [ vkt.TableHeader("Hub Name"), vkt.TableHeader("Hub ID"), vkt.TableHeader("Region") ] for hub in hubs_data: # Extract hub information hub_name = hub.get('attributes', {}).get('name', 'Unknown') hub_id = hub.get('id', 'Unknown') region = hub.get('attributes', {}).get('region', 'Unknown') # Add row to table table_data.append([hub_name, hub_id, region]) return vkt.TableResult(data=table_data, column_headers=column_headers) ``` ## Example - AEC Data Model API[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-construction-cloud/.md#example---aec-data-model-api "Direct link to Example - AEC Data Model API") After setting up the APS integration, you can also use the AEC Data Model API inside VIKTOR. This API gives you direct access to granular design data such as hubs, projects, elements, and their properties. ``` import viktor as vkt import requests AEC_GRAPHQL_URL = "https://developer.api.autodesk.com/aec/graphql" AEC_REGION = "US" # Use "EMEA" if your tenant is in Europe class Parametrization(vkt.Parametrization): pass class Controller(vkt.Controller): parametrization = Parametrization def get_hubs(self, token): query = """ query GetHubs { hubs { results { id name } } } """ headers = { "Authorization": f"Bearer {token}", "Content-Type": "application/json", "Region": AEC_REGION, } response = requests.post(AEC_GRAPHQL_URL, headers=headers, json={"query": query}) data = response.json().get("data", {}) return data.get("hubs", {}).get("results", []) def get_projects(self, token, hub_id): query = """ query GetProjects($hubId: ID!) { projects(hubId: $hubId) { pagination { cursor } results { id name alternativeIdentifiers { dataManagementAPIProjectId } } } } """ headers = { "Authorization": f"Bearer {token}", "Content-Type": "application/json", "Region": AEC_REGION, } payload = { "query": query, "variables": {"hubId": hub_id} } response = requests.post(AEC_GRAPHQL_URL, headers=headers, json=payload) data = response.json().get("data", {}) return data.get("projects", {}).get("results", []) def get_element_groups(self, token, project_id): query = """ query GetElementGroupsByProject($projectId: ID!) { elementGroupsByProject(projectId: $projectId) { pagination { cursor } results { name id alternativeIdentifiers { fileUrn fileVersionUrn } } } } """ headers = { "Authorization": f"Bearer {token}", "Content-Type": "application/json", "Region": AEC_REGION, } payload = { "query": query, "variables": {"projectId": project_id} } response = requests.post(AEC_GRAPHQL_URL, headers=headers, json=payload) data = response.json().get("data", {}) return data.get("elementGroupsByProject", {}).get("results", []) @vkt.TableView("AEC Element Groups") def get_aec_element_groups(self, params, **kwargs): integration = vkt.external.OAuth2Integration("aps-integration-1") token = integration.get_access_token() # Get hubs hubs = self.get_hubs(token) if not hubs: return vkt.TableResult([["No hubs found", "", "", ""]], column_headers=["Element Group Name", "Element Group ID", "File URN", "File Version URN"]) # Get projects from the first hub first_hub_id = hubs[0].get("id", "") projects = self.get_projects(token, first_hub_id) if not projects: return vkt.TableResult([["No projects found", "", "", ""]], column_headers=["Element Group Name", "Element Group ID", "File URN", "File Version URN"]) # Prepare table data rows = [] # Iterate through all projects for project in projects: project_id = project.get("id", "") element_groups = self.get_element_groups(token, project_id) # Add element groups from this project to rows for group in element_groups: group_name = group.get("name", "") group_id = group.get("id", "") alt_ids = group.get("alternativeIdentifiers") or {} file_urn = alt_ids.get("fileUrn", "") file_version_urn = alt_ids.get("fileVersionUrn", "") rows.append([group_name, group_id, file_urn, file_version_urn]) # Check if no element groups found across all projects if not rows: return vkt.TableResult([["No element groups found", "", "", ""]], column_headers=["Element Group Name", "Element Group ID", "File URN", "File Version URN"]) return vkt.TableResult(rows, column_headers=["Element Group Name", "Element Group ID", "File URN", "File Version URN"]) ``` ## Example – Data Exchange API[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-construction-cloud/.md#example--data-exchange-api "Direct link to Example – Data Exchange API") To use the Data Exchange API in VIKTOR, the endpoints are accessed through [GraphQL](https://aps.autodesk.com/en/docs/fdxgraph/v1/developers_guide/about-graphql/) queries. GraphQL is a query language where you retrieve data with queries. Below is a simple example to query the Data Exchange API and list hubs, projects, folders, and data exchanges. You can extend it to retrieve detailed model information. See more [advanced queries](https://aps.autodesk.com/en/docs/fdxgraph/v1/tutorials/advanced_queries/task1/). ``` import viktor as vkt import requests DX_GRAPHQL_URL = "https://developer.api.autodesk.com/dataexchange/2023-05/graphql" APS_REGION = "US" # Use "EMEA" if your tenant is in Europe class Parametrization(vkt.Parametrization): pass class Controller(vkt.Controller): parametrization = Parametrization def get_hubs(self, token): query = """ query GetHubs { hubs { results { name id } } } """ headers = { "Authorization": f"Bearer {token}", "x-ads-region": APS_REGION, "Content-Type": "application/json", } response = requests.post(DX_GRAPHQL_URL, headers=headers, json={"query": query}) data = response.json().get("data", {}) return data.get("hubs", {}).get("results", []) def get_projects(self, token, hub_id): query = """ query GetProjects($hubId: ID!) { projects(hubId: $hubId) { results { id name } } } """ headers = { "Authorization": f"Bearer {token}", "x-ads-region": APS_REGION, "Content-Type": "application/json", } payload = { "query": query, "variables": {"hubId": hub_id} } response = requests.post(DX_GRAPHQL_URL, headers=headers, json=payload) data = response.json().get("data", {}) return data.get("projects", {}).get("results", []) def get_project_folders(self, token, project_id): query = """ query GetProjectFolders($projectId: ID!) { project(projectId: $projectId) { id name folders { results { id name } } } } """ headers = { "Authorization": f"Bearer {token}", "x-ads-region": APS_REGION, "Content-Type": "application/json", } payload = { "query": query, "variables": {"projectId": project_id} } response = requests.post(DX_GRAPHQL_URL, headers=headers, json=payload) data = response.json().get("data", {}) project = data.get("project", {}) return project.get("folders", {}).get("results", []) def get_folder_content(self, token, folder_id): query = """ query GetFolderContent($folderId: ID!) { folder(folderId: $folderId) { exchanges { results { id name alternativeIdentifiers { fileUrn fileVersionUrn } } } } } """ headers = { "Authorization": f"Bearer {token}", "x-ads-region": APS_REGION, "Content-Type": "application/json", } payload = { "query": query, "variables": {"folderId": folder_id} } response = requests.post(DX_GRAPHQL_URL, headers=headers, json=payload) data = response.json().get("data", {}) return data.get("folder", {}) @vkt.TableView("Data Exchanges") def get_data_exchanges(self, params, **kwargs): integration = vkt.external.OAuth2Integration("aps-integration-1") token = integration.get_access_token() # Step 1: Get first hub hubs = self.get_hubs(token) if not hubs: return vkt.TableResult([["No hubs found", "", ""]], column_headers=["Exchange Name", "Exchange ID", "File URN"]) first_hub_id = hubs[0].get("id", "") # Step 2: Get first project from hub projects = self.get_projects(token, first_hub_id) if not projects: return vkt.TableResult([["No projects found", "", ""]], column_headers=["Exchange Name", "Exchange ID", "File URN"]) first_project_id = projects[0].get("id", "") # Step 3: Get folders from project folders = self.get_project_folders(token, first_project_id) if not folders: return vkt.TableResult([["No folders found", "", ""]], column_headers=["Exchange Name", "Exchange ID", "File URN"]) first_folder_id = folders[0].get("id", "") # Step 4: Get folder content (including data exchanges) folder_content = self.get_folder_content(token, first_folder_id) exchanges = folder_content.get("exchanges", {}).get("results", []) # Check if no exchanges found if not exchanges: return vkt.TableResult([["No exchanges found in this folder", "", ""]], column_headers=["Exchange Name", "Exchange ID", "File URN"]) # Prepare table data rows = [] for exchange in exchanges: exchange_name = exchange.get("name", "") exchange_id = exchange.get("id", "") alt_ids = exchange.get("alternativeIdentifiers") or {} file_urn = alt_ids.get("fileUrn", "") rows.append([exchange_name, exchange_id, file_urn]) return vkt.TableResult(rows, column_headers=["Exchange Name", "Exchange ID", "File URN"]) ``` --- # Autodesk Forma Site Design [Autodesk Forma Site Design](https://www.autodesk.com/products/forma/overview) can be integrated with VIKTOR through Autodesk Platform Services (APS). A VIKTOR app can read Forma proposals and terrain, create geometry, and publish the result as a new proposal revision. The connection uses an APS OAuth 2.0 integration in VIKTOR and a Forma extension service account. The same APS client ID links the VIKTOR integration, Autodesk Construction Cloud (ACC), and the Forma extension. | Component | Purpose | | ------------------------------- | --------------------------------------------------------------------------------- | | APS application | Provides the client ID, client secret, callback URL, API access, and OAuth scopes | | VIKTOR OAuth 2.0 integration | Authenticates each VIKTOR user and provides an APS access token to the app | | ACC custom integration | Grants the APS application access to the required ACC account, hub, and projects | | Forma extension service account | Authorizes the APS application to call Forma APIs for the selected Forma projects | ## What you can do with the Forma APIs[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-forma-site-design/.md#what-you-can-do-with-the-forma-apis "Direct link to What you can do with the Forma APIs") After setting up the APS, ACC, and Forma connections, a VIKTOR app can use the Forma APIs to read project data, process it in a custom workflow, and publish results back to Forma. | Capability | What it enables | | --------------------------- | ---------------------------------------------------------------------------------------------------------------------- | | **Proposals and revisions** | List the proposals in a Forma project, retrieve their URNs, and work with a specific proposal revision. | | **Elements** | Retrieve Forma elements by URN and inspect the elements that make up a proposal. | | **Terrain** | Find the terrain attached to a proposal and download its geometry for visualization or spatial calculations. | | **Basic geometry** | Create geometry elements, such as building volumes, using data generated or processed in VIKTOR. | | **Proposal updates** | Attach created elements to a new proposal revision while preserving the existing terrain, base, and proposal elements. | These capabilities can be used to create workflows such as: * Comparing and reporting on Forma proposals in a VIKTOR interface. * Using terrain bounds to validate or generate a site layout. * Creating geometry from engineering calculations or design rules. * Reviewing generated geometry in VIKTOR before publishing it to a new Forma proposal revision. Forma API requests are project- and region-specific. They require the Forma project ID as `authcontext`, the correct `US` or `EMEA` region, and complete element or proposal URNs when referencing existing data. ## Before you begin[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-forma-site-design/.md#before-you-begin "Direct link to Before you begin") You need: * VIKTOR administrator access to create and assign an OAuth 2.0 integration. * Access to an APS application and its client ID and client secret. * ACC Account Administrator access to add a custom integration. * Access to the target Forma project and permission to create and install an extension. info An ACC custom integration does not replace the Forma extension service account. Both use the same APS client ID, but they grant access at different layers. ## Set up the integration[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-forma-site-design/.md#set-up-the-integration "Direct link to Set up the integration") ### 1. Create the APS application and VIKTOR integration[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-forma-site-design/.md#1-create-the-aps-application-and-viktor-integration "Direct link to 1. Create the APS application and VIKTOR integration") Follow [Creating an OAuth 2.0 integration (admin)](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-platform-services/.md#creating-an-oauth-20-integration-admin) to create the APS application and configure and assign the Autodesk Platform Services integration in VIKTOR. Use `forma-site` as the integration name throughout this guide. ### 2. Add the APS client ID to the ACC account[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-forma-site-design/.md#2-add-the-aps-client-id-to-the-acc-account "Direct link to 2. Add the APS client ID to the ACC account") Follow [Integration with Autodesk Construction Cloud (ACC)](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-platform-services/.md#integration-with-autodesk-construction-cloud-acc) to register the same APS client ID as a custom integration in the ACC account. For a video walkthrough of the APS, ACC, and Forma setup, see [Integrate your VIKTOR app with Autodesk Construction Cloud](https://vimeo.com/1143370907). ### 3. Create and install the Forma extension[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-forma-site-design/.md#3-create-and-install-the-forma-extension "Direct link to 3. Create and install the Forma extension") The APS client ID must also be registered as a service account on a Forma extension. 1. Open the target Forma project and go to **Extensions** → **Add extension**. ![Open the Extensions panel in Forma Site Design](/assets/images/forma-site-extensions-panel-6d45471533c65f974bdba45825a8fca3.png) 2. In the Autodesk App Store dialog, select the settings icon in the upper-right corner and choose **Create extension**. ![Create a new Forma extension](/assets/images/forma-site-create-new-extension-0e0d6bb40a582800c1682727cf375849.png) 3. Name the extension, accept the Publisher Agreement, and select **Create**. ![Enter the new Forma extension details](/assets/images/forma-site-create-extension-form-6d6d14e910f6b8b82c123c4f1e776f9d.png) 4. Set the extension owner to the APS application used by the VIKTOR integration. In this guide, that application is **Application: forma-site-autodesk**. Limit access to the required Forma projects, or allow all Forma users when appropriate. note `forma-site-autodesk` is the display name assigned when the APS application was created on the [APS applications page](https://aps.autodesk.com/hubs/urn:adsk.ace:prod.hub:2657cf75-8153-4d33-93e6-93a23e11f4b8/applications/). Your APS application may have a different name; select the application whose client ID is used by the VIKTOR integration. ![Configure the Forma extension owner and project access](/assets/images/forma-site-extension-project-access-1c8425c872dd9cdc5612045a5ab8cf5b.png) note **Owner (who can manage the extension)** provides these options: * **Myself only**: the current Autodesk user owns and manages the extension. * **Application: *APS application name***: transfers ownership of the extension to the selected APS application. This guide uses **Application: forma-site-autodesk**; select the APS application associated with your own VIKTOR OAuth 2.0 integration. * **Manage APS Applications**: opens the APS application management page. **Who are allowed to use the extension** provides these options: * **Only specific projects**: limits the extension to the selected Forma projects. * **All users of Forma**: makes the extension available to all Forma users in the environment. This setting controls where the extension can be used; it does not replace installing the extension in each target project. warning Transferring extension ownership to an APS application is non-reversible. Confirm that you selected the APS application associated with your VIKTOR integration before saving. note Open the extension **Integration** settings, add a service account, and enter the same APS client ID used in VIKTOR and ACC. ![Add the APS client ID as a Forma service account](/assets/images/forma-site-service-account-b0e3b89d9517c2296acdfe371f6268f3.png) 5. Save the extension, return to the target project's **Extensions** catalog, and install it. Install the extension in every Forma project that the VIKTOR app needs to access. The extension does not need buttons, embedded views, endpoints, or bundles for a VIKTOR app that calls the Forma APIs directly. The service-account configuration provides the required API authorization. ## Use the integration in a VIKTOR app[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-forma-site-design/.md#use-the-integration-in-a-viktor-app "Direct link to Use the integration in a VIKTOR app") You have two alternatives for developing an app that integrates with Autodesk Forma Site Design: * [Using the App Builder](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-forma-site-design/.md#using-the-app-builder) * [Using local development](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-forma-site-design/.md#using-local-development) ### Using the App Builder[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-forma-site-design/.md#using-the-app-builder "Direct link to Using the App Builder") The [App Builder](https://docs.viktor.ai/docs/app-builder/.md) can generate the proposal lookup app from a natural-language prompt. Before submitting the prompt, make sure the Autodesk Platform Services integration is available in your VIKTOR environment. Use the following prompt: ``` Create a simple VIKTOR app that retrieves Autodesk Forma proposal alternatives using Python, requests, and the configured OAuth 2.0 integration named "forma-site". Add an H1 heading named "Application", a short description, a text input named "Forma project/site ID" explaining that the value usually starts with `pro_` and comes from the Forma project URL, a "Forma region" selector with US and EMEA options and EMEA selected by default, and a DataView named "Forma proposals" with a "Load proposals" button. Do not include a real project ID or hard-coded default. Request `https://developer.api.autodesk.com/forma/proposal/v1alpha/proposals` with the entered ID as `authcontext`, a limit of 20, the selected region in `X-Ads-Region`, and a 30-second timeout. The JSON response contains a `results` collection in which each proposal has a display name, a fallback name, and its complete URN; show these as DataItems, using the display name first, the fallback name second, and "Unnamed proposal" otherwise. Show "No proposals found" when the collection is empty, validate missing input with a clear UserError, and present safe user-facing request errors without exposing tokens or raw API responses. ``` After submitting the prompt, assign the integration to the app: 1. Open **App details** in the App Builder. 2. Open the **Integrations** tab and select the OAuth 2.0 integration named `forma-site`. 3. Save the selection and connect the integration when prompted. ![Assign the Forma Site integration in App details](/assets/images/forma-site-app-builder-integration-723e5d87fe1d7dd28b76a88176ef2e6d.png) note If your administrator used a different integration name, replace `forma-site` in the prompt with that exact name. A generated App Builder result can look like this: ![App Builder result for an Autodesk Forma proposal lookup app](/assets/images/forma-site-app-builder-result-61e3b83f8e0cf66e230e306b42b6792a.png) ### Using local development[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-forma-site-design/.md#using-local-development "Direct link to Using local development") The following small VIKTOR app retrieves the proposal alternatives in a Forma project and displays each proposal URN in a `DataView`: ``` import requests import viktor as vkt FORMA_API_URL = "https://developer.api.autodesk.com" APS_INTEGRATION_NAME = "forma-site" class Parametrization(vkt.Parametrization): introduction = vkt.Text( """# Application Retrieve proposal alternatives and their URNs from an Autodesk Forma Site Design project. """ ) project_id = vkt.TextField( "Forma project/site ID", description="Copy the pro_... value from the Forma project URL.", ) region = vkt.OptionField( "Forma region", options=["US", "EMEA"], default="EMEA", ) class Controller(vkt.Controller): label = "Forma proposal URNs" parametrization = Parametrization @vkt.DataView( "Forma proposals", duration_guess=5, update_label="Load proposals", description="Lists proposal URNs for the entered Forma project/site ID.", ) def proposal_urns(self, params, **kwargs): project_id = str(params.project_id or "").strip() if not project_id: raise vkt.UserError( "Enter a Forma project/site ID before loading proposals." ) access_token = vkt.external.OAuth2Integration( APS_INTEGRATION_NAME ).get_access_token() try: response = requests.get( f"{FORMA_API_URL}/forma/proposal/v1alpha/proposals", params={"authcontext": project_id, "limit": "20"}, headers={ "Authorization": f"Bearer {access_token}", "X-Ads-Region": str(params.region), }, timeout=30, ) response.raise_for_status() except requests.RequestException as exc: raise vkt.UserError( "Could not retrieve Forma proposals. Check the project/site ID, " "region, and integration access." ) from exc proposals = response.json().get("results", []) proposal_items = [ vkt.DataItem( proposal.get("displayName") or proposal.get("name") or "Unnamed proposal", proposal.get("urn", ""), ) for proposal in proposals ] if not proposal_items: proposal_items = [vkt.DataItem("Proposals", "No proposals found")] return vkt.DataResult(vkt.DataGroup(*proposal_items)) ``` Declare the APS OAuth 2.0 integration in `viktor.config.toml`: ``` app_type = "simple" python_version = "3.12" registered_name = "forma-site" oauth2_integrations = [ "forma-site", ] ``` note The value `forma-site` in `oauth2_integrations` and `OAuth2Integration` must exactly match the name of the Autodesk Platform Services integration created in the VIKTOR Administrator panel. Enter the project/site ID from the Forma URL and select the matching region. The view then lists the available proposal alternatives and their complete URNs. ![A VIKTOR DataView listing Autodesk Forma proposal URNs](/assets/images/forma-site-proposal-urns-data-view-d06dd4237f4263f600820c2ccc86151c.png) Keep these request requirements in mind: * `authcontext` is the Forma project or site ID, which normally starts with `pro_` and can be copied from the Forma URL. * `X-Ads-Region` must match the project region: `US` or `EMEA`. * A complete proposal URN includes its revision: `urn:adsk-forma-elements:proposal:::`. * Use the latest proposal revision before publishing changes. A stale revision cannot be updated. ## Troubleshooting[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-forma-site-design/.md#troubleshooting "Direct link to Troubleshooting") | Problem | Check | | ------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | | `403 AccessDeniedException` | Verify the VIKTOR APS integration, ACC custom integration, Forma extension service account, project access, and selected region. | | The ACC integration works but Forma rejects the request | Confirm that the Forma extension has the APS client ID configured as a service account and is installed in the target project. | | The project cannot be found | Verify the `authcontext` project ID and whether `X-Ads-Region` is set to `US` or `EMEA`. | | Geometry is not visible | Confirm that the created element URNs were attached to a new proposal revision, then reload Forma Site Design. | | A proposal update fails | Load the latest complete proposal URN before publishing; an older revision may be stale. | --- # Autodesk Platform Services Autodesk Platform Services (APS) can be integrated with VIKTOR using the OAuth 2.0 workflow for token based authentication and authorization. A general introduction to OAuth 2.0 can be found [here](https://docs.viktor.ai/docs/create-apps/software-integrations/#oauth-20). ## Creating an OAuth 2.0 integration (admin)[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-platform-services/.md#creating-an-oauth-20-integration-admin "Direct link to Creating an OAuth 2.0 integration (admin)") First, an OAuth 2.0 integration must be set up by a VIKTOR admin. This must be done in APS and in VIKTOR, following these steps: ![](/assets/images/aps-integration-1-bd0b74c5a8fabdd3fd49f83ac25a95e6.png) 1. Navigate to the **Integrations** tab in the **Administrator** panel. 2. Select the **OAuth 2.0** tab. 3. Follow the steps in the modal: 1. Select **Autodesk Platform Services**. 2. Go to the "**Basic Information**" tab and fill the required fields, including the integration name, and select the applications that will use the APS integration. You can choose to limit the integration to specific apps or allow all apps on the environment to use it. 3. Then, in the "**Configuration**" tab add the Authentication URL and Token URL as follows: * Authentication URL: * Token URL: 4. If you already have an active APS application, you can fill in the client ID and secret, as well as the [scopes](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-platform-services/.md#defining-scopes-for-aps-applications) and expiration date, if you do not have one, continue to the next step to create and set up the APS application. ![](/assets/images/aps-integration-2-3d419cb3185b6b6bcced49e9b053d764.png) 4. On the APS home page, go to your profile and click [**Applications**](https://aps.autodesk.com/hubs/@personal/applications/). 1. You can create a new application following this tutorial: [Create an app](https://aps.autodesk.com/en/docs/oauth/v2/tutorials/create-app/). 2. Or you can use an existing application. 5. In the APS application, open **App settings** and copy **Client ID** and **Client Secret** into the VIKTOR modal from **step 3**. ![](/assets/images/aps-integration-aps1-02f2d6ad8d8c35f2edf5a4e3c650660d.png) 6. Go to **General settings** and add the callback URL: ``` /api/integrations/oauth2/callback/ ``` Your environment URL should be `https://cloud.viktor.ai/` or similar, depending on your organization. ![](/assets/images/aps-integration-aps2-eba3b2bd103d50153f600bb2e4517233.png) 7. Open **App access** and select the APIs you want your application to access. ![](/assets/images/aps-integration-aps3-5f496658feae241a843e63a9c9f0fef9.webp) 8. Save the configuration in each section and verify that everything is correctly set up. ### Defining Scopes for APS applications[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-platform-services/.md#defining-scopes-for-aps-applications "Direct link to Defining Scopes for APS applications") A scope defines what a token can do, it is the permission context for the token. A token that includes `data:read` can read data in APS, and it works with endpoints that require that scope. A token that lacks the scope cannot access those endpoints. Each endpoint page states the scopes it needs. The APS documentation lists all scope values in the **Scopes** section: [APS OAuth 2.0 scopes](https://aps.autodesk.com/en/docs/oauth/v2/developers_guide/scopes/). Common scopes include: * `data:read` * `data:write` * `data:create` * `code:all` * `data:search` * `viewables:read` Security best practices Use the minimum scopes required for your application to function when creating the integration in VIKTOR. This limits the impact in case of misuse. ## Integration with Autodesk Construction Cloud (ACC)[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-platform-services/.md#integration-with-autodesk-construction-cloud-acc "Direct link to Integration with Autodesk Construction Cloud (ACC)") Your **VIKTOR-APS** integration can connect to Autodesk Construction Cloud using **Custom integrations**. A custom integration connects your Autodesk Construction Cloud account to your APS application. The user must be an **Account Admin** to add the app integration. Follow these steps to connect your APS application to your ACC projects: 1. Log in to your ACC account. 2. Open **Custom integrations** and click **Add custom integration**. ![](/assets/images/aps-integration-acc1-19c9c4945c0379fe1727237bb9fa3011.png) 3. Enter the APS **Client ID** from the previous section. 4. Enter a name and a description for the custom integration. 5. Complete the integration by clicking **Add app**. ## Implementing the integration in an app (developer)[​](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-platform-services/.md#implementing-the-integration-in-an-app-developer "Direct link to Implementing the integration in an app (developer)") Once an administrator sets up and assigns the APS OAuth 2.0 integration to the app, the developer can start the implementation. ![](/assets/images/aps-integration-aps4-9af7fe8f522a7a431b7595f2bcc4421e.png) The developer should add the integration name to the app configuration. The platform uses it to show a login button when the user opens the app. Make sure your `viktor.config.toml` contains the name exactly as configured in the Administrator panel, and include an `oauth2_integrations` entry with the integration name, for example: `viktor.config.toml`: ``` app_type = "editor" python_version = "3.14" registered_name = "your-app-name" oauth2_integrations = [ "aps-integration-1" ] ``` Then implement the logic that uses the integration in the code. You can use raw REST requests or a Python SDK, as long as it is compatible with the VIKTOR OAuth flow. A popular library is `requests`. You can add it in your `requirements.txt` to use it in the application. ``` viktor==14.37.0 requests ``` To obtain an access token, instantiate `OAuth2Integration` with the integration name and call `get_access_token`. Below is a short example showing how to retrieve the user’s available hubs and display them in a [TableView](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/data-and-tables/). It works when the VIKTOR APS integration is assigned to your app, the ACC custom integration is added to your account, and the user has granted access: ``` import viktor as vkt import requests class Parametrization(vkt.Parametrization): text = vkt.Text("# APS OAuth2 Integration") class Controller(vkt.Controller): parametrization = Parametrization @vkt.TableView("Get ACC Hubs") def get_hubs(self, params, **kwargs): integration = vkt.external.OAuth2Integration("aps-integration-1") token = integration.get_access_token() headers = {"Authorization": f"Bearer {token}"} endpoint = "https://developer.api.autodesk.com/project/v1/hubs" response = requests.get(endpoint, headers=headers, timeout=15) response.raise_for_status() hubs_data = response.json().get("data", []) data = [] for hub in hubs_data: hub_name = hub.get("attributes", {}).get("name", "") hub_id = hub.get("id", "") data.append([hub_name, hub_id]) return vkt.TableResult(data, column_headers=["Hub name", "ID"]) ``` Note The integration name in `OAuth2Integration` must match the value in `viktor.config.toml`. The ACC custom integration must be added in Account Admin, and the user must have access to projects in that account. --- # AxisVM warning This binding was tested in AxisVM version 5. We cannot guarantee that the binding in combination with the worker will function properly with other versions of AxisVM. An AxisVM binding has been developed by VIKTOR to simplify the process of creating and analyzing an AxisVM model. ## Add integration to app config[​](https://docs.viktor.ai/docs/create-apps/software-integrations/axisvm/.md#add-integration-to-app-config "Direct link to Add integration to app config") To make the worker integration available through the interface, add the following to your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#worker_integrations): ``` worker_integrations = [ "axisvm", ] ``` For personal use, install and enable the worker with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md). Instructions on how to install an organization worker can be found [here](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#installation). ## Creating a `Model`[​](https://docs.viktor.ai/docs/create-apps/software-integrations/axisvm/.md#creating-a-model "Direct link to creating-a-model") An AxisVM model is made by starting off with an empty model and creating/modifying objects via their respective interfaces. The following [`Model`](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_Model) interfaces are available: * [`references`](https://docs.viktor.ai/sdk/api/external/axisvm/.md#Model.references): for creating reference points, vectors, axes, planes and angles. * [`materials`](https://docs.viktor.ai/sdk/api/external/axisvm/.md#Model.materials): for creating materials. * [`nodes`](https://docs.viktor.ai/sdk/api/external/axisvm/.md#Model.nodes): for creating nodes. * [`cross_sections`](https://docs.viktor.ai/sdk/api/external/axisvm/.md#Model.cross_sections): for creating cross-sections. * [`lines`](https://docs.viktor.ai/sdk/api/external/axisvm/.md#Model.lines): for creating lines, beams, etc. * [`domains`](https://docs.viktor.ai/sdk/api/external/axisvm/.md#Model.domains): for creating domains. * [`node_supports`](https://docs.viktor.ai/sdk/api/external/axisvm/.md#Model.node_supports): for creating node supports. * [`line_supports`](https://docs.viktor.ai/sdk/api/external/axisvm/.md#Model.line_supports): for creating line supports. * [`load_cases`](https://docs.viktor.ai/sdk/api/external/axisvm/.md#Model.load_cases): for creating load cases. * [`loads`](https://docs.viktor.ai/sdk/api/external/axisvm/.md#Model.loads): for creating loads. * [`load_combinations`](https://docs.viktor.ai/sdk/api/external/axisvm/.md#Model.load_combinations): for creating load combinations. * [`sections`](https://docs.viktor.ai/sdk/api/external/axisvm/.md#Model.sections): for creating sections, on which results can be obtained. * [`results`](https://docs.viktor.ai/sdk/api/external/axisvm/.md#Model.results): for requesting results from the worker (only requested results will be returned). Below is an example of a model, representing a cantilever beam bending under its own weight: ``` import viktor as vkt model = vkt.axisvm.Model() # Initialize the empty model. material = model.materials.add_from_catalog('C12/15', vkt.axisvm.Material.DesignCode.EURO_CODE) cross_section = model.cross_sections.create_rectangular(0.01, 0.01) n1 = model.nodes.create(0, 0, 0) n2 = model.nodes.create(1, 0, 0) beam = model.lines.create(n1, n2).define_as_beam(material, cross_section) model.node_supports.create_relative_to_member(n1, stiffness_x=1e10, stiffness_y=1e10, stiffness_z=1e10, stiffness_xx=1e10, stiffness_yy=1e10, stiffness_zz=1e10) load_case = model.load_cases.create() model.loads.create_beam_self_weight(load_case, beam) model.results.nodal_displacements([n2]) ``` ## Running an AxisVM analysis[​](https://docs.viktor.ai/docs/create-apps/software-integrations/axisvm/.md#running-an-axisvm-analysis "Direct link to Running an AxisVM analysis") The model can be fed to the [`AxisVMAnalysis`](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_AxisVMAnalysis) as follows: ``` import viktor as vkt # Run the analysis and obtain the results, model (.axs) and/or result file (.axe). analysis = vkt.axisvm.AxisVMAnalysis(model, return_results=True, return_model=True) analysis.execute(timeout=25) # make a conservative estimation of the time needed to finish results = analysis.get_results() # obtain the results in a dict model_file = analysis.get_model_file() # obtain the model file (.axs) result_file = analysis.get_result_file() # obtain the result file (.axe) ``` If `return_results` is set to `True`, an analysis will be performed and the following methods become available: * [`get_results`](https://docs.viktor.ai/sdk/api/external/axisvm/.md#AxisVMAnalysis.get_results) * [`get_result_file`](https://docs.viktor.ai/sdk/api/external/axisvm/.md#AxisVMAnalysis.get_result_file) If `return_model=True`, the model file will also become available: * [`get_model_file`](https://docs.viktor.ai/sdk/api/external/axisvm/.md#AxisVMAnalysis.get_model_file) ## Testing[​](https://docs.viktor.ai/docs/create-apps/software-integrations/axisvm/.md#testing "Direct link to Testing") New in v13.5.0 `mock_AxisVMAnalysis` decorator for easier testing of `AxisVMAnalysis` `AxisVMAnalysis.execute` needs to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. The `viktor.testing` module provides the [`mock_AxisVMAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_AxisVMAnalysis) decorator that facilitate mocking of workers: ``` import unittest from viktor import File from viktor.testing import mock_AxisVMAnalysis from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_AxisVMAnalysis( get_results={"Forces": ...}, get_model_file=File.from_path('test_file.axs'), get_result_file=File.from_path('test_file.axe'), ) def test_axis_vm_analysis(self): MyEntityTypeController().axis_vm_analysis() ``` For the decorator's input parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). --- # BoreDM BoreDM is a cloud-based geotechnical data management platform that enables organizations to store, manage, and visualize borehole log data, lab test results, and geotechnical site investigation information. The VIKTOR integration allows you to access BoreDM project data, boring logs, lithology, samples, and lab results through the BoreDM REST API. Prerequisites * You have access to a **[BoreDM](https://boredm.com/)** account with API access * You have a **BoreDM API key** (request one from [boredm.com](https://boredm.com/)) ## BoreDM API structure[​](https://docs.viktor.ai/docs/create-apps/software-integrations/boredm/.md#boredm-api-structure "Direct link to BoreDM API structure") This guide walks you through integrating BoreDM with VIKTOR, starting with provisioning an API key from your BoreDM account, securing it as an environment variable, and then using the BoreDM REST API to access your geotechnical data. In this guide we will cover the following endpoints: * **Projects** (`/api/v4/project/`) - List and access BoreDM projects visible to your API key * **Working with log data** (`/api/v4/project/{project_id}/geojson`) - Retrieve borehole locations and log IDs * **Lithology** (`/api/v4/logs/{project_id}/lithology`) - Access soil layer descriptions, depths, and classifications * **Samples** (`/api/v4/logs/{project_id}/sample`) - Retrieve SPT N-values, blow counts, sample depths, and recovery data * **Specimens** (`/api/v4/logs/{project_id}/specimen`) - Access lab test results linked to field samples * **Other tables** (`/api/v4/logs/{project_id}/{table}`) - Query generic/custom tables, teams, users, and project-level data ## Getting a BoreDM API key[​](https://docs.viktor.ai/docs/create-apps/software-integrations/boredm/.md#getting-a-boredm-api-key "Direct link to Getting a BoreDM API key") To use the BoreDM API, you need to provision an API key from your BoreDM account. Follow these steps: 1. **Navigate to Teams** - In the BoreDM sidebar, click on **Teams** under the **Resources** section 2. **Open the Organization tab** - Click on the **Organization** tab at the top of the page 3. **Provision a new API key** - Select a user, enter a key name, and click **+ Provision new API key** ![BoreDM API key provisioning interface](/assets/images/integration-boredm-api-d6bb07b4069f8f18361e2acae54dea50.png) ## Environment variables and secrets[​](https://docs.viktor.ai/docs/create-apps/software-integrations/boredm/.md#environment-variables-and-secrets "Direct link to Environment variables and secrets") Once you have your BoreDM API key, you need to link it to your VIKTOR app. The API key should be stored as the environment variable **`BOREDM_API_KEY`**. Whether you are working in the **App Builder** or in **local development**, follow the appropriate setup below. For more details on environment variables, see the [App Builder environment variables guide](https://docs.viktor.ai/docs/app-builder/.md#environment-variables-and-secrets) or the [local development environment variables guide](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/environment-variables/.md#defining-environment-variables-for-local-development). * App Builder * Local development - Open the app in the App Builder. - Click the gear icon in the bottom-left corner. - Open the **Variables** tab. - Add a variable named `BOREDM_API_KEY`. - Mark it as secret when storing a real BoreDM API key. - Read it in Python with `os.environ["BOREDM_API_KEY"]`. - Use the same name in all snippets on this page. ``` import os api_key = os.environ["BOREDM_API_KEY"] ``` * Set the environment variable when starting or running the app locally. * Keep the real key out of committed files. * Use the same variable name used in App Builder: `BOREDM_API_KEY`. ``` viktor-cli start --env BOREDM_API_KEY=your-local-api-key ``` Then read it in Python: ``` import os api_key = os.environ["BOREDM_API_KEY"] ``` tip Use a separate BoreDM key for local development when your organization has separate development and production access policies. For more details on environment variables, see the [App Builder environment variables guide](https://docs.viktor.ai/docs/app-builder/.md#environment-variables-and-secrets) or the [local development environment variables guide](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/environment-variables/.md#defining-environment-variables-for-local-development). warning Do not put the BoreDM API key in a VIKTOR field, browser-side JavaScript, Plotly figure metadata, or a printed log message. ## Authentication[​](https://docs.viktor.ai/docs/create-apps/software-integrations/boredm/.md#authentication "Direct link to Authentication") Every BoreDM request needs the same **base URL** and **authorization header**. This section defines the minimum request contract used by all code examples on this page. * **Base URL**: `https://boredm.com` * **API version prefix**: `/api/v4` * **Required header**: `Authorization: Secret ` * **Best practices**: * Store the API key in environment variables (see section above) * Read it with `os.environ["BOREDM_API_KEY"]` * Keep the key server-side in Python * Never expose the key in browser-side JavaScript or client-visible code ## BoreDM Projects[​](https://docs.viktor.ai/docs/create-apps/software-integrations/boredm/.md#boredm-projects "Direct link to BoreDM Projects") Project endpoints are the normal entry point for a VIKTOR integration because every log and table request needs a selected project ID. **Endpoint**: `GET /api/v4/project/` Use this endpoint to discover which BoreDM projects the current API key can read. **Use it to**: * List projects visible to the API key * Fill a VIKTOR project selector * Let users choose which project to inspect The project list endpoint returns one item per project. Treat each project **`_id`** as the value you pass into later project-level endpoints. For user-facing labels, combine readable fields such as `name`, `project_number`, and `client_name` instead of exposing only the UUID. * **Important**: Use project `_id` as `project_id` - do not use project name as the identifier for later endpoints **Common project fields:** * `_id` * `name` * `project_number` - `client_name` - `status` - `date_created` * `date_updated` * `nda_strict` Expand to see all available response fields In alphabetical order: * `_id` * `accessors` * `analyte_settings_id` * `automated_notes_id` * `branding_id` * `client_name` * `comments` * `consultant_project_number` * `corporation_id` * `county_code` * `date_created` * `date_updated` * `district` * `dropdowns_id` - `facility_id` - `field_workflow_id` - `from_upload` - `library_id` - `location` - `location_id` - `mapping_rules` - `mapping_rules_id` - `n_value_id` - `name` - `nda_strict` - `project_manager` - `project_number` - `project_owner_logo` * `project_owner_name` * `project_type` * `region` * `sampling_configurations` * `sitemap_configuration` * `spell_check_id` * `status` * `stratigraphic_unit_definitions` * `template_configuration` * `unit_id` * `visual_description_config` * `visual_description_config_id` * `watermark_mapping_id` **Example response:** ``` [ { "_id": "550e8400-e29b-41d4-a716-446655440000", "name": "Downtown Bridge Project", "project_number": "2024-001", "client_name": "City Engineering", "status": ["Active"], "date_created": "2024-01-15T14:30:00Z", "date_updated": "2024-01-15T14:30:00Z", "corporation_id": "550e8400-e29b-41d4-a716-446655440000", "nda_strict": true } ] ``` ## BoreDM data endpoints[​](https://docs.viktor.ai/docs/create-apps/software-integrations/boredm/.md#boredm-data-endpoints "Direct link to BoreDM data endpoints") Use the tabs below to explore each data type: * GeoJSON * Lithology * Samples * Specimens * Other tables ### What the GeoJSON endpoint does[​](https://docs.viktor.ai/docs/create-apps/software-integrations/boredm/.md#what-the-geojson-endpoint-does "Direct link to What the GeoJSON endpoint does") **Endpoint**: `GET /api/v4/project/{project_id}/geojson` This endpoint returns a GeoJSON feature collection where each feature represents one borehole. The critical field is **`feature.properties.id`**, which serves as the `log_id` for joining lithology, sample, and specimen records. **Important**: Always use `feature.properties.id` as the log ID, never the boring name string. **Common GeoJSON fields:** * `feature.properties.id` - Unique log ID (use this for joins) * `feature.properties.name` - Boring name * `feature.properties.boringType` - Type of boring - `feature.properties.status` - Current status - `feature.geometry.coordinates` - \[longitude, latitude] array Expand to see all available response fields In alphabetical order: * `features` * `features.geometry` * `features.geometry.coordinates` * `features.geometry.type` - `features.properties` - `features.properties.boringType` - `features.properties.depth` - `features.properties.id` * `features.properties.name` * `features.properties.status` * `features.type` * `type` **Example response:** ``` { "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Point", "coordinates": [-77.0369, 38.9072] }, "properties": { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "B-1", "boringType": "Boring", "depth": 50.0, "status": "Complete" } } ] } ``` **Endpoint**: `GET /api/v4/logs/{project_id}/lithology` The lithology endpoint returns soil and rock layer descriptions with depth intervals. **Use this endpoint to**: * Access layer descriptions and classifications * Retrieve depth intervals for each soil/rock stratum * Get USCS codes, colors, moisture content, and other classification data **Common lithology fields:** * `_id` - Unique layer ID * `log_id` - Links to GeoJSON log ID * `start_depth`, `end_depth` - Depth interval * `complete_description` - Full layer description - `uscs_code` - USCS soil classification - `soil_type_1` - Primary soil type - `color`, `moisture` - Visual/physical properties Expand to see all available response fields In alphabetical order: * `_id` * `aashto` * `aashto_group_index` * `additional_description` * `additional_group_name` * `angularity` * `angularity_2` * `angularity_3` * `angularity_4` * `background_color` * `boulders` * `boulders_angularity` * `boulders_hardness` * `boulders_shape` * `cementation` * `cobbles` * `cobbles_angularity` * `cobbles_hardness` * `cobbles_shape` * `color` * `color_2` * `complete_description` * `custom_classification` * `dilatancy` * `discoloration` * `discontinuity_description` * `dontautocomplete` * `dry_strength` * `end_depth` * `fill` * `foreground_color` - `fracture_spacing` - `frozen` - `geological_unit` - `grain_size` - `grain_size_2` - `grain_size_3` - `grain_size_4` - `graphic` - `graphic_1_length` - `graphic_2` - `graphic_2_length` - `hardness` - `hcl_reaction` - `ice_classification` - `identifier` - `is_field_row` - `is_rock` - `line_type` - `log_id` - `micaceous` - `mode_of_deposition` - `moisture` - `munsell_color` - `odor` - `plasticity` - `primary_constituent` - `primary_constituent_angularity` - `primary_constituent_grain_size` - `primary_constituent_quantity` - `rock_type` - `rock_type_2` * `secondary_constituent` * `secondary_constituent_angularity` * `secondary_constituent_grain_size` * `secondary_constituent_quantity` * `sheen` * `soil_consistency` * `soil_rock_equivalent` * `soil_type_1` * `soil_type_2` * `soil_type_3` * `soil_type_4` * `soil_type_quantity_1` * `soil_type_quantity_2` * `soil_type_quantity_3` * `soil_type_quantity_4` * `staining` * `start_depth` * `stratification` * `stratigraphic_unit` * `strength` * `strength_2` * `structure` * `toughness` * `transition_length` * `type_2_modifier` * `type_modifier` * `uscs_code` * `usda` * `weathering` **Example response:** ``` [ { "_id": "fa3b1d9b-8d07-4f02-b1fe-1b031a8d344a", "log_id": "c9acc7c3-4313-4d6f-883d-9c9bf2b207ff", "start_depth": 0.0, "end_depth": 15.0, "complete_description": "Sandy CLAY, brown, moist, medium stiff (CL)", "uscs_code": "CL", "soil_type_1": "Clay", "color": "Brown", "moisture": "Moist", "is_field_row": false } ] ``` **Endpoint**: `GET /api/v4/logs/{project_id}/sample` The samples endpoint returns field sample data including SPT N-values, blow counts, sample types, and recovery. **Use this endpoint to**: * Retrieve SPT N-values for geotechnical analysis * Access blow count data (blows\_1, blows\_2, blows\_3) * Get sample depths and types * Retrieve RQD and core recovery for rock samples **Common sample fields:** * `_id` - Unique sample ID * `log_id` - Links to GeoJSON log ID * `start_depth` - Sample depth - `n_value`, `corrected_n_value` - SPT values - `blows_1`, `blows_2`, `blows_3` - Individual blow counts * `sample_type` - Sample classification * `percent_rqd`, `percent_core_recovery` - Rock data Expand to see all available response fields In alphabetical order: * `_id` * `blows_1` * `blows_2` * `blows_3` * `blows_4` * `blows_5` * `blows_6` * `core_recovery_length` * `corrected_n_value` * `depth_driven_1` * `depth_driven_2` * `depth_driven_3` * `depth_driven_4` * `depth_driven_5` - `depth_driven_6` - `diameter` - `field_sample_id` - `hydraulic_pressure` - `is_field_row` - `length` - `log_id` - `n_160` - `n_60` - `n_value` - `percent_core_recovery` - `percent_recovery` - `percent_rqd` - `photo_urls` * `recovery_length` * `refusal` * `rqd_core_length` * `sample_comment` * `sample_type` * `sampler_correction_factor` * `sampler_graphic` * `solid_core_recovery_length` * `solid_core_recovery_percent` * `start_depth` * `time_sampled` * `uncorrected_n_value` * `woh_wor` * `workflow_status` **Example response:** ``` [ { "_id": "290b70c4-2027-453f-a7fb-c8ab1990440c", "log_id": "c9acc7c3-4313-4d6f-883d-9c9bf2b207ff", "start_depth": 18.0, "blows_1": 3, "blows_2": 4, "blows_3": 6, "n_value": "10", "sample_type": "SPT", "length": 1.5, "recovery_length": 13.0, "is_field_row": false } ] ``` **Endpoint**: `GET /api/v4/logs/{project_id}/specimen` The specimens endpoint returns lab test results and specimen-level data. **Use this endpoint to**: * Access lab test results (strength, unit weight, etc.) * Retrieve environmental test data (CAS fields) * Link lab specimens back to field samples **Common specimen fields:** * `_id` - Unique specimen ID * `log_id` - Links to GeoJSON log ID * `sample_id` - Links to sample record * `start_depth`, `end_depth` - Test depth range - `direct_shear_peak_friction_angle` - Shear strength - `direct_shear_peak_cohesion` - Cohesion - `dry_unit_weight`, `wet_unit_weight` - Unit weights **Important**: Specimens typically join to samples via `specimen.sample_id = sample._id`, but always verify the join key structure for your specific account. Expand to see all available response fields In alphabetical order: * `_id` * `aashto` * `aashto_group_index` * `additional_description` * `additional_group_name` * `angularity` * `angularity_2` * `angularity_3` * `angularity_4` * `atterberg_ll` * `atterberg_pi` * `atterberg_pl` * `boulders` * `boulders_angularity` * `boulders_hardness` * `boulders_shape` * `calcium_carbonate_equivalent` * `cas_` * `cbr` * `cementation` * `cerchar_abrasivity` * `chloride` * `cobbles` * `cobbles_angularity` * `cobbles_hardness` * `cobbles_shape` * `coefficient_of_consolidation` * `cohesion` * `color` * `color_2` * `comment` * `complete_description` * `compression_index` * `compressive_strength` * `confining_pressure` * `core_condition` * `custom_classification` * `d_10` * `d_60` * `direct_shear_peak_cohesion` * `direct_shear_peak_friction_angle` * `direct_shear_peak_tangent_angle` * `discoloration` * `dry_density` * `dry_strength` * `dry_unit_weight` * `effective_cohesion` * `effective_friction_angle` * `elastic_modulus` * `end_depth` * `expansive_index` * `fid` * `field_percent_fines` * `field_percent_gravel` * `field_percent_sand` * `fill` * `fracture_spacing` * `friction_angle` * `frost_classification` * `frozen` * `geological_unit` * `grain_size` * `grain_size_2` * `grain_size_3` * `grain_size_4` * `hardness` * `hcl_reaction` * `hexane` * `hydraulic_conductivity` * `ice_classification` * `identifier` - `in_situ_dry_density` - `in_situ_moisture_classification` - `in_situ_moisture_content` - `is_environmental_specimen` - `is_field_row` - `is_lab_specimen` - `is_rock` - `isobutylene` - `lab_aashto` - `lab_aashto_group_index` - `lab_notes` - `lab_percent_fine` - `lab_percent_gravel` - `lab_percent_sand` - `lab_pocket_penetrometer` - `lab_primary_constituent` - `lab_sample_id` - `lab_secondary_constituent` - `lab_soil_type_1` - `lab_soil_type_2` - `lab_soil_type_3` - `lab_soil_type_quantity_2` - `lab_soil_type_quantity_3` - `lab_torvane` - `lab_uscs_code` - `lab_vane_shear` - `lab_vane_shear_remolded` - `linear_shrinkage` - `load_stress` - `log_id` - `max_dry_density` - `methane` - `mode_of_deposition` - `modifier` - `moisture` - `moisture_content` - `munsell_color` - `name` - `odor` - `optimum_moisture_content` - `over_consolidation_ratio` - `oxidation_reduction_potential` - `p_h` - `pct_finer_02mm` - `percent_boulders` - `percent_clay` - `percent_coarse_gravel` - `percent_coarse_sand` - `percent_cobbles` - `percent_fine_gravel` - `percent_fine_sand` - `percent_medium_sand` - `percent_organic_material` - `percent_passing_200` - `percent_passing_3_4` - `percent_passing_4` - `percent_passing_40` - `percent_retained_on_10` - `percent_retained_on_4` - `percent_saturation` - `percent_silt` - `permeability` - `pid` - `plasticity` - `plus_number_4` - `plus_number_40` - `pocket_penetrometer` - `point_load_test` - `preconsolidation_pressure` - `primary_constituent` * `primary_constituent_angularity` * `primary_constituent_grain_size` * `primary_constituent_quantity` * `qt` * `r_value` * `recompression_index` * `redox_potential` * `resistivity` * `rock_type` * `rock_type_2` * `rock_workflow_status` * `salinity` * `sample_id` * `sample_id_str` * `sample_temperature` * `secondary_constituent` * `secondary_constituent_angularity` * `secondary_constituent_grain_size` * `secondary_constituent_quantity` * `shear_strength` * `sheen` * `shrink_swell_load_stress` * `shrink_swell_potential` * `shrinkage_limit` * `slake_durability` * `slurry_abrasivity` * `so4` * `soil_consistency` * `soil_rock_equivalent` * `soil_type_1` * `soil_type_2` * `soil_type_3` * `soil_type_4` * `soil_type_quantity_1` * `soil_type_quantity_2` * `soil_type_quantity_3` * `soil_workflow_status` * `specific_gravity` * `staining` * `start_depth` * `strain` * `stratification` * `stratigraphic_unit` * `strength` * `strength_test_type` * `structure` * `sub_sample_id` * `sulfate` * `sulfides` * `swell_pressure` * `test_types` * `torvane` * `total_dissolved_solids` * `toughness` * `transition_length` * `tx_uu` * `type_2_modifier` * `type_modifier` * `unconfined_compressive_strength` * `unit_weight` * `uscs_code` * `usda` * `vane_shear` * `vane_shear_remolded` * `visual_classification` * `visual_moisture` * `void_ratio` * `weathering` * `wet_density` * `wet_unit_weight` **Example response:** ``` [ { "_id": "dd6d6d84-8762-4317-b0e6-9a382dbb8bbd", "log_id": "c9acc7c3-4313-4d6f-883d-9c9bf2b207ff", "sample_id": "290b70c4-2027-453f-a7fb-c8ab1990440c", "start_depth": 18.0, "end_depth": 19.5, "atterberg_ll": 42, "atterberg_pl": 18, "atterberg_pi": 24, "moisture_content": 15.2, "dry_unit_weight": 105.3, "is_lab_specimen": true, "is_field_row": false } ] ``` **Note**: Specimen records may also include CAS number fields (e.g., `cas_7440_02_0`, `cas_71_43_2`) for environmental/chemical analysis data. ### Generic and field tables[​](https://docs.viktor.ai/docs/create-apps/software-integrations/boredm/.md#generic-and-field-tables "Direct link to Generic and field tables") BoreDM can expose flexible table endpoints beyond the common lithology, sample, and specimen tables. These are useful for project-specific data like water levels, rock data, or custom field measurements. **Endpoint patterns:** * Office table: `GET /api/v4/logs/{project_id}/{table}` * Field/mobile table: `GET /api/v4/logs/{project_id}/field/{table}` **Example - querying water level data:** ``` table_name = "water" response = requests.get( f"https://boredm.com/api/v4/logs/{params.project_id}/{table_name}", headers={ "Authorization": f"Secret {os.environ['BOREDM_API_KEY']}", "Accept": "application/json", }, timeout=30, ) response.raise_for_status() rows = response.json() preview = [] for row in rows[:20]: preview.append([ row.get("_id"), row.get("log_id"), ", ".join(sorted(row.keys())[:8]), ]) return vkt.TableResult(preview, column_headers=["Row ID", "Log ID", "First keys"]) ``` ### Other endpoints[​](https://docs.viktor.ai/docs/create-apps/software-integrations/boredm/.md#other-endpoints "Direct link to Other endpoints") **Teams and users** (account management): * `GET /api/v4/team` - List teams * `POST /api/v4/team` - Create team * `POST /api/v4/team/{team_id}/users` - Add users to team * `DELETE /api/v4/team/{team_id}/users` - Remove users from team * `GET /api/v4/users/self` - Get current user info **Project-level data** (advanced dashboards): * `GET /api/v4/project/{project_id}/labs` - Lab test data * `GET /api/v4/project/{project_id}/quality` - Quality control data * `GET /api/v4/project/full` - Full project details * `GET /api/v4/log_graphics` - Log graphics and images **Note**: Lab rows may join through `sample_id`, but some accounts use display sample IDs or custom fields. Always inspect your data structure before implementing joins. *** ## Implementation examples[​](https://docs.viktor.ai/docs/create-apps/software-integrations/boredm/.md#implementation-examples "Direct link to Implementation examples") The following implementation examples demonstrate complete, ready-to-use code for common BoreDM integration patterns in VIKTOR apps. Each example shows the full function or class definition you can copy into your `app.py`. * Projects * Log data * Visualization ### Create a project selector[​](https://docs.viktor.ai/docs/create-apps/software-integrations/boredm/.md#create-a-project-selector "Direct link to Create a project selector") Create an OptionField that lets users select a BoreDM project by combining the project name, number, and client name into a readable label. ``` import os import requests import viktor as vkt def project_options(params, **kwargs) -> list[vkt.OptionListElement]: response = requests.get( "https://boredm.com/api/v4/project/", headers={ "Authorization": f"Secret {os.environ['BOREDM_API_KEY']}", "Accept": "application/json", }, timeout=30, ) response.raise_for_status() projects = response.json() options = [] for project in projects: project_id = project.get("_id") if not project_id: continue name = project.get("name") or "Unnamed project" number = project.get("project_number") or "No number" client = project.get("client_name") or "No client" label = f"{name} | {number} | {client}" options.append(vkt.OptionListElement(value=project_id, label=label[:90])) return options class Parametrization(vkt.Parametrization): project_id = vkt.OptionField("Project", options=project_options) ``` ### Show projects in a TableView[​](https://docs.viktor.ai/docs/create-apps/software-integrations/boredm/.md#show-projects-in-a-tableview "Direct link to Show projects in a TableView") Display all available projects in a table with their key information (ID, name, project number, client, and status). ``` @vkt.TableView("Projects", duration_guess=2) def projects_table(self, params, **kwargs): response = requests.get( "https://boredm.com/api/v4/project/", headers={ "Authorization": f"Secret {os.environ['BOREDM_API_KEY']}", "Accept": "application/json", }, timeout=30, ) response.raise_for_status() projects = response.json() rows = [] for project in projects: rows.append([ project.get("_id"), project.get("name"), project.get("project_number"), project.get("client_name"), ", ".join(project.get("status") or []), ]) return vkt.TableResult( rows, column_headers=["Project ID", "Name", "Number", "Client", "Status"], ) ``` ### Show lithology in a TableView[​](https://docs.viktor.ai/docs/create-apps/software-integrations/boredm/.md#show-lithology-in-a-tableview "Direct link to Show lithology in a TableView") Display lithology layers with depth intervals, USCS codes, and soil descriptions for a selected project. ``` @vkt.TableView("Lithology rows", duration_guess=3) def lithology_table(self, params, **kwargs): response = requests.get( f"https://boredm.com/api/v4/logs/{params.project_id}/lithology", headers={ "Authorization": f"Secret {os.environ['BOREDM_API_KEY']}", "Accept": "application/json", }, timeout=30, ) response.raise_for_status() lithologies = response.json() rows = [] for row in lithologies: rows.append([ row.get("log_id"), row.get("start_depth"), row.get("end_depth"), row.get("uscs_code"), row.get("soil_type_1"), row.get("complete_description"), ]) return vkt.TableResult( rows, column_headers=["Log ID", "Start", "End", "USCS", "Soil type", "Description"], ) ``` ### Show samples in a TableView[​](https://docs.viktor.ai/docs/create-apps/software-integrations/boredm/.md#show-samples-in-a-tableview "Direct link to Show samples in a TableView") Display sample data including SPT N-values, blow counts, and sample depths for a selected project. ``` @vkt.TableView("Sample rows", duration_guess=3) def sample_table(self, params, **kwargs): response = requests.get( f"https://boredm.com/api/v4/logs/{params.project_id}/sample", headers={ "Authorization": f"Secret {os.environ['BOREDM_API_KEY']}", "Accept": "application/json", }, timeout=30, ) response.raise_for_status() samples = response.json() rows = [] for row in samples: rows.append([ row.get("log_id"), row.get("start_depth"), row.get("sample_type"), row.get("n_value"), row.get("blows_1"), row.get("blows_2"), row.get("blows_3"), ]) return vkt.TableResult( rows, column_headers=["Log ID", "Depth", "Type", "N", "Blows 1", "Blows 2", "Blows 3"], ) ``` ### Plot borings on a map[​](https://docs.viktor.ai/docs/create-apps/software-integrations/boredm/.md#plot-borings-on-a-map "Direct link to Plot borings on a map") Create an interactive map showing all borehole locations from the GeoJSON endpoint using Plotly. ``` @vkt.PlotlyView("Boring map", duration_guess=3) def boring_map(self, params, **kwargs): response = requests.get( f"https://boredm.com/api/v4/project/{params.project_id}/geojson", headers={ "Authorization": f"Secret {os.environ['BOREDM_API_KEY']}", "Accept": "application/json", }, timeout=30, ) response.raise_for_status() geojson = response.json() names, lats, lons = [], [], [] for feature in geojson.get("features", []): geometry = feature.get("geometry") properties = feature.get("properties") or {} if not geometry: continue lon, lat = geometry.get("coordinates", [None, None]) names.append(properties.get("name")) lats.append(lat) lons.append(lon) fig = go.Figure() fig.add_trace(go.Scattermapbox(lat=lats, lon=lons, text=names, mode="markers+text")) return vkt.PlotlyResult(fig) ``` ### Visualize lithology layers[​](https://docs.viktor.ai/docs/create-apps/software-integrations/boredm/.md#visualize-lithology-layers "Direct link to Visualize lithology layers") Create a stacked bar chart showing lithology layers by depth for each borehole. ``` @vkt.PlotlyView("Lithology layers", duration_guess=3) def lithology_layers(self, params, **kwargs): response = requests.get( f"https://boredm.com/api/v4/logs/{params.project_id}/lithology", headers={"Authorization": f"Secret {os.environ['BOREDM_API_KEY']}"}, timeout=30, ) response.raise_for_status() fig = go.Figure() for row in response.json(): top = row.get("start_depth") bottom = row.get("end_depth") if top is None or bottom is None: continue label = row.get("uscs_code") or row.get("soil_type_1") or "Layer" fig.add_trace(go.Bar( x=[row.get("log_id")], y=[bottom - top], base=[top], text=[label], showlegend=False, )) fig.update_yaxes(autorange="reversed", title="Depth") fig.update_layout(xaxis_title="Borelog", barmode="stack") return vkt.PlotlyResult(fig) ``` *** ## Connecting BoreDM data[​](https://docs.viktor.ai/docs/create-apps/software-integrations/boredm/.md#connecting-boredm-data "Direct link to Connecting BoreDM data") The implementation examples above show how to retrieve data from individual endpoints. To build more advanced features, like associating SPT N-values with soil layers or linking lab results to field samples, you'll need to join data across multiple endpoints. BoreDM data follows a hierarchical structure where **projects** contain **logs** (boreholes), and each log contains **data tables** like lithology, samples, and specimens. To work with this data effectively, follow the ID relationships rather than relying on string names. ### Basic relationship chain[​](https://docs.viktor.ai/docs/create-apps/software-integrations/boredm/.md#basic-relationship-chain "Direct link to Basic relationship chain") 1. Select a **project** from `/api/v4/project/` and use its `_id` as `project_id` 2. Get **logs** from `/api/v4/project/{project_id}/geojson` and use `feature.properties.id` as the log ID 3. Join **lithology**, **samples**, and **specimens** to logs using their `log_id` field 4. Join **specimens** to **samples** using `specimen.sample_id = sample._id` 5. Join **samples** to **lithology** by matching both `log_id` and depth interval warning Do not use boring names as join keys. Always use BoreDM IDs (`_id` or `id` fields) to ensure reliable data relationships. *** ## Conclusion[​](https://docs.viktor.ai/docs/create-apps/software-integrations/boredm/.md#conclusion "Direct link to Conclusion") By following this guide, you've learned how to authenticate with the BoreDM API, retrieve project and log data, work with lithology, samples, and specimens, and visualize geotechnical data in VIKTOR apps. You now have the templates and patterns you need to integrate BoreDM with your applications and automate your geotechnical data workflows. --- # Civil 3D This guide explains how to integrate Autodesk Civil 3D with a VIKTOR app. Your app calls the Civil 3D COM (ActiveX) API directly, so you can read the surfaces, alignments and COGO points in a drawing, add to them, and draw with the full AutoCAD drafting surface, all from your app code. note `vkt.civil3d.connect()` and `vkt.civil3d.attach()` are a **BETA** feature and require **viktor >= 14.36.0**. `vkt.civil3d.connect()` starts a Civil 3D instance on the worker for the session. `vkt.civil3d.attach()` binds the session to the instance the user already has open instead of starting a new one; see [Attaching to a running instance](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#attaching-to-a-running-instance). ## The worker[​](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#the-worker "Direct link to The worker") A worker is a program that connects the VIKTOR platform to third-party software running outside the platform. For Civil 3D it belongs on the machine where you use Civil 3D, as a [personal worker](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#install-the-worker): Civil 3D must be installed where the worker is, and a session drives the real desktop application. Your VIKTOR app handles the communication between the web app and the worker. Here is what happens during the integration: 1. The user performs an action that requires a Civil 3D analysis. 2. Your app opens a session, and each ActiveX call it makes is sent to the worker as a task. 3. The worker executes that one call against the live Civil 3D instance and returns its result. 4. Your app uses the returned values to build its views, or draws the next piece of geometry. 5. (Optional) **VIKTOR UI** displays the result. Unlike the integrations that send a file or a script to the worker, there is no script to write and ship: all of your code stays in your app, and the worker machine needs no Python environment. Civil 3D cannot run headless The worker drives the real desktop application, so the machine it runs on needs a **logged-in, interactive Windows session** (a service running in Session 0 cannot start Civil 3D). The licence must not prompt on startup either: nobody is there to answer an Autodesk sign-in or activation dialog, so the app would only see a timeout. Activate the licence once by launching Civil 3D by hand on that machine, as the same user the worker runs as. ## Calling the API directly from your app[​](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#calling-the-api-directly-from-your-app "Direct link to Calling the API directly from your app") Open a session with `vkt.civil3d.connect()` and navigate the Civil 3D object model from the `c3d` object it gives you: app.py ``` import viktor as vkt class Controller(vkt.Controller): parametrization = Parametrization def write_to_civil3d(self, params, **kwargs): with vkt.civil3d.connect(timeout=180) as c3d: document = c3d.ActiveDocument point = document.Points.Add([params.easting, params.northing, params.level]) number = point.Number() # property read: call syntax (note the parentheses) point.Description = "SET-OUT" # property write: plain assignment document.SaveAs("setting-out.dwg") # relative filename, not an absolute path ``` Please consider the following: * **A property is read with parentheses and written without them.** `point.Number()` gives you the value; `point.Description = "SET-OUT"` sets it. This is the convention that catches people out most often, so it is worth checking first when a call behaves unexpectedly. Reading a property *without* the parentheses raises a `TypeError` as soon as you use it as a value, before any round trip, with a hint naming the call you meant. * **Objects that calls return are session-scoped handles.** Use them as the start of further calls and as arguments, exactly like the COM objects they stand for. They are released when the session closes, so read the values you need before the `with` block ends. * **Collections are read one item at a time, and they are 0-based.** Use `Count()` and `Item(i)`; `Item` also takes a name, so `document.Surfaces.Item("EG")` is a lookup rather than a scan. A Python `for` loop over a collection raises: there is no iteration protocol on a handle. * **COGO points are Easting, Northing, Elevation.** `Points.Add([1000.0, 2000.0, 3.5])` in that order, read back with `Easting()`, `Northing()` and `Elevation()`. Reversing the first two misplaces every point without any error, so it is worth asserting the round trip in a test. * **Navigate down from `c3d`.** The back-references `Application`, `Document` and `Parent` are refused, so keep your own reference to `c3d.ActiveDocument` instead of walking back up. * **Every call is a round trip** to the worker; navigating attributes to reach it is free. `c3d.ActiveDocument.Points.Count()` is one round trip, not three. Bound loops that call or read properties per item, and prefer the calls that work in bulk over a loop that touches every object of a large drawing. * **Filenames are confined to the session's working directory.** Give `SaveAs`, `ImportPoints`, `Surfaces.ImportXML` and the other file members a relative filename rather than an absolute path. In this release a drawing cannot be returned from the session to your app, so read the values you need through COM while the session is open. * **Some members are refused by the worker** and raise `vkt.ExecutionError`: those that execute arbitrary code (`SendCommand`, `Run`, `GetInterfaceObject`), those that wait for input at the command line, those that change settings outliving the session (`Preferences`, `SetVariable`), and `Save`, `Close` and `Quit`. Save with `SaveAs` and a relative filename instead. Civil 3D's `Aecc` objects inherit the AutoCAD surface, so the same refusals hold on them. * **The enumerations live on `vkt.civil3d`**, covering the AutoCAD `Ac*` enumerations as well as Civil 3D's `Aec*` and `Aecc*` ones (`AeccDrawingUnitType`, `AeccProfilePVICurveType`, `AcMeasurementUnits`, and so on): `vkt.civil3d.AeccDrawingUnitType.aeccDrawingUnitMeters`. Their member names mirror the product API exactly, so the enum reads like the reference and beats a magic number. `from viktor.external.civil3d import AeccDrawingUnitType` gives you the same object under a shorter name. Note that they are **not** on the top-level `vkt` namespace, so `vkt.AeccDrawingUnitType` raises `AttributeError`. * **Creation members vary between Civil 3D releases.** The COM object model is not identical from one release to the next, and the corridor domain is largely read-only. Where a member creates something, check it against the release you are automating rather than assuming the signature carries over. The COM members you call on `c3d` mirror the Civil 3D object model (the `AeccXUi*` type libraries) plus the AutoCAD ActiveX model it extends, and are not listed in the SDK reference. Look them up in the [Civil 3D Developer's Guide](https://www.autodesk.com/developer-network/platform-technologies/civil-3d) ("COM API" chapters), and in the [AutoCAD ActiveX Reference Guide](https://www.autodesk.com/developer-network/platform-technologies/autocad) for the drafting surface. ### The three domain roots[​](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#the-three-domain-roots "Direct link to The three domain roots") Civil 3D splits its API over several application objects, and `c3d` is one of them: it is the **Land** root, whose `ActiveDocument` carries the surfaces, COGO points, alignments, sites and styles, plus the whole AutoCAD drafting surface. The other two domains are separate roots, reached as properties of `c3d`: app.py ``` with vkt.civil3d.connect(timeout=180) as c3d: surfaces = c3d.ActiveDocument.Surfaces.Count() # Land: the connection root networks = c3d.pipe.ActiveDocument.PipeNetworks.Count() # pipe networks corridors = c3d.roadway.ActiveDocument.Corridors.Count() # corridors and assemblies ``` * `c3d` is the Land root. There is no `c3d.land`, and **your app never calls `GetInterfaceObject`** to reach a domain: the worker owns that, and the member is refused. * `c3d.pipe` is the pipe-network root. Its `ActiveDocument` is the same drawing seen through the pipe domain, and holds `PipeNetworks`. * `c3d.roadway` is the corridor root, whose `ActiveDocument` carries `Corridors`, `Assemblies` and `Subassemblies`. This domain is **largely read-only** in Civil 3D's COM API, so plan on reading a corridor rather than building one. Each root is resolved on the worker the first time you touch it, which costs one round trip, and is then cached for the rest of the session. The cache does not outlive the session: a root taken from a closed session raises, like any other handle. ### Attaching to a running instance[​](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#attaching-to-a-running-instance "Direct link to Attaching to a running instance") `vkt.civil3d.attach()` opens the same kind of session against the Civil 3D that is **already running** on the worker machine, rather than starting a fresh instance. The app then reads and writes the drawing the user has on screen, and what it draws appears in their window. This is what you want when the point is to act on the drawing in front of the user, which in practice means a personal worker on their own machine. app.py ``` def read_from_civil3d(self, params, **kwargs): try: with vkt.civil3d.attach(timeout=180) as c3d: surface = c3d.ActiveDocument.Surfaces.Item(params.surface_name) return surface.Statistics.MinElevation() except vkt.WorkerSessionAttachError as err: if err.reason == "error_attach_no_instance": raise vkt.UserError( "No Civil 3D instance was found on your worker. Open your drawing in Civil 3D on " "the machine running your personal worker, then try again. If plain AutoCAD is " "open there, close it first." ) from err if err.reason == "error_attach_wrong_product": raise vkt.UserError( f"Your Civil 3D runs a different units profile than your worker expects: {err}" ) from err raise vkt.UserError(f"Could not attach to Civil 3D ({err.reason or 'unknown reason'}).") from err ``` The two are strictly separate: * `attach()` fails when nothing attachable is running on the worker machine; it never starts Civil 3D for you. * `connect()` always starts a fresh instance. If any AutoCAD-family application is already open on the worker machine the session is refused — close it there, or use `attach()`. * There is no automatic fallback in either direction. If you want one, write it yourself by catching `vkt.WorkerSessionAttachError` and calling `connect()`. What changes once the session is attached: * The drawing is **not empty**. Do not assume the surfaces and point groups you expect are there, that layer names are free, or that the coordinate system is at its defaults. * Closing the session **detaches without exiting Civil 3D**. The instance and the drawing stay as they were, including everything your app wrote. * **Nothing rolls back.** Your app's changes are real edits in the user's drawing, and undoing them is their call. Write onto layers with a recognisable prefix so the result is easy to isolate. * The user's file on disk is still never overwritten: `Save` is refused, and `SaveAs` writes into the session's working directory. Trigger it from an action button, not a download button An attached session produces edits in the drawing already open on the user's screen — they watch the points or geometry appear, and saving the file is theirs to do. A `DownloadButton` promises a file that is never coming, and a save dialog is not what anyone expects after editing a model in front of them. Use a [`vkt.ActionButton`](https://docs.viktor.ai/sdk/api/parametrization/.md#_ActionButton) when your app only writes to the drawing, and a [`vkt.SetParamsButton`](https://docs.viktor.ai/sdk/api/parametrization/.md#_SetParamsButton) when it also feeds values back into the parametrization. Keep `DownloadButton` for output your app builds itself, such as a report or a CSV of values read through COM. [`vkt.errors.WorkerSessionAttachError`](https://docs.viktor.ai/sdk/api/errors/.md#_WorkerSessionAttachError) carries a `reason`; the reference page lists the full set of eight. The ones specific to a Civil 3D session: | `reason` | Meaning | | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------- | | `"error_attach_no_instance"` | nothing attachable is running: either no instance at all, or the one that is running is plain AutoCAD, which must be closed first | | `"error_attach_wrong_product"` | the running instance uses a different units profile than the worker's `units` setting; the message names both profiles | | `"error_attach_refused"` | an instance was found but would not accept the connection, typically because it is busy or waiting on a dialog | The rest come from the worker connection itself rather than Civil 3D — for example `"no_worker_online"` (no worker is connected) and `"worker_kind_not_allowed"` (this worker kind is disabled for the organization) are usually the first ones a user hits. Handle an unrecognised `reason` as a generic attach failure. Note that `WorkerSessionAttachError` is a subclass of `vkt.WorkerSessionError`, so catch it first if you handle both. ### Add integration to app config[​](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#add-integration-to-app-config "Direct link to Add integration to app config") To make the worker integration available through the interface, add the following to your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#worker_integrations): ``` worker_integrations = [ "civil3d", ] ``` ### Install the worker[​](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#install-the-worker "Direct link to Install the worker") Install a Civil 3D worker as a **personal worker**, on the machine where you use Civil 3D. It calls the Civil 3D API directly, so it needs no Python environment. A personal worker connects the software that is installed on your own machine, for your own use. Personal workers are installed and managed with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md): 1. [Download and install VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#download-and-install-viktor-desktop) and log in with your VIKTOR account, if you haven't done so already 2. In VIKTOR Desktop, click "Add" and select **Civil 3D** ![](/assets/images/viktor-desktop-add-worker-list-01993b58665874f7b82e3e76d84dd9b9.webp) 3. Start the worker. You can view its [logs](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#view-logs) inside VIKTOR Desktop, and the editor shows when your worker is online note Personal workers that were installed with the previous per-worker installer keep running, but new personal workers can only be added through [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#migrate-existing-workers-to-viktor-desktop): the per-worker installer download and connection-key flow are no longer available for personal use. The Civil 3D worker also carries a `units` setting, `metric` by default or `imperial`. It decides which Civil 3D settings profile a `connect()` session starts in, and which instances `attach()` will bind to; see [Create mode](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#create-mode) and [Attach mode](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#attach-mode). Set it when you [configure the worker](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#add-and-configure-a-worker). Why there is no organization worker here An organization worker shares one machine between the users of a workspace, which does not suit Civil 3D. The session drives the real desktop application, so every concurrent user needs their own interactive Windows session and their own licence, and [attaching](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#attaching-to-a-running-instance) to "the instance already running" on a shared machine would reach whatever drawing the previous job left open. To offer Autodesk capability across your organization instead of per user, use [Autodesk Platform Services](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-platform-services/.md) and its [Design Automation API](https://aps.autodesk.com/en/docs/design-automation/v3/developers_guide/overview/), which runs Autodesk workloads in Autodesk's cloud with no worker and no local install. ### Testing[​](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#testing "Direct link to Testing") `vkt.civil3d.connect` needs to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. The `vkt.testing` module provides the [`mock_Civil3DConnection`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_Civil3DConnection) decorator, which maps each COM path to the result it should return. The same decorator also mocks `vkt.civil3d.attach`: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_Civil3DConnection(results={ # a result shaped {"__handle__": n} is decoded into an object handle, as in production 'ActiveDocument.Points.Add': [{"__handle__": 1}], 'Easting': [1000.0], 'ActiveDocument.PipeNetworks.Count': [2], }) def test_write_to_civil3d(self): MyEntityTypeController().write_to_civil3d() ``` Paths that are not in the dictionary return `None`. For a result that depends on the call, pass a function of the COM path and its arguments instead of a dictionary. Two things are specific to this mock: * **The domain roots need no fixture.** `c3d.pipe` and `c3d.roadway` are transport, answered by the mock itself, so `results` maps only the COM paths your app is visibly calling. * **Results are keyed by path alone, without the root.** `c3d.pipe.ActiveDocument.PipeNetworks.Count()` is keyed `'ActiveDocument.PipeNetworks.Count'`, which therefore collides with the same path reached from `c3d` itself. Key by the most specific path your test calls. ## Troubleshooting the worker installation[​](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#troubleshooting-the-worker-installation "Direct link to Troubleshooting the worker installation") ### How the worker finds the application[​](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#how-the-worker-finds-the-application "Direct link to How the worker finds the application") The `autocad` and `civil3d` worker kinds both use AutoCAD's automation registration, `AutoCAD.Application`. Civil 3D has no separate registration: it is AutoCAD started with Civil 3D's product switches, so both kinds start and connect to the same `acad.exe`. At worker start, the worker checks that this registration points to an installed executable. If the version-independent entry is stale, the worker falls back to the newest versioned entry, such as `AutoCAD.Application.26`, and logs a warning. If no entry points to an installed executable, the kind refuses to start and asks you to install or repair the product. ### Installation conflicts[​](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#installation-conflicts "Direct link to Installation conflicts") Every AutoCAD-family product registers two entries: a versioned one per release, such as `AutoCAD.Application.26` for the 2027 release, and the shared version-independent `AutoCAD.Application`. The shared entry is owned by whichever installer wrote it last, and uninstallers do not always clean it up. This is what can leave it stale or pointing at the wrong product: * **An older release was removed after a newer one was installed.** The shared entry keeps pointing at the removed release. The newer install registered its own versioned entry but did not rewrite the shared one. With the fallback the worker binds through the newest versioned entry and logs a warning. No action is needed, but repairing the installation cleans the entry up. * **Several releases installed side by side.** The worker starts the newest registered release, and for the `civil3d` kind that release must be a Civil 3D installation of a [supported version](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#supported-releases). If a newer plain AutoCAD sits next to an older Civil 3D, the worker starts the plain AutoCAD and fails with "the instance this worker started did not load Civil 3D". Install one AutoCAD-family release per worker machine, or make sure the newest one is the Civil 3D release you want to automate. * **Per-user registry overrides.** Entries under the current user's classes take precedence over the machine-wide ones for a worker that runs without elevation. A leftover per-user entry can shadow a healthy machine-wide registration. Remove it, or repair the installation. * **No registration at all.** A failed or trial installation may not register the automation server. The worker refuses to start the kind with "No Civil 3D COM server is registered on this worker host. Install or repair Civil 3D." In all cases the fix is on the machine, not in the worker. Repair the installation from Apps & Features, restart the worker, and check the worker log for the stale-registration warning. ### Create mode[​](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#create-mode "Direct link to Create mode") `connect()` starts a private instance for the session. Only one AutoCAD-family application can be automated on a machine at a time, so create mode refuses to start while **any** AutoCAD or Civil 3D window is already open on the worker machine. Close the open application, or use [attach mode](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#attach-mode) to work with it. This also means create sessions on one worker run one at a time. Civil 3D create sessions start with the settings profile matching the worker's `units` setting, `metric` by default or `imperial`. ### Attach mode[​](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#attach-mode "Direct link to Attach mode") `attach()` connects to the instance the engineer already has open. Keep exactly one instance open. With several open, the worker reaches only the first one started and cannot pick another. * **Nothing open.** The session fails with `reason` `"error_attach_no_instance"`. Open the model on the worker machine and retry. * **Plain AutoCAD open, Civil 3D requested.** Refused, with that same `"error_attach_no_instance"` reason: there is no attachable Civil 3D. Close AutoCAD, open the drawing in Civil 3D, and retry. * **Civil 3D open, AutoCAD requested.** Accepted. Civil 3D exposes the full AutoCAD API, so the [`autocad`](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md) kind binds it happily. * **Civil 3D open with the other units profile.** Refused with `"error_attach_wrong_product"`, and the message names both profiles. Change the worker's `units` setting, or restart Civil 3D from its metric or imperial shortcut. * **Product started as administrator.** An elevated instance is invisible to a worker that runs without elevation, and the session reports no running instance. Run the product and the worker as the same Windows user at the same elevation. The worker never closes, hides, or saves the engineer's instance in attach mode. ### Supported releases[​](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#supported-releases "Direct link to Supported releases") The `civil3d` kind supports **Civil 3D 2024 through 2027**. An installed release outside that range fails at session start with a `vkt.ExecutionError` whose message lists the supported versions. The [`autocad`](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md) kind has no release gate. ## FAQs[​](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#faqs "Direct link to FAQs") **Why does reading a property need parentheses?** Every attribute you touch on `c3d` is forwarded to Civil 3D, and the connection cannot tell "give me this value" from "give me this object to keep navigating" without the call. So a property is read with call syntax, `point.Number()`, and written by plain assignment, `point.Description = "SET-OUT"`. A method is called the same way, which makes the rule simple in practice: anything you want a value back from gets parentheses. Getting it wrong raises a `TypeError` as soon as you use it as a value, before any round trip, with a hint naming the call you meant. **My points are all in the wrong place** Check the coordinate order. `Points.Add` takes **Easting, Northing, Elevation** — not Northing first, and not the `[x, y, z]` order you may be carrying through the rest of your app. Nothing raises when they are swapped; the points simply land somewhere else. Read `Easting()` and `Northing()` back in a test and assert they match what you sent. **Why can't I create a TIN surface?** `Surfaces.AddTinSurface` cannot be reached through a session. Its one parameter is an `AeccTinCreationData` object that no member of the API surface returns, so there is no way to build the argument from your app. This is a coverage boundary of Civil 3D's COM API rather than a restriction the worker adds. What does work: reading an existing surface and its statistics (`document.Surfaces.Item("EG").Statistics.MinElevation()`), and `Surfaces.ImportXML` with a relative filename. Where a surface has to be created, create it in Civil 3D and have the app work against it. **Can I build a corridor from my app?** Mostly no. `c3d.roadway.ActiveDocument` gives you `Corridors`, `Assemblies` and `Subassemblies`, but Civil 3D's COM API exposes that domain as largely read-only. Read a corridor the engineer has built, and treat writing to it as something to verify against your own release before designing an app around it. **Why are `Save` and `SendCommand` refused?** The worker refuses members that let a session reach outside itself. `Save` would overwrite the user's file in place, so `SaveAs` with a relative filename is offered instead, which writes into the session's working directory. `SendCommand`, `Run` and `GetInterfaceObject` execute arbitrary code on the worker machine — and `GetInterfaceObject` is not needed anyway, because the worker hands you the [domain roots](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#the-three-domain-roots) directly. Civil 3D's `Aecc` objects inherit the AutoCAD surface, so these refusals hold on them too. **Can I download the DWG my app wrote?** Not in this release: no file can be returned from the session to the app, and the session's working directory goes away with the session. Where the point is to produce drawn output, use `vkt.civil3d.attach()` so the result lands in the drawing the user has open and they save it themselves. Where the point is a calculation, read the values you need through COM while the session is open and build your views from those. **My session fails with "the instance this worker started did not load Civil 3D"** The worker started an AutoCAD-family release that is not Civil 3D. Both products register as `AutoCAD.Application`, and the worker starts the newest registered release, so this happens when a newer plain AutoCAD is installed alongside an older Civil 3D. See [Installation conflicts](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#installation-conflicts). **My Civil 3D release is not supported** The `civil3d` kind supports [Civil 3D 2024 through 2027](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#supported-releases). A release outside that range fails at session start with a message listing the supported versions. If the machine has a supported release installed as well, check that it is the newest registered one, since that is the one the worker starts. **Every session times out and Civil 3D never appears** Check the two requirements in [The worker](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#the-worker) before looking at your app code. The worker machine needs a logged-in, interactive Windows session, and Civil 3D must open straight to a drawing without an Autodesk sign-in or activation dialog. There is no way to check a licence up front, so a prompting licence surfaces only as a start-up failure. Then check the timeout itself. `timeout` bounds one call, and for `connect()` the first of those has to cover Civil 3D booting, which takes minutes on a cold machine — hence the generous `timeout=180` in the examples above. For `attach()` the timeout also bounds the attach itself, so keep it at or above 30 seconds. **How do I roll this out to everyone in my organization?** Not with an organization worker: it shares one machine between the users of a workspace, and each concurrent Civil 3D session needs its own interactive Windows session and licence. Give each engineer a personal worker if they each work in their own drawings. If what you need is Autodesk capability without a per-user install, that is a different integration: [Autodesk Platform Services](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-platform-services/.md) offers a [Design Automation API](https://aps.autodesk.com/en/docs/design-automation/v3/developers_guide/overview/) that runs Autodesk workloads in Autodesk's cloud, reached from a VIKTOR app through an OAuth 2.0 integration rather than through `vkt.civil3d`. **My app is slow when it reads a large drawing** Every call, property read, or property write is one round trip to the worker; navigating attributes to reach it is free. Collections are the usual culprit: `Count()` plus `Item(i)` plus one property read per item is three round trips per object, so a view over a drawing with thousands of points has to bound its work or look the objects up by name instead of sweeping the collection. Resolving `c3d.ActiveDocument` once outside the loop costs nothing either way, but it reads better. --- # Databricks Databricks supports various authentication methods, as outlined in their [documentation](https://docs.databricks.com/aws/en/dev-tools/auth/#databricks-authorization-methods). We recommend the use of OAuth 2.0 for users (OAuth U2M). A general introduction on OAuth 2.0 can be found [here](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#oauth-20). ## Creating an OAuth 2.0 integration (admin)[​](https://docs.viktor.ai/docs/create-apps/software-integrations/databricks/.md#creating-an-oauth-20-integration-admin "Direct link to Creating an OAuth 2.0 integration (admin)") First an OAuth 2.0 integration needs be setup by one of the VIKTOR admins. This needs to be done in Databricks and in VIKTOR. ![](/assets/images/create-databricks-integration-for-admin-3192e4c5394544037ab4f36585679f8b.png) 1. Navigate to the "Integrations" tab in the Administrator panel and select the OAuth 2.0 integrations tab 2. Click "Add OAuth 2.0 integration" 3. Follow the steps provided in the modal 1. Select "Databricks" 2. Fill in the basic information of the integration, including the app that the integration should be available to. You can choose to limit the integration to specific apps or allow all apps on the environment to use it. 3. Fill in the credentials needed to establish a connection. These credentials can found in your Databricks app. ![](/assets/images/create-oauth-integration-admin-configuration-details-7ced0828b6c88d9e12e5bb50d011c85e.png) 4. For gathering the OAuth 2.0 integration information, navigate to Databricks **account console** of your organization and then navigate to the **Settings**. Account console is if the Databricks setup does not live on Azure. 5. Go to **App Connections** tab and add a new connection. 1. Fill in basic connection information. 2. Add `/api/integrations/oauth2/callback/` to the allowed redirect urls. 3. Select the scope for your integration and make sure to enable generate a **client secret**. Security Best Practices * Use minimum scope for your application(s) to function when creating integration on VIKTOR. This would limit the impact when there is misuse of integrated software. * Use a short Time-to-Live for your Access Tokens when configuring the OAuth 2.0 application on the integration provider. ![](/assets/images/create-oauth-integration-admin-configuration-on-databricks-324bf62d8a28edb01e65f0f45146c4f8.png) 7. When the integration is created, you should copy the **Client ID** and **Client Secret** information and fill into the modal in the VIKTOR. You will not be able to gather these credentials again. 8. If you are intending to use **Accounts API** the urls can be set like below: * **Authentication URL**: `/oidc/accounts//v1/authorize` which is mostly resembling to `https://accounts.cloud.databricks.com/oidc/accounts/00000000-abcd-efgh-ijkl-000000000000/v1/authorize` * **Token URL**: `/oidc/accounts//v1/token` which is mostly resembling to `https://accounts.cloud.databricks.com/oidc/accounts/00000000-abcd-efgh-ijkl-000000000000/v1/token` * You can find your account id in your account console, profile section. ![](/assets/images/create-oauth-integration-admin-configuration-on-databricks-account-id-05e306fd976ca13dacc6ce3afda4a85e.png) 9. If you are intending to use **Workspace API** the urls can be set like below: * **Authentication URL**: `/oidc/v1/authorize` which is mostly resembling to `https://myworkspace.cloud.databricks.com/oidc/v1/authorize` * **Token URL**: `/oidc/v1/token` which is mostly resembling to `https://myworkspace.cloud.databricks.com/oidc/v1/token` * You can find your workspace url on the Browser URL part when you enter your Databricks workspace. ## Implementing the integration in an app (developer)[​](https://docs.viktor.ai/docs/create-apps/software-integrations/databricks/.md#implementing-the-integration-in-an-app-developer "Direct link to Implementing the integration in an app (developer)") When the Databricks OAuth 2.0 integration has been set up and been assigned to the app, the developer can start implementing the integration. ![](/assets/images/OAuth-integrations-tab-app-details-f1c95d188c9ca211b7f6da1a05d1d0b9.png) *OAuth 2.0 integrations information in the app details page* First the integration is added in the config file, using the integration name. This is used by the platform to trigger a login button for the user when entering the app. `viktor.config.toml` ``` ... oauth2_integrations = [ "databricks-workspace-1" ] ... ``` Secondly the logic that uses the integration can be implemented in the app. Using Databrick's [Python SDK](https://docs.databricks.com/aws/en/dev-tools/sdk-python), you can quickly integrate. In order to obtain the necessary token for authentication, you instantiate the `OAuth2Integration` class with the integration name and call the method `get_access_token`. ``` import viktor as vkt from databricks.sdk import WorkspaceClient integration = vkt.external.OAuth2Integration('databricks-workspace-1') access_token = integration.get_access_token() client = WorkspaceClient( host="http://myworkspace.cloud.databricks.com/", token=access_token ) for cluster in client.clusters.list(): print(cluster.cluster_name) ``` --- # D-Foundations GEOLIB The [GEOLIB](https://docs.viktor.ai/docs/create-apps/software-integrations/geolib/.md) replaces VIKTOR's D-Series bindings for input file generation. These bindings won't be removed for now, but there won't follow any updates anymore. warning The D-Foundations binding is created to work with D-Foundations version v17. Other versions of D-Foundations might not be able to read the generated input files properly. A D-Foundations binding has been developed by VIKTOR to simplify the process of creating a D-Foundations model, running an analysis (worker required) and parsing the results. ## Add integration to app config[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dfoundations/.md#add-integration-to-app-config "Direct link to Add integration to app config") To make the worker integration available through the interface, add the following to your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#worker_integrations): ``` worker_integrations = [ "dfoundations", ] ``` For personal use, install and enable the worker with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md). Instructions on how to install an organization worker can be found [here](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#installation). ## Creating the model[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dfoundations/.md#creating-the-model "Direct link to Creating the model") The process consists of the following steps: 1. Create the 'empty' model (optionally with default materials), applying the desired settings. 2. (Optional) Create material(s). Also possible to only use the default materials. 3. Create or import profile(s). 4. Create pile type(s). 5. Create pile(s). 6. Let VIKTOR generate the input file for you. 7. Run the D-Foundations analysis (worker required) with the input file. 8. Obtain and parse the results, and process them as desired. Supported model types D-Foundations supports 4 type of models. The following types are currently (un)supported in the D-Foundations binding: * Bearing Piles (EC7-NL): supported * Bearing Piles (EC7-B): not supported * Tension Piles (EC7-NL): supported * Shallow Foundations (EC7-NL): not supported ## Example: Bearing Piles (EC7-NL) model[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dfoundations/.md#example-bearing-piles-ec7-nl-model "Direct link to Example: Bearing Piles (EC7-NL) model") The class [`BearingPilesModel`](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_BearingPilesModel) represents the Bearing Piles (EC7-NL) model in D-Foundations. The following code shows how a (minimal) bearing piles model can be created in Python using the binding. The Tension Piles (EC7-NL) model can be created in a similar way, using the [`TensionPilesModel`](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_TensionPilesModel) class. ``` import viktor as vkt # Create the model with misc. options. options = vkt.dfoundations.BearingPilesCalculationOptions( vkt.dfoundations.CalculationType.BEARING_CAPACITY_AT_FIXED_PILE_TIP_LEVEL, False ) model = vkt.dfoundations.BearingPilesModel( vkt.dfoundations.ConstructionSequence.CPT_INSTALL_EXCAVATION, options, -5.0 ) # Create material (optional), or use one of the default material names. model.create_material("my_material", vkt.dfoundations.SoilType.SAND, 19.0, 19.0, 3.0) # Create profile(s). layers = [ vkt.dfoundations.ProfileLayer(0.0, "my_material"), vkt.dfoundations.ProfileLayer(-20.0, "my_material") ] measurements = [(0.0, 10.0), (-20.0, 20.0)] model.create_profile('my_profile', layers, 0.0, 0.0, measurements, -5.0, -15.0, 1.0, -10.0, -12.0, -0.11) # Create pile type(s). model.create_pile_type( "my_pile_type", vkt.dfoundations.RectPile(1.0, 1.0), vkt.dfoundations.PileType.PREFAB_CONCRETE, vkt.dfoundations.PileSlipLayer.NONE ) # Create pile(s). model.create_pile("my_pile", 0.0, 0.0, -1.0, 1.0, 0.0, 0.0) # Generate the input file for the model as if it was generated by D-Foundations. # Metadata can be used (not required) to update data such as titles, company, etc. metadata = vkt.dfoundations.Metadata(title_1='Example Model', company='VIKTOR') foi_file = model.generate_input_file(metadata) # Run the analysis with the generated input file (requires worker). analysis = vkt.dfoundations.DFoundationsAnalysis(foi_file) analysis.execute(300) # Obtain the result file. fod_file = analysis.get_output_file() ``` ## Parsing output using `OutputFileParser`[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dfoundations/.md#parsing-output-using-outputfileparser "Direct link to parsing-output-using-outputfileparser") After running a [`DFoundationsAnalysis`](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_DFoundationsAnalysis), the fod file can be obtained and results can be extracted. The class [`OutputFileParser`](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_OutputFileParser) makes the parsing more convenient and return Python objects that can be further processed: ``` parser = vkt.dfoundations.OutputFileParser(fod_file) # Calculation parameters. calculation_parameters = parser.calculation_parameters # Parsed results in the form of a dictionary. results = parser.results(False) # True (default) for returning pandas DataFrame(s). # Raw, unparsed results in the form of a string. # Manual parsing required. Useful, if parser.results is not sufficient. raw_results = parser.raw_results ``` ## Supported D-Foundation versions[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dfoundations/.md#supported-d-foundation-versions "Direct link to Supported D-Foundation versions") Currently, the parser supports the following versions (completely or partially) of D-Foundations: * v17: * Tension Piles model * Bearing Piles model - Preliminary Design (calculation options only) * v19: * Tension Piles model * Bearing Piles model - Verification ## Testing[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dfoundations/.md#testing "Direct link to Testing") New in v13.5.0 `mock_DFoundationsAnalysis` decorator for easier testing of `DFoundationsAnalysis` `BearingPilesModel.generate_input_file`, `TensionPilesModel.generate_input_file` and `DFoundationsAnalysis.execute` need to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. The `viktor.testing` module provides the [`mock_DFoundationsAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_DFoundationsAnalysis) decorator that facilitate mocking of workers: ``` import unittest from viktor import File from viktor.testing import mock_DFoundationsAnalysis from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_DFoundationsAnalysis(get_output_file={ '.fod': File.from_path('test_output.fod'), '.fos': File.from_path('test_output.fos'), }) def test_dfoundations_analysis(self): MyEntityTypeController().dfoundations_analysis() ``` For the decorator's input parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). --- # D-Geo Stability Analyzing a D-Geo Stability model in VIKTOR can be done using the [`DGeoStabilityAnalysis`](https://docs.viktor.ai/sdk/api/external/dgeostability/.md#_DGeoStabilityAnalysis) class (worker required). GEOLIB The [GEOLIB](https://docs.viktor.ai/docs/create-apps/software-integrations/geolib/.md) replaces VIKTOR's D-Series bindings for input file generation. These bindings won't be removed for now, but there won't follow any updates anymore. ## Add integration to app config[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dgeostability/.md#add-integration-to-app-config "Direct link to Add integration to app config") To make the worker integration available through the interface, add the following to your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#worker_integrations): ``` worker_integrations = [ "dgeostability", ] ``` For personal use, install and enable the worker with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md). Instructions on how to install an organization worker can be found [here](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#installation). ## App code[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dgeostability/.md#app-code "Direct link to App code") No binding is provided by VIKTOR for this module, which means that the input file has to be generated manually: ``` import viktor as vkt # Generate the input STI file. input_file = ... # Run the analysis and obtain the output file. analysis = vkt.dgeostability.DGeoStabilityAnalysis(input_file) analysis.execute(timeout=10) output_file = analysis.get_output_file() ``` ## Testing[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dgeostability/.md#testing "Direct link to Testing") New in v13.5.0 `mock_DGeoStabilityAnalysis` decorator for easier testing of `DGeoStabilityAnalysis` `DGeoStabilityAnalysis.execute` needs to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. The `viktor.testing` module provides the [`mock_DGeoStabilityAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_DGeoStabilityAnalysis) decorator that facilitate mocking of workers: ``` import unittest from viktor import File from viktor.testing import mock_DGeoStabilityAnalysis from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_DGeoStabilityAnalysis(get_output_file={ '.sto': File.from_path('test_output.sto'), }) def test_dgeostability_analysis(self): MyEntityTypeController().dgeostability_analysis() ``` For the decorator's input parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). --- # D-Settlement GEOLIB The [GEOLIB](https://docs.viktor.ai/docs/create-apps/software-integrations/geolib/.md) replaces VIKTOR's D-Series bindings for input file generation. These bindings won't be removed for now, but there won't follow any updates anymore. A D-Settlement binding has been developed by VIKTOR to simplify the process of creating a D-Settlement model, running an analysis (worker required) and parsing the results. ## Add integration to app config[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dsettlement/.md#add-integration-to-app-config "Direct link to Add integration to app config") To make the worker integration available through the interface, add the following to your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#worker_integrations): ``` worker_integrations = [ "dsettlement", ] ``` For personal use, install and enable the worker with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md). Instructions on how to install an organization worker can be found [here](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#installation). ## Creating the model[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dsettlement/.md#creating-the-model "Direct link to Creating the model") The process consists of the following steps: 1. Create the 'empty' model, applying the desired settings. 2. Extend the model with the desired objects (material, layers, pl-lines, loads, verticals, calculation times, etc.). 3. Let VIKTOR generate the input file for you. 4. Run the D-Settlement analysis (worker required) with the input file mentioned above. 5. Obtain and parse the results, and process them as desired. It is possible to create both a 1D-model and a 2D-model using VIKTOR's D-Settlement binding. The following sections describe how each of these models can be made. ### 1D-model[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dsettlement/.md#1d-model "Direct link to 1D-model") The class [`Model1D`](https://docs.viktor.ai/sdk/api/external/dsettlement/.md#_Model1D) represents the 1D-model in D-Settlement. Its geometry is defined by a list of depths versus materials. ``` import viktor as vkt # Create the model with misc. default parameters. model = vkt.dsettlement.Model1D( vkt.dsettlement.CalculationModel.NEN_KOPPEJAN, vkt.dsettlement.ConsolidationModel.TERZAGHI ) # Create material(s). model.create_material("my_mat", 21.0, 19.0, color=vkt.Color(0, 0, 0)) # Update the geometry. model.update_geometry(-1.0, [(1.0, "Loam"), (0.0, "my_mat")], phreatic_level=-3.0) # Create loads. model.create_uniform_load("my_load", 0, 0.001, 0.0, 0.0) # Generate the input file for the model as if it was generated by D-Settlement. # Metadata can be used (not required) to update data such as created_by, titles, etc. metadata = vkt.dsettlement.Metadata(title_1='Example Model', created_by='VIKTOR') input_file = model.generate_input_file(metadata) # Run the analysis with the generated input file (requires worker). analysis = vkt.dsettlement.DSettlementAnalysis(input_file) analysis.execute(300) # Obtain the result file. sld_file = analysis.get_sld_file() ``` ### 2D-model[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dsettlement/.md#2d-model "Direct link to 2D-model") The class [`Model2D`](https://docs.viktor.ai/sdk/api/external/dsettlement/.md#_Model2D) represents the 2D-model in D-Settlement. Its geometry can be built-up from layers, consisting of points. It is possible to create a model using VIKTOR's binding that will result in errors in D-Settlement (e.g. intersecting boundaries). Notice that it is not guaranteed that these errors are captured in the code upon creation of the model, such that the error only shows up during the analysis. It is the responsibility of the developer to build-up a 'valid' model. ``` import viktor as vkt # Initialize the settings for vertical drains. vertical_drain = vkt.dsettlement.VerticalDrain( vkt.dsettlement.DrainType.SAND_WALL, 5.0, 90.0, 0.0, 2.0, 4.0, start_of_drainage=2.0, phreatic_level_in_drain=4.0 ) # Create the model with a starting bottom boundary, vertical drainage settings and misc. default parameters. model = vkt.dsettlement.Model2D( vkt.dsettlement.CalculationModel.NEN_KOPPEJAN, vkt.dsettlement.ConsolidationModel.TERZAGHI, boundary_bottom=[(0.0, 0.0), (100.0, 0.0)], vertical_drain=vertical_drain ) # Create points for defining boundaries and pl-lines. points_boundary1 = [model.create_point(x, y) for (x, y) in [(0.0, 5.0), (50.0, 5.0), (100.0, 2.5)]] points_boundary2 = [model.create_point(x, y) for (x, y) in [(0.0, 5.0), (50.0, 5.0), (100.0, 7.5)]] points_boundary3 = [model.create_point(x, y) for (x, y) in [(0.0, 10.0), (25, 10.0), (75, 10.0), (100.0, 10.0)]] points_plline1 = [model.create_point(x, y) for (x, y) in [(0.0, 4.0), (100.0, 4.0)]] points_plline2 = [model.create_point(x, y) for (x, y) in [(0.0, 6.0), (100.0, 6.0)]] # Create the pl-lines. plline1 = model.create_pl_line(points_plline1, is_phreatic=True) plline2 = model.create_pl_line(points_plline2) # Create the layers. model.create_layer(points_boundary1, 'Sand', pl_line_top=99, pl_line_bottom=plline2) model.create_layer(points_boundary2, 'Soft Clay', pl_line_top=99, pl_line_bottom=99) model.create_layer(points_boundary3, 'Loam', pl_line_top=plline1, pl_line_bottom=99) # Create verticals. model.create_vertical(45.0) model.create_vertical(50.0) model.create_vertical(55.0) # Create loads. model.create_non_uniform_load('load1', [(25, 10.0), (50.0, 12.0), (75, 10.0)]) # Create calculation/residual times. model.set_calculation_times(1, 4, 2, 5) # Generate the input file for the model as if it was generated by D-Settlement. # Metadata can be used (not required) to update data such as created_by, titles, etc. metadata = vkt.dsettlement.Metadata(title_1='Example Model', created_by='VIKTOR') input_file = model.generate_input_file(metadata) # Run the analysis with the generated input file (requires worker). analysis = vkt.dsettlement.DSettlementAnalysis(input_file) analysis.execute(300) # Obtain the result file. sld_file = analysis.get_sld_file() ``` ### Supported features[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dsettlement/.md#supported-features "Direct link to Supported features") Currently, the following 1D-Model features are supported: * Defining consolidation and calculation model and various settings. * Creating materials (or using the default ones). * Defining the geometry. * Creating uniform loads. * Adding calculation times (residual times). Currently, the following 2D-Model features are supported: * Defining consolidation and calculation model and various settings. * Creating materials (or using the default ones). * Creating points (for the creation of layers and pl-lines). * Creating layers. * Creating pl-lines. * Creating uniform loads. * Creating non-uniform loads. * Creating verticals. * Adding calculation times (residual times). ## Parsing output using `OutputFileParser`[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dsettlement/.md#parsing-output-using-outputfileparser "Direct link to parsing-output-using-outputfileparser") After running a [`DSettlementAnalysis`](https://docs.viktor.ai/sdk/api/external/dsettlement/.md#_DSettlementAnalysis), the sld file can be obtained and results can be extracted. The class [`OutputFileParser`](https://docs.viktor.ai/sdk/api/external/dsettlement/.md#_OutputFileParser) makes the parsing more convenient and return Python objects that can be further processed: ``` parser = vkt.dsettlement.OutputFileParser(sld_file) vertical_results = parser.vertical_results residual_times = parser.residual_times ``` ## Testing[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dsettlement/.md#testing "Direct link to Testing") New in v13.5.0 `mock_DSettlementAnalysis` decorator for easier testing of `DSettlementAnalysis` `Model1D.generate_input_file`, `Model2D.generate_input_file` and `DSettlementAnalysis.execute` need to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. The `viktor.testing` module provides the [`mock_DSettlementAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_DSettlementAnalysis) decorator that facilitate mocking of workers: ``` import unittest from viktor import File from viktor.testing import mock_DSettlementAnalysis from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_DSettlementAnalysis(get_output_file={ '.sld': File.from_path('test_output.sld'), '.slo': File.from_path('test_output.slo') }) def test_dsettlement_analysis(self): MyEntityTypeController().dsettlement_analysis() ``` For the decorator's input parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/BytesIO/StringIO object (with empty content) is returned each time the corresponding method is called (endlessly). --- # D-Sheet Piling Analyzing a D-Sheet Piling model in VIKTOR can be done using the [`DSheetPilingAnalysis`](https://docs.viktor.ai/sdk/api/external/dsheetpiling/.md#_DSheetPilingAnalysis) class (worker required). ## Add integration to app config[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dsheetpiling/.md#add-integration-to-app-config "Direct link to Add integration to app config") To make the worker integration available through the interface, add the following to your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#worker_integrations): ``` worker_integrations = [ "dsheetpiling", ] ``` For personal use, install and enable the worker with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md). Instructions on how to install an organization worker can be found [here](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#installation). ## App code[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dsheetpiling/.md#app-code "Direct link to App code") No binding is provided by VIKTOR for this module, which means that the input file has to be generated manually or by using the [GEOLIB](https://docs.viktor.ai/docs/create-apps/software-integrations/geolib/.md): ``` import viktor as vkt # Generate the input SHI file. input_file = ... # Run the analysis and obtain the output file. analysis = vkt.dsheetpiling.DSheetPilingAnalysis(input_file) analysis.execute(timeout=10) output_file = analysis.get_output_file() ``` ## Testing[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dsheetpiling/.md#testing "Direct link to Testing") New in v13.5.0 `mock_DSheetPilingAnalysis` decorator for easier testing of `DSheetPilingAnalysis` `DSheetPilingAnalysis.execute` needs to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. The `viktor.testing` module provides the [`mock_DSheetPilingAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_DSheetPilingAnalysis) decorator that facilitate mocking of workers: ``` import unittest from viktor import File from viktor.testing import mock_DSheetPilingAnalysis from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_DSheetPilingAnalysis(get_output_file={ '.shd': File.from_path('test_output.shd'), '.shl': File.from_path('test_output.shl'), '.shs': File.from_path('test_output.shs'), '.sho': File.from_path('test_output.sho') }) def test_dsheetpiling_analysis(self): MyEntityTypeController().dsheetpiling_analysis() ``` For the decorator's input parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). --- # D-Stability Analyzing a D-Stability model in VIKTOR can be done using the [`DStabilityAnalysis`](https://docs.viktor.ai/sdk/api/external/dstability/.md#_DStabilityAnalysis) class (worker required). ## Add integration to app config[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dstability/.md#add-integration-to-app-config "Direct link to Add integration to app config") To make the worker integration available through the interface, add the following to your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#worker_integrations): ``` worker_integrations = [ "dstability", ] ``` For personal use, install and enable the worker with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md). Instructions on how to install an organization worker can be found [here](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#installation). ## App code[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dstability/.md#app-code "Direct link to App code") No binding is provided by VIKTOR for this module, which means that the input file has to be generated manually or by using the [GEOLIB](https://docs.viktor.ai/docs/create-apps/software-integrations/geolib/.md): ``` import viktor as vkt # Generate the input STIX file. input_file = ... # Run the analysis and obtain the output file. analysis = vkt.dstability.DStabilityAnalysis(input_file) analysis.execute(timeout=10) output_file = analysis.get_output_file() ``` ## Testing[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dstability/.md#testing "Direct link to Testing") New in v13.5.0 `mock_DStabilityAnalysis` decorator for easier testing of `DStabilityAnalysis` `DStabilityAnalysis.execute` needs to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. The `viktor.testing` module provides the [`mock_DStabilityAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_DStabilityAnalysis) decorator that facilitate mocking of workers: ``` import unittest from viktor import File from viktor.testing import mock_DStabilityAnalysis from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_DStabilityAnalysis(get_output_file={ '.stix': File.from_path('test_output.stix') }) def test_dstability_analysis(self): MyEntityTypeController().dstability_analysis() ``` For the decorator's input parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). --- # Dynamo Nodes \[BETA] caution The VIKTOR Dynamo nodes are currently in **BETA**, which means we reserve the right to make breaking changes without providing an upgrade strategy. VIKTOR offers a Dynamo library for easy drag-and-drop of custom VIKTOR nodes within Dynamo. The functionalities of these nodes strongly resemble the functionalities of the [`viktor.api_v1`](https://docs.viktor.ai/sdk/api/api-v1/.md) module and can be used to communicate with certain entities that are present in an app instance. ## Installation[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dynamo-nodes/.md#installation "Direct link to Installation") The VIKTOR package can be installed through the Dynamo interface: * In the toolbar navigate to "Packages > Search for a Package..." * In the search bar type "VIKTOR" * Find VIKTOR (by viktor.ai) and click on `+ Install` to install ![](/assets/images/dynamo-viktor-library-cecf3e450c3a5f98f2649d8c4953dd2f.png) After the package has been installed successfully, you will see "VIKTOR" has been added to the Add-ons in the library bar: ![](/assets/images/dynamo-viktor-add-on-67811871d6cc90d8862a99bcec5efbe7.png) ## Implementation[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dynamo-nodes/.md#implementation "Direct link to Implementation") The starting point is logging in to VIKTOR using the `Login.login` node. This requires three input text nodes consisting of your username, password, and environment which you want to connect to. The login method returns an `Environment` object. With this object we can select the app instance of interest. This is done using the `Environment.SelectWorkspace` node, which triggers a dropdown menu with the available app instances. In case the environment consists of a single app instance, this will automatically be selected. ![](/assets/images/dynamo-viktor-login-247fe0d93493104c379f21f7e6b58d30.png) Alternatively, you may store your credentials in a separate file. This way you will be able to share dynamo projects amongst colleagues without sharing personal credentials: ![](/assets/images/dynamo-viktor-login-file-9a7abf40bfee21f3a8fa89663db6d4f3.png) The `Environment.SelectWorkspace` method returns the `Workspace` object. The next step is to obtain the root entities using the `Workspace.GetRootEntities` node. The root entities are returned as a list of `Entity` objects. This list can be passed to the `Workspace.SelectFromEntities` node, to trigger another dropdown menu. After selecting the entity of interest, properties such as the entity name or last saved params can be retrieved, or you can obtain different entities such as the children or siblings: ![](/assets/images/dynamo-viktor-select-entity-f47dc9610215eb448e94495ff221b38e.png) The example above displays the general flow of the VIKTOR Dynamo nodes. See [Available Nodes](https://docs.viktor.ai/docs/create-apps/software-integrations/dynamo-nodes/.md#available-nodes) for an overview of all the nodes and the actions that can be performed. caution Dynamo will only re-execute nodes that have been subjected to a change in input. When, for example, an entity has been updated in the VIKTOR interface, this will not automatically be detected by Dynamo. For such cases, you will need to manually trigger a complete rerun, for example: * disconnect the nodes `Login.login` and `Environment.SelectWorkspace` * click "Run" to trigger an entire rerun * reconnect the two nodes * click "Run" to trigger an entire rerun ## Available Nodes[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dynamo-nodes/.md#available-nodes "Direct link to Available Nodes") ### Login[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dynamo-nodes/.md#login "Direct link to Login") ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPYAAABdCAYAAACWyZvlAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAoHSURBVHic7d19UFV1HsfxN9x7RRFEEuVBQFKEAPFh0XG1TCvX1sxabVbH1hkjHdZaG3RRd1yXnXZMm5y1sdnWXCcydsqmmtUpwql0a31KUXERYTEgfMAnEpUH9Xq7POwfV0gwH5BzuXj8vP6Cc373e76Xmc/8fueecw9e8fHxjYiIqXh7ugERMZ6CLWJCCraICSnYIiakYIuYkIItYkIKtogJKdgiJqRgt9PU1dl8/Ocxnm5DpAUv0995NnsdOydVsHhqOt94uheRDtKhM7a3tzeLFi0iOTn5lmOTk5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AhIX3o378fNTUX2bfvv9TV1VFfX8+hQ0WcPVtJXNxAIiL6uuHINh4dMZjyXW+zp9K1xXlqM+98fYbBSWNdG8YmMbhyP5vyLrt+v5zHnpLKW1a2lOWwftcp1wxduZlDR4LpFemGtyCdkoINhIUFEx8fg9VqZe/egziddTidTvbsOYDNZmXAgCh6977PDUeOJqRXJWePtFwgV9kdWIJCGAjE9e2NxWGnqq2lG+q17L6H3fPn2ABWq5X4+BjCwoLZvz8Pu92O01nH9u17CA39MfTuYcFb97yIwTRjXxUbO4Dw8FCOHz9Jfn4RBw8WUl5+kvDwUGJjB7jpqKWcORdISHTL76737dmd+sozlABFZ86BTzf07XZpCwX7qvDwMKKiIrFarXz55TZycg5gtVqJiookIqJ9D2hszdI8RTv5al8+ISNm8PMg1xZb2BNMH+1P7q5trg05pZREDGfKUN/m/RN/pkdPyc1pKX5V164+DBuWyOeff825c+exWCz4+XUnPj4GHx8fw45TWnYC24y5rLRsYPHb3+DcsY43/F/g+ZffZMbVy12Fn65m/b6rZ8hVn5Lxz0DmzFzJm8n11NceZs/hCnoZ1pGYkVd8fHynuvm56dHDg2d/Zki9tjzzrKiohNmzF5CY6LoulJdXwJo1r5GUNPi2a3TEM8/iZi1nJu+xNLPI7ceSu5OW4teIioogNDQEb28L4EVQUK82hdpdgiIjab773ncoo2P8OFV2/bVrkSZail+jW7eujBs3CovFwqVLl0lMjPV0S0AYQyfOYkJiMD5X6rF0raV48xu8tUMXs+TGFOxWXnpptqdbaOUUW/+xjK2ebkPuKlqKi5iQgi1iQgq2iAkp2CImZPoPz/S/tORepBlbxIQUbBETUrBFTKjT3SsuIu2nGVvEhBRsERNSsEVMSMEWMSEFW8SEFGwRE1KwRUxIwRYxIQVbxIQUbBET+j/m7QuB3rvxxQAAAABJRU5ErkJggg==) ### Environment[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dynamo-nodes/.md#environment "Direct link to Environment") ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPUAAABdC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TnocwYZHgdrL2ZOM7n7vEaNJWg2nVKNaNm+D8yD/vI9NtIhw5WDB7cn92793PlylUUCgU2Np3w9e2DlZWVaRq5kUxiykzmBK/k9yq4qVNijYazX0ex9st8fRndQTavak/wguW8H1BDdbUFFQUpJKYY6sjNo0g5hwWrFXz6cjSHGyufv42NO0NZvPx9fgf6W1o7z6OkHB2ZJCRd4JV5UUTNLuZwVKThCm8mF4t+z2+dvyPJeFafcp4LgdPpe/Y7sowW52/bSFxgMC+8v77ultahzVH8X3PuAunS+fR/03jj+ecIOBnF2So3/vDa+4Ra6UBhwdXsr/g43vic9ibWQ19izR9tUSh0FB3/JxtrL08f3MaOfmEsiFpPta6a6+f2kHRMY7iIZjjG/1ATPm8164MMt7R2/w/JwM38bazdbMHiZ1ezPkhHNTo0Z//NJ7/w9OJha+fr69vmHmSu/XrgAfO/NEl9zfmOsszMHObPX0r//vr35dTUdDZsWMVjjw1och3yHWUPgz8vRvuREbyOPa3dlTZGpt/1eHi44eLijIWFAmiHSuXQrEAL0dpk+l1Px44dGDduBAqFgh9+uEn//t6NbyREGyKhvo9Fi+a3dhdEo/awLlgm3vcj028hzIyEWggzI6EWwsxIqIUwM7+KC2Vy31j8mshILYSZkVALYWYk1EKYmTb57LcQ4peTkVoIMyOhFsLMSKiFMDMSaiHMjIRaCDMjoRbCzEiohTAzEmohzIyEWggzI6EWwsxIqIUwM/8PAB17pLt+U9EAAAAASUVORK5CYII=) ### Workspace[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dynamo-nodes/.md#workspace "Direct link to Workspace") ![](/assets/images/dynamo-node-Workspace-084792ab71dd8287c8ac036bd6226bd8.png) ### Entity[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dynamo-nodes/.md#entity "Direct link to Entity") ![](/assets/images/dynamo-node-Entity-6d72d6abb0135f08ff7eeb6249236b62.png) ### EntityType[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dynamo-nodes/.md#entitytype "Direct link to EntityType") ![](data:image/png;base64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2FCFuRReiZy7kjQlWLBYVZUVpbE+zvf+iY3EyGAwd8ibpeZu/A+CN391jl+O15W+o5eQcZcaMeYSH110/OnQoi9WrVzBkyKBWH0P+hppobzItv46AAD98fLxRqdSAE56eHm0KthAdgUzLr6Nbt66MGTMCtVrNpUtVhIfbcpYrRPuQcN/Ac8/NaO8uCGETmZYLoVASbiEUSsIthEJJuIVQqE6zoCbXnUVnIyO3EAol4RZCoSTcQihUh723XAhhGxm5hVAoCbcQCiXhFkKhJNxCKJSEWwiFknALoVASbiEU6v8BvKRY9fpU3vwAAAAASUVORK5CYII=) ### EntityRevision[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dynamo-nodes/.md#entityrevision "Direct link to EntityRevision") ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPgAAACACAYAAAAmoKSnAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AABXTSURBVHic7d17dMx3/sfxZzIzEiOJIndJZCMSScS16tK1jW6tI6jWrUsVafJDqxaNpVZ1u1XrUqyiapWq/ly2VNSPWFV1iYSgNHK/VRFxHSQRiTG5/P6YJE00kmBG0q/34xznmJnP5T1zvOb7+V7M18Lf378UIYQiWdZ3AUII85GAC6FgEnAhFEwCLoSCScCFUDAJuBAKJgEXQsEk4EIomARcCAWTgAuhYBLwRzV4KZFb36NXfddRi8FLI9n6Xh2r/I28J1E7iyfmWvTQ1USP9uJWvp6Siicz2NR/ChvrOITPzM3M1y5n8OwjNbQazrJ9L3D6hXGsrXtxrI4ejdetfPQloNFqQZdMxNy3WRWnr/MoQtxLXR+TWlpaEh4ejk6nY926dTW2DQkJAai1XZ1cP8qcwbOpKZ41sdda1aGVLdbWDzP6dY7OGYzxu8MK7yHzWbhoOYaR41h79WHGE6KeAh4eHk6PHj0qHt8vvCEhIQwcOBCAkpIS1q9fb76iQlcT0TqavU0HMbiNLZaWBrK/X8C4eVHogVeXRjKqnQ1aZhMZW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BzzKd8G1Abg0K0QvR9B/M2SJfg9rays6dQpkz54DXL9+A5VKhY1NE/z9fbCysnpsdWRHbCc6fCwfrOyLwWDg0qntxKQG07jmTmyPDmfsByvpazBguHSK7TGpBNfYqQaGy9xo1JewecNpXlIMGj0XTmxkzeHau4qGwcLf379BXlQ9dWsMAP8a9qxJxnuQ32RLSckgNHQqgYHGS07i4hJZuXIBXbq0r/MY8ptsoiGQJXo1PD3dcXFxxtJSBVhgb9/igcItREMhS/RqNG5sTVBQD1QqFbdvFxAY6FvfJQnxUCTg9zFpUmh9lyDEI5MluhAKJgEXQsEk4EIomARcCAV7Yg6yyXlp8SSSLbgQCiYBF0LBJOBCKFiDvRZdCPHoZAsuhIJJwIVQMAm4EAomARdCwSTgQiiYBFwIBZOAC6FgEnAhFOz/AYYRJlFaIoLeAAAAAElFTkSuQmCC) ## Limitations[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dynamo-nodes/.md#limitations "Direct link to Limitations") The Dynamo package has a couple of limitations in contrast to the actual [`viktor.api_v1`](https://docs.viktor.ai/sdk/api/api-v1/.md) module: * Not able to perform "privileged" API calls to [bypass user access restrictions](https://docs.viktor.ai/docs/api/sdk/.md#bypassing-user-access-restrictions). * No deserialization of params, which means that the params are returned as raw data. For example, a `GeoPoint` will be returned as dictionary containing a `lat` and `lon` property, an `Entity` will be returned as integer (entity id) etc. * Less efficient (no caching). For example, an API call is performed to get the params of an entity for each single `LastSavedParams` node. --- # Dynamo Sandbox caution This guide is only relevant for **Dynamo Sandbox**, not to be confused with the Dynamo plugin for Revit! tip This guide provides the basis information about our Dynamo Sandbox integration. **If you setup this integration for the first time, we recommend to follow the [Dynamo tutorial](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md).** A [`dynamo`](https://docs.viktor.ai/sdk/api/external/dynamo/.md) module has been developed by VIKTOR which can be used for easy updating of Dynamo input files and processing output files (results + geometry). With a worker you will also be able to completely automate an integration with Dynamo Sandbox. For this integration, we recommend using the **generic worker**. Running a Dynamo script requires passing arguments to the `DynamoWPFCLI` executable (the input and output files, and optionally the path to FormIt or Revit for the geometry export). The dedicated Dynamo worker does not expose these arguments in VIKTOR Desktop, whereas the generic worker lets you define the executables and their arguments yourself in its `config.yaml` file. ## Add integration to app config[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dynamo/.md#add-integration-to-app-config "Direct link to Add integration to app config") To make the worker integration available through the interface, add the following to your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#worker_integrations): ``` worker_integrations = [ "generic", ] ``` Instructions on how to install the worker: Install the worker Follow these steps to install the worker: * Personal worker * Organization worker A personal worker connects the software that is installed on your own machine, for your own use. Personal workers are installed and managed with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md): 1. [Download and install VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#download-and-install-viktor-desktop) and log in with your VIKTOR account, if you haven't done so already 2. In VIKTOR Desktop, click "Add" and select **Generic** ![](/assets/images/viktor-desktop-add-worker-list-01993b58665874f7b82e3e76d84dd9b9.webp) 3. Define the executables, arguments and paths in the worker's `config.yaml` file, which VIKTOR Desktop exposes when adding the worker 4. Start the worker. You can view its [logs](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#view-logs) inside VIKTOR Desktop, and the editor shows when your worker is online note Personal workers that were installed with the previous per-worker installer keep running, but new personal workers can only be added through [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#migrate-existing-workers-to-viktor-desktop): the per-worker installer download and connection-key flow are no longer available for personal use. An organization worker connects software that runs on a machine managed by your organization, such as a virtual or remote machine, and is shared by the users of the app instance(s) you select. caution You need to be an environment administrator in order to install an organization worker. 1. Navigate to the "Integrations" tab in the Administrator panel 2. Click "Add integration" 3. Follow the steps provided in the modal ![](/assets/images/create-integration-admin-598d0869714267fcb7a220c370dde5df.png) 3.1. Select **Generic** 3.2. Select the app instance(s) the integration should be available to 3.3. Download the worker .msi (Microsoft Installer) and run it on the machine of choice 3.4. Copy the generated **connection key** and paste it when the installer asks for it. In the browser, you can now click Finish and continue in the installer. Connection Key The generated connection key **should be copied immediately** as VIKTOR will not preserve this data for security reasons. 4. After installation, define the executables, arguments and paths in the `config.yaml` file, located in the same directory as the worker 5. Make sure to launch the integration once the installation is finished. If you closed the integration, you can restart it through the desktop shortcut. ## Updating a model[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dynamo/.md#updating-a-model "Direct link to Updating a model") An existing Dynamo model can be passed to VIKTOR's [`DynamoFile`](https://docs.viktor.ai/sdk/api/external/dynamo/.md#_DynamoFile) as shown below. With the `update` method, the value of input nodes can be updated. When all inputs have been updated as desired, the `generate` method can be used to generate an updated `File` object. ``` import viktor as vkt file = vkt.File.from_path("template.dyn") dyn_file = vkt.dynamo.DynamoFile(file) # update input nodes radius = params.radius dyn_file.update('Radius', radius) # input node called "Radius" ... # generate updated file input_file = dyn_file.generate() ``` ## Running an analysis[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dynamo/.md#running-an-analysis "Direct link to Running an analysis") Integrating with Dynamo Sandbox can be done using the [`DynamoAnalysis`](https://docs.viktor.ai/sdk/api/external/dynamo/.md#_DynamoAnalysis) class (worker required): ``` files = [ ('input.dyn', input_file), ] # run the analysis analysis = vkt.dynamo.DynamoAnalysis(files=files, output_filenames=["output.xml", "geometry.json"]) analysis.execute(timeout=60) ``` The `executable_key` in the example above refers to the "dynamo" command. This command is part of the worker configuration: it points to the file location of `DynamoWPFCLI.exe` (Dynamo Sandbox command-line interface), with additional arguments specifying where the input model is located and where the results should be exported to. The command is specified in the worker's configuration file (`config.yaml`), as shown below. For workers managed with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#add-and-configure-a-worker), this file is exposed when you add the worker. For organization workers (installed with the per-worker installer), the file is located in the same directory as the worker. See the [Dynamo Sandbox documentation](https://github.com/DynamoDS/Dynamo/wiki/Dynamo-Command-Line-Interface) for more info on running Dynamo from the command-line. **config.yaml** ``` executables: dynamo: path: 'C:\path\to\DynamoSandbox\DynamoWPFCLI.exe' arguments: - '-o' - 'input.dyn' - '-v' - 'output.xml' maxParallelProcesses: 1 ``` Geometry can also be exported, for which an installation of either "FormIt" or "Revit" is required: ``` arguments: ... - '-gp' - 'C:\Program Files\Autodesk\FormIt' # or Revit - '-g' - 'geometry.json' ``` note The worker reads the config file once during startup. So when you change the config file, you will need to restart the worker for your changes to take effect. ## Processing results[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dynamo/.md#processing-results "Direct link to Processing results") After running the analysis, the output file (.xml) can be obtained using: ``` output_file = analysis.get_output_file("output.xml", as_file=True) ``` With the `as_file` flag, VIKTOR is instructed to return a `File` object which can directly be passed to the [`get_dynamo_result`](https://docs.viktor.ai/sdk/api/external/dynamo/.md#_get_dynamo_result) function. The results can then be obtained by node id, which corresponds to the same node id as the input file. ``` import viktor as vkt dyn_file = vkt.dynamo.DynamoFile(file) ... output_id = dyn_file.get_node_id("Area") # output node called "Area" with output_file.open_binary() as f: result = vkt.dynamo.get_dynamo_result(f, id_=output_id) ``` note Results will be returned as `str` type, which means you will need to take care of conversions in the app. ## Processing geometry[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dynamo/.md#processing-geometry "Direct link to Processing geometry") In a similar matter the geometry file can be obtained after the analysis has been performed. With the helper function [`convert_geometry_to_glb`](https://docs.viktor.ai/sdk/api/external/dynamo/.md#_convert_geometry_to_glb), you can convert it to a GLB type file, which can directly be visualized in a `GeometryResult`. ``` import viktor as vkt @vkt.GeometryView(...) def geometry_view(self, params, **kwargs): ... geometry_file = analysis.get_output_file('geometry.json', as_file=True) glb_file = vkt.dynamo.convert_geometry_to_glb(geometry_file) return vkt.GeometryResult(glb_file) ``` ## Testing[​](https://docs.viktor.ai/docs/create-apps/software-integrations/dynamo/.md#testing "Direct link to Testing") `DynamoAnalysis.execute` needs to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. The `viktor.testing` module provides the [`mock_DynamoAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_DynamoAnalysis) decorator that facilitate mocking of workers: ``` import unittest import viktor as vkt from viktor.testing import mock_DynamoAnalysis from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_DynamoAnalysis(get_output_file={ 'result.xml': vkt.File.from_path('test_file.xml'), # : 'result.json': vkt.File.from_path('test_file.json'), ... }) def test_analysis(self): MyEntityTypeController().analysis() ``` For the decorator's input parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). --- # ETABS and SAP2000 This guide provides detailed instructions for setting up the VIKTOR worker with the CSI software suite, focusing specifically on ETABS and SAP2000. The steps outlined are also applicable to other CSI tools. It is designed to offer the necessary context and file templates to facilitate the integration process. note There are two ways to integrate with the CSI software from an app. You can call the CSI API directly from your app with `vkt.etabs.connect()` or `vkt.sap2000.connect()`, or you can send a Python script to the worker with `vkt.etabs.ETABSAnalysis`, `vkt.sap2000.SAP2000Analysis`, or `vkt.python.PythonAnalysis`. Both need a worker; [Choose your approach](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000/.md#choose-your-approach) compares them. `vkt.etabs.attach()` and `vkt.sap2000.attach()` are variants of `connect()` that bind the session to the instance the user already has open, instead of starting a new one. See [Attaching to a running instance](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000/.md#attaching-to-a-running-instance). ## The worker[​](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000/.md#the-worker "Direct link to The worker") A worker is a program that connects the VIKTOR platform to third-party software running outside the platform. You can install the worker on your local machine or a remote server, but the CSI software must be installed where the worker is located. Your VIKTOR app will handle the communication between the web app and the worker as shown in the following diagram. ![worker](/assets/images/integration_etabs_worker-ee5b31b4ce7e118aef4f514a2b036f73.png) Here is what happens during the integration: 1. The user enters input parameters in the **VIKTOR UI**. 2. The `app.py` in the VIKTOR app sends a task to the worker 3. The worker (running on your local machine or a virtual machine) executes the task by using the CSI API. 4. The worker returns the result of the **calculation** to your VIKTOR app. 5. **VIKTOR UI** displays the result of the calculation. The CSI software cannot run headless The worker drives the real desktop application, so the machine it runs on needs a **logged-in, interactive Windows session** (a service running in Session 0 cannot start ETABS or SAP2000). The license must not prompt on startup either: nobody is there to answer a sign-in or activation dialog, so the app would only see a timeout. ## Choose your approach[​](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000/.md#choose-your-approach "Direct link to Choose your approach") | | `vkt.etabs.connect()` / `vkt.sap2000.connect()` | `vkt.etabs.ETABSAnalysis` / `vkt.sap2000.SAP2000Analysis` / `vkt.python.PythonAnalysis` | | ----------------------------------------- | -------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | | Worker integration | `etabsconnect` / `sap2000connect` | `etabs` / `sap2000` / `python` | | Where the API calls live | in your app | in a Python script that is sent to the worker | | Python + `comtypes` on the worker machine | not needed | required | | Software | ETABS / SAP2000 | ETABS / SAP2000, and other CSI tools such as SAFE and CSiBridge\* | | Which instance is used | a fresh one, or the one already running when you use `attach()` | a fresh one, started by your script | | SDK version | viktor >= 14.31.0 (ETABS), >= 14.32.0 (SAP2000), >= 14.33.0 for `attach()` | viktor >= v14.17.0 | \* SAFE and CSiBridge have no dedicated analysis class — use `viktor.external.python.PythonAnalysis` directly and the `python` worker integration; see [Sending a Python script to the worker](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000/.md#sending-a-python-script-to-the-worker). `connect()` is the preferred approach for integrations with ETABS and SAP2000, since you don't need any additional configuration on the worker side. Use the script-based approach for other CSI tools, or to maintain an app that already uses it. ## Calling the API directly from your app[​](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000/.md#calling-the-api-directly-from-your-app "Direct link to Calling the API directly from your app") note This is a **BETA** feature and requires **SDK version >= 14.31.0** for ETABS, or **>= 14.32.0** for SAP2000. `attach()` requires **>= 14.33.0** for both. [`vkt.etabs.connect()`](https://docs.viktor.ai/sdk/api/external/etabs/.md) and [`vkt.sap2000.connect()`](https://docs.viktor.ai/sdk/api/external/sap2000/.md) open a live session with the CSI software on a connected worker and return the model object itself: `sap` **is** the CSI `SapModel`, and every call on it is forwarded to that running instance and executed there. Use it as a context manager — the session (and the ETABS or SAP2000 instance) exists only inside the `with` block: * ETABS * SAP2000 app.py ``` import viktor as vkt class Controller(vkt.Controller): ... # A method inside the Controller opens the session and drives ETABS. def run_etabs(self, params, **kwargs): with vkt.etabs.connect(timeout=60) as sap: ret = sap.InitializeNewModel(vkt.etabs.eUnits.kN_m_C) # a call returns the status code [beam_name, ret] = sap.FrameObj.AddByCoord(0, 0, 0, 6, 0, 0, "", "Default", "Beam", "Global") [pt_i, pt_j, ret] = sap.FrameObj.GetPoints(beam_name, "", "") # ...or out-params, then status ret = sap.File.Save("model.edb") # use a relative filename, not an absolute path ``` app.py ``` import viktor as vkt class Controller(vkt.Controller): ... # A method inside the Controller opens the session and drives SAP2000. def run_sap2000(self, params, **kwargs): with vkt.sap2000.connect(timeout=60) as sap: ret = sap.InitializeNewModel(vkt.sap2000.eUnits.kN_m_C) # a call returns the status code [beam_name, ret] = sap.FrameObj.AddByCoord(0, 0, 0, 6, 0, 0, "", "Default", "Beam", "Global") [pt_i, pt_j, ret] = sap.FrameObj.GetPoints(beam_name, "", "") # ...or out-params, then status ret = sap.File.Save("model.sdb") # use a relative filename, not an absolute path ``` Every member of the [CSI API](https://www.csiamerica.com/developer) is reachable on `sap`. A call returns the API status code (`0` is success), or a list of the method's output parameters followed by that status code. Please consider the following: * Every call is a round trip to the worker, so prefer Open API methods that act on many objects at once over long per-element loops. `timeout` bounds a single call, not the session. * File arguments must be **relative filenames**. Each session gets its own working directory on the worker, which is removed when the session closes; absolute paths are refused. * The current version of `connect()` doesn't support returning models created using the worker. Read the results you need through the CSI API (`sap.Results...`) while the session is open. * `connect()` always starts its own, empty ETABS or SAP2000 instance. To work on an instance that is already running on the worker machine, use `attach()` instead; see [Attaching to a running instance](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000/.md#attaching-to-a-running-instance). * The object models of ETABS and SAP2000 are similar but not identical: the model file is an `.edb` for ETABS and an `.sdb` for SAP2000, the self-weight load case is called `Dead` in ETABS and `DEAD` in SAP2000, and enumeration members are each product's own. Check the CSI documentation of the product you are targeting instead of porting code across. ### Attaching to a running instance[​](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000/.md#attaching-to-a-running-instance "Direct link to Attaching to a running instance") [`vkt.etabs.attach()`](https://docs.viktor.ai/sdk/api/external/etabs/.md#_attach) and [`vkt.sap2000.attach()`](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_attach) open the same kind of session as `connect()`, with one difference: they bind to the ETABS or SAP2000 instance that is already running on the worker machine instead of starting a fresh, empty one. The app acts on the model the engineer has open on screen, and the changes it makes appear in their own window. note `attach()` is a **BETA** feature and requires **SDK version >= 14.33.0**. This is a personal-worker workflow. The engineer runs the worker and the CSI software on their own machine (see [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md)), so the model they are working on is on the same host the session lands on. A worker on a hosted machine has no interactive desktop session, and therefore nothing to attach to. * ETABS * SAP2000 app.py ``` import viktor as vkt class Controller(vkt.Controller): ... def check_open_model(self, params, **kwargs): try: with vkt.etabs.attach(timeout=60) as sap: [pt_i, pt_j, ret] = sap.FrameObj.GetPoints("B1", "", "") # reads the model that is open ret = sap.View.RefreshView() # a change shows in the user's own window except vkt.errors.WorkerSessionAttachError as err: raise vkt.UserError(f"Could not attach to ETABS ({err.reason}). Open your model and try again.") from err ``` app.py ``` import viktor as vkt class Controller(vkt.Controller): ... def check_open_model(self, params, **kwargs): try: with vkt.sap2000.attach(timeout=60) as sap: [pt_i, pt_j, ret] = sap.FrameObj.GetPoints("B1", "", "") # reads the model that is open ret = sap.View.RefreshView() # a change shows in the user's own window except vkt.errors.WorkerSessionAttachError as err: raise vkt.UserError(f"Could not attach to SAP2000 ({err.reason}). Open your model and try again.") from err ``` The two are strictly separate: * `connect()` always opens a new instance, it never attaches to an existing instance. * `attach()` always attaches to a running instance, it will fail if there is no running instance. What changes once the session is attached: * Closing the session detaches from the instance without closing it. The user can carry on working in the model afterwards. Session close, a worker restart and the idle timeout never close an attached instance. * The app can change the attached model, but it cannot save it in place. File arguments keep the same restriction as `connect()`: `sap.File.Save("model.edb")` takes a relative filename and writes into the session's own working directory, which is removed when the session closes. * With several instances of the **same** product running, the session binds whichever one the CSI API hands back, and you cannot choose between them. Keep a single instance open on the worker machine when an app attaches to it. * `timeout` bounds the attach itself as well as each later call, so keep it at 30 seconds or more. If the attach fails, [`vkt.errors.WorkerSessionAttachError`](https://docs.viktor.ai/sdk/api/errors/.md#_WorkerSessionAttachError) is raised and no session is established. Its `reason` attribute names the cause, for example `"error_attach_no_instance"` when nothing is running on the worker machine, or `"error_attach_wrong_product"` when the running instance belongs to the other CSI product. The set of reasons is open-ended, so handle a value you do not recognise as a generic attach failure. Once the session is established, losing the instance (the user closes ETABS, for example) raises `vkt.errors.WorkerSessionError`, exactly as it does for `connect()`. `WorkerSessionAttachError` is a subclass of `WorkerSessionError`, so `except vkt.errors.WorkerSessionError` catches a failed attach as well as a lost session. ### Add integration to app config[​](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000/.md#add-integration-to-app-config "Direct link to Add integration to app config") To make the worker integration available through the interface, add the following to your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#worker_integrations): * ETABS * SAP2000 ``` worker_integrations = [ "etabsconnect", ] ``` ``` worker_integrations = [ "sap2000connect", ] ``` ### Install the worker[​](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000/.md#install-the-worker "Direct link to Install the worker") This worker calls the CSI API directly, so it needs no Python environment on the worker machine. note For SAP2000, follow the same steps, selecting the SAP2000 integration instead of ETABS. Follow these steps to install the worker: * Personal worker * Organization worker A personal worker connects the software that is installed on your own machine, for your own use. Personal workers are installed and managed with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md): 1. [Download and install VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#download-and-install-viktor-desktop) and log in with your VIKTOR account, if you haven't done so already 2. In VIKTOR Desktop, click "Add" and select **ETABS** ![](/assets/images/viktor-desktop-add-worker-list-01993b58665874f7b82e3e76d84dd9b9.webp) 3. Start the worker. You can view its [logs](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#view-logs) inside VIKTOR Desktop, and the editor shows when your worker is online note Personal workers that were installed with the previous per-worker installer keep running, but new personal workers can only be added through [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#migrate-existing-workers-to-viktor-desktop): the per-worker installer download and connection-key flow are no longer available for personal use. An organization worker connects software that runs on a machine managed by your organization, such as a virtual or remote machine, and is shared by the users of the workspace(s) you select. caution You need to be an environment administrator in order to install an organization worker. 1. Navigate to the "Integrations" tab in the Administrator panel 2. Click "Add integration" 3. Follow the steps provided in the modal ![](/assets/images/create-integration-admin-598d0869714267fcb7a220c370dde5df.png) 3.1. Select **ETABS** 3.2. Select the workspace(s) the integration should be available to 3.3. Download the worker .msi (Microsoft Installer) and run it on the machine of choice 3.4. Copy the generated **connection key** and paste it when the installer asks for it. In the browser, you can now click Finish and continue in the installer. Connection Key The generated connection key **should be copied immediately** as VIKTOR will not preserve this data for security reasons. 4. Make sure to launch the integration once the installation is finished. If you closed the integration, you can restart it through the desktop shortcut. ### Testing[​](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000/.md#testing "Direct link to Testing") `vkt.etabs.connect` and `vkt.sap2000.connect` need to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. The `vkt.testing` module provides the [`mock_ETABSConnection`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_ETABSConnection) and [`mock_SAP2000Connection`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_SAP2000Connection) decorators, which map each Open API path to the result it should return. The same two decorators also mock `vkt.etabs.attach` and `vkt.sap2000.attach`: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_ETABSConnection(results={ 'FrameObj.AddByCoord': ['B1', 0], # : [*output_params, status] 'FrameObj.GetPoints': ['P1', 'P2', 0], }) def test_analysis(self): MyEntityTypeController().analysis() ``` ## Sending a Python script to the worker[​](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000/.md#sending-a-python-script-to-the-worker "Direct link to Sending a Python script to the worker") Your app sends a Python script to the worker, which runs it against the CSI software through `comtypes`. This is the only option for other CSI tools such as SAFE and CSiBridge, and remains supported for existing ETABS and SAP2000 apps. ETABS and SAP2000 each have a dedicated analysis class (`vkt.etabs.ETABSAnalysis`, `vkt.sap2000.SAP2000Analysis`) and worker integration (`etabs`, `sap2000`). **SAFE and CSiBridge have neither** — use the generic `viktor.external.python.PythonAnalysis` class and the `python` worker integration instead; see the SAFE/CSiBridge notes below, and [App code](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000/.md#app-code) for the class itself. ### Add integration to app config[​](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000/.md#add-integration-to-app-config-1 "Direct link to Add integration to app config") To make the worker integration available through the interface, add the following to your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#worker_integrations): ``` worker_integrations = [ "etabs", "sap2000", ] ``` SAFE and CSiBridge Neither has its own worker integration — register the 'python' worker instead: ``` worker_integrations = [ "python", ] ``` ### Install the worker[​](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000/.md#install-the-worker-1 "Direct link to Install the worker") This worker runs your Python script, so its setup includes selecting the Python environment it should use. note For SAP2000, follow the same steps, but select **SAP2000** instead of **ETABS (Legacy)**. For SAFE or CSiBridge, select the **Python** integration instead — see below. Follow these steps to install the worker: * Personal worker * Organization worker A personal worker connects the software that is installed on your own machine, for your own use. Personal workers are installed and managed with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md): 1. [Download and install VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#download-and-install-viktor-desktop) and log in with your VIKTOR account, if you haven't done so already 2. In VIKTOR Desktop, click "Add" and select **ETABS (Legacy)** ![](/assets/images/viktor-desktop-add-worker-list-01993b58665874f7b82e3e76d84dd9b9.webp) 3. Select the Python environment of your choice by setting the path to its `python.exe` as the executable path. This can be your system Python, or the python.exe in a dedicated virtual environment tip Your default Python environment can usually be found in `C:\Users\Username\AppData\Local\Programs\Python\Python31X\python.exe` If you cannot find it, try running the following command in your terminal ``` where python ``` 4. Start the worker. You can view its [logs](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#view-logs) inside VIKTOR Desktop, and the editor shows when your worker is online note Personal workers that were installed with the previous per-worker installer keep running, but new personal workers can only be added through [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#migrate-existing-workers-to-viktor-desktop): the per-worker installer download and connection-key flow are no longer available for personal use. An organization worker connects software that runs on a machine managed by your organization, such as a virtual or remote machine, and is shared by the users of the app instance(s) you select. caution You need to be an environment administrator in order to install an organization worker. 1. Navigate to the "Integrations" tab in the Administrator panel 2. Click "Add integration" 3. Follow the steps provided in the modal ![](/assets/images/create-integration-admin-598d0869714267fcb7a220c370dde5df.png) 3.1. Select **ETABS (Legacy)** 3.2. Select the app instance(s) the integration should be available to 3.3. Download the worker .msi (Microsoft Installer) and run it on the machine of choice 3.4. Copy the generated **connection key** and paste it when the installer asks for it. In the browser, you can now click Finish and continue in the installer. Connection Key The generated connection key **should be copied immediately** as VIKTOR will not preserve this data for security reasons. 4. In the installer wizard, select the Python executable of your choice, this can be your system Python, or the python.exe in a dedicated virtual environment tip Your default Python environment can usually be found in `C:\Users\\AppData\Local\Programs\Python\Python31X\python.exe`. If you cannot find it, try running `where python` in your terminal. 5. Make sure to launch the integration once the installation is finished. If you closed the integration, you can restart it through the desktop shortcut. SAFE and CSiBridge Follow the same steps, but select the **Python** integration in step 2 (or 3.1 for an organization worker), matching the `python` worker integration configured above. ### Install Python dependencies[​](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000/.md#install-python-dependencies "Direct link to Install Python dependencies") The `etabs` and `sap2000` workers control the CSI software through a Python environment where `pywin32` and `comtypes` need to be installed. This environment can be on your local Windows machine or a **remote server** where the CSI software is installed with a valid license. 1. Install the necessary libraries (`pywin32` and `comtypes`) using `pip` in the python environment selected during worker setup (in VIKTOR Desktop, the Python environment is the one whose `python.exe` you set as the executable path): ``` pip install pywin32 comtypes ``` ### App code[​](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000/.md#app-code "Direct link to App code") The following directory structure can be used as a template when working with the ETABS and SAP2000 API: ``` my-etabs-app/ ├── app.py ├── run_etabs_model.py ├── inputs.json ``` This is the role of each file: * The `app.py` contains the logic of your VIKTOR app. It will use the `inputs.json` file as input for the worker and reads the `output.json` generated by the worker. * The worker executes the `run_etabs_model.py` using the Python environment defined during worker installation (also defined in the `config.yaml`). This file will generate `output.json` which is send back to the VIKTOR app. You can use the following `app.py` template to set up the communication with your worker: ``` # app.py import viktor as vkt from pathlib import Path class Parametrization(vkt.Parametrization): ... class Controller(vkt.Controller): ... # A function inside the Controller creates the `inputs.json`. def run_etabs(self, params, **kwargs): script = vkt.File.from_path(Path(__file__).parent / "run_etabs_model.py") files = [("inputs.json", vkt.File.from_path(Path(__file__).parent / "inputs.json"))] analysis = vkt.etabs.ETABSAnalysis( script=script, files=files, output_filenames=["output.json"] ) analysis.execute(timeout=300) output_file = analysis.get_output_file("output.json") ``` note For SAP2000, use `vkt.sap2000.SAP2000Analysis` instead of `vkt.etabs.ETABSAnalysis`; the rest of the template is the same. SAFE and CSiBridge Neither has a dedicated analysis class. Import the generic [`PythonAnalysis`](https://docs.viktor.ai/sdk/api/external/python/.md) instead and use it directly: ``` from viktor.external.python import PythonAnalysis analysis = PythonAnalysis( script=script, files=files, output_filenames=["output.json"] ) ``` The rest of the template — building `inputs.json`, driving the CSI COM API through `comtypes` on the worker, writing `output.json` — is unchanged. Only the program path and COM identifiers differ per product; check the CSI help file installed with SAFE or CSiBridge for its own. The following template can be used to define the content of your `run_etabs_model.py` to communicate with the worker and your VIKTOR app: ``` # run_etabs_model.py import json from pathlib import Path def create_etabs_model(): ''' 1. Your code reads the inputs.json file and uses the content for structural analysis in ETABS. ''' input_json = Path.cwd() / "inputs.json" with open(input_json) as jsonfile: data = json.load(jsonfile) ''' 2. Add your logic here for the analysis using the ETABS API. ''' ''' 3. Store the results of your analysis in the output.json file to be sent to your VIKTOR app. ''' output = Path.cwd() / "output.json" with open(output, "w") as jsonfile: json.dump(outputs, jsonfile) create_etabs_model() ``` info You can check the following [tutorial](https://docs.viktor.ai/docs/tutorials/integrate-etabs-sap2000/.md) to see the worker in action! ### Testing[​](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000/.md#testing-1 "Direct link to Testing") `ETABSAnalysis.execute` and `SAP2000Analysis.execute` need to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. The `viktor.testing` module provides the [`mock_ETABSAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_ETABSAnalysis) and [`mock_SAP2000Analysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_SAP2000Analysis) decorators that facilitate mocking of workers. For SAFE or CSiBridge, mock the underlying [`mock_PythonAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_PythonAnalysis) decorator instead: ``` import unittest import viktor as vkt from viktor.testing import mock_ETABSAnalysis from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_ETABSAnalysis(get_output_file={ 'result.xml': vkt.File.from_path('test_file.xml'), # : 'result.json': vkt.File.from_path('test_file.json'), ... }) def test_analysis(self): MyEntityTypeController().analysis() ``` For the decorator's input parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). --- # Excel VIKTOR provides an integration with Excel to be able to use an Excel sheet **with macros** within your app. If you want to use an Excel sheet **without macros** as a calculation tool, you can also consider using [`SpreadsheetCalculation`](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/spreadsheet-calculator/.md). ## Add integration to app config[​](https://docs.viktor.ai/docs/create-apps/software-integrations/excel/.md#add-integration-to-app-config "Direct link to Add integration to app config") To make the worker integration available through the interface, add the following to your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#worker_integrations): ``` worker_integrations = [ "excel", ] ``` For personal use, install and enable the worker with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md). Instructions on how to install an organization worker can be found [here](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#installation). ## App code[​](https://docs.viktor.ai/docs/create-apps/software-integrations/excel/.md#app-code "Direct link to App code") Instances of [`NamedInputCell`](https://docs.viktor.ai/sdk/api/external/spreadsheet/.md#_NamedInputCell) (cells which can be found using a certain key) and [`DirectInputCell`](https://docs.viktor.ai/sdk/api/external/spreadsheet/.md#_DirectInputCell) (cell which can be found by a direct address `{sheet, column, row}`) can be used to fill the template. Similarly, instances of [`NamedOutputCell`](https://docs.viktor.ai/sdk/api/external/spreadsheet/.md#_NamedOutputCell) and [`DirectOutputCell`](https://docs.viktor.ai/sdk/api/external/spreadsheet/.md#_DirectOutputCell) can be used to specify which cells should be returned. Below example assumes the template is available. The sheet can be filled with predefined values: ``` import viktor as vkt def run_excel(): named_input_cells = [ vkt.excel.NamedInputCell('named_cell_1', 'text_to_be_placed'), vkt.excel.NamedInputCell('named_cell_2', 5), ] macros = [vkt.excel.Macro('caculate_mean'), vkt.excel.Macro('calculate_area')] area_cell = vkt.excel.DirectOutputCell('sheet1', 'B', 9) direct_output_cells = [ area_cell ] excel = vkt.excel.Excel(template=my_template, named_input_cells=named_input_cells, macros=macros, direct_output_cells=direct_output_cells) # The timeout in excel.execute() is the time in seconds the whole cycle of # sending the job, executing the job, and receiving the job result may take. excel.execute(timeout=120) return area_cell.result # or excel.get_direct_cell_result('sheet1', 'B', 9) ``` The macros are run in the order in which they are present in the list. Thus, in above example 'calculate\_mean' is run first and 'calculate\_area' second. ## Testing[​](https://docs.viktor.ai/docs/create-apps/software-integrations/excel/.md#testing "Direct link to Testing") New in v13.5.0 `mock_Excel` decorator for easier testing of `Excel` `Excel.execute` needs to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. The `viktor.testing` module provides the [`mock_Excel`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_Excel) decorator that facilitate mocking of workers: ``` import unittest from viktor import File from viktor.testing import mock_Excel from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_Excel( get_named_cell_result={ 'cell_1': 1, # : 'cell_2': 2, ... }, get_direct_cell_result={ ('sheet_1', 'A', 1): 1, # (, , ): ('sheet_1', 'C', 1): 3, ... }, get_filled_template=File.from_path('test_file.xlsx'), ) def test_excel_analysis(self): MyEntityTypeController().excel_analysis() ``` For the decorator's input parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). --- # Other Software VIKTOR comes with a list of specific integrations, but also enables you to integrate with other software packages not listed. This is possible using * Generic worker * Generic OAuth 2.0 integration. A general introduction on OAuth 2.0 and a comparison with other integration types can be found here [here](https://docs.viktor.ai/docs/create-apps/software-integrations/.md). ## Generic worker[​](https://docs.viktor.ai/docs/create-apps/software-integrations/generic/.md#generic-worker "Direct link to Generic worker") VIKTOR offers a Generic [worker](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#workers), which can be used to integrate with any software package that supports command-line interaction. The [`GenericAnalysis`](https://docs.viktor.ai/sdk/api/external/generic/.md#_GenericAnalysis) class is used for this, which requires one or multiple input files. Furthermore, you need to specify an `executable_key` to instruct the worker to call a specific task as defined in the configuration file (`config.yaml`). ``` from viktor.external.generic import GenericAnalysis # Generate the input file(s) files = [ ('input1.txt', file1), ('input2.txt', file2) ] # Run the analysis and obtain the output file. generic_analysis = GenericAnalysis(files=files, executable_key="some_executable", output_filenames=["output.txt"]) generic_analysis.execute(timeout=60) output_file = generic_analysis.get_output_file("output.txt") ``` The `executable_key` in the example above refers to the "some\_executable" command. This command is part of the worker configuration, defined in the configuration file (`config.yaml`). For workers managed with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#add-and-configure-a-worker), this file is exposed to you when setting up the worker, and you define the executables, arguments and paths in it yourself. For organization workers (installed with the per-worker installer), the file is located on the server, in the same directory as the worker: **config.yaml** ``` executables: some_executable: path: 'C:\path\to\executable.exe' arguments: - '-arg1' - '-arg2' - '-arg3' workingDirectoryPath: 'C:\path\to\script' maxParallelProcesses: 1 # must be 1 if any of the above workingDirectoryPath is not '' (stateful path) ``` note If a fixed `workingDirectoryPath` is defined in the configuration file the maximum number of parallel processes should be 1. When the `workingDirectoryPath` is not specified a temporary directory will be created to run each job. This allows for a `maxParallelProcesses > 1`. note The worker reads the config file once during startup. So when you change the config file, you will need to restart the worker for your changes to take effect. With this setup, we can basically run any third-party software which supports command-line execution. ### Testing[​](https://docs.viktor.ai/docs/create-apps/software-integrations/generic/.md#testing "Direct link to Testing") New in v13.5.0 `mock_GenericAnalysis` decorator for easier testing of `GenericAnalysis` `GenericAnalysis.execute` needs to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. The `viktor.testing` module provides the [`mock_GenericAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_GenericAnalysis) decorator that facilitate mocking of workers: ``` import unittest import viktor as vkt from viktor.testing import mock_GenericAnalysis from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_GenericAnalysis(get_output_file={ 'result.xml': vkt.File.from_path('test_file.xml'), # : 'result.json': vkt.File.from_path('test_file.json'), ... }) def test_analysis(self): MyEntityTypeController().analysis() ``` For the decorator's input parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). ## Generic OAuth 2.0 integration[​](https://docs.viktor.ai/docs/create-apps/software-integrations/generic/.md#generic-oauth-20-integration "Direct link to Generic OAuth 2.0 integration") VIKTOR offers a generic OAuth 2.0 integration, enabling you to connect to any software which supports the OAuth 2.0 protocol. ### Creating a generic OAuth 2.0 integration (admin)[​](https://docs.viktor.ai/docs/create-apps/software-integrations/generic/.md#creating-a-generic-oauth-20-integration-admin "Direct link to Creating a generic OAuth 2.0 integration (admin)") First a generic OAuth 2.0 integration needs be setup by one of the VIKTOR admins. This needs to be done in the third-party software and VIKTOR. ![](/assets/images/create-oauth-generic-integration-admin-211e3cf4e5083ecb6b34b9d09f49e084.png) 1. Navigate to the "Integrations" tab in the Administrator panel 2. Select the "OAuth 2.0 integrations" tab 3. Click "Add OAuth 2.0 integration" 4. Follow the steps provided in the modal 1. Select "Generic" 2. Fill in the basic information of the integration, including the app that the integration should be available to. You can choose to limit the integration to specific apps or allow all apps on the environment to use it. 3. Fill in the credentials needed to establish a connection. These credentials can found in your third-party software app. 5. Consult the vendor's documentation on how to set up an "OAuth 2.0" application. In general, the steps are: 1. Create an OAuth 2.0 application within the relevant software. 2. Make sure you gather the **Client ID**, and the **Client Secret** if you are using a confidential client * Most vendors use the terminology **Public App** or **Non-Confidential App** for creating OAuth 2.0 applications for public usage (lacking a **Client Secret**). VIKTOR Platform supports both confidential and public clients. VIKTOR runs PKCE on all clients, so public clients are secured without a Client Secret. 3. Make sure you allow `/api/integrations/oauth2/callback/` within redirect urls (e.g. `https://acme.viktor.ai/api/integrations/oauth2/callback/`) 4. Determine the relevant scopes for your integration. 5. Some example integration documentation you can refer to: * [Microsoft Entra OAuth 2.0 Integration](https://learn.microsoft.com/en-us/entra/identity-platform/) * [Autodesk Platform Services](https://aps.autodesk.com/en/docs/oauth/v2/developers_guide/overview/) Security Best Practices * Use minimum scope for your application(s) to function when creating integration on VIKTOR. This would limit the impact when there is misuse of integrated software. * Use a short Time-to-Live for your Access Tokens when configuring the OAuth 2.0 application on the integration provider. ![](/assets/images/create-oauth-integration-admin-configuration-details-7ced0828b6c88d9e12e5bb50d011c85e.png) ### Implementing the integration in an app (developer)[​](https://docs.viktor.ai/docs/create-apps/software-integrations/generic/.md#implementing-the-integration-in-an-app-developer "Direct link to Implementing the integration in an app (developer)") With the integration name, the developer can start the implementation. First the integration is added in the config file. This is used by the platform to know that this app needs an integration and to trigger a login button for the user. `viktor.config.toml` ``` oauth2_integrations = [ "my-integration-1" ] ``` Secondly the logic that uses the integration can be implemented in the app. Often external software will provide examples and/or a Python SDK, making it easier to implement. In order to obtain the necessary token for authentication, you instantiate the `OAuth2Integration` class with the integration name and call the method `get_access_token`. ``` integration = vkt.external.OAuth2Integration('my-integration-1') access_token = integration.get_access_token() # code using the token inside your Python code to integrate ``` --- # GEOLIB The [GEOLIB](https://github.com/Deltares/GEOLib) is a [publicly available Python library](https://pypi.org/project/d-geolib/) developed by Deltares. The GEOLIB provides functionality for the following Deltares software: * DFoundations * DSettlement * DSheetPiling * DStability note The GEOLIB replaces VIKTOR's D-Series bindings. These bindings won't be removed for now, but there won't follow any updates anymore. ## Using GEOLIB[​](https://docs.viktor.ai/docs/create-apps/software-integrations/geolib/.md#using-geolib "Direct link to Using GEOLIB") To make use of the GEOLIB, add the following to your `requirements.txt`: ``` d-geolib==0.1.6 # or any other available version ``` For more information on how to use the GEOLIB, see the online [documentation](https://deltares.github.io/GEOLib/latest/index.html). ## Executing jobs[​](https://docs.viktor.ai/docs/create-apps/software-integrations/geolib/.md#executing-jobs "Direct link to Executing jobs") All GEOLIB models have an `execute()` method. However, it's not possible to use this in a VIKTOR app. Fortunately, there is still a way to execute your model, making use of VIKTOR's corresponding analysis class and worker, by serializing your model into VIKTOR's writable [`File`](https://docs.viktor.ai/sdk/api/core/.md#_File) object: ``` from geolib import DSettlementModel from pathlib import Path import viktor as vkt ... model = DSettlementModel() # build up your model ... file = vkt.File() # create a writable file (GEOLIB is going to write to it) path = Path(file.source) # source returns the path in `str`, GEOLIB requires (in most cases) a Path object model.serialize(path) # let GEOLIB write the serialized model to the file dsettlement_analysis = vkt.dsettlement.DSettlementAnalysis(input_file=file) # pass the input file to the analysis as usual dsettlement_analysis.execute() # requires a worker ``` The GEOLIB can be used in conjunction with the following VIKTOR analysis classes and workers: * [`DFoundationsAnalysis`](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_DFoundationsAnalysis) * [`DSettlementAnalysis`](https://docs.viktor.ai/sdk/api/external/dsettlement/.md#_DSettlementAnalysis) * [`DSheetPilingAnalysis`](https://docs.viktor.ai/sdk/api/external/dsheetpiling/.md#_DSheetPilingAnalysis) * [`DStabilityAnalysis`](https://docs.viktor.ai/sdk/api/external/dstability/.md#_DStabilityAnalysis) ## Parsing in-memory data[​](https://docs.viktor.ai/docs/create-apps/software-integrations/geolib/.md#parsing-in-memory-data "Direct link to Parsing in-memory data") GEOLIB also features the parsing of output files for the different models. It does however work with paths and includes a check on the file's suffix. If you have in-memory data (e.g. `StringIO` or `BytesIO`), you can convert it to a path with suffix by creating a temporary file with `NamedTemporaryFile`: note Creating a temporary path with VIKTOR's `File.from_data(...).copy()` does not work here, because GEOLIB requires the file path to have a valid suffix. ``` import os from geolib import DSettlementModel from pathlib import Path from tempfile import NamedTemporaryFile ... temp_file = NamedTemporaryFile(suffix='.sld', delete=False, mode='wb') # create a temporary file with correct suffix; don't delete on close(); remove mode 'b' in case of StringIO/str temp_file.write(my_bytesio.getvalue()) # write in-memory content (bytes in this case) to file temp_file.close() # close (does not delete) the file to ensure the data is actually written to file (instead of kept in buffer) path = Path(temp_file.name) # name returns the path in `str`, GEOLIB requires (in most cases) a Path object dsettlement_model = DSettlementModel() # create empty model dsettlement_model.parse(path) # parse file into DSettlementModel() model os.remove(temp_file.name) # remove the temporary file to avoid cluttering of files ``` --- # GRLWEAP Analyzing a GRLWEAP model in VIKTOR can be done using the [`GRLWeapAnalysis`](https://docs.viktor.ai/sdk/api/external/grlweap/.md#_GRLWeapAnalysis) class (worker required). ## Add integration to app config[​](https://docs.viktor.ai/docs/create-apps/software-integrations/grlweap/.md#add-integration-to-app-config "Direct link to Add integration to app config") To make the worker integration available through the interface, add the following to your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#worker_integrations): ``` worker_integrations = [ "grlweap", ] ``` For personal use, install and enable the worker with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md). Instructions on how to install an organization worker can be found [here](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#installation). ## App code[​](https://docs.viktor.ai/docs/create-apps/software-integrations/grlweap/.md#app-code "Direct link to App code") No binding is provided by VIKTOR for this module, which means that the input file has to be generated manually: ``` import viktor as vkt # Generate the input GWT file. input_file = ... # Run the analysis and obtain the output file. analysis = vkt.grlweap.GRLWeapAnalysis(input_file) analysis.execute(timeout=10) output_file = analysis.get_output_file() ``` ## Testing[​](https://docs.viktor.ai/docs/create-apps/software-integrations/grlweap/.md#testing "Direct link to Testing") New in v13.5.0 `mock_GRLWeapAnalysis` decorator for easier testing of `GRLWeapAnalysis` `GRLWeapAnalysis.execute` needs to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. The `viktor.testing` module provides the [`mock_GRLWeapAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_GRLWeapAnalysis) decorator that facilitate mocking of workers: ``` import unittest from viktor import File from viktor.testing import mock_GRLWeapAnalysis from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_GRLWeapAnalysis(get_output_file=File.from_path('test_file.GWO')) def test_grlweap_analysis(self): MyEntityTypeController().grlweap_analysis() ``` For the decorator's input parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). --- # IDEA StatiCa Concrete Supported (tested) IDEA StatiCa versions: * v24 * v23 * v22 * v21 An IDEA StatiCa Concrete binding has been developed by VIKTOR to simplify the process of creating a model, running an analysis (worker required) and parsing the results. ## Add integration to app config[​](https://docs.viktor.ai/docs/create-apps/software-integrations/idea/.md#add-integration-to-app-config "Direct link to Add integration to app config") To make the worker integration available through the interface, add the following to your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#worker_integrations): ``` worker_integrations = [ "idearcs", ] ``` For personal use, install and enable the worker with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md). Instructions on how to install an organization worker can be found [here](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#installation). ## Creating a model[​](https://docs.viktor.ai/docs/create-apps/software-integrations/idea/.md#creating-a-model "Direct link to Creating a model") A model can be created using the binding in two different ways: 1. [`Model`](https://docs.viktor.ai/sdk/api/external/idea/.md#_Model): create a model with the least effort. Limited set of features. 2. [`OpenModel`](https://docs.viktor.ai/sdk/api/external/idea/.md#_OpenModel): resembles the API of IDEA StatiCa Concrete. Less intuitive than `Model`, but can be used if the latter lacks desired features. ### Creating a model using `Model`[​](https://docs.viktor.ai/docs/create-apps/software-integrations/idea/.md#creating-a-model-using-model "Direct link to creating-a-model-using-model") The process consists of the following steps: 1. Create the 'empty' [`Model`](https://docs.viktor.ai/sdk/api/external/idea/.md#_Model). Optionally [`ProjectData`](https://docs.viktor.ai/sdk/api/external/idea/.md#_ProjectData) and/or [`CodeSettings`](https://docs.viktor.ai/sdk/api/external/idea/.md#_CodeSettings) can be specified (see [this section](https://docs.viktor.ai/docs/create-apps/software-integrations/idea/.md#projectdata-and-codesettings)) 2. Create one or more materials for the cross section(s) using [`Model.create_concrete_material`](https://docs.viktor.ai/sdk/api/external/idea/.md#Model.create_concrete_material). 3. Create one or more materials for the reinforcement(s) using [`Model.create_reinforcement_material`](https://docs.viktor.ai/sdk/api/external/idea/.md#Model.create_reinforcement_material). 4. Create members to be checked using [`Model.create_beam`](https://docs.viktor.ai/sdk/api/external/idea/.md#Model.create_beam) (or similar methods, see below). 5. Create reinforcement(s) using [`Beam.create_bar`](https://docs.viktor.ai/sdk/api/external/idea/.md#Beam.create_bar). 6. Create extreme(s) with corresponding internal forces using [`Beam.create_extreme`](https://docs.viktor.ai/sdk/api/external/idea/.md#Beam.create_extreme) (or similar). 7. Generate the input XML file using [`Model.generate_xml_input`](https://docs.viktor.ai/sdk/api/external/idea/.md#Model.generate_xml_input). ``` import viktor as vkt model = vkt.idea_rcs.Model() # Initialize the model. # Create the desired material(s). cs_mat = model.create_concrete_material(vkt.idea_rcs.ConcreteMaterial.C12_15) mat_reinf = model.create_reinforcement_material(vkt.idea_rcs.ReinforcementMaterial.B_400A) # Create a beam (or other type of member) to be checked. cross_section = vkt.idea_rcs.RectSection(0.5, 1.0) beam = model.create_beam(cross_section, cs_mat) # Create bars (and stirrups) as desired bar_locations = [(-0.101, -0.175), (0.101, -0.175), (0.101, 0.175), (-0.101, 0.175)] bar_diameters = [0.016, 0.016, 0.016, 0.016] for coords, diameter in zip(bar_locations, bar_diameters): beam.create_bar(coords, diameter, mat_reinf) # Add extreme(s) freq = vkt.idea_rcs.LoadingSLS(vkt.idea_rcs.ResultOfInternalForces(N=-100000, My=210000)) fund = vkt.idea_rcs.LoadingULS(vkt.idea_rcs.ResultOfInternalForces(N=-99999, My=200000)) beam.create_extreme(frequent=freq, fundamental=fund) # Generate the input XML file. input_file = model.generate_xml_input() ``` caution `Model.generate_xml_input` needs to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. Currently, `Model` supports the following member types: * [Beam](https://docs.viktor.ai/sdk/api/external/idea/.md#Model.create_beam) * [Compression member](https://docs.viktor.ai/sdk/api/external/idea/.md#Model.create_compression_member) * [One-way slab](https://docs.viktor.ai/sdk/api/external/idea/.md#Model.create_one_way_slab) Currently, `Model` supports the following section types: * [General](https://docs.viktor.ai/sdk/api/external/idea/.md#_GeneralShape) * [Rectangular](https://docs.viktor.ai/sdk/api/external/idea/.md#_RectSection) ### Creating a model using `OpenModel`[​](https://docs.viktor.ai/docs/create-apps/software-integrations/idea/.md#creating-a-model-using-openmodel "Direct link to creating-a-model-using-openmodel") The process consists of the following steps: 1. Create the 'empty' [`OpenModel`](https://docs.viktor.ai/sdk/api/external/idea/.md#_OpenModel). Optionally [`ProjectData`](https://docs.viktor.ai/sdk/api/external/idea/.md#_ProjectData) and/or [`CodeSettings`](https://docs.viktor.ai/sdk/api/external/idea/.md#_CodeSettings) can be specified (see [this section](https://docs.viktor.ai/docs/create-apps/software-integrations/idea/.md#projectdata-and-codesettings)) 2. Create one or more materials for the cross section(s) using [`OpenModel.create_matconcrete_ec2`](https://docs.viktor.ai/sdk/api/external/idea/.md#OpenModel.create_matconcrete_ec2). 3. Create a concrete cross-section using one of: * [`OpenModel.create_cross_section_parameter`](https://docs.viktor.ai/sdk/api/external/idea/.md#OpenModel.create_cross_section_parameter) * [`OpenModel.create_cross_section_component`](https://docs.viktor.ai/sdk/api/external/idea/.md#OpenModel.create_cross_section_component) note In case of a `CrossSectionParameter`, the `**parameters` argument should contain keys and values corresponding to the `cross_section_type`, else the input file will be invalid. For more information on what `**parameters` are required for a certain `cross_section_type`, please see [`create_cross_section_parameter`](https://docs.viktor.ai/sdk/api/external/idea/.md#OpenModel.create_cross_section_parameter) 4. Create one or more materials for the reinforcement(s) using [`OpenModel.create_matreinforcement_ec2`](https://docs.viktor.ai/sdk/api/external/idea/.md#OpenModel.create_matreinforcement_ec2). 5. Create the reinforced cross section(s) using [`OpenModel.create_reinforced_cross_section`](https://docs.viktor.ai/sdk/api/external/idea/.md#OpenModel.create_reinforced_cross_section). 6. Create reinforcement(s) using [`ReinforcedCrossSection.create_bar`](https://docs.viktor.ai/sdk/api/external/idea/.md#ReinforcedCrossSection.create_bar). 7. Create check member(s) using [`OpenModel.create_check_member1d`](https://docs.viktor.ai/sdk/api/external/idea/.md#OpenModel.create_check_member1d). 8. Couple the check member and reinforced cross section using [`OpenModel.add_check_section`](https://docs.viktor.ai/sdk/api/external/idea/.md#OpenModel.add_check_section). 9. Create extreme(s) with corresponding internal forces using [`CheckSection.create_extreme`](https://docs.viktor.ai/sdk/api/external/idea/.md#CheckSection.create_extreme). 10. Add additional data to the check member using [`OpenModel.add_member_data_ec2`](https://docs.viktor.ai/sdk/api/external/idea/.md#OpenModel.add_member_data_ec2). note The `member_type` and `two_way_slab_type` should correspond to the chosen reinforced cross section 11. Generate the input XML file using [`OpenModel.generate_xml_input`](https://docs.viktor.ai/sdk/api/external/idea/.md#OpenModel.generate_xml_input). ``` import viktor as vkt model = vkt.idea_rcs.OpenModel() # Initialize the model. # Create the concrete section. mat = model.create_matconcrete_ec2(vkt.idea_rcs.ConcreteMaterial.C12_15) cs = model.create_cross_section_parameter( name='cs', cross_section_type=vkt.idea_rcs.CrossSectionType.RECT, material=mat, Width=2.0, Height=2.0 ) # Create the reinforced cross section. rcs = model.create_reinforced_cross_section(name='rcs', cross_section=cs) # Create bars (and stirrups) as desired mat_reinf = model.create_matreinforcement_ec2(vkt.idea_rcs.ReinforcementMaterial.B_400A) bar_locations = [(-0.101, -0.175), (0.101, -0.175), (0.101, 0.175), (-0.101, 0.175)] bar_diameters = [0.016, 0.016, 0.016, 0.016] for coords, diameter in zip(bar_locations, bar_diameters): rcs.create_bar(coords, diameter, mat_reinf) # Create a CheckMember. member = model.create_check_member1d() # 'Assign' the CheckMember to a CheckSection with the previously defined reinforced section and add extremes. check_section = model.add_check_section(description='S 1', check_member=member, reinf_section=rcs) freq = vkt.idea_rcs.LoadingSLS(vkt.idea_rcs.ResultOfInternalForces(N=-100000, My=210000)) fund = vkt.idea_rcs.LoadingULS(vkt.idea_rcs.ResultOfInternalForces(N=-99999, My=200000)) check_section.create_extreme(frequent=freq, fundamental=fund) # 'Assign' the necessary additional data to the CheckMember. model.add_member_data_ec2(member, vkt.idea_rcs.MemberType.BEAM_SLAB, vkt.idea_rcs.TwoWaySlabType.SHELL_AS_PLATE) # Generate the input XML file. input_file = model.generate_xml_input() ``` caution `OpenModel.generate_xml_input` needs to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. ### ProjectData and CodeSettings[​](https://docs.viktor.ai/docs/create-apps/software-integrations/idea/.md#projectdata-and-codesettings "Direct link to ProjectData and CodeSettings") When a `Model` or `OpenModel` is initialized, optionally project data and/or code settings can be specified. Currently, `ProjectData` supports: * Project name (>= v14.6.0) * Project number (>= v14.6.0) * Project description (>= v14.6.0) * Author (>= v14.6.0) * Date (>= v14.6.0) * National Annex (no annex, Dutch, Belgium) * Fatigue check * Design working life (>= v14.6.0) Currently, `CodeSettings` supports: * [`EvaluationInteractionDiagram`](https://docs.viktor.ai/sdk/api/external/idea/.md#_EvaluationInteractionDiagram) * [`NoResistanceConcreteTension1d`](https://docs.viktor.ai/sdk/api/external/idea/.md#_NoResistanceConcreteTension1d) * [`TypeSLSCalculation`](https://docs.viktor.ai/sdk/api/external/idea/.md#_TypeSLSCalculation) * `theta`, `theta_min`, `theta_max` * `n_cycles_fatigue` ## Running an analysis[​](https://docs.viktor.ai/docs/create-apps/software-integrations/idea/.md#running-an-analysis "Direct link to Running an analysis") After having generated an input XML file, it can be fed to the [`IdeaRcsAnalysis`](https://docs.viktor.ai/sdk/api/external/idea/.md#_IdeaRcsAnalysis): ``` import viktor as vkt # Generate the input XML file from `Model` or `OpenModel`, or generate one yourself. input_file = ... # Run the analysis and obtain the output file. analysis = vkt.idea_rcs.IdeaRcsAnalysis(input_file) analysis.execute(60) output_file = analysis.get_output_file() ``` ## Extracting results using `RcsOutputFileParser`[​](https://docs.viktor.ai/docs/create-apps/software-integrations/idea/.md#extracting-results-using-rcsoutputfileparser "Direct link to extracting-results-using-rcsoutputfileparser") After running an analysis, the obtained output file can be fed to the `RcsOutputFileParser` for convenient extraction of the results: ``` import viktor as vkt # Obtain the XML output file from `IdeaRcsAnalysis`, or obtain one yourself. xml_file = idea_rcs_analysis.get_output_file(as_file=True) # Obtain the results for specific or all section(s). with xml_file.open_binary() as f: parser = vkt.idea_rcs.RcsOutputFileParser(f) # loop through all sections for section in parser.section_results(): capacity_results = section.capacity() shear_results = section.shear() # or get results for a single section section_4 = parser.section_result(4) ... ``` Currently, `RcsOutputFileParser` supports the following results (partially): * [`Capacity`](https://docs.viktor.ai/sdk/api/external/idea/.md#RcsOutputFileParser.SectionResult.capacity) * [`Shear`](https://docs.viktor.ai/sdk/api/external/idea/.md#RcsOutputFileParser.SectionResult.shear) * [`Torsion`](https://docs.viktor.ai/sdk/api/external/idea/.md#RcsOutputFileParser.SectionResult.torsion) (>= v13.4.0) * [`Interaction`](https://docs.viktor.ai/sdk/api/external/idea/.md#RcsOutputFileParser.SectionResult.interaction) (>= v13.4.0) * [`Crack width`](https://docs.viktor.ai/sdk/api/external/idea/.md#RcsOutputFileParser.SectionResult.crack_width) * [`Detailing`](https://docs.viktor.ai/sdk/api/external/idea/.md#RcsOutputFileParser.SectionResult.detailing) * [`Stress limitation`](https://docs.viktor.ai/sdk/api/external/idea/.md#RcsOutputFileParser.SectionResult.stress_limitation) * [`Fatigue`](https://docs.viktor.ai/sdk/api/external/idea/.md#RcsOutputFileParser.SectionResult.fatigue) In case you require results which are not supported, you can retrieve the raw results using the [`OutputFileParser`](https://docs.viktor.ai/sdk/api/external/idea/.md#_OutputFileParser). We do not advice to use this when handling very large result files: ``` # Obtain the raw results as a dictionary xml_file = idea_rcs_analysis.get_output_file(as_file=True) parser = OutputFileParser(xml_file) raw_results = parser.raw_results() ``` ## Testing[​](https://docs.viktor.ai/docs/create-apps/software-integrations/idea/.md#testing "Direct link to Testing") New in v13.5.0 `mock_IdeaRcsAnalysis` decorator for easier testing of `IdeaRcsAnalysis` `IdeaRcsAnalysis.execute` needs to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. The `viktor.testing` module provides the [`mock_IdeaRcsAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_IdeaRcsAnalysis) decorator that facilitate mocking of workers: ``` import unittest from viktor import File from viktor.testing import mock_IdeaRcsAnalysis from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_IdeaRcsAnalysis( get_output_file=File.from_path('test_file.xml'), get_idea_rcs_file=File.from_path('test_file.ideaRcs'), ) def test_idea_analysis(self): MyEntityTypeController().idea_analysis() ``` For the decorator's input parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). --- # Bentley iTwin **Bentley iTwin** can be integrated with **VIKTOR** using the **OAuth 2.0** workflow for token based authentication and authorization. A general introduction to OAuth 2.0 can be found [here](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#oauth-20). ## Prerequisites[​](https://docs.viktor.ai/docs/create-apps/software-integrations/iTwin/.md#prerequisites "Direct link to Prerequisites") To create this integration, you need access to the **Bentley** developer portal and a Bentley account that can register applications in **[My Apps](https://developer.bentley.com/my-apps/)**. This tutorial uses a Bentley **Web App** because VIKTOR's `OAuth2Integration` expects a confidential client with a `client_id`, `client_secret`, and redirect callback. note Make sure the Bentley account and subscription used for testing have access to the required iTwin APIs. For non-production testing, a Bentley Community subscription can be used. ## Creating a Bentley application[​](https://docs.viktor.ai/docs/create-apps/software-integrations/iTwin/.md#creating-a-bentley-application "Direct link to Creating a Bentley application") Open [Bentley My Apps](https://developer.bentley.com/my-apps/) and register a new application. This application will serve as the bridge between VIKTOR and your Bentley iTwin account, allowing secure data exchange through OAuth 2.0. When creating your application in the Bentley portal, configure it with the following settings: * **Application type**: `Web App` - This type provides the client secret needed for secure server-to-server communication * **Scopes**: `itwin-platform` - This grants access to the iTwin Platform APIs, allowing you to retrieve projects and iModels * **Redirect URI**: `/api/integrations/oauth2/callback/` - This is where Bentley will redirect users after successful authentication The redirect URI must match your VIKTOR environment URL exactly. For example, if your VIKTOR environment is hosted at `demo.viktor.ai`, your redirect URI should be: ``` https://demo.viktor.ai/api/integrations/oauth2/callback/ ``` The screenshot below shows the expected Bentley application setup using `demo.viktor.ai` as an example. Remember to use your own company's VIKTOR environment URL (e.g., `yourcompany.viktor.ai`). ![Bentley application registration](/assets/images/bentley_itwin_integration_create_app-1d1b14da9d66f6c67e06faf9ee6621ff.png) After saving the application, copy the following values from Bentley: * `Client ID` * `Client Secret` ## Creating an OAuth 2.0 integration (admin)[​](https://docs.viktor.ai/docs/create-apps/software-integrations/iTwin/.md#creating-an-oauth-20-integration-admin "Direct link to Creating an OAuth 2.0 integration (admin)") After receiving the **Client ID** and **Client Secret**, a **VIKTOR** admin can generate an **OAuth 2.0** integration. Start in the Administrator panel and create a new OAuth 2.0 integration with **iTwin** as the selected software. ![Open the OAuth 2.0 modal](/assets/images/bentley_itwin_integration_viktor_modal-96e7b0d82536eefba53e8ab8ea22864b.png) In the **Basic Information** step, choose a descriptive integration name that clearly identifies this connection. For example, you could use `viktor-itwin-integration`, `bentley-itwin-oauth`, or any custom name that makes sense for your organization. This name will be referenced in your application code, so make it memorable and meaningful. note Throughout this guide, we use `viktor-itwin-integration` as the example integration name. When you see this name in code samples or configuration steps, replace it with your own chosen name. Add a clear description that explains the purpose of this integration (e.g., "OAuth 2.0 integration for accessing Bentley iTwin projects and iModels"), and assign the integration to the VIKTOR applications that should have access to it. ![Basic integration information](/assets/images/bentley_itwin_integration_viktor_basic_info-bb07fb2c4ba83f6aa0c755d59d8199b2.png) Then, in the **Configuration** step, use the Bentley OAuth values shown below: * **Authentication URL**: `https://ims.bentley.com/connect/authorize` * **Token URL**: `https://ims.bentley.com/connect/token` * **Client ID**: `` * **Client Secret**: `` * **Scopes**: `itwin-platform` `offline_access` `offline_access` is optional. If you do not need refresh-token support, you can use only `itwin-platform`. ![Bentley OAuth configuration in VIKTOR](/assets/images/bentley_itwin_integration_viktor_configuration-434a6338951a3bc1f4523c445386a077.png) info The iTwin Platform uses the universal `itwin-platform` scope instead of individual API scopes. Access to iTwin data is controlled by the user's assigned roles and permissions, not by granular OAuth scope selection. For more information, see the [iTwin authorization documentation](https://developer.bentley.com/apis/overview/authorization/#application-scopes-and-user-permissions). ## Implementing the integration[​](https://docs.viktor.ai/docs/create-apps/software-integrations/iTwin/.md#implementing-the-integration "Direct link to Implementing the integration") Once an administrator sets up the **OAuth 2.0** integration, the developer can start the implementation. You have two alternatives to develop apps that integrate Bentley iTwin: * [Using the App Builder](https://docs.viktor.ai/docs/create-apps/software-integrations/iTwin/.md#using-the-app-builder) * [Using Local Development](https://docs.viktor.ai/docs/create-apps/software-integrations/iTwin/.md#using-local-development) ### Using the App Builder[​](https://docs.viktor.ai/docs/create-apps/software-integrations/iTwin/.md#using-the-app-builder "Direct link to Using the App Builder") The [App Builder](https://docs.viktor.ai/docs/app-builder/.md) provides a no-code approach to create applications with Bentley iTwin integration. You can describe the app in natural language and let the App Builder generate the first version for you. Use the following prompt: ``` Create a VIKTOR app that uses the OAuth2 integration viktor-itwin-integration to call https://api.bentley.com/itwins/?subClass=Project&$top=50 and https://api.bentley.com/imodels/?iTwinId=&$top=100, then show all accessible iTwins in a DataView result tree with each iTwin’s status, number, and iModels; for each iModel, show its name, id, state, and created date, and handle empty results with “No iTwins found” or “No iModels found.” ``` A generated App Builder result can look like this: ![Bentley App Builder result](/assets/images/bentley_itwin_integration_app_builder_result-d5051cc51d2261bb061c07d0f67e40d3.png) After submitting the prompt, the App Builder will ask you to connect the integration in the app settings: 1. Click the `App details` button 2. Select the integration name `viktor-itwin-integration` 3. Save the current selection ![Assign the integration in App details](/assets/images/bentley_itwin_integration_app_builder_setup-118be683130a642776df42c82df615e3.png) ### Using local development[​](https://docs.viktor.ai/docs/create-apps/software-integrations/iTwin/.md#using-local-development "Direct link to Using local development") For local development, the developer should add the integration name to the app configuration after the administrator has assigned the integration to the app. The platform uses it to show a login button when the user opens the app. Make sure your `viktor.config.toml` contains the name exactly as configured in the Administrator panel. note Remember to use your own integration name in `viktor.config.toml`. In the examples below, we continue using `viktor-itwin-integration`, but you should replace this with the custom name you defined earlier in the Administrator panel. `viktor.config.toml`: ``` app_type = "editor" python_version = "3.13" registered_name = "your-app-name" oauth2_integrations = [ "viktor-itwin-integration" ] ``` Then implement the logic that uses the integration in the code. You can use raw REST requests or a Python SDK, as long as it is compatible with the **VIKTOR** OAuth flow. A popular library is `requests`. You can add it in your `requirements.txt`: ``` viktor requests ``` To obtain an access token, instantiate `OAuth2Integration` with the integration name and call `get_access_token`. The example below fetches the user's accessible iTwins, then fetches the iModels for each iTwin, and displays everything in a nested [DataView](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/data-and-tables/.md). ``` import requests import viktor as vkt class Parametrization(vkt.Parametrization): intro = vkt.Text("# Bentley iTwin OAuth2 Integration") explanation = vkt.Text( "This view fetches all accessible iTwins and their iModels in one result tree." ) class Controller(vkt.Controller): parametrization = Parametrization @vkt.DataView("Bentley data", duration_guess=2) def get_bentley_data(self, params, **kwargs): token = vkt.external.OAuth2Integration( "viktor-itwin-integration" ).get_access_token() itwin_headers = { "Authorization": f"Bearer {token}", "Accept": "application/vnd.bentley.itwin-platform.v1+json", "Prefer": "return=minimal", } imodel_headers = { "Authorization": f"Bearer {token}", "Accept": "application/vnd.bentley.itwin-platform.v2+json", "Prefer": "return=representation", } response = requests.get( "https://api.bentley.com/itwins/?subClass=Project&$top=50", headers=itwin_headers, timeout=15, ) response.raise_for_status() itwins = response.json().get("iTwins", []) if not itwins: return vkt.DataResult(vkt.DataGroup(vkt.DataItem("Result", "No iTwins found"))) data_items = [] for itwin in itwins: itwin_id = itwin.get("id", "") imodel_response = requests.get( f"https://api.bentley.com/imodels/?iTwinId={itwin_id}&$top=100", headers=imodel_headers, timeout=15, ) imodel_response.raise_for_status() imodels = imodel_response.json().get("iModels", []) imodel_items = [ vkt.DataItem( imodel.get("displayName", imodel.get("name", "Unnamed iModel")), imodel.get("id", ""), explanation_label=( f"State: {imodel.get('state', '')} | " f"Created: {imodel.get('createdDateTime', '')}" ), ) for imodel in imodels ] if not imodel_items: imodel_items = [vkt.DataItem("iModels", "No iModels found")] data_items.append( vkt.DataItem( itwin.get("displayName", "Unnamed iTwin"), itwin_id, subgroup=vkt.DataGroup( vkt.DataItem("Status", itwin.get("status", "")), vkt.DataItem("Number", itwin.get("number", "")), vkt.DataItem( "iModels", len(imodels), subgroup=vkt.DataGroup(*imodel_items), ), ), ) ) return vkt.DataResult(vkt.DataGroup(*data_items)) ``` Note The integration name in `OAuth2Integration` must match the value in `viktor.config.toml`. Make sure the user has access to the relevant Bentley iTwins and iModels in the connected account. ## About iTwin.js viewer[​](https://docs.viktor.ai/docs/create-apps/software-integrations/iTwin/.md#about-itwinjs-viewer "Direct link to About iTwin.js viewer") This integration provides access to iTwin Platform APIs for data retrieval. Please note that the [iTwin.js 3D viewer](https://www.itwinjs.org/learning/tutorials/develop-web-viewer/) requires a React framework, so it's not directly embeddable in VIKTOR's [WebView](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/html/.md) component at this time. tip Want iTwin.js 3D viewer support in VIKTOR? Submit a feature request on the [VIKTOR Community Forum](https://community.viktor.ai/). Your feedback helps us decide what to build next. --- # Matlab Matlab can be executed through command-line instructions, which allows executing complete Matlab scripts. These scripts can, for example, be generated dynamically within VIKTOR. See the [Matlab documentation](https://www.mathworks.com/help/matlab/ref/matlabwindows.html) for more info on running Matlab from the command-line. ## Add integration to app config[​](https://docs.viktor.ai/docs/create-apps/software-integrations/matlab/.md#add-integration-to-app-config "Direct link to Add integration to app config") To make the worker integration available through the interface, add the following to your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#worker_integrations): ``` worker_integrations = [ "matlab", ] ``` Instructions on how to install the worker: Install the worker Follow these steps to install the worker: * Personal worker * Organization worker A personal worker connects the software that is installed on your own machine, for your own use. Personal workers are installed and managed with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md): 1. [Download and install VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#download-and-install-viktor-desktop) and log in with your VIKTOR account, if you haven't done so already 2. In VIKTOR Desktop, click "Add" and select **Matlab** ![](/assets/images/viktor-desktop-add-worker-list-01993b58665874f7b82e3e76d84dd9b9.webp) 3. Set the path to the Matlab executable as the executable path 4. Start the worker. You can view its [logs](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#view-logs) inside VIKTOR Desktop, and the editor shows when your worker is online note Personal workers that were installed with the previous per-worker installer keep running, but new personal workers can only be added through [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#migrate-existing-workers-to-viktor-desktop): the per-worker installer download and connection-key flow are no longer available for personal use. An organization worker connects software that runs on a machine managed by your organization, such as a virtual or remote machine, and is shared by the users of the app instance(s) you select. caution You need to be an environment administrator in order to install an organization worker. 1. Navigate to the "Integrations" tab in the Administrator panel 2. Click "Add integration" 3. Follow the steps provided in the modal ![](/assets/images/create-integration-admin-598d0869714267fcb7a220c370dde5df.png) 3.1. Select **Matlab** 3.2. Select the app instance(s) the integration should be available to 3.3. Download the worker .msi (Microsoft Installer) and run it on the machine of choice 3.4. Copy the generated **connection key** and paste it when the installer asks for it. In the browser, you can now click Finish and continue in the installer. Connection Key The generated connection key **should be copied immediately** as VIKTOR will not preserve this data for security reasons. 4. In the installer wizard, select the Matlab executable 5. Make sure to launch the integration once the installation is finished. If you closed the integration, you can restart it through the desktop shortcut. ## App code[​](https://docs.viktor.ai/docs/create-apps/software-integrations/matlab/.md#app-code "Direct link to App code") ``` import viktor as vkt # Generate the input file(s) files = [ ('input1.txt', file1), ('input2.txt', file2) ] # Run the analysis and obtain the output file analysis = vkt.matlab.MatlabAnalysis(files=files, output_filenames=["output.txt"]) analysis.execute(timeout=60) output_file = analysis.get_output_file("output.txt") ``` ## Testing[​](https://docs.viktor.ai/docs/create-apps/software-integrations/matlab/.md#testing "Direct link to Testing") `MatlabAnalysis.execute` needs to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. The `viktor.testing` module provides the [`mock_MatlabAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_MatlabAnalysis) decorator that facilitate mocking of workers: ``` import unittest import viktor as vkt from viktor.testing import mock_MatlabAnalysis from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_MatlabAnalysis(get_output_file={ 'result.xml': vkt.File.from_path('test_file.xml'), # : 'result.json': vkt.File.from_path('test_file.json'), ... }) def test_analysis(self): MyEntityTypeController().analysis() ``` For the decorator's input parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). --- # Microsoft **Microsoft** services such as **SharePoint**, **OneDrive**, and other resources exposed through the [Microsoft Graph API](https://learn.microsoft.com/en-us/graph/overview) can be integrated with **VIKTOR** using the **OAuth 2.0** workflow for token based authentication and authorization. Authentication is handled by **Microsoft Entra ID** (formerly Azure Active Directory). A general introduction to OAuth 2.0 can be found [here](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#oauth-20). This guide uses **SharePoint** as the running example, but the same setup applies to any Microsoft Graph resource. You only need to adjust the scopes and the endpoints your app calls. ## Prerequisites[​](https://docs.viktor.ai/docs/create-apps/software-integrations/microsoft/.md#prerequisites "Direct link to Prerequisites") To create this integration you need: * A **Microsoft Entra ID** tenant and an account that is allowed to register applications in the [Microsoft Entra admin center](https://entra.microsoft.com/) (or the [Azure portal](https://portal.azure.com/)). Registering apps or granting admin consent for tenant-wide permissions typically requires an administrator. * Access to the SharePoint sites (or other Microsoft resources) you want to read from, with the account that will log in to the app. This tutorial registers a Microsoft **Web** application because VIKTOR's `OAuth2Integration` expects a confidential client with a `client_id`, `client_secret`, and a redirect callback. ## Registering an application in Microsoft Entra[​](https://docs.viktor.ai/docs/create-apps/software-integrations/microsoft/.md#registering-an-application-in-microsoft-entra "Direct link to Registering an application in Microsoft Entra") Open the [Microsoft Entra admin center](https://entra.microsoft.com/) and go to **Identity** > **Applications** > **App registrations** > **New registration**. This application acts as the bridge between VIKTOR and your Microsoft tenant, allowing secure data exchange through OAuth 2.0. ![Register an application in Microsoft Entra](/assets/images/microsoft-integration-register-app-76d4dafad5841adccf86f70748346644.png) Configure the registration as follows: 1. **Name**: choose a descriptive name, for example `viktor-sharepoint-integration`. 2. **Supported account types**: select **Accounts in this organizational directory only** for a single tenant. Choose a multi-tenant option only if you explicitly need to support external tenants. 3. **Redirect URI**: set the platform to **Web** and add your VIKTOR callback URL: ``` /api/integrations/oauth2/callback/ ``` Your environment URL should be `https://cloud.viktor.ai/` or similar, depending on your organization. For example, if your VIKTOR environment is hosted at `demo.viktor.ai`, your redirect URI should be: ``` https://demo.viktor.ai/api/integrations/oauth2/callback/ ``` Note The redirect URI must match your VIKTOR environment URL exactly, otherwise the integration will fail. After registering, note the following values from the application **Overview** page: * **Application (client) ID** * **Directory (tenant) ID** (used to build the authentication and token URLs) ### Adding API permissions[​](https://docs.viktor.ai/docs/create-apps/software-integrations/microsoft/.md#adding-api-permissions "Direct link to Adding API permissions") Go to **API permissions** > **Add a permission** > **Microsoft Graph** > **Delegated permissions**, and add the permissions your app needs. For browsing SharePoint sites and reading files, add: * `User.Read` * `Sites.Read.All` * `Files.Read.All` Add `offline_access` as well if you want refresh-token support so the user does not have to log in again as often. ![Microsoft Graph delegated permissions](/assets/images/microsoft-integration-api-permissions-bce8aa66aa479e93f07bdc98643c3b10.png) Which permissions you need depends on what the app does: | What the app does | Delegated permissions to add | | ------------------------------------------- | -------------------------------------------- | | Sign in and read the user profile | `User.Read` | | Browse SharePoint sites and read files | `Sites.Read.All`, `Files.Read.All` | | Upload, replace, or delete SharePoint files | `Sites.ReadWrite.All`, `Files.ReadWrite.All` | | Send email as the logged-in user | `Mail.Send` | The write permissions include the read permissions, so you do not need to add both `Files.Read.All` and `Files.ReadWrite.All`. Security best practices Use the minimum permissions required for your application to function. For example, if your app only reads data, do not request write permissions. This limits the impact in case of misuse. Some permissions require **admin consent**. If the **Status** column shows that consent is required, an administrator must click **Grant admin consent for \**. ### Creating a client secret[​](https://docs.viktor.ai/docs/create-apps/software-integrations/microsoft/.md#creating-a-client-secret "Direct link to Creating a client secret") Go to **Certificates & secrets** > **Client secrets** > **New client secret**. Add a description and an expiration period, then create the secret. ![Create a client secret (step 1)](/assets/images/microsoft-integration-client-secret-1-193c27eba695f7e3ab202fd90c5758bb.png) ![Create a client secret (step 2)](/assets/images/microsoft-integration-client-secret-2-4b48dad3489b4fb49c6ef865f9f4df07.png) Note Copy the client secret **Value** (not the Secret ID) immediately. You will not be able to view it again after leaving the page. Security best practices Use a short expiration for your client secret and rotate it regularly. Use a short Time-to-Live for your access tokens as well. After completing this section you should have the following values ready: * **Application (client) ID** * **Client secret value** * **Directory (tenant) ID** ## Creating an OAuth 2.0 integration (admin)[​](https://docs.viktor.ai/docs/create-apps/software-integrations/microsoft/.md#creating-an-oauth-20-integration-admin "Direct link to Creating an OAuth 2.0 integration (admin)") After registering the application, a **VIKTOR** admin can generate an **OAuth 2.0** integration. Note VIKTOR does not have a dedicated **Microsoft** integration yet, so you set up the connection using the [**Generic** OAuth 2.0 integration](https://docs.viktor.ai/docs/create-apps/software-integrations/generic/.md#generic-oauth-20-integration). The steps below are identical, you only fill in Microsoft's endpoints, credentials, and scopes. Start in the Administrator panel and create a new OAuth 2.0 integration with **Generic** as the selected software. ![Open the OAuth 2.0 modal](/assets/images/create-oauth-generic-integration-admin-211e3cf4e5083ecb6b34b9d09f49e084.png) 1. Navigate to the **Integrations** tab in the **Administrator** panel. 2. Select the **OAuth 2.0** tab. 3. Follow the steps in the modal: * Select **Generic**. * Go to the **Basic Information** tab and fill in the required fields, including a descriptive integration name, and select the applications that will use the integration. You can choose to limit the integration to specific apps or allow all apps in the environment to use it. note Throughout this guide we use `microsoft-entra` as the example integration name. When you see this name in code samples or configuration steps, replace it with your own chosen name. This name is referenced in your application code, so make it memorable and meaningful. * Then, in the **Configuration** tab, add the Authentication URL and Token URL. Replace `` with your **Directory (tenant) ID** from the previous section: * **Authentication URL**: `https://login.microsoftonline.com//oauth2/v2.0/authorize` * **Token URL**: `https://login.microsoftonline.com//oauth2/v2.0/token` Note Make sure to use the **v2.0** endpoints as shown above. The v2.0 endpoints are the ones compatible with the scope-based OAuth 2.0 configuration used by VIKTOR. 4. Fill in the **Client ID** (Application ID) and **Client Secret** (the secret value) from your Microsoft Entra application. 5. For the scopes, use the same delegated permissions you configured in the app registration, separated by spaces: ``` offline_access User.Read Sites.Read.All Files.Read.All ``` If the app also writes files or sends email, extend the list with the matching scopes, for example: ``` offline_access User.Read Sites.ReadWrite.All Files.ReadWrite.All Mail.Send ``` note If your tenant requires it, you can prefix the Microsoft Graph scopes with the resource URL, for example `https://graph.microsoft.com/Sites.Read.All`. The short form shown above works for the v2.0 endpoint in most tenants. ![VIKTOR Microsoft OAuth configuration](/assets/images/create-oauth-integration-admin-configuration-details-7ced0828b6c88d9e12e5bb50d011c85e.png) ## Implementing the integration[​](https://docs.viktor.ai/docs/create-apps/software-integrations/microsoft/.md#implementing-the-integration "Direct link to Implementing the integration") Once an administrator sets up the **OAuth 2.0** integration, the developer can start the implementation. You have two alternatives to develop apps that integrate Microsoft services: * [Using the App Builder](https://docs.viktor.ai/docs/create-apps/software-integrations/microsoft/.md#using-the-app-builder) * [Using Local Development](https://docs.viktor.ai/docs/create-apps/software-integrations/microsoft/.md#using-local-development) ### Using the App Builder[​](https://docs.viktor.ai/docs/create-apps/software-integrations/microsoft/.md#using-the-app-builder "Direct link to Using the App Builder") The [App Builder](https://docs.viktor.ai/docs/app-builder/.md) provides a no-code approach to create applications with a Microsoft integration. Simply provide a natural language prompt describing what you want to build, and the App Builder will generate the application for you. To create an app that lists the SharePoint sites you have access to, you can run the following prompt (make sure to replace `microsoft-entra` with the name of the integration you created in the previous steps): ``` Create an app using my OAuth2 integration 'microsoft-entra' to fetch SharePoint sites from: URL: https://graph.microsoft.com/v1.0/sites?search=* The API returns JSON with a 'value' list, where each site has 'displayName' and 'webUrl' fields. Display these in a table. ``` After submitting the prompt, the App Builder will ask you to set up the integration by following these 3 steps: 1. Click the **App details** button 2. Select the integration name `microsoft-entra` 3. Save the current selection ### Using local development[​](https://docs.viktor.ai/docs/create-apps/software-integrations/microsoft/.md#using-local-development "Direct link to Using local development") For local development, the developer should add the integration name to the app configuration (after the administrator has assigned the integration to the app). The platform uses it to show a login button when the user opens the app. Make sure your `viktor.config.toml` contains the name exactly as configured in the Administrator panel. note Remember to use your own integration name in `viktor.config.toml`. In the examples below we continue using `microsoft-entra`, but you should replace this with the custom name you defined earlier in the Administrator panel. `viktor.config.toml`: ``` app_type = "editor" python_version = "3.13" registered_name = "your-app-name" oauth2_integrations = [ "microsoft-entra" ] ``` Then implement the logic that uses the integration in the code. You can use raw REST requests or a Python SDK, as long as it is compatible with the **VIKTOR** OAuth flow. A popular library is `requests`. You can add it in your `requirements.txt`: ``` viktor requests ``` To obtain an access token, instantiate `OAuth2Integration` with the integration name and call `get_access_token`. All Microsoft Graph requests use the token as a bearer token in the `Authorization` header. The example below fetches the SharePoint sites the user has access to and displays them in a [TableView](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/data-and-tables/.md). It works when the **VIKTOR** **OAuth 2.0** integration is assigned to your app and the user has granted access: ``` import viktor as vkt import requests class Parametrization(vkt.Parametrization): text = vkt.Text("# Microsoft SharePoint OAuth2 Integration") class Controller(vkt.Controller): parametrization = Parametrization @vkt.TableView("SharePoint sites") def get_sites(self, params, **kwargs): integration = vkt.external.OAuth2Integration("microsoft-entra") token = integration.get_access_token() headers = { "Authorization": f"Bearer {token}", "Accept": "application/json", } endpoint = "https://graph.microsoft.com/v1.0/sites?search=*" response = requests.get(endpoint, headers=headers, timeout=15) response.raise_for_status() sites = response.json().get("value", []) data = [] for site in sites: site_name = site.get("displayName", "") site_url = site.get("webUrl", "") data.append([site_name, site_url]) return vkt.TableResult(data, column_headers=["Site name", "URL"]) ``` Note The integration name in `OAuth2Integration` must match the value in `viktor.config.toml`. Make sure the user has access to the relevant SharePoint sites (or other Microsoft resources) in the connected account. ## Reading and modifying SharePoint files[​](https://docs.viktor.ai/docs/create-apps/software-integrations/microsoft/.md#reading-and-modifying-sharepoint-files "Direct link to Reading and modifying SharePoint files") SharePoint files are reached through the Microsoft Graph **drive** endpoints. A site contains one or more document libraries (drives), and each drive contains folders and files (drive items). Reading and writing a file therefore takes two steps: look up the drive of the site, then address the file inside that drive. The examples below reuse the same headers as in the previous section: ``` integration = vkt.external.OAuth2Integration("microsoft-entra") token = integration.get_access_token() headers = {"Authorization": f"Bearer {token}", "Accept": "application/json"} ``` ### Looking up a site and its document library[​](https://docs.viktor.ai/docs/create-apps/software-integrations/microsoft/.md#looking-up-a-site-and-its-document-library "Direct link to Looking up a site and its document library") You can address a site by its hostname and path, which avoids hardcoding an internal site ID: ``` BASE = "https://graph.microsoft.com/v1.0" # https://contoso.sharepoint.com/sites/engineering site = requests.get(f"{BASE}/sites/viktor.sharepoint.com:/sites/engineering", headers=headers, timeout=15) site.raise_for_status() site_id = site.json()["id"] # the default document library ("Documents") of the site drive = requests.get(f"{BASE}/sites/{site_id}/drive", headers=headers, timeout=15) drive.raise_for_status() drive_id = drive.json()["id"] ``` Use `/sites/{site-id}/drives` instead of `/sites/{site-id}/drive` to list all document libraries of a site, and `/drives/{drive-id}/root/children` to list the items in the root folder of a library. ### Reading a file[​](https://docs.viktor.ai/docs/create-apps/software-integrations/microsoft/.md#reading-a-file "Direct link to Reading a file") Files are read with the `content` endpoint, either by item ID or by path. The example below downloads a file by its path in the document library and hands it to the user with a [`DownloadButton`](https://docs.viktor.ai/docs/create-apps/user-input/action-buttons/.md#downloadbutton---download-a-file): ``` import viktor as vkt import requests BASE = "https://graph.microsoft.com/v1.0" DRIVE_ID = "..." # see "Looking up a site and its document library" FILE_PATH = "Projects/beam-loads.xlsx" class Parametrization(vkt.Parametrization): download = vkt.DownloadButton("Download from SharePoint", method="download_file") class Controller(vkt.Controller): parametrization = Parametrization def download_file(self, params, **kwargs): integration = vkt.external.OAuth2Integration("microsoft-entra") token = integration.get_access_token() headers = {"Authorization": f"Bearer {token}"} response = requests.get( f"{BASE}/drives/{DRIVE_ID}/root:/{FILE_PATH}:/content", headers=headers, timeout=60, ) response.raise_for_status() return vkt.DownloadResult(vkt.File.from_data(response.content), "beam-loads.xlsx") ``` The response body is the raw file content, so you can also feed it straight into your own processing logic, for example `openpyxl` for a spreadsheet or `vkt.File.from_data(response.content)` for any VIKTOR function that accepts a `File`. ### Modifying a file[​](https://docs.viktor.ai/docs/create-apps/software-integrations/microsoft/.md#modifying-a-file "Direct link to Modifying a file") Writing a file uses the same path with a `PUT` request. Uploading to a path that already exists replaces the file and creates a new version in SharePoint; uploading to a path that does not exist creates the file. This requires the `Files.ReadWrite.All` and `Sites.ReadWrite.All` scopes. Do this in an [action](https://docs.viktor.ai/docs/create-apps/user-input/action-buttons/.md) rather than in a view, because views are re-evaluated whenever the user changes an input and would write to SharePoint every time: ``` import viktor as vkt import requests BASE = "https://graph.microsoft.com/v1.0" DRIVE_ID = "..." class Parametrization(vkt.Parametrization): upload_file = vkt.FileField("File to upload", file_types=[".xlsx"]) upload = vkt.ActionButton("Upload to SharePoint", method="upload_to_sharepoint") class Controller(vkt.Controller): parametrization = Parametrization def upload_to_sharepoint(self, params, **kwargs): if not params.upload_file: raise vkt.UserError("Select a file first.") integration = vkt.external.OAuth2Integration("microsoft-entra") token = integration.get_access_token() content = params.upload_file.file.getvalue_binary() target = f"Projects/{params.upload_file.filename}" response = requests.put( f"{BASE}/drives/{DRIVE_ID}/root:/{target}:/content", headers={ "Authorization": f"Bearer {token}", "Content-Type": "application/octet-stream", }, data=content, timeout=60, ) response.raise_for_status() vkt.UserMessage.success(f"Uploaded {params.upload_file.filename} to SharePoint.") ``` Note A simple `PUT` upload is limited to 4 MB. For larger files, create an upload session with `POST /drives/{drive-id}/root:/{path}:/createUploadSession` and send the file in chunks. See [upload large files](https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession) in the Microsoft Graph documentation. Other common operations on drive items follow the same pattern: `PATCH /drives/{drive-id}/items/{item-id}` renames or moves an item, `DELETE /drives/{drive-id}/items/{item-id}` removes it, and `POST /drives/{drive-id}/items/{parent-item-id}/children` creates a folder. See the [Microsoft Graph SharePoint documentation](https://learn.microsoft.com/en-us/graph/api/resources/sharepoint) for the full list of endpoints. ## Sending email from an app[​](https://docs.viktor.ai/docs/create-apps/software-integrations/microsoft/.md#sending-email-from-an-app "Direct link to Sending email from an app") Email is sent through the Microsoft Graph `sendMail` endpoint. Because the integration uses delegated permissions, the message is sent from the mailbox of the user who is logged in to the app, and it appears in their Sent Items. Add the `Mail.Send` scope to both the app registration and the VIKTOR integration to use this. ``` import viktor as vkt import requests class Parametrization(vkt.Parametrization): recipient = vkt.TextField("Send results to") send = vkt.ActionButton("Send email", method="send_email") class Controller(vkt.Controller): parametrization = Parametrization def send_email(self, params, **kwargs): integration = vkt.external.OAuth2Integration("microsoft-entra") token = integration.get_access_token() message = { "message": { "subject": "Calculation results", "body": { "contentType": "HTML", "content": "

The calculation finished. The results are attached.

", }, "toRecipients": [{"emailAddress": {"address": params.recipient}}], }, "saveToSentItems": True, } response = requests.post( "https://graph.microsoft.com/v1.0/me/sendMail", headers={ "Authorization": f"Bearer {token}", "Content-Type": "application/json", }, json=message, timeout=30, ) response.raise_for_status() vkt.UserMessage.success(f"Email sent to {params.recipient}.") ``` A successful call returns status `202 Accepted` with an empty body, which means Microsoft accepted the message for delivery. ### Adding an attachment[​](https://docs.viktor.ai/docs/create-apps/software-integrations/microsoft/.md#adding-an-attachment "Direct link to Adding an attachment") Attachments are sent inline as base64-encoded content in the same request. The example below attaches a PDF report generated by the app: ``` import base64 report = ... # a vkt.File, for example the result of a report generation encoded = base64.b64encode(report.getvalue_binary()).decode() message = { "message": { "subject": "Calculation results", "body": {"contentType": "Text", "content": "The report is attached."}, "toRecipients": [{"emailAddress": {"address": params.recipient}}], "attachments": [ { "@odata.type": "#microsoft.graph.fileAttachment", "name": "report.pdf", "contentType": "application/pdf", "contentBytes": encoded, } ], }, "saveToSentItems": True, } ``` Note The total size of a message including its attachments is limited to 4 MB on the `sendMail` endpoint. For larger attachments, create a draft message with `POST /me/messages`, add the attachment with an upload session, and send the draft with `POST /me/messages/{id}/send`. ## FAQs[​](https://docs.viktor.ai/docs/create-apps/software-integrations/microsoft/.md#faqs "Direct link to FAQs") **How do I read or modify SharePoint files?** Address the file through the Microsoft Graph drive endpoints: look up the document library of the site, then read the file with `GET /drives/{drive-id}/root:/{path}:/content` or write it with a `PUT` to the same path. Reading needs the `Files.Read.All` and `Sites.Read.All` scopes, writing needs `Files.ReadWrite.All` and `Sites.ReadWrite.All`. See [Reading and modifying SharePoint files](https://docs.viktor.ai/docs/create-apps/software-integrations/microsoft/.md#reading-and-modifying-sharepoint-files) for full examples. **How do I send emails from an app?** Add the `Mail.Send` scope to the app registration and the VIKTOR integration, then post the message to `https://graph.microsoft.com/v1.0/me/sendMail` with the access token of the integration. The email is sent from the mailbox of the user who is logged in to the app. See [Sending email from an app](https://docs.viktor.ai/docs/create-apps/software-integrations/microsoft/.md#sending-email-from-an-app) for a working example, including attachments. **Can the app act on its own, without a user logging in?** No. This integration uses the OAuth 2.0 authorization code flow with delegated permissions, so every call is made on behalf of the logged-in user and is limited to what that user may see and do. A background job or a shared service account is not supported by this integration. **I get a 403 Forbidden from Microsoft Graph** The token was accepted but the requested scope is missing or was never consented to. Check that the permission is listed in **API permissions** of the app registration, that its **Status** shows granted consent, and that the same scope is present in the scopes field of the VIKTOR integration. After changing the scopes, the user has to log in again so a new token is issued. **I get a 404 Not Found for a site or file that exists** Microsoft Graph returns 404 for items the logged-in user cannot access, so this is often a permission issue on the SharePoint site rather than a wrong path. Confirm that the account used to log in to the app has access to the site, and check the path: paths in `root:/{path}:` are relative to the root of the document library, not to the site URL. --- # PLAXIS PLAXIS has a [Python API](https://communities.bentley.com/products/geotech-analysis/w/plaxis-soilvision-wiki/45393/api-python-scripting---plaxis) that is distributed in a Python installer. The API can be used to build-up PLAXIS models and process results, integrating the PLAXIS workflow within your VIKTOR app. For more information on the PLAXIS API, see the [website](https://communities.bentley.com/products/geotech-analysis/w/plaxis-soilvision-wiki/45454/identify-python-commands-from-plaxis-command-line). note A 'Bentley Geotechnical SELECT Entitlement' (previously 'PLAXIS-vip') license is required To integrate PLAXIS in your application, the following is needed: * A Plaxis worker * A machine on which PLAXIS is installed (with the correct licensing) ## Add integration to app config[​](https://docs.viktor.ai/docs/create-apps/software-integrations/plaxis/.md#add-integration-to-app-config "Direct link to Add integration to app config") To make the worker integration available through the interface, add the following to your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#worker_integrations): ``` worker_integrations = [ "plaxis", ] ``` Instructions on how to install the worker: Install the worker Follow these steps to install the worker: * Personal worker * Organization worker A personal worker connects the software that is installed on your own machine, for your own use. Personal workers are installed and managed with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md): 1. [Download and install VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#download-and-install-viktor-desktop) and log in with your VIKTOR account, if you haven't done so already 2. In VIKTOR Desktop, click "Add" and select **Plaxis** ![](/assets/images/viktor-desktop-add-worker-list-01993b58665874f7b82e3e76d84dd9b9.webp) 3. Select the Python environment of your choice by setting the path to its `python.exe` as the executable path. This can be your system Python, or the python.exe in a dedicated virtual environment tip Your default Python environment can usually be found in `C:\Users\Username\AppData\Local\Programs\Python\Python31X\python.exe` If you cannot find it, try running the following command in your terminal ``` where python ``` 4. Start the worker. You can view its [logs](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#view-logs) inside VIKTOR Desktop, and the editor shows when your worker is online note Personal workers that were installed with the previous per-worker installer keep running, but new personal workers can only be added through [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#migrate-existing-workers-to-viktor-desktop): the per-worker installer download and connection-key flow are no longer available for personal use. An organization worker connects software that runs on a machine managed by your organization, such as a virtual or remote machine, and is shared by the users of the app instance(s) you select. caution You need to be an environment administrator in order to install an organization worker. 1. Navigate to the "Integrations" tab in the Administrator panel 2. Click "Add integration" 3. Follow the steps provided in the modal ![](/assets/images/create-integration-admin-598d0869714267fcb7a220c370dde5df.png) 3.1. Select **Plaxis** 3.2. Select the app instance(s) the integration should be available to 3.3. Download the worker .msi (Microsoft Installer) and run it on the machine of choice 3.4. Copy the generated **connection key** and paste it when the installer asks for it. In the browser, you can now click Finish and continue in the installer. Connection Key The generated connection key **should be copied immediately** as VIKTOR will not preserve this data for security reasons. 4. In the installer wizard, select the Python executable of your choice, this can be your system Python, or the python.exe in a dedicated virtual environment tip Your default Python environment can usually be found in `C:\Users\\AppData\Local\Programs\Python\Python31X\python.exe`. If you cannot find it, try running `where python` in your terminal. 5. Make sure to launch the integration once the installation is finished. If you closed the integration, you can restart it through the desktop shortcut. ## App code[​](https://docs.viktor.ai/docs/create-apps/software-integrations/plaxis/.md#app-code "Direct link to App code") From within the VIKTOR app, the Python script is sent, via the plaxis worker, to the server. After the analysis, the worker sends back the specified files to the app, after which the developer can process the results (visualize, download, etc.). In the following code snippet two files are sent to the worker: `run_plaxis.py` and `input.json`. For additional ideas on how to pass parameters to PLAXIS have a look at the [PLAXIS sample application](https://github.com/viktor-platform/sample-plaxis/). ``` import viktor as vkt script = vkt.File.from_path(Path(__file__).parent / "run_plaxis.py") files = [('input.json', vkt.File.from_data(b'{parameter_a: 1, parameter_b: 2}')] analysis = vkt.plaxis.PlaxisAnalysis( script=script, files=files, output_filenames=["output.txt"] ) analysis.execute(timeout=300) output_file = analysis.get_output_file("output.txt") ``` The file `run_plaxis.py` and the other file represented as bytes is then sent to the Python distribution PLAXIS is set to work with. You can specify [which Python distribution PLAXIS should use](https://communities.bentley.com/products/geotech-analysis/w/plaxis-soilvision-wiki/51822/how-to-install-additional-python-modules-in-plaxis), in the "Using a custom Python distribution" section. **run\_plaxis.py** The Python script that is sent to the worker should consist of the following parts: * Starting of the [PLAXIS remote scripting service](https://communities.bentley.com/products/geotech-analysis/w/plaxis-soilvision-wiki/46005/using-plaxis-remote-scripting-with-the-python-wrapper) * Code to build-up the PLAXIS model and read-out the desired results * Creation of output files in the working directory of the worker, to be returned to the app * Close the PLAXIS application Starting of the PLAXIS remote scripting service can be done as follows: ``` import subprocess, time PLAXIS_PATH = r'C:\Program Files\Bentley\Geotechnical\PLAXIS 2D CONNECT Edition V20\\Plaxis2DXInput.exe' # Specify PLAXIS path on server. PORT_I = 10000 # Define an input port number. PORT_O = 10001 # Define an output port number. PASSWORD = 'secret' # Define a password. subprocess.Popen([PLAXIS_PATH, f'--AppServerPassword={PASSWORD}', f'--AppServerPort={PORT}']) # Start the PLAXIS remote scripting service. time.sleep(30) # Wait for PLAXIS to boot before sending commands to the scripting service. # Start the scripting server. global g_i, s_i s_i, g_i = new_server('localhost', PORT_I, password=PASSWORD) s_o, g_o = new_server('localhost', PORT_O, password=PASSWORD) # Execute code. ... # Extract required data and write files to working directory. ... # Close the application g_o.close() # Close the output window g_i.kill() # Close the input window ``` caution The resulting files can be very large. Consider sending back files to the app with only the relevant information, by filtering out unnecessary results, to reduce in size. An example can be found in the [sample application](https://github.com/viktor-platform/sample-plaxis/) ## Testing[​](https://docs.viktor.ai/docs/create-apps/software-integrations/plaxis/.md#testing "Direct link to Testing") `PlaxisAnalysis.execute` needs to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. The `viktor.testing` module provides the [`mock_PlaxisAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_PlaxisAnalysis) decorator that facilitate mocking of workers: ``` import unittest import viktor as vkt from viktor.testing import mock_PlaxisAnalysis from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_PlaxisAnalysis(get_output_file={ 'result.xml': vkt.File.from_path('test_file.xml'), # : 'result.json': vkt.File.from_path('test_file.json'), ... }) def test_analysis(self): MyEntityTypeController().analysis() ``` For the decorator's input parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). --- # Autodesk Revit Use the VIKTOR Revit worker to run Python scripts on a Windows machine with Revit installed. You can read and change the model that is open in Revit, or start a new Revit session for a batch job. tip For your first software integration, start with one of the [intermediate tutorials](https://docs.viktor.ai/docs/tutorials/.md#intermediate-level). ## System requirements[​](https://docs.viktor.ai/docs/create-apps/software-integrations/revit/.md#system-requirements "Direct link to System requirements") * A Windows machine with Revit installed. Use Revit 2024 or newer for these examples. * Python for the VIKTOR worker. The worker scripts below use only the Python standard library. * [pyRevit](https://github.com/pyrevitlabs/pyRevit/releases). The Agent Runtime requires version 7.0 or newer. The worker Python environment is separate from the pyRevit engine that runs the scripts inside Revit. ## Two ways to run Revit from VIKTOR[​](https://docs.viktor.ai/docs/create-apps/software-integrations/revit/.md#two-ways-to-run-revit-from-viktor "Direct link to Two ways to run Revit from VIKTOR") The worker calls pyRevit to execute your Revit API code: * **Open model:** the Agent Runtime uses the model that is currently open in Revit. Use `query` to read data, `modify` to write values back, and `dry_run` to preview changes and roll them back. Each approved run is one undo entry in Revit. * **Batch scripts:** `pyrevit run` starts a new Revit session for a model file. Use this approach for batch jobs and file exports, such as the PDF example below. Experimental feature The Agent Runtime was introduced in pyRevit 7.0 and is marked as **experimental** in the [pyRevit documentation](https://docs.pyrevitlabs.io/agent-runtime/). Test your scripts locally before deploying them. ### Download and install pyRevit[​](https://docs.viktor.ai/docs/create-apps/software-integrations/revit/.md#download-and-install-pyrevit "Direct link to Download and install pyRevit") Download the [pyRevit installer](https://github.com/pyrevitlabs/pyRevit/releases). Pick `pyRevit__signed.exe` (installs for the current user) or `pyRevit__admin_signed.exe` (installs for all users). Follow the installer steps, then check the installation in a new terminal: ``` pyrevit --version pyrevit attached ``` Check that pyRevit is attached to the Revit version you will use. If `pyrevit` is not found, add the folder that contains `pyrevit.exe` to your Windows `PATH`. If `pyrevit agent` only prints the general help text, check that the command uses pyRevit 7.0 or newer. ### Set up the pyRevit Agent Runtime[​](https://docs.viktor.ai/docs/create-apps/software-integrations/revit/.md#set-up-the-pyrevit-agent-runtime "Direct link to Set up the pyRevit Agent Runtime") Complete this section for the **Open model: read and write** example. Batch scripts do not need the Agent Runtime. The Agent Runtime is **off by default**. To enable it: 1. Start Revit and open a model. 2. Go to **pyRevit → Settings** and expand **Agent Runtime (MCP)**. 3. Tick **Agent Host (Beta)**. This starts the in-Revit host that the `pyrevit agent` command connects to. 4. Choose how **Model Changes** are handled: * **Ask for my approval in Revit before every change** (default): every `modify` run shows a Keep/Discard prompt in Revit, with the changed elements selected. Recommended while developing. * **Auto**: changes are applied without a prompt. Each run is still a single undo entry named `Agent: `. * **Read-only**: only `query` and `dry_run` runs are allowed. 5. Keep **IronPython** as the **Default Script Engine**, unless your Revit scripts need CPython packages such as `numpy`. 6. Click **Save Settings and Reload**. The **Connect an Agent** buttons register pyRevit with AI coding tools. You do not need to use these buttons or enable the **Routes** server for this VIKTOR integration. ![pyRevit settings: Agent Runtime (MCP)](/assets/images/revit-pyrevit-agent-runtime-settings-85feb147ae40ac9a6ed0fc1de4505694.webp) Check that the open Revit session is listening: ``` pyrevit agent status ``` Things to know about the Agent Runtime * The `pyrevit agent` command talks to Revit over a local named pipe that **only the same Windows user** can open. Run the VIKTOR worker as the same user that runs Revit, e.g. a personal worker in [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md). * Revit must be running with a model open. `modify` runs are refused when no document is active. * With the **Ask** policy, a `modify` run waits until the user answers the prompt in Revit. Set the timeouts in the worker script and `analysis.execute()` long enough for the user to respond. * The `query` mode rejects and rolls back model changes, but the script itself has full access to the worker machine. pyRevit also stores the script and result of each run as plain text under `%APPDATA%\pyRevit\agent` for 14 days. ### Additional information[​](https://docs.viktor.ai/docs/create-apps/software-integrations/revit/.md#additional-information "Direct link to Additional information") * [Revit API](https://www.revitapidocs.com/) * [pyRevit documentation](https://docs.pyrevitlabs.io/) * [pyRevit Agent Runtime](https://docs.pyrevitlabs.io/agent-runtime/) ## Set up the work environment[​](https://docs.viktor.ai/docs/create-apps/software-integrations/revit/.md#set-up-the-work-environment "Direct link to Set up the work environment") ### Step 1: Add integration to app config[​](https://docs.viktor.ai/docs/create-apps/software-integrations/revit/.md#step-1-add-integration-to-app-config "Direct link to Step 1: Add integration to app config") To make the worker integration available through the interface, add the following to your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#worker_integrations): ``` worker_integrations = [ "revit", ] ``` Instructions on how to install the worker: Install the worker Follow these steps to install the worker: * Personal worker * Organization worker A personal worker connects the software that is installed on your own machine, for your own use. Personal workers are installed and managed with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md): 1. [Download and install VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#download-and-install-viktor-desktop) and log in with your VIKTOR account, if you haven't done so already 2. In VIKTOR Desktop, click "Add" and select **Revit** ![](/assets/images/viktor-desktop-add-worker-list-01993b58665874f7b82e3e76d84dd9b9.webp) 3. Select the Python environment of your choice by setting the path to its `python.exe` as the executable path. This can be your system Python, or the python.exe in a dedicated virtual environment tip Your default Python environment can usually be found in `C:\Users\Username\AppData\Local\Programs\Python\Python31X\python.exe` If you cannot find it, try running the following command in your terminal ``` where python ``` 4. Start the worker. You can view its [logs](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#view-logs) inside VIKTOR Desktop, and the editor shows when your worker is online note Personal workers that were installed with the previous per-worker installer keep running, but new personal workers can only be added through [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#migrate-existing-workers-to-viktor-desktop): the per-worker installer download and connection-key flow are no longer available for personal use. An organization worker connects software that runs on a machine managed by your organization, such as a virtual or remote machine, and is shared by the users of the app instance(s) you select. caution You need to be an environment administrator in order to install an organization worker. 1. Navigate to the "Integrations" tab in the Administrator panel 2. Click "Add integration" 3. Follow the steps provided in the modal ![](/assets/images/create-integration-admin-598d0869714267fcb7a220c370dde5df.png) 3.1. Select **Revit** 3.2. Select the app instance(s) the integration should be available to 3.3. Download the worker .msi (Microsoft Installer) and run it on the machine of choice 3.4. Copy the generated **connection key** and paste it when the installer asks for it. In the browser, you can now click Finish and continue in the installer. Connection Key The generated connection key **should be copied immediately** as VIKTOR will not preserve this data for security reasons. 4. In the installer wizard, select the Python executable of your choice, this can be your system Python, or the python.exe in a dedicated virtual environment tip Your default Python environment can usually be found in `C:\Users\<Username>\AppData\Local\Programs\Python\Python31X\python.exe`. If you cannot find it, try running `where python` in your terminal. 5. Make sure to launch the integration once the installation is finished. If you closed the integration, you can restart it through the desktop shortcut. ### Step 2: Start a VIKTOR app[​](https://docs.viktor.ai/docs/create-apps/software-integrations/revit/.md#step-2-start-a-viktor-app "Direct link to Step 2: Start a VIKTOR app") Create, install, and start an empty app. Follow the [starter guide](https://docs.viktor.ai/docs/getting-started/starter-guide/.md) if you need help. ### Step 3: Add the scripts to your VIKTOR app[​](https://docs.viktor.ai/docs/create-apps/software-integrations/revit/.md#step-3-add-the-scripts-to-your-viktor-app "Direct link to Step 3: Add the scripts to your VIKTOR app") The integration uses three types of file: * a **Revit script** that contains the Revit API code and runs inside Revit, * a **worker script** that calls the pyRevit CLI and collects the output, * the **VIKTOR app** (`app.py`), which sends both scripts to the worker with `vkt.revit.RevitAnalysis` and reads the result. Select an approach below. The title of each code block shows the file to create. * Open model: read and write * Batch scripts #### Read the open model[​](https://docs.viktor.ai/docs/create-apps/software-integrations/revit/.md#read-the-open-model "Direct link to Read the open model") Read data from the model that is currently open in Revit. Query runs reject and roll back model changes. **Revit script.** pyRevit provides `doc`, `uidoc`, `DB` (`Autodesk.Revit.DB`), `UI`, and `inputs`. Assign the data you want to return to `result`; it is converted to JSON (an `ElementId` becomes an integer). revit\_scripts/walls\_by\_level.py ``` walls = DB.FilteredElementCollector(doc).OfClass(DB.Wall).WhereElementIsNotElementType() rows = [] for wall in walls: level = doc.GetElement(wall.LevelId) length = wall.get_Parameter(DB.BuiltInParameter.CURVE_ELEM_LENGTH) rows.append({ "id": wall.Id, "type": wall.Name, "level": level.Name if level else "", "length_m": DB.UnitUtils.ConvertFromInternalUnits(length.AsDouble(), DB.UnitTypeId.Meters) if length else 0.0, }) result = {"model": doc.Title, "walls": rows} ``` **Worker script.** Reads `job.json`, runs the Revit script with `pyrevit agent run` and saves the JSON response that the CLI prints. The response contains `status` (`"ok"` on success), `result`, `output` (printed text) and `error`. revit\_scripts/run\_agent.py ``` import json import os import shutil import subprocess from pathlib import Path root = Path(__file__).resolve().parent job = json.loads((root / "job.json").read_text(encoding="utf-8")) mode = job.get("mode", "query") if mode not in ("query", "dry_run", "modify"): raise ValueError("Invalid mode: " + mode) pyrevit = shutil.which("pyrevit") or os.path.expandvars(r"%APPDATA%\pyRevit-Master\bin\pyrevit.exe") command = [ pyrevit, "agent", "run", str(root / "revit_task.py"), "--mode=" + mode, "--title=" + job.get("title", "VIKTOR"), "--inputs=" + json.dumps(job.get("inputs", {})), "--timeout=" + str(job.get("timeout", 240)), ] if job.get("revit"): command.append("--revit=" + str(job["revit"])) # Revit year, when several versions are running process = subprocess.run(command, capture_output=True, text=True, timeout=job.get("timeout", 240) + 30) try: response = json.loads(process.stdout[process.stdout.find("{"):]) except ValueError: response = {"status": "error", "error": (process.stderr or process.stdout).strip()} (root / "output.json").write_text(json.dumps(response, indent=2), encoding="utf-8") ``` **VIKTOR app.** app.py ``` import json from io import BytesIO from pathlib import Path import viktor as vkt SCRIPTS = Path(__file__).parent / "revit_scripts" def run_agent(task_script, mode="query", inputs=None, title="VIKTOR", timeout=240): job = {"mode": mode, "title": title, "inputs": inputs or {}, "timeout": timeout} analysis = vkt.revit.RevitAnalysis( script=vkt.File.from_path(SCRIPTS / "run_agent.py"), files=[ ("revit_task.py", vkt.File.from_path(SCRIPTS / task_script)), ("job.json", BytesIO(json.dumps(job).encode())), ], output_filenames=["output.json"], ) analysis.execute(timeout=timeout + 60) response = json.loads(analysis.get_output_file("output.json").getvalue()) if response.get("status") != "ok": error = response.get("error") message = error.get("message") if isinstance(error, dict) else error raise vkt.UserError(f"Revit run failed: {message}") return response class Parametrization(vkt.Parametrization): intro = vkt.Text("Shows the walls of the model that is currently open in Revit.") class Controller(vkt.Controller): parametrization = Parametrization @vkt.TableView("Walls in the open Revit model", duration_guess=10) def walls(self, params, **kwargs): result = run_agent("walls_by_level.py", mode="query")["result"] rows = [[w["id"], w["type"], w["level"], round(w["length_m"], 2)] for w in result["walls"]] return vkt.TableResult(rows, column_headers=["Id", "Type", "Level", "Length [m]"]) ``` #### Write to the open model[​](https://docs.viktor.ai/docs/create-apps/software-integrations/revit/.md#write-to-the-open-model "Direct link to Write to the open model") Write values back to the model that is currently open in Revit. The worker script `run_agent.py` and the `run_agent()` helper are the same as in the read example above. **Revit script.** In `modify` mode the script opens its own transaction. Values from VIKTOR arrive in `inputs`. revit\_scripts/set\_wall\_comments.py ``` level_name = inputs["level"] comment = inputs["comment"] walls = DB.FilteredElementCollector(doc).OfClass(DB.Wall).WhereElementIsNotElementType() t = DB.Transaction(doc, "Set wall comments") t.Start() updated = [] for wall in walls: level = doc.GetElement(wall.LevelId) if level is None or level.Name != level_name: continue parameter = wall.get_Parameter(DB.BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS) if parameter and not parameter.IsReadOnly: parameter.Set(comment) updated.append(wall.Id) t.Commit() result = {"updated": len(updated), "ids": updated} ``` **VIKTOR app.** Keep the imports, `SCRIPTS`, and `run_agent()` helper from the read example above. Replace `Parametrization` and `Controller` with the classes below. Use an `ActionButton`, so the model is only changed when the user clicks the button. Select "Preview only" to use `--mode=dry_run`, which reports the changes and rolls them back. app.py ``` class Parametrization(vkt.Parametrization): intro = vkt.Text( "Writes a comment to all walls on a level of the model that is open in Revit. " "Depending on the pyRevit policy, you may need to approve the change in Revit." ) level = vkt.TextField("Level name", default="Level 1") comment = vkt.TextField("Comment", default="Checked in VIKTOR") preview = vkt.BooleanField("Preview only (dry run)", default=True) apply = vkt.ActionButton("Write to Revit", method="write_comments", longpoll=True) class Controller(vkt.Controller): parametrization = Parametrization def write_comments(self, params, **kwargs): response = run_agent( "set_wall_comments.py", mode="dry_run" if params.preview else "modify", inputs={"level": params.level, "comment": params.comment}, title="VIKTOR wall comments", timeout=600, # leave time to approve the change in Revit ) vkt.UserMessage.info( f"Walls processed: {response['result']['updated']} (decision: {response.get('decision')})" ) ``` Run a script in a new Revit session, typically on a closed model file. `pyrevit run` starts Revit, runs the script and closes Revit again; it does not use the session a user has open. This approach does not need the Agent Runtime. The model path must point to a file on the worker machine that the worker user can access. Keep that model closed in other Revit sessions. **Revit script.** `__revit__` is the Revit `UIApplication`. The script reads the model path from `job.json`, opens the document itself and writes its output next to the script. Pass the model path in job.json Do not pass the model file to `pyrevit run` on the command line. pyRevit then checks the Revit version of the file first. This can fail for newer file versions with the error "Can not detect the Revit version of model". Pass the model path in `job.json` and open it in the Revit script instead. Export time Exporting a 21 MB sample model took about 5 minutes during testing. Allow several minutes for a batch export, set the timeouts accordingly, and test with a small model first. revit\_scripts/export\_pdf.py ``` import json import os from Autodesk.Revit import DB from System.Collections.Generic import List job_dir = os.path.dirname(__file__) job = json.load(open(os.path.join(job_dir, "job.json"))) doc = __revit__.Application.OpenDocumentFile(job["model_path"]) try: sheets = [s.Id for s in DB.FilteredElementCollector(doc).OfClass(DB.ViewSheet) if not s.IsPlaceholder] options = DB.PDFExportOptions() options.FileName = "output" options.Combine = True doc.Export(job_dir, List[DB.ElementId](sheets), options) finally: doc.Close(False) ``` **Worker script.** Runs the Revit script with `pyrevit run`. The script reads the model path from `job.json`. `--purge` removes the temporary run environment afterwards. revit\_scripts/run\_pyrevit.py ``` import json import os import shutil import subprocess from pathlib import Path root = Path(__file__).resolve().parent job = json.loads((root / "job.json").read_text(encoding="utf-8")) pyrevit = shutil.which("pyrevit") or os.path.expandvars(r"%APPDATA%\pyRevit-Master\bin\pyrevit.exe") subprocess.run( [pyrevit, "run", str(root / "revit_task.py"), "--revit=" + str(job["revit"]), "--purge"], timeout=1200, ) if not (root / "output.pdf").exists(): raise RuntimeError("Revit did not create output.pdf") ``` **VIKTOR app.** app.py ``` import json from io import BytesIO from pathlib import Path import viktor as vkt SCRIPTS = Path(__file__).parent / "revit_scripts" class Parametrization(vkt.Parametrization): model_path = vkt.TextField("Model path on the worker", default=r"C:\Models\project.rvt") revit = vkt.IntegerField("Revit version", default=2024) download = vkt.DownloadButton("Export sheets to PDF", method="export_pdf", longpoll=True) class Controller(vkt.Controller): parametrization = Parametrization def export_pdf(self, params, **kwargs): job = {"model_path": params.model_path, "revit": params.revit} analysis = vkt.revit.RevitAnalysis( script=vkt.File.from_path(SCRIPTS / "run_pyrevit.py"), files=[ ("revit_task.py", vkt.File.from_path(SCRIPTS / "export_pdf.py")), ("job.json", BytesIO(json.dumps(job).encode())), ], output_filenames=["output.pdf"], ) analysis.execute(timeout=1500) return vkt.DownloadResult(analysis.get_output_file("output.pdf"), "sheets.pdf") ``` ## Test the scripts locally[​](https://docs.viktor.ai/docs/create-apps/software-integrations/revit/.md#test-the-scripts-locally "Direct link to Test the scripts locally") Test your scripts on your computer before you set up a worker on another machine. Run a Revit script from a Windows Command Prompt with the same command the worker uses: ``` pyrevit agent run revit_scripts\walls_by_level.py --mode=query pyrevit agent run revit_scripts\set_wall_comments.py --mode=dry_run --inputs="{\"level\": \"Level 1\", \"comment\": \"Test\"}" pyrevit agent runs ``` `pyrevit agent runs` lists the recent runs, and `pyrevit agent show <run_id>` prints the script, request and response of a run. The Revit API documentation uses C#, but the API names are the same in pyRevit. Refer to the [Revit API documentation](https://www.revitapidocs.com/) for classes and methods. Revit stores lengths in feet; convert them with `DB.UnitUtils`, as shown in the query example. ## Example app[​](https://docs.viktor.ai/docs/create-apps/software-integrations/revit/.md#example-app "Direct link to Example app") Try the [pyRevit integration app](https://github.com/viktor-platform/pyrevit-viktor-integration). It reads element counts and applies colours by category to a view in the open Revit model. Its `docs/images` folder also shows how to configure pyRevit and the Revit worker in VIKTOR Desktop. ## Testing[​](https://docs.viktor.ai/docs/create-apps/software-integrations/revit/.md#testing "Direct link to Testing") `RevitAnalysis.execute` needs to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. The `viktor.testing` module provides the [`mock_RevitAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_RevitAnalysis) decorator to mock workers: ``` import unittest import viktor as vkt from viktor.testing import mock_RevitAnalysis from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_RevitAnalysis(get_output_file={ 'result.xml': vkt.File.from_path('test_file.xml'), # <name>: <File> 'result.json': vkt.File.from_path('test_file.json'), }) def test_analysis(self): MyEntityTypeController().analysis() ``` The decorator accepts these input values: * A sequence: each method call returns the next item. A call after the last item raises an exception. * A single object: each method call returns the same object. * `None` (default): each method call returns a default `File` or `BytesIO` object with empty content. --- # RFEM 5 Analyzing an RFEM 5 model in VIKTOR can be done using the [`RFEMAnalysis`](https://docs.viktor.ai/sdk/api/external/rfem/.md#_RFEMAnalysis) class (worker required). ## Add integration to app config[​](https://docs.viktor.ai/docs/create-apps/software-integrations/rfem/.md#add-integration-to-app-config "Direct link to Add integration to app config") To make the worker integration available through the interface, add the following to your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#worker_integrations): ``` worker_integrations = [ "rfem", ] ``` For personal use, install and enable the worker with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md). Instructions on how to install an organization worker can be found [here](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#installation). ## App code[​](https://docs.viktor.ai/docs/create-apps/software-integrations/rfem/.md#app-code "Direct link to App code") The RFEM model is defined by: * input .rfx file which has to be created manually * list of actions which are to be performed sequentially ### Creating the actions[​](https://docs.viktor.ai/docs/create-apps/software-integrations/rfem/.md#creating-the-actions "Direct link to Creating the actions") The following actions can be defined: * [`EnergyOptimizationAction`](https://docs.viktor.ai/sdk/api/external/rfem/.md#_EnergyOptimizationAction) * [`CopyNodalLoadAction`](https://docs.viktor.ai/sdk/api/external/rfem/.md#_CopyNodalLoadAction) * [`WriteResultsAction`](https://docs.viktor.ai/sdk/api/external/rfem/.md#_WriteResultsAction) Please click on the actions above to navigate to their reference for more detail on the meaning of each action. ``` import viktor as vkt # SLS sls_cases = [1, 2, 3] sls_optimization = vkt.rfem.EnergyOptimizationAction(sls_cases, goal=10000, accuracy=0.1) # goal = 10 kNm, accuracy = 10 cm # ALS als_cases = [4, 5, 6] als_optimization = vkt.rfem.EnergyOptimizationAction(als_cases, goal=15000, accuracy=0.1) # goal = 15 kNm, accuracy = 10 cm # ULS uls_cases = [7, 8, 9] uls_creation = vkt.rfem.CopyNodalLoadAction(list(zip(sls_cases, uls_cases)), factor=1.5) # ULS = SLS x 1.5 # Write action write_result_action = vkt.rfem.WriteResultsAction(sls_cases + als_cases + uls_cases) # or can be left empty = all cases actions = [sls_optimization, als_optimization, uls_creation, write_result_action] ``` ### Running an RFEM analysis[​](https://docs.viktor.ai/docs/create-apps/software-integrations/rfem/.md#running-an-rfem-analysis "Direct link to Running an RFEM analysis") The model can be fed to the [`RFEMAnalysis`](https://docs.viktor.ai/sdk/api/external/rfem/.md#_RFEMAnalysis) as follows: ``` # Generate the input RFX file. input_file = ... # Run the analysis and obtain the results. analysis = vkt.rfem.RFEMAnalysis(input_file, actions=actions) analysis.execute(timeout=300) model = analysis.get_model() result_lc1 = analysis.get_result(load_case=1) result_lc2 = analysis.get_result(load_case=2) ``` ## Testing[​](https://docs.viktor.ai/docs/create-apps/software-integrations/rfem/.md#testing "Direct link to Testing") New in v13.5.0 `mock_RFEMAnalysis` decorator for easier testing of `RFEMAnalysis` `RFEMAnalysis.execute` needs to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. The `viktor.testing` module provides the [`mock_RFEMAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_RFEMAnalysis) decorator that facilitate mocking of workers: ``` import unittest from viktor import File from viktor.testing import mock_RFEMAnalysis from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_RFEMAnalysis( get_model=File.from_path('test_file.rfx'), get_result={ 1: File.from_path('test_file.json'), # <load_case>: <File> ... }, ) def test_rfem_analysis(self): MyEntityTypeController().rfem_analysis() ``` For the decorator's input parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). --- # Rhino / Grasshopper tip This guide provides the basic information about our Rhino/Grasshopper integration. **If you setup this integration for the first time, we recommend to follow the [Rhino/Grasshopper tutorial](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper/.md).** There are 2 ways to integrate VIKTOR with Rhino/Grasshopper: 1. Connect to Rhino/Grasshopper on your local computer via the Hops component and a dedicated worker 2. Connect to a Rhino Compute Server Scalability We recommend to use the worker (1) when you don't have a Rhino Compute server yet and you want to get started quickly, and to setup a Rhino Compute server (2) when you want to go to production with your app. Having the basic RhinoCompute setup running may be fine for developing/testing purposes but might not be the ideal solution for production apps, in terms of license billing. Please check [RhinoCompute: Licensing & Billing](https://developer.rhino3d.com/guides/compute/core-hour-billing/) for further details. ## System requirements:[​](https://docs.viktor.ai/docs/create-apps/software-integrations/rhino-grasshopper/.md#system-requirements "Direct link to System requirements:") * 💻 Windows PC * 🦏 Rhino 7 with Hops plugin installed * 🐍 Python =< 3.13 (Check this with your version of Rhino) ## Method 1: Connect to Rhino/Grasshopper on your local computer[​](https://docs.viktor.ai/docs/create-apps/software-integrations/rhino-grasshopper/.md#method-1-connect-to-rhinograsshopper-on-your-local-computer "Direct link to Method 1: Connect to Rhino/Grasshopper on your local computer") VIKTOR's Rhino / Grasshopper integration can be set up using the dedicated Grasshopper worker. tip If you don't want to have to start Grasshopper; check out how to [run RhinoCompute (locally) without running Rhino or Grasshopper](https://developer.rhino3d.com/guides/compute/development/) ## Add integration to app config[​](https://docs.viktor.ai/docs/create-apps/software-integrations/rhino-grasshopper/.md#add-integration-to-app-config "Direct link to Add integration to app config") To make the worker integration available through the interface, add the following to your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#worker_integrations): ``` worker_integrations = [ "grasshopper", ] ``` For personal use, install and enable the worker with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md). Instructions on how to install an organization worker can be found [here](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#installation). ### VIKTOR app[​](https://docs.viktor.ai/docs/create-apps/software-integrations/rhino-grasshopper/.md#viktor-app "Direct link to VIKTOR app") In the VIKTOR app, the input files for the worker are defined and the `GrasshopperAnalysis` is executed to run the Grasshopper worker on the server. Start by adding your grasshopper script to the app folder (if you would like a script, you can find one in our [tutorial](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper/.md)) and add the code below to your `app.py` file: ``` import viktor as vkt import json import rhino3dm from pathlib import Path class Parametrization(vkt.Parametrization): # Input fields that correspond with the HOPS components ... class Controller(vkt.Controller): parametrization = Parametrization @vkt.GeometryView("Geometry", duration_guess=10, x_axis_to_right=True, update_label='Run Grasshopper') def run_grasshopper(self, params, **kwargs): grasshopper_script_path = Path(__file__).parent / "your_grasshopper_script.gh" script = vkt.File.from_path(grasshopper_script_path) input_parameters = dict(params) # Run the Grasshopper analysis and obtain the output data analysis = vkt.grasshopper.GrasshopperAnalysis(script=script, input_parameters=input_parameters) analysis.execute(timeout=30) output = analysis.get_output() # Convert output data to mesh file3dm = rhino3dm.File3dm() obj = rhino3dm.CommonObject.Decode(json.loads(output["values"][0]["InnerTree"]['{0}'][0]["data"])) file3dm.Objects.AddMesh(obj) # Write to geometry_file geometry_file = vkt.File() file3dm.Write(geometry_file.source, version=7) return vkt.GeometryResult(geometry=geometry_file, geometry_type="3dm") ``` Then you will need to add your input fields that correspond to the Hops components in your grasshopper file (see next section) and make sure to replace `your_grasshopper_script.gh` with the name of your script. For a full example on how the components relate to the inputs, feel free to check out the [grasshopper tutorial](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper/.md). ### Grasshopper script[​](https://docs.viktor.ai/docs/create-apps/software-integrations/rhino-grasshopper/.md#grasshopper-script "Direct link to Grasshopper script") The Grasshopper script should be defined so that the Hops 'Get components' are connected to the inputs and outputs. The 'Get components' can be found under Params Tab > Util Group. Components preceded by 'Get' can be used as an input parameter. The 'Context bake' and 'Context print' components should connected to the desired output components to return geometry or text respectively. See the [Rhino documentation](https://developer.rhino3d.com/guides/compute/hops-component/#create-a-hops-function) for an extensive explanation. ![](/assets/images/tutorial_grasshopper_script-4ccb11f965a8f7f97e55b0026c389671.png) ## Method 2: Connect your app to a Rhino Compute Server[​](https://docs.viktor.ai/docs/create-apps/software-integrations/rhino-grasshopper/.md#method-2-connect-your-app-to-a-rhino-compute-server "Direct link to Method 2: Connect your app to a Rhino Compute Server") Instead of using the worker and the local version of Rhino Compute with Hops, you can also connect the VIKTOR app directly to a Rhino Compute Server: ![](/assets/images/tutorial_grasshopper_setup_rhino_compute-c5fe9bf70ffa40f53eb8455cd5bedf96.png) This has the following advantages: * Faster (the worker creates some overhead running time) * More robust and scalable, you can make sure the compute server is always running The main disadvantage is that it takes time and effort to setup a Rhino Compute Server, which takes time and needs to be done by someone who is familiar with setting up Virtual Machines (i.e. an IT department). We recommend to use the worker when you don't have a Rhino Compute server yet and you want to get started quickly, and to setup a Rhino Compute server when you want to go to production with your app. The following steps are needed to connect your app to a Rhino Computer Server: ### 1. Setup the Rhino Compute Server[​](https://docs.viktor.ai/docs/create-apps/software-integrations/rhino-grasshopper/.md#1-setup-the-rhino-compute-server "Direct link to 1. Setup the Rhino Compute Server") McNeel has documented how to setup a Rhino Compute Server very clear and extensively, see the [Compute Guides](https://developer.rhino3d.com/guides/compute/). Once you have the Rhino Compute Server running, you should have a `URL` and an `API key`. Now you can connect your VIKTOR app to this Rhino Compute server. ### 2. Adjust your app code[​](https://docs.viktor.ai/docs/create-apps/software-integrations/rhino-grasshopper/.md#2-adjust-your-app-code "Direct link to 2. Adjust your app code") Since the compute server is available via the internet, we can now directly communicate with this server in the app code. Change `app.py` to the following code: ``` import viktor as vkt import compute_rhino3d.Grasshopper as gh import compute_rhino3d.Util import json import os import rhino3dm import tempfile from pathlib import Path class Parametrization(vkt.Parametrization): # Input fields that correspond with the HOPS components ... class Controller(vkt.Controller): parametrization = Parametrization @vkt.GeometryView("Geometry", x_axis_to_right=True, update_label='Run Grasshopper') def run_grasshopper(self, params, **kwargs): # Credentials for Rhino Compute api compute_rhino3d.Util.url = os.getenv("RHINO_COMPUTE_URL") compute_rhino3d.Util.apiKey = os.getenv("RHINO_COMPUTE_API_KEY") # Create an input tree with the input parameters input_trees = [] for key, value in params.items(): tree = gh.DataTree(key) tree.Append([{0}], [str(value)]) input_trees.append(tree) # Evaluate the Grasshopper definition output = gh.EvaluateDefinition( str(Path(__file__).parent / 'your_grasshopper-script.gh'), input_trees ) # Create a new rhino3dm file and add resulting geometry to file file = rhino3dm.File3dm() output_geometry = output['values'][0]['InnerTree']['{0}'][0]['data'] obj = rhino3dm.CommonObject.Decode(json.loads(output_geometry)) file.Objects.AddMesh(obj) # Write a temporary file temp_file = tempfile.NamedTemporaryFile(suffix=".3dm", delete=False, mode="wb") temp_file.close() file.Write(temp_file.name, 7) return vkt.GeometryResult(geometry=vkt.File.from_path(Path(temp_file.name)), geometry_type="3dm") ``` Since we need to send the Grasshopper file to the Rhino Compute server (line 37), **place `your_grasshopper_script.gh` in the same folder as `app.py`**. As you can see, we are now using the packages `compute-rhino3d` and `rhino3dm` in the app code, so we should add these to the `requirements.txt`: ``` viktor==X.X.X compute-rhino3d==0.12.2 rhino3dm==8.17.0 ``` Make sure to set the right Python version to match the rhino3dm distribution in `viktor.config.toml`: ``` app_type = 'editor' python_version = "3.14" ``` Because of these changes to the requirements and Python version, reinstall the app in the terminal: ``` > viktor-cli install ``` Now we can start the app! credentials in app code As you can see in line 34 and 35, we have not placed the URL and API Key in the code **because of security reasons** (you do not want to leak these credentials). When you start the app, add the credentials as follows: ``` > viktor-cli start --env RHINO_COMPUTE_URL="YOUR_URL" --env RHINO_COMPUTE_API_KEY="YOUR_API_KEY" ``` Now open the app and you should see a running app with the Rhino Compute server running behind it! 🚀 ### 3. Publish your app with the API credentials[​](https://docs.viktor.ai/docs/create-apps/software-integrations/rhino-grasshopper/.md#3-publish-your-app-with-the-api-credentials "Direct link to 3. Publish your app with the API credentials") If you want to make your app available for other people to use, you can easily do this by [publishing the app](https://docs.viktor.ai/docs/publish-apps/.md). In that case you'll need to add the environment variables for the URL and API key to the app as described in [this guide](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/environment-variables/.md#defining-environment-variables-for-published-apps).<br /><!-- -->Note that these environment variables are only visible to the maintainers of the app, users will never have access to these variables unless specifically been assigned so. ![](/assets/images/tutorial_grasshopper_setup_environment_variables-42b8fe171173ae46f098e15780493ebd.png) --- # Robot Structural Analysis Analyzing an Autodesk Robot model in VIKTOR can be done using the [`RobotAnalysis`](https://docs.viktor.ai/sdk/api/external/robot/.md#_RobotAnalysis) class (worker required). ## Add integration to app config[​](https://docs.viktor.ai/docs/create-apps/software-integrations/robot/.md#add-integration-to-app-config "Direct link to Add integration to app config") To make the worker integration available through the interface, add the following to your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#worker_integrations): ``` worker_integrations = [ "robot", ] ``` For personal use, install and enable the worker with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md). Instructions on how to install an organization worker can be found [here](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#installation). ## App code[​](https://docs.viktor.ai/docs/create-apps/software-integrations/robot/.md#app-code "Direct link to App code") No binding is provided by VIKTOR for this module, which means that the input file has to be generated manually: ``` import viktor as vkt # Generate the input STR file. input_file = ... # Run the analysis and obtain the results. analysis = vkt.robot.RobotAnalysis(input_file) analysis.execute(timeout=10) results = analysis.get_results() # obtain the results in a dict model_file = analysis.get_model_file() # obtain the model file (.rtd) ``` If `return_results` is set to `True`, a result dictionary can be retrieved: * [`get_results`](https://docs.viktor.ai/sdk/api/external/robot/.md#RobotAnalysis.get_results) If `return_model=True`, the model file will also become available: * [`get_model_file`](https://docs.viktor.ai/sdk/api/external/robot/.md#RobotAnalysis.get_model_file) ## Testing[​](https://docs.viktor.ai/docs/create-apps/software-integrations/robot/.md#testing "Direct link to Testing") New in v13.5.0 `mock_RobotAnalysis` decorator for easier testing of `RobotAnalysis` `RobotAnalysis.execute` needs to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. The `viktor.testing` module provides the [`mock_RobotAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_RobotAnalysis) decorator that facilitate mocking of workers: ``` import unittest from viktor import File from viktor.testing import mock_RobotAnalysis from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_RobotAnalysis( get_model_file=File.from_path('test_file.rtd'), get_results={'bar_forces': {...}, ...}, ) def test_robot_analysis(self): MyEntityTypeController().robot_analysis() ``` For the decorator's input parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/dict object (with empty content) is returned each time the corresponding method is called (endlessly). --- # SCIA Engineer tip This guide is an informative piece to help you if you have questions about our SCIA Engineer integration. If you would like a more instructive lesson, take a look at the [SCIA Engineer tutorial](https://docs.viktor.ai/docs/tutorials/integrate-scia/.md) we have available. New in v14.1.0 Create selections using `Model.create_selection()` New in v13.1.0 Several new objects can be constructed: * `SolverSetup` to configure (general) solver settings * `ProjectData` to set basic project information * Library cross-sections using `Model.create_library_cross_section()` * Cross-links using `Model.create_cross_link()` Supported (tested) SCIA versions: * v25 * v24 * v23 * v22 * v21 * v20 * v19 ## Add integration to app config[​](https://docs.viktor.ai/docs/create-apps/software-integrations/scia/.md#add-integration-to-app-config "Direct link to Add integration to app config") To make the worker integration available through the interface, add the following to your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#worker_integrations): ``` worker_integrations = [ "scia", ] ``` For personal use, install and enable the worker with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md). Instructions on how to install an organization worker can be found [here](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#installation). ## App code[​](https://docs.viktor.ai/docs/create-apps/software-integrations/scia/.md#app-code "Direct link to App code") Creating and analyzing a SCIA model in VIKTOR consists of the following steps: 1. Create the empty model. 2. Fill the model with the desired parts (e.g. nodes, beams, load cases, forces, etc.), by calling the corresponding create\_xxx() methods. 3. Generate the XML representation of the SCIA model. 4. Run the SCIA analysis with the generated XML input file and a user-created esa template file. 5. Obtain the results In code this looks like: ``` import viktor as vkt # 1. Create the empty model model = vkt.scia.Model() # 2. Fill the model with the parts (to be extended as desired) cross_section = model.create_rectangular_cross_section( 'rectangular_section', vkt.scia.Material(455, 'test_material'), 100, 100 ) n1 = model.create_node('n1', 0, 0, 0) n2 = model.create_node('n2', 1, 0, 0) model.create_beam(n1, n2, cross_section, name='test_beam') # 3. Generate the XML input file xml_file, def_file = model.generate_xml_input() # 4. Run the SCIA analysis esa_file = vkt.File.from_path('my_template.esa') scia_analysis = vkt.scia.SciaAnalysis(xml_file, def_file, esa_file) scia_analysis.execute(300) # Obtain the results analysis_result = scia_analysis.get_xml_output_file() ``` ## The ESA template file[​](https://docs.viktor.ai/docs/create-apps/software-integrations/scia/.md#the-esa-template-file "Direct link to The ESA template file") The ESA file must be created by the user by using the SCIA interface. It functions as the template to which the model is added. The materials used in the VIKTOR model must exist in the ESA template file: both the name and id of the material must match. The SCIA version in which the template file was created must match the SCIA version called by the worker. note An I/O document has to be defined in the `.esa` file, which has to be named "output". If not defined, the worker will not be able to write this expected document and fails to execute. ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANEAAADiCAYAAADQ1CLsAAAO40lEQVR4nO2d3Y8b1RmH52+KpVz4D9iLolZU0Kq12u5KZEdVW1T1yhcVcquiBEjoeoGuCLSpCSxf2zQkIBeWhKzzgVSxXejSgCIjpA3NCpXdZDeBfADR2wt77JnxfPodj2fGzyP9FNszPnPO+jxzzhl7FENCWF//j6y0zsXOBx+sy927d8OKB8g9RtgOx157Q1Y/uOibf/37oqytfyRr6x/J68tn5eRbnbz06nHZ2tpKow0AYyVUondWzsvt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yRKn0nCK3jsZ+LUTiYqS1CTa2GhIxT4qWeslRzqdrVHpiNOolKRWq0mp0pCNRkVK1pl93BK593HJZZRKUqk1pNUbWb3biUTFSIoSdc7YpUrFJpHP9KxRkVKt1pGuK1+tZltXjVKiKGsiX4ms5w2pVUpiGBVpBLUTiQqRVCXqTHesq3XdKZFt3eAYtQyjN/I0KiXHumO0EkW5Ohc0nbMEtGQMaicSFSEpS9TvoC2rc3ouuK1O2h+ZOp00HYk69bR9T2R4fE/kuFhgH2377+tNP33biURFCL9YyGiQKD9BoowGifITJMpokCg/QaKMBonyEyTKaJAoP+H28Axn3J2DjFgiQkgnSESIMkhEiDJIRIgySESIMkhEiDKBEo27coTkIX4S/R8Ajup0SqIVqwAAAABJRU5ErkJggg==) *Example I/O document of the esa model* ## Supported parts[​](https://docs.viktor.ai/docs/create-apps/software-integrations/scia/.md#supported-parts "Direct link to Supported parts") Currently, the creation of the following SCIA parts is (fully, or partially) supported in VIKTOR: Libraries: * [Circular composed cross-section](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_circular_composed_cross_section) * [Circular cross-section](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_circular_cross_section) * [Circular hollow cross-section](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_circular_hollow_cross_section) * [General cross-section](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_general_cross_section) (>= v14.7.0, polygon + openings only) * [Layer](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_layer) * [Library cross section](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_library_cross_section) (>= v13.1.0) * [Non-linear function](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_nonlinear_function) * [Numerical cross section](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_numerical_cross_section) * [Orthotropy](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_orthotropy) * [Rectangular cross-section](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_rectangular_cross_section) * [Selections](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_selection) (>= v14.1.0) * [Subsoil](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_subsoil) * [Updating of material properties](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.update_concrete_material) Structure: * [Arbitrary profile](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_arbitrary_profile) * [Arbitrary profile span](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_arbitrary_profile_span) * [Beam](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_beam) * [Circular plane](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_circular_plane) * [Cross-link](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_cross_link) (>= v13.1.0) * [Node](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_node) * [Open slab](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_open_slab) * [Plane](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_plane) * [Rigid arm](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_rigid_arm) Results: * [Integration strip](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_integration_strip) * [Averaging strip](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_averaging_strip) (>= v14.3.0; Point type only) * [Section on beam](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_section_on_beam) * [Section on 2D-member](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_section_on_plane) Supports: * [Hinge on beam](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_hinge_on_beam) * [Hinge on plane](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_hinge_on_plane) * [Line support on beam](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_line_support_on_beam) * [Line support on 2D-member edge](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_line_support_on_plane) * [Point support on beam](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_point_support_on_beam) * [Support in node](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_point_support) * [Surface support](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_surface_support) Sets: * [Load case permanent](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_permanent_load_case) * [Load case variable](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_variable_load_case) * [Load combination](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_load_combination) * [Load group](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_load_group) * [Nonlinear load combination](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_nonlinear_load_combination) * [Result class](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_result_class) Loads: * [Free line force](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_free_line_load) * [Free point force](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_free_point_load) * [Free surface load](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_free_surface_load) * [Line force on beam](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_line_load) * [Line force on 2D-member edge](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_line_load_on_plane) * [Line moment on beam](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_line_moment_on_beam) * [Line moment on 2D-member edge](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_line_moment_on_plane) * [Moment in node](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_point_moment_node) * [Point force on beam](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_point_load) * [Point force in node](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_point_load_node) * [Surface load](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_surface_load) * [Thermal load on beam](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_thermal_load) * [Thermal load on 2D-member](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_thermal_surface_load) Misc.: * [Mesh setup](https://docs.viktor.ai/sdk/api/external/scia/.md#_MeshSetup) * [Project data](https://docs.viktor.ai/sdk/api/external/scia/.md#_ProjectData) (>= v13.1.0) * [Solver setup](https://docs.viktor.ai/sdk/api/external/scia/.md#_SolverSetup) (>= v13.1.0) ## Testing[​](https://docs.viktor.ai/docs/create-apps/software-integrations/scia/.md#testing "Direct link to Testing") New in v13.3.0 `mock_SciaAnalysis` decorator for easier testing of `SciaAnalysis` `Model.generate_xml_input` and `SciaAnalysis.execute` need to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. The `viktor.testing` module provides the [`mock_SciaAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_SciaAnalysis) decorator that facilitate mocking of workers: ``` import unittest from viktor import File from viktor.testing import mock_SciaAnalysis from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_SciaAnalysis( get_engineering_report=File.from_path('test_file.pdf'), get_updated_esa_model=File.from_path('test_file.esa'), get_xml_output_file=File.from_path('test_file.xml'), ) def test_scia_analysis(self): MyEntityTypeController().scia_analysis() ``` For the decorator's input parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). --- # STAAD.Pro ## Introduction[​](https://docs.viktor.ai/docs/create-apps/software-integrations/staadpro/.md#introduction "Direct link to Introduction") This guide explains how to connect a VIKTOR app to Bentley STAAD.Pro with the VIKTOR Python worker. The worker runs a Python script on a Windows machine that has STAAD.Pro installed and licensed. ## The worker[​](https://docs.viktor.ai/docs/create-apps/software-integrations/staadpro/.md#the-worker "Direct link to The worker") A worker is a program that connects the VIKTOR platform to third-party software running outside the platform. You can install the worker on your local machine or a remote server, but STAAD.Pro must be installed where the worker is located. Your VIKTOR app will handle the communication between the web app and the worker as shown in the following diagram: ![worker](/assets/images/tutorial_staad_worker_integration-bac3cd80b2a1f7c50ab474e8370ef540.png) Here is what happens during the integration: 1. The user enters input parameters in the `VIKTOR UI`. 2. The `app.py` in the VIKTOR app sends these parameters to the worker. 3. The worker runs a Python script on the worker machine. 4. The Python script creates the model in STAAD.Pro, runs the analysis, and writes the results to `output.json`. 5. The worker sends `output.json` back to your VIKTOR app. 6. `VIKTOR UI` displays the result of the calculation. ## Add integration to app config[​](https://docs.viktor.ai/docs/create-apps/software-integrations/staadpro/.md#add-integration-to-app-config "Direct link to Add integration to app config") To make the worker integration available through the interface, add the following to your [`viktor.config.toml`](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#worker_integrations): ``` worker_integrations = [ "python", ] ``` Instructions on how to install an organization worker can be found [here](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#installation). ## Install the Python worker[​](https://docs.viktor.ai/docs/create-apps/software-integrations/staadpro/.md#install-the-python-worker "Direct link to Install the Python worker") Follow these steps to install the worker: * Personal worker * Organization worker A personal worker connects the software that is installed on your own machine, for your own use. Personal workers are installed and managed with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md): 1. [Download and install VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#download-and-install-viktor-desktop) and log in with your VIKTOR account, if you haven't done so already 2. In VIKTOR Desktop, click "Add" and select**** ![](/assets/images/viktor-desktop-add-worker-list-01993b58665874f7b82e3e76d84dd9b9.webp) 3. Select the Python environment of your choice by setting the path to its `python.exe` as the executable path. This can be your system Python, or the python.exe in a dedicated virtual environment tip Your default Python environment can usually be found in `C:\Users\Username\AppData\Local\Programs\Python\Python31X\python.exe` If you cannot find it, try running the following command in your terminal ``` where python ``` 4. Start the worker. You can view its [logs](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#view-logs) inside VIKTOR Desktop, and the editor shows when your worker is online note Personal workers that were installed with the previous per-worker installer keep running, but new personal workers can only be added through [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#migrate-existing-workers-to-viktor-desktop): the per-worker installer download and connection-key flow are no longer available for personal use. An organization worker connects software that runs on a machine managed by your organization, such as a virtual or remote machine, and is shared by the users of the app instance(s) you select. caution You need to be an environment administrator in order to install an organization worker. 1. Navigate to the "Integrations" tab in the Administrator panel 2. Click "Add integration" 3. Follow the steps provided in the modal ![](/assets/images/create-integration-admin-598d0869714267fcb7a220c370dde5df.png) 3.1. Select**** 3.2. Select the app instance(s) the integration should be available to 3.3. Download the worker .msi (Microsoft Installer) and run it on the machine of choice 3.4. Copy the generated **connection key** and paste it when the installer asks for it. In the browser, you can now click Finish and continue in the installer. Connection Key The generated connection key **should be copied immediately** as VIKTOR will not preserve this data for security reasons. 4. In the installer wizard, select the Python executable of your choice, this can be your system Python, or the python.exe in a dedicated virtual environment tip Your default Python environment can usually be found in `C:\Users\<Username>\AppData\Local\Programs\Python\Python31X\python.exe`. If you cannot find it, try running `where python` in your terminal. 5. Make sure to launch the integration once the installation is finished. If you closed the integration, you can restart it through the desktop shortcut. ## Set up the Python environment on the worker[​](https://docs.viktor.ai/docs/create-apps/software-integrations/staadpro/.md#set-up-the-python-environment-on-the-worker "Direct link to Set up the Python environment on the worker") The Python worker will execute the script that communicates with STAAD.Pro. Install the STAAD.Pro Python dependencies in the same Python environment that you selected during worker setup (in VIKTOR Desktop, or the installer wizard for organization workers). Use `openstaadpy` for STAAD.Pro 2025 or newer: ``` pip install git+https://github.com/BentleySystems/openstaadpy.git ``` info For older STAAD.Pro versions (<2025), use the COM-based workflow: ``` pip install pywin32 comtypes ``` You can find a complete guide [here](https://www.viktor.ai/blog/186/how-to-use-python-to-automate-staad-pro) ## Connecting your app to the worker[​](https://docs.viktor.ai/docs/create-apps/software-integrations/staadpro/.md#connecting-your-app-to-the-worker "Direct link to Connecting your app to the worker") You can use the following `app.py` template to set up the communication with your worker. In the current state you will need to add some code to the 'Parametrization' class as well as functions to generate 'inputs.json'. The code to generate 'output.json' needs to be added to the 'run\_staad\_model.py' file (see next section). If you would like an example of these feel free to follow our [STAAD.Pro tutorial](https://docs.viktor.ai/docs/tutorials/integrate-staadpro/.md). ``` from viktor.external.python import PythonAnalysis from viktor.core import File from pathlib import Path class Parametrization(vkt.Parametrization): # add your parameters here class Controller(vkt.Controller): ... # Add a function inside the Controller to create an `inputs.json` file. def run_staad(self, params, **kwargs): input_json = json.dumps([nodes, lines, cross_section]) script_path = Path(__file__).parent / "run_staad_model.py" staad_analysis = PythonAnalysis( script=File.from_path(script_path), files=[("inputs.json", BytesIO(input_json.encode("utf-8")))], output_filenames=["output.json"], ) staad_analysis.execute(timeout=300) output_file = staad_analysis.get_output_file("output.json") # Further logic to handle the output.json data ``` The following template can be used to define the content of your `run_staad_model.py` to communicate with the worker and your VIKTOR app: ``` # run_staad_model.py import json from pathlib import Path def create_staad_model(): """ 1. Your code reads the inputs.json file and uses the content for structural analysis in STAAD.Pro. """ input_json = Path.cwd() / "inputs.json" with open(input_json) as jsonfile: data = json.load(jsonfile) """ 2. Add your logic here for the analysis using the STAAD.Pro API, possibly through openstaadpy. """ outputs = { "some_result": 123 # Example placeholder data } """ 3. Store the results of your analysis in the output.json file to be sent to your VIKTOR app. """ output_file = Path.cwd() / "output.json" with open(output_file, "w") as jsonfile: json.dump(outputs, jsonfile) create_staad_model() ``` ## Conclusion[​](https://docs.viktor.ai/docs/create-apps/software-integrations/staadpro/.md#conclusion "Direct link to Conclusion") By following this guide, you have learned how to set up your worker for use with STAAD.Pro. With the provided templates, you are ready to integrate STAAD.Pro into your VIKTOR app and automate design and analysis tasks. Want to dive right in and build a complete STAAD.Pro automation? Follow our [STAAD.Pro tutorial](https://docs.viktor.ai/docs/tutorials/integrate-staadpro/.md). --- # TabLogs **TabLogs** can be integrated with **VIKTOR** using the **OAuth 2.0** workflow for token based authentication and authorization. A general introduction to OAuth 2.0 can be found [here](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#oauth-20). Prerequisites * You have access to a **[TabLogs](https://tablogs.com/)** account that can manage OAuth integrations * You have a **VIKTOR** administrator account that can create OAuth 2.0 integrations and assign them to **VIKTOR** apps ## Creating a TabLogs application[​](https://docs.viktor.ai/docs/create-apps/software-integrations/tablogs/.md#creating-a-tablogs-application "Direct link to Creating a TabLogs application") Open **[TabLogs Integrations](https://web.tablogs.com/settings/integrations)** and select the **VIKTOR** integration card, then open **OAuth Details**. The **TabLogs** OAuth details provide the values needed to configure the integration in **VIKTOR**: * **Client ID**: A unique public identifier for your application * **Client Secret**: A confidential password used to authenticate your application If the client secret is not available, click **Regenerate** to create a new secret. The screenshot below shows the expected **TabLogs** OAuth details page. ![TabLogs OAuth details](/assets/images/tablogs-integration-1-73439d4673441cda38a2834d9b87d077.png) note Unlike other OAuth 2.0 integrations, **TabLogs** manages the redirect callback URL internally on their end. You do not need to configure or provide a callback URL when setting up the integration - **TabLogs** handles this automatically as part of their **VIKTOR** integration. ## Creating an OAuth 2.0 integration (admin)[​](https://docs.viktor.ai/docs/create-apps/software-integrations/tablogs/.md#creating-an-oauth-20-integration-admin "Direct link to Creating an OAuth 2.0 integration (admin)") After receiving the **Client ID** and **Client Secret**, a **VIKTOR** admin can generate an **OAuth 2.0** integration. Start in the Administrator panel and create a new OAuth 2.0 integration with **TabLogs** as the selected software. ![Open the OAuth 2.0 modal](/assets/images/tablogs-integration-viktor-modal-afe15fbac126942f4ef93ca55c88e9ff.png) In the **Basic Information** step, choose a descriptive integration name that clearly identifies this connection. In this tutorial we will use **`viktor-tablogs-integration`**, but you can use any custom name that makes sense for your organization. This name will be referenced in your application code, so make it memorable and meaningful. note Throughout this guide, we use `viktor-tablogs-integration` as the example integration name. When you see this name in code samples or configuration steps, replace it with your own chosen name. Add a clear description that explains the purpose of this integration (e.g., "OAuth 2.0 integration for accessing TabLogs projects and logs"), and assign the integration to the VIKTOR applications that should have access to it. ![Basic integration information](/assets/images/tablogs-integration-2-d0dd52175e8c6bea65f34be2c02ca527.png) Then, in the **Configuration** step, use the **TabLogs** OAuth values shown below: * **Authentication URL**: `https://web.tablogs.com/oauth/authorize` * **Token URL**: `https://api.tablogs.com/api/oauth/token` * **Client ID**: `<your TabLogs client id>` * **Client Secret**: `<your TabLogs client secret>` * **Client secret expiration date**: `<expiration date shown in TabLogs>` * **Scopes**: `projects:read` `logs:read` `openapi:access` ![TabLogs OAuth configuration in VIKTOR](/assets/images/tablogs-integration-2-d0dd52175e8c6bea65f34be2c02ca527.png) info The following scopes are used for this integration: * `projects:read` — allows access to available TabLogs projects. * `logs:read` — allows access to available TabLogs logs. * `openapi:access` — allows access to the TabLogs OpenAPI-backed API ## Implementing the integration[​](https://docs.viktor.ai/docs/create-apps/software-integrations/tablogs/.md#implementing-the-integration "Direct link to Implementing the integration") Once an administrator sets up the **OAuth 2.0** integration, the developer can start the implementation. You have two alternatives to develop apps that integrate **TabLogs**: * [Using the App Builder](https://docs.viktor.ai/docs/create-apps/software-integrations/tablogs/.md#using-the-app-builder) * [Using Local Development](https://docs.viktor.ai/docs/create-apps/software-integrations/tablogs/.md#using-local-development) ### Using the App Builder[​](https://docs.viktor.ai/docs/create-apps/software-integrations/tablogs/.md#using-the-app-builder "Direct link to Using the App Builder") The [App Builder](https://docs.viktor.ai/docs/app-builder/.md) provides a no-code approach to create applications with **TabLogs** integration. You can describe the app in natural language and let the **App Builder** generate the first version for you. Use the following prompt to create an application that allows users to visualize the geographic location of bore logs (geotechnical boreholes) from a selected project: ``` Create a VIKTOR app that uses the OAuth2 integration “viktor-tablogs-integration” to fetch TabLogs projects from https://api.tablogs.com/openapi/v1.1.0/projects and bore logs from https://api.tablogs.com/openapi/v1.1.0/logs, using requests.get(..., params={...}) for page, limit, and project_id; parse TabLogs pagination correctly with records in response[“data”][“data”] and last_page in response[“data”][“last_page”]; populate a “Select Project” dropdown using each project’s id and project_name; when a project is selected, display its bore logs in a MapView to visualize their geographic locations. ``` A generated **App Builder** result can look like this: ![TabLogs App Builder result](/assets/images/tablogs-integration-3-cff198a4308f38586e1049d313dac091.png) After submitting the prompt, the **App Builder** will ask you to connect the integration in the app settings: 1. Click the **App details** button 2. Select the integration name `viktor-tablogs-integration` 3. Save the current selection ![Assign the integration in App details](/assets/images/tablogs-integration-4-6ac42940ef7450b59a21436a38c875cf.png) tip For more complex applications or to use a more natural language approach with the App Builder, you can download the **[TabLogs OpenAPI documentation](https://api.tablogs.com/openapi/v1.1.0/documentation)** as a text file and attach it to your App Builder prompt. This provides the App Builder with complete API endpoint details, allowing it to generate more sophisticated integrations with access to all available **TabLogs** features and data structures. ### Using local development[​](https://docs.viktor.ai/docs/create-apps/software-integrations/tablogs/.md#using-local-development "Direct link to Using local development") For local development, the developer should add the integration name to the app configuration after the administrator has assigned the integration to the app. The platform uses it to show a login button when the user opens the app. Make sure your `viktor.config.toml` contains the name exactly as configured in the **Administrator panel**. note Remember to use your own integration name in `viktor.config.toml`. In the examples below, we continue using `viktor-tablogs-integration`, but you should replace this with the custom name you defined earlier in the **Administrator panel**. `viktor.config.toml`: ``` app_type = “editor” python_version = “3.13” registered_name = “your-app-name” oauth2_integrations = [ “viktor-tablogs-integration” ] ``` Then implement the logic that uses the integration in the code. You can use raw **REST** requests or a **Python SDK**, as long as it is compatible with the **VIKTOR** OAuth flow. A popular library is `requests`. You can add it in your `requirements.txt`: ``` viktor requests ``` To obtain an access token, instantiate `OAuth2Integration` with the integration name and call `get_access_token`. The example below fetches the user’s accessible **TabLogs** projects, then fetches the bore logs for the selected project, and displays them in a [MapView](https://docs.viktor.ai/docs/create-apps/03-create-apps/04-results-and-visualizations/03-maps.md). ``` import requests import viktor as vkt BASE_URL = "https://api.tablogs.com/openapi/v1.1.0" INTEGRATION = "viktor-tablogs-integration" def get_token(): return vkt.external.OAuth2Integration(INTEGRATION).get_access_token() def get_records(endpoint, token, params): response = requests.get( BASE_URL + endpoint, headers={"Authorization": "Bearer " + token}, params=params, timeout=15, ) if response.status_code != 200: raise vkt.UserError("TabLogs request failed: " + str(response.status_code)) return response.json().get("data", {}).get("data", []) def get_project_options(params, **kwargs): token = get_token() projects = get_records("/projects", token, {"page": 1, "limit": 5}) options = [] for project in projects: project_id = project.get("id") project_name = project.get("project_name") or project.get("name") or str(project_id) if project_id: options.append(vkt.OptionListElement(str(project_id), project_name)) return options class Parametrization(vkt.Parametrization): project = vkt.OptionField("Select Project", options=get_project_options) class Controller(vkt.Controller): parametrization = Parametrization @vkt.MapView("Bore Logs Map", duration_guess=2) def get_map_view(self, params, **kwargs): if not params.project: return vkt.MapResult([]) token = get_token() logs = get_records("/logs", token, {"project_id": params.project, "page": 1, "limit": 100}) features = [] for log in logs: lat = log.get("latitude") or log.get("lat") lon = log.get("longitude") or log.get("lon") or log.get("lng") try: lat = float(lat) lon = float(lon) except (TypeError, ValueError): continue title = log.get("log_no") or log.get("name") or log.get("log_name") or str(log.get("id")) features.append(vkt.MapPoint(lat, lon, title=str(title))) return vkt.MapResult(features) ``` note The integration name in `OAuth2Integration` must match the value in `viktor.config.toml`. Make sure the user has access to the relevant **TabLogs** projects and logs in the connected account. --- # Tekla Structures tip This guide provides the basic information about the Tekla integration. **If this is your first time setting up an integration, we recommend to follow one of the [Intermediate tutorials](https://docs.viktor.ai/docs/tutorials/.md#intermediate-level).** ## System requirements:[​](https://docs.viktor.ai/docs/create-apps/software-integrations/tekla/.md#system-requirements "Direct link to System requirements:") * 💻 Windows PC * 🐍 Python =< 3.11 (pyTekla requirement) * PyTekla (Tekla Open API wrapper) * Tekla Structures (with an active model on the worker) ### Additional information[​](https://docs.viktor.ai/docs/create-apps/software-integrations/tekla/.md#additional-information "Direct link to Additional information") Below you can find some useful information for this integration. * [Tekla Open API](https://developer.tekla.com/tekla-structures/api/28/8180) * [PyTekla API](https://efdiloreto.github.io/PyTekla/api_reference/) ### Download and install pyTekla[​](https://docs.viktor.ai/docs/create-apps/software-integrations/tekla/.md#download-and-install-pytekla "Direct link to Download and install pyTekla") PyTekla is a Python wrapper that provides a thin wrapper around the Tekla Open API. The Tekla Open API is an API that provides a range of tools and functions that allow developers to automate processes, integrate with other software (VIKTOR in this case) and customise the behaviour of Tekla Structures software. You can follow the instructions to installing PyTekla [here](https://efdiloreto.github.io/PyTekla/install/). ## Setup environment[​](https://docs.viktor.ai/docs/create-apps/software-integrations/tekla/.md#setup-environment "Direct link to Setup environment") Before you can start building your VIKTOR - Tekla apps, you will need to complete some steps for the setup. ### Step 1: Start a VIKTOR app[​](https://docs.viktor.ai/docs/create-apps/software-integrations/tekla/.md#step-1-start-a-viktor-app "Direct link to Step 1: Start a VIKTOR app") You will need to create, install and start an empty app. If you would like a quick reminder on how to do this, you can follow the steps [here](https://docs.viktor.ai/docs/getting-started/starter-guide/.md). For your VIKTOR app, you will not need to add any extra packages to your `requirements.txt` as they will be installed on the worker. Furthermore you can copy `app.py` below to get started with the VIKTOR - Tekla integration. In this example, the `app.py` dumps the parameters into a `.json` file that the worker will be able to use for `run_tekla.py`. ``` import viktor as vkt import json from pathlib import Path class Parametrization(vkt.Parametrization): # Add your parameters here class Controller(vkt.Controller): parametrization = Parametrization @vkt.IFCView("IFC Viewer", duration_guess=5) def show_ifc(self, params, entity_id, **kwargs): # Create empty file to dump the params json in file = File() params['export_ifc'] = True with file.open() as f: json.dump(params, f) # Run the python script and obtain the output files analysis = vkt.tekla.TeklaAnalysis(files=[('input.json', file)], output_filenames=["output.ifc"]) analysis.execute(timeout=60) return_ifc = analysis.get_output_file("output.ifc", as_file=True) return vkt.IFCResult(return_ifc) ``` ### Step 2: Add integration to app config[​](https://docs.viktor.ai/docs/create-apps/software-integrations/tekla/.md#step-2-add-integration-to-app-config "Direct link to Step 2: Add integration to app config") To make the worker integration available through the interface, add the following to your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#worker_integrations): ``` worker_integrations = [ "tekla", ] ``` Instructions on how to install the worker: Install the worker Follow these steps to install the worker: * Personal worker * Organization worker A personal worker connects the software that is installed on your own machine, for your own use. Personal workers are installed and managed with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md): 1. [Download and install VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#download-and-install-viktor-desktop) and log in with your VIKTOR account, if you haven't done so already 2. In VIKTOR Desktop, click "Add" and select **Tekla** ![](/assets/images/viktor-desktop-add-worker-list-01993b58665874f7b82e3e76d84dd9b9.webp) 3. Select the Python environment of your choice by setting the path to its `python.exe` as the executable path. This can be your system Python, or the python.exe in a dedicated virtual environment tip Your default Python environment can usually be found in `C:\Users\Username\AppData\Local\Programs\Python\Python31X\python.exe` If you cannot find it, try running the following command in your terminal ``` where python ``` 4. Start the worker. You can view its [logs](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#view-logs) inside VIKTOR Desktop, and the editor shows when your worker is online note Personal workers that were installed with the previous per-worker installer keep running, but new personal workers can only be added through [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#migrate-existing-workers-to-viktor-desktop): the per-worker installer download and connection-key flow are no longer available for personal use. An organization worker connects software that runs on a machine managed by your organization, such as a virtual or remote machine, and is shared by the users of the app instance(s) you select. caution You need to be an environment administrator in order to install an organization worker. 1. Navigate to the "Integrations" tab in the Administrator panel 2. Click "Add integration" 3. Follow the steps provided in the modal ![](/assets/images/create-integration-admin-598d0869714267fcb7a220c370dde5df.png) 3.1. Select **Tekla** 3.2. Select the app instance(s) the integration should be available to 3.3. Download the worker .msi (Microsoft Installer) and run it on the machine of choice 3.4. Copy the generated **connection key** and paste it when the installer asks for it. In the browser, you can now click Finish and continue in the installer. Connection Key The generated connection key **should be copied immediately** as VIKTOR will not preserve this data for security reasons. 4. In the installer wizard, select the Python executable of your choice, this can be your system Python, or the python.exe in a dedicated virtual environment tip Your default Python environment can usually be found in `C:\Users\<Username>\AppData\Local\Programs\Python\Python31X\python.exe`. If you cannot find it, try running `where python` in your terminal. 5. Make sure to launch the integration once the installation is finished. If you closed the integration, you can restart it through the desktop shortcut. ### Step 3: Configure PyTekla[​](https://docs.viktor.ai/docs/create-apps/software-integrations/tekla/.md#step-3-configure-pytekla "Direct link to Step 3: Configure PyTekla") Open a python environment on the machine that hosts the worker, make sure this is the Python version that you have configured in your worker. run the following commands: ``` import pytekla ``` ``` pytekla.config.set_tekla_path("C:/Program Files/Tekla Structures/2023.0/bin") ``` Make sure that the Tekla path is set to the bin folder of your Tekla Structures. You may now run the VIKTOR worker, and connect it to your app instance. ### Step 4: Start using Tekla in a VIKTOR app[​](https://docs.viktor.ai/docs/create-apps/software-integrations/tekla/.md#step-4-start-using-tekla-in-a-viktor-app "Direct link to Step 4: Start using Tekla in a VIKTOR app") There are two options to using Tekla in VIKTOR. One way is to use the PyTekla Wrapper to perform all the operations on the Tekla model. The other option is to use Tekla through Grasshopper. #### Method 1: use PyTekla[​](https://docs.viktor.ai/docs/create-apps/software-integrations/tekla/.md#method-1-use-pytekla "Direct link to Method 1: use PyTekla") You can use PyTekla's wrpapper to open, save and close models Tekla models. You can copy the boiler plate code into your `run_tekla.py` file to get started. Then you can add your own code to start developing with pyTekla. This boiler plate allows you to edit an active model in Tekla. Note that this boiler plate is for opening and closing models you will require some extra code. ``` # THIS FILE HAS TO BE ON THE VIKTOR WORKER DIRECTORY FOR THIS EXAMPLE # Pip install required packages [on worker] import os import json import math import ctypes # An included library with Python install. from pytekla import wrap from Tekla.Structures.Model import Model from Tekla.Structures.Model.Operations import Operation from System import String def save_model_as_ifc(path: str) -> bool: """This is a function to save the active Tekla model as IFC""" model = wrap("Model.Model") myie = List[String]() myie.Add("..//default//General//Shared//IFC//AdditionalPSets//CIP Construction data.xml") flags = Operation.IFCExportFlags() flags.IsLocationFromOrganizer = True flags.IsPoursEnabled = True success = Operation.CreateIFC4ExportFromAll( path, Operation.IFCExportViewTypeEnum.REFERENCE_VIEW, myie, Operation.ExportBasePoint.GLOBAL, "__Name__", "ByObjectClass", flags, "") return success # Define path to local working directory workdir = os.getcwd() + '\\' # Read input parameters from JSON file with open(workdir + 'input.json') as f: params = json.load(f) # Clear the model to prevent overwriting model = wrap('Model.Model') for tekla_obj in model.get_objects_with_types(["Beam"]): if tekla_obj: tekla_obj.Delete() # Add your code here model.commit_changes("Viktor changes") # Delete this line if you dont want Tekla visualization # Save ifc path = workdir + 'output.ifc' success = save_model_as_ifc(path) ``` #### Method 2: use Grasshopper[​](https://docs.viktor.ai/docs/create-apps/software-integrations/tekla/.md#method-2-use-grasshopper "Direct link to Method 2: use Grasshopper") A powerful connection can also be made with the Grasshopper-Tekla link. Tekla structures are easily created with Grasshopper and the GH-components available. When creating a VIKTOR - Tekla app, Grasshopper can also be used. The main issue is that we want a .ifc from the Tekla model; and Grasshopper nodes don't allow for saving / export Tekla files. This can be solved like this: * Follow this [guide](https://docs.viktor.ai/docs/create-apps/software-integrations/rhino-grasshopper/.md) to set up your VIKTOR app that communicates with GH. * Have your worker look for an `output.ifc` in your worker-directory * Use [these Grasshopper nodes](https://www.food4rhino.com/en/resource/rhinoinside-tekla-structures) to create a Tekla model * Add the following C# component to your Grasshopper file (feel free to replace some defaults, [documentation here](https://developer.tekla.com/tekla-structures/api/28/26130)): ``` if (run){ Model model = new Model(); success = Operation.CreateIFC4ExportFromAll( ifc_path, Operation.IFCExportViewTypeEnum.REFERENCE_VIEW, new List<string> { @"..\\default\\General\\Shared\\IFC\\AdditionalPSets\\CIP Construction data.xml" }, Operation.ExportBasePoint.GLOBAL, "__Name__", "ByObjectClass", new Operation.IFCExportFlags { IsLocationFromOrganizer = true, IsPoursEnabled = true}, string.Empty); } success = true; ``` * you can then add the success output to a context print (this way the worker will know the script is finished). Below you can find an example of how this may look: ![](/assets/images/tekla-integration-1-a27ea382fe21a637da3c1b22830746b4.png) ## Would you like to see an example?[​](https://docs.viktor.ai/docs/create-apps/software-integrations/tekla/.md#would-you-like-to-see-an-example "Direct link to Would you like to see an example?") VIKTOR offers a wide variety of sample repositories on GitHub, one of which is the [PyTekla integration app](https://github.com/viktor-rick/tekla-viktor-example). ## Testing[​](https://docs.viktor.ai/docs/create-apps/software-integrations/tekla/.md#testing "Direct link to Testing") `TeklaAnalysis.execute` needs to be [mocked](https://docs.viktor.ai/docs/create-apps/automated-testing/mocking/.md) within the context of (automated) testing. The `viktor.testing` module provides the [`mock_TeklaAnalysis`](https://docs.viktor.ai/sdk/api/testing/.md#_mock_TeklaAnalysis) decorator that facilitate mocking of workers: ``` import unittest import viktor as vkt from viktor.testing import mock_TeklaAnalysis from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @mock_TeklaAnalysis(get_output_file={ 'result.xml': vkt.File.from_path('test_file.xml'), # <name>: <File> 'result.json': vkt.File.from_path('test_file.json'), ... }) def test_analysis(self): MyEntityTypeController().analysis() ``` For the decorator's input parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). --- # Trimble Connect **Trimble Connect** can be integrated with **VIKTOR** using the **OAuth 2.0** workflow for token based authentication and authorization. A general introduction to OAuth 2.0 can be found [here](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#oauth-20). ## Prerequisites[​](https://docs.viktor.ai/docs/create-apps/software-integrations/trimble-connect/.md#prerequisites "Direct link to Prerequisites") To create an integration using **Trimble Connect**, the administrator's email must be an organizational email. Personal emails (e.g., @gmail, outlook, yahoo) are not eligible for API access. Your organization should have a subscription plan. Go to the [Trimble Connect webpage](https://www.trimble.com/en/products/trimble-connect) and make sure you have either a "Pro" or "Innovative" plan. ## Creating a Project in Trimble Connect[​](https://docs.viktor.ai/docs/create-apps/software-integrations/trimble-connect/.md#creating-a-project-in-trimble-connect "Direct link to Creating a Project in Trimble Connect") In your **Trimble Connect** dashboard, you can manage or create a new project. This project will be connected to the **VIKTOR** application. If there is no project yet, you can click on "New" and fill in the form to create one. ![Create App](/assets/images/trimble-integration-1-f8e146128c385dd9c9456faa62283eae.png) Note It is important to note the region where the application is hosted because the APIs to use depend on the region, as we will see later. ## Request API Credentials[​](https://docs.viktor.ai/docs/create-apps/software-integrations/trimble-connect/.md#request-api-credentials "Direct link to Request API Credentials") The administrator should go to the **Trimble** [integrations page](https://www.trimble.com/en/products/trimble-connect/integrations) and request API credentials by filling out this [form](https://docs.google.com/forms/d/e/1FAIpQLSfR3_qGbEQFfu8l7EM84qHmrRBygzNtPH-tsl8kD5tKZzeSCQ/viewform) with your account information, the **Application Name**, and the **Sign-In Redirect URL (OAuth 2.0)**. The application name is important because it will be used to request an authorization token. Make sure to use a unique name. For demonstration purposes, the image below uses `my-viktor-integration`, but make sure to use something unique and specific for your case. For the Sign-In Redirect URL (OAuth 2.0), you will provide a URL based on your **VIKTOR** environment. ``` <your-viktor-environment-url>/api/integrations/oauth2/callback/ ``` Your environment URL should be `https://cloud.viktor.ai/` or similar, depending on your organization. As an example, we will use `https://cloud.viktor.ai/api/integrations/oauth2/callback/`, but make sure to use the proper environment URL. ![Application Information](/assets/images/trimble-integration-2-7d423ec6a9476f62db908da28639427f.png) After filling in the form, you will receive an email from the **Trimble support** team within the next 72 hours with the following information: ``` Application Name: my-viktor-integration Client ID: a1d022e6-.... Client Secret: ese18630... Callback URLs: https://cloud.viktor.ai/api/integrations/oauth2/callback/ ``` Note Make sure to confirm the callback URL matches your environment, otherwise the integration will fail. ## Creating an OAuth 2.0 Integration (Admin)[​](https://docs.viktor.ai/docs/create-apps/software-integrations/trimble-connect/.md#creating-an-oauth-20-integration-admin "Direct link to Creating an OAuth 2.0 Integration (Admin)") After receiving the **Client ID** and **Client Secret**, a **VIKTOR** admin can generate an **OAuth 2.0** integration. ![](/assets/images/trimble-integration-3-c8f44ea2b380eaa9c13876a5468f6bce.png) 1. Navigate to the Integrations tab in the Administrator panel. 2. Select the OAuth 2.0 tab. 3. Follow the steps in the modal: * Select **Trimble Connect**. * Go to the **"Basic Information"** tab and fill in the required fields, including the integration name, and select the applications that will use the integration. You can choose to limit the integration to specific apps or allow all apps in the environment to use it. * Then, in the "Configuration" tab, add the Authentication URL and Token URL as follows: <!-- --> * Authentication URL: <https://id.trimble.com/oauth/authorize> * Token URL: <https://id.trimble.com/oauth/token> 4. Fill in the **Client ID** and **Client Secret** from the email you received from **Trimble support**. 5. For the scope section, you will fill in: ``` openid <ApplicationName> ``` As defined in the previous step, for the "my-viktor-integration" application name, the scope will be `openid my-viktor-integration`. ![VIKTOR Integration Configuration](/assets/images/trimble-integration-4-1006705f51f787db4cb5e1c6c4ba0cbc.png) ## Implementing the Integration[​](https://docs.viktor.ai/docs/create-apps/software-integrations/trimble-connect/.md#implementing-the-integration "Direct link to Implementing the Integration") Once an administrator sets up the **OAuth 2.0** integration, the developer can start the implementation. You have two alternatives to develop apps that integrate Trimble Connect: * [Using the App Builder](https://docs.viktor.ai/docs/create-apps/software-integrations/trimble-connect/.md#using-the-app-builder) * [Using Local Development](https://docs.viktor.ai/docs/create-apps/software-integrations/trimble-connect/.md#using-local-development) ### Using the App Builder[​](https://docs.viktor.ai/docs/create-apps/software-integrations/trimble-connect/.md#using-the-app-builder "Direct link to Using the App Builder") The **[App Builder](https://docs.viktor.ai/docs/app-builder/.md)** provides a no-code approach to create applications with **Trimble Connect** integration. Simply provide a natural language prompt describing what you want to build, and the App Builder will generate the application for you. To create an app that lists your projects from your Trimble Connect account, you can run the following prompt (make sure to replace **'my-viktor-integration'** with the **name** of the integration you created in the previous steps): ``` Create an app using my OAuth2 integration 'my-viktor-integration' to fetch projects from: URL: https://app.connect.trimble.com/tc/api/2.0/projects The API returns JSON with fields 'name' and 'id' for each project. Display these in a table. ``` After submitting the prompt, the App Builder will ask you to set up the integration by following these 3 steps: 1. Click the 'App details' button 2. Select the integration name 3. Save the current selection ![App Builder Integration Configuration](/assets/images/trimble-integration-5-7bcfdfa283c2362a6f91a670c17d83d0.png) Finally, the App Builder will generate an application that displays your Trimble Connect projects in a table after you log in. Note that in the example below, "my-viktor-integration" was replaced with a real integration name "trimble-connect". ![App Builder Trimble Connect App](/assets/images/trimble-integration-6-ef51fe9cebd3f84b5665d87acf6e5615.png) tip * You can provide context to the App Builder by adding snippets of the [official API documentation](https://developer.trimble.com/docs/connect/reference/openapi/core#) to your prompts. * When creating prompts, make sure to select the correct regional endpoint. For example, if your project is in Europe, use `https://app21.connect.trimble.com/tc/api/2.0/` instead of the US endpoint. ### Using Local Development[​](https://docs.viktor.ai/docs/create-apps/software-integrations/trimble-connect/.md#using-local-development "Direct link to Using Local Development") For local development, the developer should add the integration name to the app configuration (after the administrator has assigned the integration to the app). The platform uses it to show a login button when the user opens the app. Make sure your `viktor.config.toml` contains the name exactly as configured in the Administrator panel, and include an `oauth2_integrations` entry with the integration name, for example: `viktor.config.toml`: ``` app_type = "editor" python_version = "3.13" registered_name = "your-app-name" oauth2_integrations = [ "my-viktor-integration" ] ``` Then implement the logic that uses the integration in the code. You can use raw REST requests or a Python SDK, as long as it is compatible with the **VIKTOR** **OAuth** flow. A popular library is `requests`. You can add it in your `requirements.txt` to use it in the application. ``` viktor requests ``` To obtain an access token, instantiate `OAuth2Integration` with the integration name and call `get_access_token`. Below is a short example showing how to retrieve the user's available projects and display them in a [TableView](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/data-and-tables/.md). It works when the **VIKTOR** **OAuth 2.0** integration is assigned to your app and the user has granted access: Regional API Endpoints The example uses the US API endpoint. **Trimble Connect** has different API endpoints depending on your region: * **US (North America)**: `https://app.connect.trimble.com/tc/api/2.0/` * **Europe**: `https://app21.connect.trimble.com/tc/api/2.0/` * **Asia**: `https://app31.connect.trimble.com/tc/api/2.0/` Make sure to use the correct endpoint URL based on where your **Trimble Connect** project is hosted. For example, if your project is in Europe, replace the endpoint in the code with `https://app21.connect.trimble.com/tc/api/2.0/projects`. ``` import viktor as vkt import requests class Parametrization(vkt.Parametrization): text = vkt.Text("# Trimble Connect OAuth2 Integration") class Controller(vkt.Controller): parametrization = Parametrization @vkt.TableView("Get Trimble Connect Projects") def get_projects(self, params, **kwargs): integration = vkt.external.OAuth2Integration("my-viktor-integration") token = integration.get_access_token() headers = {"Authorization": f"Bearer {token}"} # This endpoint is for US-based projects. See the Regional API Endpoints section below for Europe and Asia. endpoint = "https://app.connect.trimble.com/tc/api/2.0/projects" response = requests.get(endpoint, headers=headers, timeout=15) response.raise_for_status() projects = response.json() data = [] for project in projects: project_name = project.get("name", "") project_id = project.get("id", "") data.append([project_name, project_id]) return vkt.TableResult(data, column_headers=["Project Name", "ID"]) ``` Note The integration name in `OAuth2Integration` must match the value in `viktor.config.toml`. Make sure the user has access to **Trimble Connect** projects in the connected account. --- # VIKTOR Desktop <!-- --> **VIKTOR Desktop** is a Windows application that lets you install, authenticate, run, and monitor your personal [workers](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#workers) from one place. You install VIKTOR Desktop once, log in with your VIKTOR account, and start the workers you need. Workers are started, stopped, and monitored from within VIKTOR Desktop, and each worker has its own formatted logs. Organization workers are managed by environment administrators and are not affected; they continue to use the [existing installation flow](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#installation). ![](/assets/images/viktor-desktop-main-menu-with-workers-fb5fef632f5d72ba5272acc24669c414.webp) *VIKTOR Desktop showing your workers and their status* ## Supported workers[​](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#supported-workers "Direct link to Supported workers") The workers available to you are shown in VIKTOR Desktop when you [add a worker](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#add-and-configure-a-worker); this list expands over time. For an overview of the software VIKTOR integrates with, see [supported software](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#supported-software). In addition, the [generic worker](https://docs.viktor.ai/docs/create-apps/software-integrations/generic/.md) is available to integrate with any other software that supports command-line interaction. note Personal workers that were installed with the previous per-worker installers are not migrated into VIKTOR Desktop. To fix this, re-install or, if listed, reconfigure these workers via VIKTOR Desktop. See [Migrate existing workers to VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#migrate-existing-workers-to-viktor-desktop). ## Requirements[​](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#requirements "Direct link to Requirements") * Operating system: Windows (64-bit AMD or Intel processor). macOS and Linux are not supported. * The third-party software that is to be integrated is installed and licenses are available on the same machine. * Outgoing TCP access to the internet over port 443. * A web browser to log in with your VIKTOR account. For IT administrators Logging in to VIKTOR Desktop uses OAuth 2.1 with PKCE: the app opens the system browser and completes the login through a temporary redirect to a local loopback address (`localhost`). No ports need to be opened for incoming traffic from the network. ## Download and install VIKTOR Desktop[​](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#download-and-install-viktor-desktop "Direct link to Download and install VIKTOR Desktop") 1. Download the VIKTOR Desktop installer (a signed .msi Microsoft Installer). You can download it directly below, or from: <!-- --> * the "My integrations" tab in your personal settings, using the "Download VIKTOR Desktop" button on the "Local software" tab, or * the editor of an application: when the application has a worker as a dependency and the platform does not detect a connected VIKTOR Desktop (not installed, or not running), the editor offers the download 2. Run the installer and complete the installation wizard 3. Launch VIKTOR Desktop ### Download and install VIKTOR Desktop \[ ]I accept the <!-- --> [terms and conditions](https://www.viktor.ai/terms) <!-- --> and <!-- --> [privacy policy](https://www.viktor.ai/privacy).[Download VIKTOR Desktop for Windows](<> "Accept the terms & conditions and privacy policy first") ![](/assets/images/my-integrations-page-24fa0d0f060f3ae8c72ba1d47903dab3.png) *The "My integrations" page with the "Download VIKTOR Desktop" button* You only need to do this once per machine; all your personal workers are managed from within the app. When a new version of VIKTOR Desktop is available, the app prompts you to update; once you confirm, it updates automatically. You never need to download and run the installer again. ## Log in[​](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#log-in "Direct link to Log in") On first launch, VIKTOR Desktop asks you to sign in: paste the URL of your VIKTOR environment, click "Next", and log in with your VIKTOR account in the browser that opens. After logging in, return to the app. ![](/assets/images/viktor-desktop-sign-in-page-7fbeaafa995f25ac7d1da161141062f9.webp) *The VIKTOR Desktop sign-in page* You log in once for all your personal workers: no connection keys need to be generated or pasted. To log out, or to switch to a different VIKTOR environment, click your profile in the top-right corner of VIKTOR Desktop and select "Log out". ## Add and configure a worker[​](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#add-and-configure-a-worker "Direct link to Add and configure a worker") 1. In VIKTOR Desktop, click "Add" 2. Select the software you want to integrate with ![](/assets/images/viktor-desktop-add-worker-list-01993b58665874f7b82e3e76d84dd9b9.webp) *Selecting the software when adding a worker* 3. Follow the instructions to complete the worker configuration. The configuration differs per software: * For Python-based workers, select the Python environment of your choice by setting the path to its `python.exe` as the executable path. This can be your system Python, or the python.exe in a dedicated virtual environment. * For workers that run a local program (e.g. Dynamo), set the path to that executable. * For the [generic worker](https://docs.viktor.ai/docs/create-apps/software-integrations/generic/.md), VIKTOR Desktop exposes the worker's `config.yaml` file, in which you define the executables, arguments and paths yourself. note The first release of VIKTOR Desktop does not expose the executable arguments for dedicated workers; only the generic worker allows for arguments (through its `config.yaml`). ## Run and stop workers[​](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#run-and-stop-workers "Direct link to Run and stop workers") Workers are started and stopped inside VIKTOR Desktop; there is no separate terminal window. The worker list shows for each of your workers whether it is "Running" or "Stopped". When a worker update is available, VIKTOR Desktop prompts you to update; once you confirm, the worker updates automatically. There is no installer to rerun. ## View logs[​](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#view-logs "Direct link to View logs") Each worker has its own log inside VIKTOR Desktop. Logs are formatted, showing when tasks are started and completed and any errors the worker encounters. ![](/assets/images/viktor-desktop-log-view-37d595e47bb4d2d0784b11d463c54a88.webp) *The log view of a worker in VIKTOR Desktop* ## Worker status in the editor[​](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#worker-status-in-the-editor "Direct link to Worker status in the editor") The editor shows whether your worker is online or offline (see also [worker status](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#worker-status)). If a worker is offline, the editor can open VIKTOR Desktop for you; in VIKTOR Desktop, look up the worker in your worker list and start it. When the platform does not detect a connected VIKTOR Desktop at all, the editor offers to [download](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#download-and-install-viktor-desktop) it. ## Migrate existing workers to VIKTOR Desktop[​](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#migrate-existing-workers-to-viktor-desktop "Direct link to Migrate existing workers to VIKTOR Desktop") Personal workers that were installed with the previous per-worker installers keep running, but they are not migrated into VIKTOR Desktop: their existing installation and configuration are not taken over. To migrate a personal worker, re-install it by [adding and configuring it again](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#add-and-configure-a-worker) in VIKTOR Desktop. Workers that are listed on the "My integrations" page in your personal settings are reflected in VIKTOR Desktop. To remove a worker from this list, delete it in VIKTOR Desktop. Uninstall your old personal workers When you migrate a personal worker to VIKTOR Desktop, uninstall its old installation using the "Add or remove programs" feature of Windows. If both keep running, two workers with potentially different configurations compete for the same tasks, which leads to unpredictable results. New personal workers can only be added through VIKTOR Desktop: with the release of VIKTOR Desktop, the per-worker installer download and the connection-key flow are no longer available on the "My integrations" page for personal workers. Organization workers and workers running on (shared) servers continue to use the [existing installers](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#installation). ## FAQs[​](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#faqs "Direct link to FAQs") **How do I update a worker in VIKTOR Desktop?** When an update is available, VIKTOR Desktop will prompt you with the available update. Confirm the update and the worker will update automatically. There is nothing else that needs to be done once the update is complete. **How do I download and install VIKTOR Desktop?** VIKTOR Desktop can be downloaded from the "My integrations" tab in your personal settings using the "Download VIKTOR Desktop" button. You can also directly download the VIKTOR Desktop from our documentation. See [Download and install VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#download-and-install-viktor-desktop). **I am not able to log in to VIKTOR Desktop** Make sure a default browser is available and that the browser can reach your VIKTOR environment. If your organization restricts localhost redirects or uses a proxy, see the note for IT administrators under [requirements](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#requirements). **Why is my worker showing as offline when I am in an app?** If the worker is showing as offline in an application it means that VIKTOR Desktop is unable to connect to the application. Check in VIKTOR Desktop that the worker is running, and inspect its log for errors. See [run and stop workers](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#run-and-stop-workers). --- # User input, fields & buttons The parametrization is built up by means of input fields that can be filled in and/or buttons that can be clicked by the user. ## Input fields[​](https://docs.viktor.ai/docs/create-apps/user-input/.md#input-fields "Direct link to Input fields") Different types of input fields can be used, For each input field, arguments can be specified to set specific options and/or constraints such as the default, minimum, or maximum value. See [`Field`](https://docs.viktor.ai/sdk/api/parametrization/.md#_Field) for all possible options. The following input fields are available: ### Numeric input[​](https://docs.viktor.ai/docs/create-apps/user-input/.md#numeric-input "Direct link to Numeric input") ![](/img/docs/cards/numberfield.png) ## [Decimal number](https://docs.viktor.ai/docs/create-apps/user-input/numeric-input/.md#numberfield---decimal-numbers) Numbers with decimals can be specified using a NumberField ![](/img/docs/cards/slider.png) ## [Slider](https://docs.viktor.ai/docs/create-apps/user-input/numeric-input/.md#numberfield---decimal-numbers) Slider is a visual variant of the NumberField ![](/img/docs/cards/integerfield.png) ## [Integer](https://docs.viktor.ai/docs/create-apps/user-input/numeric-input/.md#integerfield---whole-numbers) The IntegerField can contain integers only ### Textual input[​](https://docs.viktor.ai/docs/create-apps/user-input/.md#textual-input "Direct link to Textual input") ![](/img/docs/cards/textfield.png) ## [Short text](https://docs.viktor.ai/docs/create-apps/user-input/textual-input/.md#textfield---short-texts) Short text can be specified in a TextField ![](/img/docs/cards/textareafield.png) ## [Long text](https://docs.viktor.ai/docs/create-apps/user-input/textual-input/.md#textareafield---longer-texts) Long text can be specified in a TextAreaField ### Options & selections[​](https://docs.viktor.ai/docs/create-apps/user-input/.md#options--selections "Direct link to Options & selections") ![](/img/docs/cards/optionfield.png) ## [Single option](https://docs.viktor.ai/docs/create-apps/user-input/options-and-selections/.md#single-option) A single option can be selected in an OptionField ![](/img/docs/cards/optionfield-radio.png) ## [Radio button](https://docs.viktor.ai/docs/create-apps/user-input/options-and-selections/.md#variants) An OptionField can be visualized as a radio button ![](/img/docs/cards/optionfield-radio-inline.png) ## [Radio button (horizontal)](https://docs.viktor.ai/docs/create-apps/user-input/options-and-selections/.md#variants) An OptionField can also be visualized as a horizontal radio button ![](/img/docs/cards/autocompletefield.svg) ## [Autocomplete](https://docs.viktor.ai/docs/create-apps/user-input/options-and-selections/.md#autocomplete) Filter options through typing using an AutocompleteField ![](/img/docs/cards/multiselectfield.svg) ## [Multi-select](https://docs.viktor.ai/docs/create-apps/user-input/options-and-selections/.md#multi-select) Select multiple items from a list using a MultiSelectField ### Entity selection[​](https://docs.viktor.ai/docs/create-apps/user-input/.md#entity-selection "Direct link to Entity selection") ![](/img/docs/cards/childentityoptionfield.svg) ## [Select single child](https://docs.viktor.ai/docs/create-apps/user-input/entity-selection/.md#select-children) Select a single child entity using a ChildEntityOptionField ![](/img/docs/cards/childentitymultiselectfield.svg) ## [Select children](https://docs.viktor.ai/docs/create-apps/user-input/entity-selection/.md#select-children) Select from a list of child entities using a ChildEntityMultiSelectField ![](/img/docs/cards/siblingentityoptionfield.svg) ## [Select single sibling](https://docs.viktor.ai/docs/create-apps/user-input/entity-selection/.md#select-siblings) Select a single sibling entity using a SiblingEntityOptionField ![](/img/docs/cards/siblingentitymultiselectfield.svg) ## [Select siblings](https://docs.viktor.ai/docs/create-apps/user-input/entity-selection/.md#select-siblings) Select from a list of sibling entities using a SiblingEntityMultiSelectField ![](/img/docs/cards/entityoptionfield.svg) ## [Select generic entity](https://docs.viktor.ai/docs/create-apps/user-input/entity-selection/.md#select-generic-entity) Select a single generic entity using an EntityOptionField ![](/img/docs/cards/entitymultiselectfield.svg) ## [Select generic entities](https://docs.viktor.ai/docs/create-apps/user-input/entity-selection/.md#select-generic-entity) Select from a list of generic entities using an EntityMultiSelectField ### Geometry selection[​](https://docs.viktor.ai/docs/create-apps/user-input/.md#geometry-selection "Direct link to Geometry selection") ![](/img/docs/cards/select_geometry.png) ## [Select a geometry](https://docs.viktor.ai/docs/create-apps/user-input/geometry-selection/.md#select-a-geometry) Select a geometry in a Geometry or IFCView using a GeometrySelectField ![](/img/docs/cards/select_geometries.png) ## [Select multiple geometries](https://docs.viktor.ai/docs/create-apps/user-input/geometry-selection/.md#select-multiple-geometries) Select multiple geometries in a Geometry or IFCView using a GeometryMultiSelectField ### Map features[​](https://docs.viktor.ai/docs/create-apps/user-input/.md#map-features "Direct link to Map features") ![](/img/docs/cards/geopointfield.svg) ## [Define a point](https://docs.viktor.ai/docs/create-apps/user-input/map-features/.md#draw-a-point) Define a geo-point on a MapView using a GeoPointField ![](/img/docs/cards/geopolylinefield.svg) ## [Define a polyline](https://docs.viktor.ai/docs/create-apps/user-input/map-features/.md#draw-a-polyline) Define a geo-polyline on a MapView using a GeoPolylineField ![](/img/docs/cards/geopolygonfield.svg) ## [Define a polygon](https://docs.viktor.ai/docs/create-apps/user-input/map-features/.md#draw-a-polygon) Define a geo-polygon on a MapView using a GeoPolygonField ### File upload[​](https://docs.viktor.ai/docs/create-apps/user-input/.md#file-upload "Direct link to File upload") ![](/img/docs/cards/filefield.png) ## [Upload single file](https://docs.viktor.ai/docs/create-apps/user-input/upload-files/.md#filefield---upload-a-file) Upload a single file using a FileField ![](/img/docs/cards/multifilefield.png) ## [Upload multiple files](https://docs.viktor.ai/docs/create-apps/user-input/upload-files/.md#multifilefield---upload-multiple-files) Upload multiple files at once using a MultiFileField ### Autodesk files[​](https://docs.viktor.ai/docs/create-apps/user-input/.md#autodesk-files "Direct link to Autodesk files") ![](/img/docs/cards/autodesk_file_field.svg) ## [Select an Autodesk file](https://docs.viktor.ai/docs/create-apps/user-input/autodesk-files/.md) Select an Autodesk file from Autodesk cloud storage ### Other[​](https://docs.viktor.ai/docs/create-apps/user-input/.md#other "Direct link to Other") New in v14.0.0 ![](/img/docs/cards/colorfield.png) ## [Select a color](https://docs.viktor.ai/docs/create-apps/user-input/other-fields/.md#select-a-color) Pick a color from a palette using a ColorField ![](/img/docs/cards/datefield.svg) ## [Select a date](https://docs.viktor.ai/docs/create-apps/user-input/other-fields/.md#select-a-date) Pick a date on a calendar using a DateField ![](/img/docs/cards/booleanfield.png) ## [Toggle button](https://docs.viktor.ai/docs/create-apps/user-input/other-fields/.md#toggle-button) Switch on/off using a BooleanField ![](/img/docs/cards/hiddenfield.png) ## [Store JSON data](https://docs.viktor.ai/docs/create-apps/user-input/other-fields/.md#generic-json-data) Store hidden JSON data on a HiddenField ![](/img/docs/cards/linebreak.svg) ## [Line break](https://docs.viktor.ai/docs/create-apps/user-input/other-fields/.md#manual-line-break) Style your editor by manually arrange fields using a LineBreak ## Tables & arrays[​](https://docs.viktor.ai/docs/create-apps/user-input/.md#tables--arrays "Direct link to Tables & arrays") If the user must be able to make a dynamic number of objects sharing the same properties, tables or arrays can be used. ![](/img/docs/cards/table.svg) ## [Table](https://docs.viktor.ai/docs/create-apps/user-input/tables-and-arrays/.md#table) Draw a table consisting of rows and columns using Table ![](/img/docs/cards/dynamicarray.svg) ## [Array](https://docs.viktor.ai/docs/create-apps/user-input/tables-and-arrays/.md#dynamicarray) Bundle fields in rows and let the user add rows using a DynamicArray ## Action buttons[​](https://docs.viktor.ai/docs/create-apps/user-input/.md#action-buttons "Direct link to Action buttons") In addition to the input fields, action buttons can be added to the parametrization to enable user actions. The following table gives an overview of all action buttons: ![](/img/docs/cards/actionbutton.png) ## [Action without result](https://docs.viktor.ai/docs/create-apps/user-input/action-buttons/.md#action-without-result) Perform an action without returning any result using an ActionButton ![](/img/docs/cards/downloadbutton.png) ## [File download](https://docs.viktor.ai/docs/create-apps/user-input/action-buttons/.md#download-action) Perform an action that returns a file download using a DownloadButton ![](/img/docs/cards/setparamsbutton.png) ## [Set params](https://docs.viktor.ai/docs/create-apps/user-input/action-buttons/.md#set-params-action) Set params by means of a button click using a SetParamsButton ![](/img/docs/cards/optimizationbutton.png) ## [Optimization routine](https://docs.viktor.ai/docs/create-apps/user-input/action-buttons/.md#optimization-action) Perform an optimization routine using an OptimizationButton ## Read-only fields[​](https://docs.viktor.ai/docs/create-apps/user-input/.md#read-only-fields "Direct link to Read-only fields") The fields below can be used to guide users by providing more context, without the user being able to edit the values. ![](/img/docs/cards/outputfield.png) ## [Show output](https://docs.viktor.ai/docs/create-apps/inform-end-user/output-field/.md) Show a (dynamic) value using an OutputField ![](/img/docs/cards/static-text.svg) ## [Static text](https://docs.viktor.ai/docs/create-apps/inform-end-user/text-blocks/.md) Show a static text using Text ![](/img/docs/cards/static-image.svg) ## [Static image](https://docs.viktor.ai/docs/create-apps/inform-end-user/static-image/.md) Show a static image using Image ## LLM chat[​](https://docs.viktor.ai/docs/create-apps/user-input/.md#llm-chat "Direct link to LLM chat") ![](/img/docs/cards/chat.png) ## [Chat](https://docs.viktor.ai/docs/create-apps/user-input/llm-chat/.md) Enable the potential of LLM in your app --- # Action buttons Action buttons can be added to a parametrization to enable the user to perform certain actions. All action buttons have a (required) `method` argument that represents the name of the method on the corresponding [controller class](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure/.md#the-controller). Various buttons exist for different type of actions, which all require a different return on the corresponding button method. Reference For a more technical API reference, please see the following pages: * [`ActionButton`](https://docs.viktor.ai/sdk/api/parametrization/.md#_ActionButton) * [`DownloadButton`](https://docs.viktor.ai/sdk/api/parametrization/.md#_DownloadButton) * [`OptimizationButton`](https://docs.viktor.ai/sdk/api/parametrization/.md#_OptimizationButton) * [`SetParamsButton`](https://docs.viktor.ai/sdk/api/parametrization/.md#_SetParamsButton) ## ActionButton - action without result[​](https://docs.viktor.ai/docs/create-apps/user-input/action-buttons/.md#actionbutton---action-without-result "Direct link to ActionButton - action without result") To perform an action without returning any result, the `ActionButton` can be used: ``` import viktor as vkt class Parametrization(vkt.Parametrization): button = vkt.ActionButton('ActionButton', method='perform_action') ``` ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPsAAAAxCAYAAAAcAd90AAAABHNCSVQICAgI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WzYtJ1nunYiIqI7GzZuA+DSpcsAxMVGszZlC+kZR93WtWTZKrZsSmZDynL2pqbxwvPPYTDoWZm0tlo1P3rzxJyiKAQHt6FraEc+S03DYql4Pz/7yxz69gln2tuTMRj0DBn8V5fv91TrpUs/AfDnP/Xn+vUbbNr8MctXrmHya+NZkjiLvLwzjBw5iGvXCtmydWe16hXekc7uI1FRkdhsNvYf+LfL+KtXCzlxMpvwnmHUr2/k8k9XeGVEHEXFxbwxJY4WLR7j9fjpHEhLB2DX7n1kHjlOr4gehIR4PkGVmXmcCZP+TqNGDzI1PhaDwcDY8fHVvp1Y8+bNeOvNSUyJj6XDk+1IWbeF1+MrP/X37vvzOXnyS4YNHUhIcBtS1m1x+X5PtV7Iv8jqNRtp+Yff0y8yAoBFiUksXrqKsLAuTJoYw3dnzvPi30Zz5cq1atUrvKOx2Wx2u91OeXk5ZrMZk8nEU5371HRdQggvnDyWitFoRK/X4+fn53p3WSHE/U3CLkQdIWEXoo6QsAtRR0jYhagjJOxC1BEuYff0r2CFELVT1TxLZxeijnALu3R3IWo/TzlWPE00GPR3pyIhhM8559c5126v2TUaDZ06tr97lQkhfKpTx/Zqlp25dHaNRoOiKIwY/hJ6ve6uFymE8I5er2PE8JdQFMUt8IrzCEVR0Ol0BLdrTcKcdwgJDkKnk6tghbjX6XRaQoKDSJjzDsHtWqPT6VCUil7uyLjGXgG73Y7NZsNisWAymfj555/58ccfuXz5Mmaz2e0fuwshap4jyHq9nsaNG9O0aVMaNGiA0WhUA+8Wdqi4y4jVasVisVBSUkJJSQmlpaWUl5er04UQ947KW3z54e/vT0BAAAEBAeh0OrRarTpdDTtUBtlxbbvValUfnu6bJsEXomZ4fFtNUdBqterDcQ278/xq2ME18I6AO54l3ELcm5zPuTmeqwYdqoQdXEMtAReidnEJd5UjALdT7fIJOiFqr9vl9/+VxggdB7IFDAAAAABJRU5ErkJggg==) Expand to see all available arguments In alphabetical order: * **description**: add a tooltip with additional information ``` button = vkt.ActionButton('ActionButton', method='perform_action', description="This field represents the ...") ``` * **flex**: the width of the field between 0 and 100 (default=33) ``` button = vkt.ActionButton('ActionButton', method='perform_action', flex=50) ``` * **interaction**: enable view interaction ``` button = vkt.ActionButton( 'ActionButton', method='perform_action', interaction=MapSelectInteraction('my_map_view', selection=['points']) ) ``` * **longpoll**: set to True if the triggered method cannot be completed within the timeout limit (15s) ``` button = vkt.ActionButton('ActionButton', method='perform_action', longpoll=True) ``` * **method**: controller method that will be triggered ``` button = vkt.ActionButton('ActionButton', method='perform_action') ``` * **visible**: can be used when the visibility depends on other input fields ``` button = vkt.ActionButton('ActionButton', method='perform_action', visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. The button method is expected to return nothing (`None`): ``` class Controller(vkt.Controller): def perform_action(self, params, **kwargs): ... # no return ``` ## DownloadButton - download a file[​](https://docs.viktor.ai/docs/create-apps/user-input/action-buttons/.md#downloadbutton---download-a-file "Direct link to DownloadButton - download a file") To perform an action that returns a file download, the `DownloadButton` can be used. ``` import viktor as vkt class Parametrization(vkt.Parametrization): button = vkt.DownloadButton('DownloadButton', method='perform_download') ``` ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPwAAAAxCAYAAAD+3cQNAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAqiSURBVHic7d17WBT1Hsfx9wy7rAiKoqJpnU5mCiFYeMFb2sVbeTnejmmaZd7vmbfMLJ+e6jFTM/FumuYF9ZjdTk+mJZ4UUQQEk0JFyU0swBRhSdmFnfPHuuOubIpYIvF9PQ/P7s7M7vx+A5/5zs7ub1A0TdMQQlQIalk3QAhx+xiuN1OKvxDli6Io151fLPCuIZfAC1F+eQq/4voe3nlX0zS3+663Qog7izPYrrfXTnPSK/y1Ybfb7fp9T2GXHYAQZcNj5b4SckVRUFVVn6ZpmtvyBnAPuzPoyUdSiFy8mn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oI+Bv3Z5PfDgHnpnyJ23EnAh7kyu5+Cct57CDtcEHtyDLSEXonxxq+YejgSKnYKXb9oJUX7dKL//B8DpwEr6OjKjAAAAAElFTkSuQmCC) Expand to see all available arguments In alphabetical order: * **description**: add a tooltip with additional information ``` button = vkt.DownloadButton('DownloadButton', method='perform_download', description="This field represents the ...") ``` * **flex**: the width of the field between 0 and 100 (default=33) ``` button = vkt.DownloadButton('DownloadButton', method='perform_download', flex=50) ``` * **interaction**: enable view interaction ``` button = vkt.DownloadButton( 'DownloadButton', method='perform_download', interaction=MapSelectInteraction('my_map_view', selection=['points']) ) ``` * **longpoll**: set to True if the triggered method cannot be completed within the timeout limit (15s) ``` button = vkt.DownloadButton('DownloadButton', method='perform_download', longpoll=True) ``` * **method**: controller method that will be triggered ``` button = vkt.DownloadButton('DownloadButton', method='perform_download') ``` * **visible**: can be used when the visibility depends on other input fields ``` button = vkt.DownloadButton('DownloadButton', method='perform_download', visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. The button method is expected to return a [`DownloadResult`](https://docs.viktor.ai/sdk/api/result/.md#_DownloadResult): ``` import viktor as vkt class Controller(vkt.Controller): def perform_download(self, params, **kwargs): ... return vkt.DownloadResult(...) ``` For more information, refer to the guide on [how to handle downloading of files](https://docs.viktor.ai/docs/create-apps/managing-files/downloading-files/.md). ## SetParamsButton - set params action[​](https://docs.viktor.ai/docs/create-apps/user-input/action-buttons/.md#setparamsbutton---set-params-action "Direct link to SetParamsButton - set params action") To set the `params` by means of a button click, the `SetParamsButton` can be used. ``` import viktor as vkt class Parametrization(vkt.Parametrization): button = vkt.SetParamsButton('SetParamsButton', method='set_params') ``` ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPwAAAA0CAYAAACuEFW+AAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAvoSURBVHic7d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0umu2hiNJsaGhJGTk8vU0BDs7bX8M+4wjRo51fptvNl/+X/ijyQSNHIYfn6+rF4TC1QMJNampsAnp6QRMu4t3N3dWLpkHv379WJxVAybNu+0Khc4YggzI6YwOiiAK1evMTYkjDNnUwBISUnnnXej8fT0YNRIf+Ljj5F7Pc9qflvbyNa0cROmE/f5FwSNHMbwgEHs/jSOMcHWYyfi3qjMFTCbzRiNRsrKyigqKsKnW++6rpsQ4mc4dWI/Op0Oe3t7NBpN9bvWCiEebBJ4IRoQCbwQDYgEXogGRAIvRAMigReiAakW+JrOzQoh6p+qeZYWXogGxGbgpZUXov6zlWN1TQUcHOx/+RoJIX4RlfNbOdc2j+FVKhVdu3T6dWomhLjvunbppGS5smotvEqlQq1WEzRqKPb2cosgIeobe3stQaOGolarq4VeDVhNVKvVaLVavDq2Y9HCOXh7tUWrlatohfit02rt8PZqy6KFc/Dq2A6tVqvcg8CScZX5x9u3WK6YM5lMlJeXU1RUREFBATk5OeTm5lJWVlbtn8sLIeqeJcz29vY0b96cFi1a0LhxY3Q6nRJ6m4G3PBsMBsrLyykuLqa4uJiSkhKMxjt3chFC/HZYeucajQZHR0ecnJxwcnJCq9ViZ2envG8VeLAOvdFoxGAwKA+Tqfo/PJDwC1E3bJ5yU6uxs7NTHpZr4CuXtwo8WIfeEnLLswRciN+mymNwlueqYQcbgQfrYEvIhahfrAJepSdgc/hdvmknRP1VW37ver5Nwi/Eg+M/Xt8sxtrCicMAAAAASUVORK5CYII=) Expand to see all available arguments In alphabetical order: * **description**: add a tooltip with additional information ``` button = vkt.SetParamsButton('SetParamsButton', method='set_params', description="This field represents the ...") ``` * **flex**: the width of the field between 0 and 100 (default=33) ``` button = vkt.SetParamsButton('SetParamsButton', method='set_params', flex=50) ``` * **interaction**: enable view interaction ``` button = vkt.SetParamsButton( 'SetParamsButton', method='set_params', interaction=MapSelectInteraction('my_map_view', selection=['points']) ) ``` * **longpoll**: set to True if the triggered method cannot be completed within the timeout limit (15s) ``` button = vkt.SetParamsButton('SetParamsButton', method='set_params', longpoll=True) ``` * **method**: controller method that will be triggered ``` button = vkt.SetParamsButton('SetParamsButton', method='set_params') ``` * **visible**: can be used when the visibility depends on other input fields ``` button = vkt.SetParamsButton('SetParamsButton', method='set_params', visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. The button method is expected to return a [`SetParamsResult`](https://docs.viktor.ai/sdk/api/result/.md#_SetParamsResult): ``` import viktor as vkt class Controller(vkt.Controller): def set_params(self, params, **kwargs): ... return vkt.SetParamsResult(...) ``` For more information, refer to the guide on [how to set params using a button](https://docs.viktor.ai/docs/create-apps/user-input/set-params-using-button/.md). ## OptimizationButton - optimization action[​](https://docs.viktor.ai/docs/create-apps/user-input/action-buttons/.md#optimizationbutton---optimization-action "Direct link to OptimizationButton - optimization action") The `OptimizationButton` can be used to perform an optimization routine. ``` import viktor as vkt class Parametrization(vkt.Parametrization): button = vkt.OptimizationButton('OptimizationButton', method='perform_optimization') ``` ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAP0AAAAyCAYAAACXi92dAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAArGSURBVHic7d15WFT1Hsfx9xyYAWRCcn186up1yRQZcEksW+61m0taecuwVNzJSlGzDO2mZvZoXLJcQEmJxNy9eluUVLyKJYiQrEmguIFBLqWIKMJs9w+Y4wzMxCAq4PxezzPPnPmdM2e+M/CZ7+HMnIPCaDQaEQTBYUj1XYAgCHeXCL0gOBjnmhYQW/+C0LgoFIo/nW819OZBF6EXhMbL2huAouqOPNNNo9FoMW1+LQhCw2IKt/l11TETi05fNfAGg0GethZ48SYgCPXDagevDLpCoUCSJHnMaDRaLC+H3jzwprBnZGYRFh5FfEISN26U3ennIQhCHbi6uvDE432YGjQRX59ucvirBl/evDfv6AaDgbT0n3l15OuUlZXX6xMRBKF2XFxUbN64ih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Lb+QJQuNVU37/D9UaL9mv/PhwAAAAAElFTkSuQmCC) Expand to see all available arguments In alphabetical order: * **description**: add a tooltip with additional information ``` button = vkt.OptimizationButton('OptimizationButton', method='perform_optimization', description="This field represents the ...") ``` * **flex**: the width of the field between 0 and 100 (default=33) ``` button = vkt.OptimizationButton('OptimizationButton', method='perform_optimization', flex=50) ``` * **interaction**: enable view interaction ``` button = vkt.OptimizationButton( 'OptimizationButton', method='perform_optimization', interaction=MapSelectInteraction('my_map_view', selection=['points']) ) ``` * **longpoll**: set to True if the triggered method cannot be completed within the timeout limit (15s) ``` button = vkt.OptimizationButton('OptimizationButton', method='perform_optimization', longpoll=True) ``` * **method**: controller method that will be triggered ``` button = vkt.OptimizationButton('OptimizationButton', method='perform_optimization') ``` * **visible**: can be used when the visibility depends on other input fields ``` button = vkt.OptimizationButton('OptimizationButton', method='perform_optimization', visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. The button method is expected to return a [`OptimizationResult`](https://docs.viktor.ai/sdk/api/result/.md#_OptimizationResult): ``` import viktor as vkt class Controller(vkt.Controller): def perform_optimization(self, params, **kwargs): ... return vkt.OptimizationResult(...) ``` For more information, refer to the guide on [how to perform an optimization routine](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/optimization-routine/.md). --- # Autodesk files New in v14.25.0 Reference For a more technical API reference, please see the following pages: * [`AutodeskFileField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_AutodeskFileField) The [`AutodeskFileField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_AutodeskFileField) lets a user select a single file from Autodesk cloud storage. For the [`AutodeskView`](https://docs.viktor.ai/sdk/api/views/.md#_AutodeskView), an access token is required; therefore, an [Autodesk Platform Services integration](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-platform-services/.md) must be set up first, and the integration name must be passed in the field. ``` import viktor as vkt class Parametrization(vkt.Parametrization): autodesk_file = vkt.AutodeskFileField( "Select a file", oauth2_integration="aps-integration-1", ) ``` Expand to see all available arguments In alphabetical order: * **description**, add a tooltip with extra information ``` vkt.AutodeskFileField(..., description="This field represents the project model") ``` * **file\_types**, optional restriction of file types, case insensitive ``` vkt.AutodeskFileField(..., file_types=[".rvt"]) ``` * **flex**, width of the field between 0 and 100, default is 33 ``` vkt.AutodeskFileField(..., flex=50) ``` * **name**, defines the position of the parameter in `params` ``` vkt.AutodeskFileField(..., name="f") # obtained using params.f ``` * **oauth2\_integration**, required integration name for Autodesk authentication ``` vkt.AutodeskFileField(..., oauth2_integration="aps-integration-1") ``` * **visible**, control visibility based on other input fields ``` vkt.AutodeskFileField(..., visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ## Using `AutodeskFileField` in a Controller[​](https://docs.viktor.ai/docs/create-apps/user-input/autodesk-files/.md#using-autodeskfilefield-in-a-controller "Direct link to using-autodeskfilefield-in-a-controller") The user input can be obtained through the params argument and can have the following values: * [`AutodeskFile`](https://docs.viktor.ai/sdk/api/external/autodesk/.md#_AutodeskFile): when a file is selected * None: when empty The following sections show how to use these methods and attributes to download the raw file and to display the model in VIKTOR apps. ## Downloading a model file[​](https://docs.viktor.ai/docs/create-apps/user-input/autodesk-files/.md#downloading-a-model-file "Direct link to Downloading a model file") To download a BIM model, you start with the `AutodeskFile` and follow a clear sequence. First, use the integration to obtain a token. Then request the latest [`AutodeskFileVersion`](https://docs.viktor.ai/sdk/api/external/autodesk/.md#_AutodeskFileVersion), read its attributes to get the file metadata, and finally download the file. The code below demonstrates this flow: 1. Obtain an access token with `OAuth2Integration`. 2. Use `get_latest_version(token)` on the `AutodeskFile` to retrieve the latest version. 3. Access metadata through `version.attributes`. 4. (Optional) Get the model identifier with `version.urn`. 5. Call `version.get_file()` to get the file content and return it in a `DownloadResult`.. ``` import viktor as vkt class Parametrization(vkt.Parametrization): autodesk_file = vkt.AutodeskFileField( "Select a file", oauth2_integration="aps-integration-1", ) download = vkt.DownloadButton("Download BIM model", method="download_model") class Controller(vkt.Controller): parametrization = Parametrization def download_model(self, params, **kwargs): if not params.autodesk_file: raise vkt.UserError("Select a file in the Autodesk field") integration = vkt.external.OAuth2Integration("aps-integration-1") token = integration.get_access_token() # Latest version and key metadata version = params.autodesk_file.get_latest_version(token) attrs = version.attributes # dict display_name = attrs.get("displayName", "model") urn = version.urn vkt.UserMessage.info(f"Downloading BIM file, urn={urn}") file_bytes = version.get_file() return vkt.DownloadResult(file_content=file_bytes, file_name=display_name) ``` ### AutodeskFileVersion attributes[​](https://docs.viktor.ai/docs/create-apps/user-input/autodesk-files/.md#autodeskfileversion-attributes "Direct link to AutodeskFileVersion attributes") The [`AutodeskFileVersion.attributes`](https://docs.viktor.ai/sdk/api/external/autodesk/.md#AutodeskFileVersion.attributes) property returns a dict with the file’s metadata. Common attributes include `displayName` (file name), `versionNumber`, `createTime` and `createUserName`, `lastModifiedTime` and `lastModifiedUserName`, `fileType`, `storageSize`, processing and review states such as `processState`, `extractionState`, `splittingState`, `reviewState`, and revision identifiers like `revisionDisplayLabel` and `sourceFileName`. ## Displaying a model file[​](https://docs.viktor.ai/docs/create-apps/user-input/autodesk-files/.md#displaying-a-model-file "Direct link to Displaying a model file") The [`AutodeskFile`](https://docs.viktor.ai/sdk/api/external/autodesk/.md#_AutodeskFile) can be passed directly to a [`AutodeskResult`](https://docs.viktor.ai/sdk/api/views/.md#_AutodeskResult) to display the model in an [`AutodeskView`](https://docs.viktor.ai/sdk/api/views/.md#_AutodeskView). Refer to the complete [documentation](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/autodesk/.md) for sample code. ## Miscellaneous file properties[​](https://docs.viktor.ai/docs/create-apps/user-input/autodesk-files/.md#miscellaneous-file-properties "Direct link to Miscellaneous file properties") There are various other file properties and methods: #### AutodeskFile[​](https://docs.viktor.ai/docs/create-apps/user-input/autodesk-files/.md#autodeskfile "Direct link to AutodeskFile") * [`urn`](https://docs.viktor.ai/sdk/api/external/autodesk/.md#AutodeskFile.urn) (≥ v14.26.0): Unique resource id of this file. * [`project_id`](https://docs.viktor.ai/sdk/api/external/autodesk/.md#AutodeskFile.project_id) (≥ v14.26.0): URN of the project this file belongs to. * [`get_hub_id(access_token)`](https://docs.viktor.ai/sdk/api/external/autodesk/.md#AutodeskFile.get_hub_id) (≥ v14.26.0): Obtain the hub this file belongs to. * [`get_region(access_token)`](https://docs.viktor.ai/sdk/api/external/autodesk/.md#AutodeskFile.get_region) (≥ v14.26.0): Obtain the region of the hub this file belongs to. * [`get_aec_data_model_element_group_id(access_token)`](https://docs.viktor.ai/sdk/api/external/autodesk/.md#AutodeskFile.get_aec_data_model_element_group_id) (≥ v14.26.0): Obtain the AEC Data Model ElementGroup ID associated with this file. #### AutodeskFileVersion[​](https://docs.viktor.ai/docs/create-apps/user-input/autodesk-files/.md#autodeskfileversion "Direct link to AutodeskFileVersion") * [`storage_url`](https://docs.viktor.ai/sdk/api/external/autodesk/.md#AutodeskFileVersion.storage_url) (≥ v14.26.0): Storage url of this version of the file. --- # Entity selection When an entity depends on data of one or more other entities, the entity selection fields enable the user to make this selection. This is especially useful when [making a tree-type app](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md#tree-type-app). If none of the below entity selection fields are sufficient, data between entities can be shared [using the API](https://docs.viktor.ai/docs/api/sdk/handling-entity-data/.md). Reference For a more technical API reference, please see the following pages: * [`ChildEntityOptionField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_ChildEntityOptionField) / [`ChildEntityMultiSelectField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_ChildEntityMultiSelectField) * [`EntityOptionField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_EntityOptionField) / [`EntityMultiSelectField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_EntityMultiSelectField) * [`SiblingEntityOptionField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_SiblingEntityOptionField) / [`SiblingEntityMultiSelectField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_SiblingEntityMultiSelectField) ## ChildEntityOptionField - select child(ren)[​](https://docs.viktor.ai/docs/create-apps/user-input/entity-selection/.md#childentityoptionfield---select-children "Direct link to ChildEntityOptionField - select child(ren)") For the selection of a single child entity, the `ChildEntityOptionField` can be used. For example, when the entity type structure of your application looks similar to the following, and you need your users to select one of the child entities of a `Parent`, the following code can be used: ``` Parent └── Child ``` ``` import viktor as vkt class Parametrization(vkt.Parametrization): entity = vkt.ChildEntityOptionField('Select a child entity') ``` ![](/assets/images/childentityoptionfield-3e7506b5ac7c8975050af10e4b411c74.svg) The user input can be obtained through the **params** argument and can have the following values: * `Entity` object: when user selects an entity * `None`: when empty Expand to see all available arguments In alphabetical order: * **description**: add a tooltip with additional information ``` entity = vkt.ChildEntityOptionField('Select a child entity', description="This field represents the ...") ``` * **entity\_type\_names**: users will only be able to select entities of types within this list ``` entity = vkt.ChildEntityOptionField('Select a child entity', entity_type_names=["TypeA", "TypeC"]) ``` * **flex**: the width of the field between 0 and 100 (default=33) ``` entity = vkt.ChildEntityOptionField('Select a child entity', flex=50) ``` * **name**: defines the position of the parameter in the *params* ``` entity = vkt.ChildEntityOptionField('Select a child entity', name="e") # obtained using params.e ``` * **visible**: can be used when the visibility depends on other input fields ``` entity = vkt.ChildEntityOptionField('Select a child entity', visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ### Select multiple children[​](https://docs.viktor.ai/docs/create-apps/user-input/entity-selection/.md#select-multiple-children "Direct link to Select multiple children") In case multiple children should be selectable, the `ChildEntityMultiSelectField` can be used. ``` import viktor as vkt class Parametrization(vkt.Parametrization): entities = vkt.ChildEntityMultiSelectField('Select child entities') ``` ![](/assets/images/childentitymultiselectfield-d34f730e4810222516430ec724b2edd9.svg) The user input can be obtained through the **params** argument and can have the following values: * `list` of `Entity` objects: when user selects an entity * empty list when empty Expand to see all available arguments In alphabetical order: * **description**: add a tooltip with additional information ``` entities = vkt.ChildEntityMultiSelectField('Select child entities', description="This field represents the ...") ``` * **entity\_type\_names**: users will only be able to select entities of types within this list ``` entities = vkt.ChildEntityMultiSelectField('Select child entities', entity_type_names=["TypeA", "TypeC"]) ``` * **flex**: the width of the field between 0 and 100 (default=33) ``` entities = vkt.ChildEntityMultiSelectField('Select child entities', flex=50) ``` * **name**: defines the position of the parameter in the *params* ``` entities = vkt.ChildEntityMultiSelectField('Select child entities', name="e") # obtained using params.e ``` * **visible**: can be used when the visibility depends on other input fields ``` entities = vkt.ChildEntityMultiSelectField('Select child entities', visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ## SiblingEntityOptionField - select sibling(s)[​](https://docs.viktor.ai/docs/create-apps/user-input/entity-selection/.md#siblingentityoptionfield---select-siblings "Direct link to SiblingEntityOptionField - select sibling(s)") Similar to children, siblings can be selected using the `SiblingEntityOptionField`. For example, when the entity type structure of your application looks similar to the following, and you need your users to select entities of type `SiblingB` from an editor in `SiblingA`, the following code can be used: ``` Parent ├── SiblingA └── SiblingB ``` ``` import viktor as vkt class Parametrization(vkt.Parametrization): entity = vkt.SiblingEntityOptionField('Select a sibling') ``` ![](/assets/images/siblingentityoptionfield-6dd1c4a77f6cd17f67249e09f8212b03.svg) The user input can be obtained through the **params** argument and can have the following values: * `Entity` object: when user selects an entity * `None`: when empty Expand to see all available arguments In alphabetical order: * **description**: add a tooltip with additional information ``` entity = vkt.SiblingEntityOptionField('Select a sibling', description="This field represents the ...") ``` * **entity\_type\_names**: users will only be able to select entities of types within this list ``` entity = vkt.SiblingEntityOptionField('Select a sibling', entity_type_names=["TypeA", "TypeC"]) ``` * **flex**: the width of the field between 0 and 100 (default=33) ``` entity = vkt.SiblingEntityOptionField('Select a sibling', flex=50) ``` * **name**: defines the position of the parameter in the *params* ``` entity = vkt.SiblingEntityOptionField('Select a sibling', name="e") # obtained using params.e ``` * **visible**: can be used when the visibility depends on other input fields ``` entity = vkt.SiblingEntityOptionField('Select a sibling', visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ### Select multiple siblings[​](https://docs.viktor.ai/docs/create-apps/user-input/entity-selection/.md#select-multiple-siblings "Direct link to Select multiple siblings") In case multiple siblings should be selectable, the `SiblingEntityMultiSelectField` can be used. ``` import viktor as vkt class Parametrization(vkt.Parametrization): entities = vkt.SiblingEntityMultiSelectField('Select sibling entities') ``` ![](/assets/images/siblingentitymultiselectfield-00ebec8fdffb08a7edef0fccab886ff5.svg) The user input can be obtained through the **params** argument and can have the following values: * `list` of `Entity` objects: when user selects an entity * empty list when empty Expand to see all available arguments In alphabetical order: * **description**: add a tooltip with additional information ``` entities = vkt.SiblingEntityMultiSelectField('Select sibling entities', description="This field represents the ...") ``` * **entity\_type\_names**: users will only be able to select entities of types within this list ``` entities = vkt.SiblingEntityMultiSelectField('Select sibling entities', entity_type_names=["TypeA", "TypeC"]) ``` * **flex**: the width of the field between 0 and 100 (default=33) ``` entities = vkt.SiblingEntityMultiSelectField('Select sibling entities', flex=50) ``` * **name**: defines the position of the parameter in the *params* ``` entities = vkt.SiblingEntityMultiSelectField('Select sibling entities', name="e") # obtained using params.e ``` * **visible**: can be used when the visibility depends on other input fields ``` entities = vkt.SiblingEntityMultiSelectField('Select sibling entities', visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ## EntityOptionField - select any entity[​](https://docs.viktor.ai/docs/create-apps/user-input/entity-selection/.md#entityoptionfield---select-any-entity "Direct link to EntityOptionField - select any entity") In some cases, both the `ChildEntityOptionField` and `SiblingEntityOptionField` may not be sufficient because the entities you need to select are in a different part of the entity type tree. In the following example, we want to select a `CPTFile` entity in a `Foundation` entity: ``` ProjectFolder └── Project ├── CPTFolder │ └── CPTFile └── Foundation ``` We can make use of the `EntityOptionField` and the `entity_type_names` attribute to filter which entity type(s) should be selectable: ``` import viktor as vkt class Parametrization(vkt.Parametrization): selected_cpt = vkt.EntityOptionField('CPT File', entity_type_names=['CPTFile']) ``` ![](/assets/images/entity-option-field-37e8ba8f3d8edca46624bdc7c1d23e64.png) The user input can be obtained through the **params** argument and can have the following values: * `Entity` object: when user selects an entity * `None`: when empty Expand to see all available arguments In alphabetical order: * **description**: add a tooltip with additional information ``` entity = vkt.EntityOptionField('CPT File', description="This field represents the ...") ``` * **entity\_type\_names**: users will only be able to select entities of types within this list ``` entity = vkt.EntityOptionField('CPT File', entity_type_names=["TypeA", "TypeC"]) ``` * **flex**: the width of the field between 0 and 100 (default=33) ``` entity = vkt.EntityOptionField('CPT File', flex=50) ``` * **name**: defines the position of the parameter in the *params* ``` entity = vkt.EntityOptionField('CPT File', name="e") # obtained using params.e ``` * **visible**: can be used when the visibility depends on other input fields ``` entity = vkt.EntityOptionField('CPT File', visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ### Select multiple entities[​](https://docs.viktor.ai/docs/create-apps/user-input/entity-selection/.md#select-multiple-entities "Direct link to Select multiple entities") Multiple entities can be selected by using `EntityMultiSelectField`. ``` import viktor as vkt class Parametrization(vkt.Parametrization): selected_cpt = vkt.EntityMultiSelectField('CPT File(s)', entity_type_names=['CPTFile']) ``` ![](/assets/images/entity-multi-select-field-f4125415a008c687c930a8fe17be4feb.png) The user input can be obtained through the **params** argument and can have the following values: * `list` of `Entity` objects: when user selects an entity * empty list when empty Expand to see all available arguments In alphabetical order: * **description**: add a tooltip with additional information ``` entities = vkt.EntityMultiSelectField('CPT File(s)', description="This field represents the ...") ``` * **entity\_type\_names**: users will only be able to select entities of types within this list ``` entities = vkt.EntityMultiSelectField('CPT File(s)', entity_type_names=["TypeA", "TypeC"]) ``` * **flex**: the width of the field between 0 and 100 (default=33) ``` entities = vkt.EntityMultiSelectField('CPT File(s)', flex=50) ``` * **name**: defines the position of the parameter in the *params* ``` entities = vkt.EntityMultiSelectField('CPT File(s)', name="e") # obtained using params.e ``` * **visible**: can be used when the visibility depends on other input fields ``` entities = vkt.EntityMultiSelectField('CPT File(s)', visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ## Entity object[​](https://docs.viktor.ai/docs/create-apps/user-input/entity-selection/.md#entity-object "Direct link to Entity object") When the user selects an entity with these fields, the entity is returned in the `params` as `Entity` object. For more detail on how to use an `Entity`, see [this guide](https://docs.viktor.ai/docs/api/sdk/handling-entity-data/.md). ``` import viktor as vkt class Parametrization(vkt.Parametrization): cpt_entity = vkt.EntityOptionField('Select a CPT', entity_type_names=['CPTFile']) class Controller(vkt.Controller): parametrization = Parametrization @vkt.DataView("CPT data") def visualize(self, params, **kwargs): cpt_entity = params.cpt_entity # Entity | None if cpt_entity: return vkt.DataResult(vkt.DataGroup( x=vkt.DataItem('CPT X coordinate', cpt_entity.last_saved_params.x_coordinate), y=vkt.DataItem('CPT Y coordinate', cpt_entity.last_saved_params.y_coordinate) )) return vkt.DataResult(vkt.DataGroup()) ``` --- # Geometry selection New in v14.10.0 The geometry selection fields, enable the user to select geometries in an [`IFCView`](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#ifcview) or a [`GeometryView`](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#geometryview). Reference For a more technical API reference, please see the following pages: * [`GeometrySelectField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_GeometrySelectField) * [`GeometryMultiSelectField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_GeometryMultiSelectField) ## GeometrySelectField - select a geometry[​](https://docs.viktor.ai/docs/create-apps/user-input/geometry-selection/.md#geometryselectfield---select-a-geometry "Direct link to GeometrySelectField - select a geometry") The `GeometrySelectField` enables the user to select a single (sub-)geometry in a geometric view. It should be used in combination with an `IFCView` or `GeometryView` (showing `TransformableObject` or `.3dm` files). ``` import viktor as vkt class Parametrization(vkt.Parametrization): geometry = vkt.GeometrySelectField("Select Geometry") ``` ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANYAAABCCAYAAAArFCh7AAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AABC4SURBVHic7Z17WFTV+sc/opzBG6gJplyViwWkNhxTMVAkJUV/5qWDSKVhpnnStPMTPCcsKzp1wscUy5OolaUSJV6SvARqgqKmKIqCopKC6MOgJig18wNZvz/26KByGS8zjLY+z8PzsPd691rvntnfedd699p7NRFCCCQSyX3FqrEdkEgeRqSwJBITYF5hleWxMmoCfX38cHLrQ98R0Sz6+YJxx1alM6u7H5N/NK2LBq6Q883bhAf2wcnJD4+nnmfy/HQ0VeZqX/IgY0ZhFbPy75G8k9OFKYtXsG3T57zb7wrLxkfyzl6d+dwAOJfISLf/4ZO8uk3yP5/MiNg8XCfOZ9P270mMCaDsyxmM+c8hzOyt0WT8sz9Ok360WP/+TDQzW0uadJJ3qhi94i0inlZ2eT3+H/6V05/orzP4V69nUJnNmQYoS2PewmP0jNnCRy+2V/Z5TuNz7TH8Zn9JyuvzGWXXuC5KLBvzRaxmKlToKDlXs+vXmqFzVpD4eo8botL8nMDLA/vj4eaH39BolmVfqbPKem01e1n09+fx6+qHk08I4e+mUVgFhUsjcOr+ARkVBfw70Je+7x66veKD6WRU9GBoaPubdtuFTOLdl3vgUGGkDxV5rIyKoG9XP5y6hjAyag05N44tZtFQP0bO/opZz4fg4eaHT9B0lmUXkzF/OgO6++Hk0Z8hb66hsKqB9qrSmdXdl5FLL6BbE42T0xSSy4Ct0Xh0ncD0NyPwcevD9NS9zFL7MXJp8Y36dFui8fGYQvKlOj9myd0gzEa5SJ05SDi6DhLjY5NFen757SY5C8Rg79EiOilbnCnIFRvmjBbuPWeL1KtCiModIrqbWkxKMcJWnBJLR6uFd8RikZ5/Vhzfs0pM6qMWQXNzhajU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ndefLIHZvQ2zvb8VRiWqIylVo6Ezm2U6HTqNwh0gRlbYM0xaGENv1cqmcLEkeadfSG5N0oPQd/dED/B8ANhLHdyLTUWFtcVBOjYChJHge4ahKyA99LBqokiKoBB7mCngh/DoVNrOFsOI78zTNKVWDDX4MAxiNkPDp0fzm4gWKiwADzbwcax0N8Nlh2E3svAdQGszoMBnWHqU9ClLawLA/e2UPq7Mt6SWDhXlBvMR1vBxwEPZzcQLHCMVZMOLSFhKFzWwlH9YyPtbJSM10S1wSb5b0rmsGb6XWKhtIHEKY3thOmxaGFdp40N9HVW/mqjrY0y5UkisRQstisokTzISGFJJCZACksiMQFSWBKJCZDCkkhMgNmE1cxKWYpFIrkXKquNn2zdmJjNRRc75RVmEsm9kFv6YExdM5uw+jgpi4YdKpGRS3LnVFYr1076GeVasnTMNgkX5FKpkrtHLpUqkUhkVlAiMQVSWBKJCZDCkkhMgBSWRGIC/h/oV/u/Rql/QQAAAABJRU5ErkJggg==) The user input can be obtained through the **params** argument and can have the following values: * `string`: when a geometry is selected * `None`: when empty Expand to see all available arguments In alphabetical order: * **default**: a default value will be prefilled ``` geometry = vkt.GeometrySelectField("Select Geometry", default="cube1") ``` * **description**: add a tooltip with additional information ``` geometry = vkt.GeometrySelectField("Select Geometry", description="This field represents the ...") ``` * **flex**: the width of the field between 0 and 100 (default=33) ``` geometry = vkt.GeometrySelectField("Select Geometry", flex=50) ``` * **name**: defines the position of the parameter in the *params* ``` geometry = vkt.GeometrySelectField("Select Geometry", name="g") # obtained using params.g ``` * **view**: view method to which the field is connected (default: first GeometryView / IFCView) ``` geometry = vkt.GeometrySelectField("Select Geometry", view="geometry_view") ``` * **visible**: can be used when the visibility depends on other input fields ``` geometry = vkt.GeometrySelectField("Select Geometry", visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ### Select multiple geometries[​](https://docs.viktor.ai/docs/create-apps/user-input/geometry-selection/.md#select-multiple-geometries "Direct link to Select multiple geometries") The `GeometryMultiSelectField` enables the user to select multiple (sub-)geometries in a geometric view. It should be used in combination with an `IFCView` or `GeometryView`. ``` import viktor as vkt class Parametrization(vkt.Parametrization): geometries = vkt.GeometryMultiSelectField("Select Geometries") ``` ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOcAAABKCAYAAABAdkMQAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AABHDSURBVHic7Z15WFXV+sc/IvwOagIOYHaYlEEF0jrkAIaiqDjmnFODQ4lZYnYTvDfQBvN2w8cSy6uklaWiXTHN+UoOoDjiAAqKiAoODwf1AkJxAlm/P/axg4pwpJJzcH2eh4fDXu9e77sX+7vXWu9e++x6QgiBRCIxOSxqOwCJRFI5UpwSiYkixSmRmChSnBKJiSLFKZGYKFKcEomJIsUpkZgoUpwSiYkixSmRmChSnBKJiWJ+4ixIZ1XYJLp6++Lo6kfXoeEs3nPduH3LEpjVwZcpW/7aEA3cIvX72Yzp5oejoy/unUYy5fMEtGWPyv9fQ/b3k/DuHU2qmR+HqWNm4rzCqjcnMie1NVOXrmTXtiV80P0Wy8dPZM4h3aMN5Wosw1xf4LP0B5tkLJnC0LnpuLz+Odt2/4fYiAAKvpnB6H+d5BFHazSJfw/EMWRLlfG1eG4Yb77SHWfLRxbWY4l5Na82gbh9KkasfI9xzyubPNv9i3+kBhL+XSL/6NwLVe1GaKAgngWLztAxYgefvNxc2eYRypKSM/hGfsPmtz5nuG3thlhTVO0GMLVdbUdR9zGvntNShQoduVcrDmMbM/D9lcS+9YxemLc4siyc/hpfHF0D6TkphsSbD65SuyeGCb0DcXf1xXdgOMtP3KpQeIjFb47Et40vjt7BjPkgnuwyyF42DscOH5NYnMW8bj50/eDk/RUfTyCx+BkGDmh+12bb4BA+mPAMDsVGxlCczqqwcXRt44tjm2CGha0n9c6+BesZ4/oCs76YrwydXf3o+lI0iRfSWR46El93Hxy9X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P4Ptu2HqIuVVFaVrQX0dwNdljK3TToLMzfDR2f0+1qBqh7kXIPtVyupuyGE+kDhOXh1J2w8B9tTYMVFoD6oLKr3P7Qt6C5CRDIknYfIA1BoA6NrcK/Dxg36qmBDMiRdB60WYuJh+y2lXGUF3IZdZ/Xz+AfRDHo2gZxCJVlU14a0UEd7zqYNlJU/a07D2KfhkyBlbvlxIpQLZTGCjUpZnADQWAVbxzzkIgR7WDEEog7Bop8h5zY4NYFpfWCavrce1R90uyFmH8SUg7sLRLSuvLqqbDUBEHUbopNgbRl4u0JMkL7XtIJXfSD5FETUB/+n7u9NNYHwbSNYlAYRZ0BnBd4t4dMu0Neqev/enWHpbYhKhvG/KRemqJ6g0QvpoWgAUYNh7h6I2g46Ffh7wjR98se7HfQ9B2v3gEMzmFZFVf08YdGBujmkBTP7DqHPDsKMLsbZXiuCQbHK3HLVMGhlp/SS5/8H3Zxhxg5YfwYaWsEvpUoGN3bYo10lJPlj5J2ErgcgepLhImMsD3Mu1RZ1clgL0PIJiB0OutsQvBI+TACLeoowAfq4ga0KtoyBpxrD5UIY9oNhYbzEhLkNx85AxFFwaFU3h7RQh8UJ4NEUto6FQFdYfhy6LAeXhbAuHXq2gmmdoHUT2DAK3JpA3i/K/FNi4txSFjGcfgI+DaibQ1qoo3POirRoBDEDIb8ETusfGWtqrWQiX9cYbOJeVDK6FW+tSEwUO4idWttB/PXUeXHewc4aujopP5XRxFpZ3ieRmAp1elgrkZgzUpwSiYkixSmRmChSnBKJiSLFKZGYKGYlTksL+LW0tqOQmDu/lhr/gENtYgYhGnC2VRY6SyR/hJxC81imaVbi9HNUvqQr/bqyHlYieRiKflPOnX05yrlk6pjVwneQr52X1Bz52nmJRPKnYFbDWonkcUKKUyIxUaQ4JRITRYpTIjFR/h8wrs4NJ8ZZ9wAAAABJRU5ErkJggg==) The user input can be obtained through the **params** argument and can have the following values: * list of `string`: when geometries are selected * empty list when empty Expand to see all available arguments In alphabetical order: * **default**: a default value will be prefilled ``` geometries = vkt.GeometryMultiSelectField("Select Geometries", default=["cube1", "cube3"]) ``` * **description**: add a tooltip with additional information ``` geometries = vkt.GeometryMultiSelectField("Select Geometries", description="This field represents the ...") ``` * **flex**: the width of the field between 0 and 100 (default=33) ``` geometries = vkt.GeometryMultiSelectField("Select Geometries", flex=50) ``` * **max\_select**: maximum amount of objects the user is allowed to select ``` geometry = vkt.GeometryMultiSelectField("Select Geometries", max_select=5) ``` * **min\_select**: minimum amount of objects the user needs to select ``` geometry = vkt.GeometryMultiSelectField("Select Geometries", min_select=3) ``` * **name**: defines the position of the parameter in the *params* ``` geometries = vkt.GeometryMultiSelectField("Select Geometries", name="g") # obtained using params.g ``` * **view**: view method to which the field is connected (default: first GeometryView / IFCView) ``` geometries = vkt.GeometryMultiSelectField("Select Geometries", view="geometry_view") ``` * **visible**: can be used when the visibility depends on other input fields ``` geometries = vkt.GeometryMultiSelectField("Select Geometries", visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ## Example[​](https://docs.viktor.ai/docs/create-apps/user-input/geometry-selection/.md#example "Direct link to Example") To support geometry selection, the following parts need to be implemented in the app: * IFCView * GeometryView 1. Create an [IFCView](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#ifcview) in the controller 2. Create a `FileField` and `GeometrySelectField` (or `GeometryMultiSelectField`) in the parametrization 3. Use the `identifier` retrieved from the params in subsequent calculations An IFC-file contains unique identifiers per geometry feature. ``` import viktor as vkt import ifcopenshell import ifcopenshell.util.element from pathlib import Path from tempfile import NamedTemporaryFile class Parametrization(vkt.Parametrization): ifc = vkt.FileField("Please provide an IFC file") geometry = vkt.GeometrySelectField("Select Geometry") class Controller(vkt.Controller): parametrization = Parametrization @vkt.IFCAndDataView("IFC", x_axis_to_right=True) def get_ifc_and_data_view(self, params, **kwargs): ifc_file = params.ifc.file if selected_geometry := params.geometry: # If user has made a selection, add its properties to `data` # parse your ifc file (e.g. with ifcopenshell as below) with NamedTemporaryFile(suffix=".ifc", delete=False, mode="w") as temp_f: temp_f.write(ifc_file.getvalue()) model = ifcopenshell.open(Path(temp_f.name)) elem = model.by_id(int(selected_geometry)) # See https://wiki.osarch.org/index.php?title=IFC_attributes_and_properties # for a list of available IFC attributes and properties data_items = [] for key, val in ifcopenshell.util.element.get_psets(elem).items(): sub_data_items = [] for k,v in val.items(): sub_data_items.append(vkt.DataItem(k, v)) data_items.append(vkt.DataItem(key, '', subgroup=vkt.DataGroup(*sub_data_items))) data = vkt.DataGroup(*data_items) else: data = vkt.DataGroup(vkt.DataItem('No geometries selected', '')) return vkt.IFCAndDataResult(ifc=ifc_file, data=data) ``` 1. Create a [GeometryView](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md#geometryview) in the controller 2. Create a `GeometrySelectField` (or `GeometryMultiSelectField`) in the parametrization 3. Use the `identifier` retrieved from the params in subsequent calculations Identifiers can be assigned to the VIKTOR geometry objects, to make them selectable in the view. This also works with .3dm files, in which case the `Name` parameter of an objects attributes will be used as an identifier. note * If several objects have an identifier assigned, then only these objects will be selectable in the View. * If none of the objects in the GeometryResult have an identifier assigned, default identifiers are assigned to all of them (enabling them for selection). * If there are multiple objects with the same name, a number will automatically be appended to enforce uniqueness. ``` import viktor as vkt class Parametrization(vkt.Parametrization): geometry = vkt.GeometrySelectField("Select Geometry") geometries = vkt.GeometryMultiSelectField("Select Geometries") class Controller(vkt.Controller): parametrization = Parametrization @vkt.GeometryAndDataView('Geometry', x_axis_to_right=True) def get_geometry_and_data_view(self, params, **kwargs): cubes = { 'cube1': vkt.SquareBeam(1, 1, 5, identifier="cube1"), 'cube2': vkt.SquareBeam(1, 4, 1, identifier="cube2"), 'cube3': vkt.SquareBeam(3, 1, 1, identifier="cube3") } # Calculate data if selected_geometry := params.geometry: volume = cubes[selected_geometry].inner_volume data_1 = vkt.DataItem('Volume of GeometrySelectField', volume, suffix="m3") else: data_1 = vkt.DataItem('No geometry selected in GeometrySelectField', '') if selected_geometries := params.geometries: volume = sum(cubes[selected_geometry].inner_volume for selected_geometry in selected_geometries) data_2 = vkt.DataItem('Volume of GeometryMultiSelectField', volume, suffix="m3") else: data_2 = vkt.DataItem('No geometries selected in GeometryMultiSelectField', '') return vkt.GeometryAndDataResult(geometry=cubes.values(), data=vkt.DataGroup(data_1, data_2)) ``` --- # Hide a field Any field can be hidden (or shown) using the `visible` argument: ``` vkt.NumberField('X', visible=...) ``` If the visibility needs to be calculated 'dynamically' (based on other input fields), one of the below methods can be used. ## Depending on BooleanField[​](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md#depending-on-booleanfield "Direct link to Depending on BooleanField") If the visibility depends on another [`BooleanField`](https://docs.viktor.ai/docs/create-apps/user-input/other-fields/.md#toggle-button), the easiest solution is to use a [`Lookup`](https://docs.viktor.ai/sdk/api/parametrization/.md#_Lookup). This looks up the value of the field with given name upon evaluation of the visibility constraint: ``` import viktor as vkt class Parametrization(vkt.Parametrization): param_x = vkt.BooleanField('X') param_y = vkt.NumberField('Y', visible=vkt.Lookup('param_x')) ``` In case of a nested parametrization structure, the dotted path should be used: ``` vkt.Lookup('tab.section.param_x') ``` When the Lookup cannot find the target field, a warning is raised and the visibility constraint is set to its default (i.e. `visible=True`). ## Depending on other field(s)[​](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md#depending-on-other-fields "Direct link to Depending on other field(s)") If the visibility depends on multiple other fields or on a field that is not a `BooleanField`, the so-called 'boolean operators' can be used. VIKTOR offers the following boolean operators: | Operator | Can be used to | | ---------- | ---------------------------------------- | | And | evaluate multiple operands to be True | | Or | evaluate if at least one operand is True | | Not | evaluate an operand to be False | | IsEqual | evaluate two operands to be equal | | IsNotEqual | evaluate two operands to be NOT equal | | IsTrue | evaluate an operand to be True | | IsFalse | evaluate an operand to be False | | IsNotNone | evaluate an operand to be NOT None | For example, if `param_z` should be visible only when the following conditions are met: * `param_x` is equal to `False` * `param_y` is not equal to `5` ``` import viktor as vkt _param_z_visible = vkt.And( vkt.IsFalse(vkt.Lookup('param_x')), vkt.IsEqual(vkt.Lookup('param_y'), 5) ) class Parametrization(vkt.Parametrization): param_x = vkt.BooleanField('X') param_y = vkt.NumberField('Y') param_z = vkt.NumberField('Z', visible=_param_z_visible) ``` If an inconsistent type is used in a boolean operator, a warning is raised and the visibility constraint is set to its default (i.e. `visible=True`). caution In Python, arbitrary types may be implicitly treated as booleans (e.g. `1 == True` evaluates to `True`, as well as `bool('text')`). Note that that VIKTOR's boolean operators **do not perform this implicit conversion**. For example, the following `IsEqual` operator evaluates to `False`: ``` vkt.IsEqual(1, True) ``` If implicit conversion is desired, a [callback function](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md#using-a-function) can be used. ## Using a function[​](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md#using-a-function "Direct link to Using a function") The most generic way to dynamically set the visibility is to use a 'callback function'. Upon evaluation of the visibility constraint, the platform passes the `params`, `entity_id`, `entity_name`, and `workspace_id` (>= v14.7.1) to the custom function: ``` import viktor as vkt def param_y_visible(params, **kwargs): return params.param_x class Parametrization(vkt.Parametrization): param_x = vkt.BooleanField('X') param_y = vkt.NumberField('Y', visible=param_y_visible) ``` tip All individual `kwargs` can be added explicitly in the signature if needed: ``` def param_y_visible(params, entity_id, entity_name, workspace_id, **kwargs): ... ``` When the visibility depends on data of another entity, the `entity_id` can be used to navigate and obtain data using the [SDK API](https://docs.viktor.ai/docs/api/sdk/handling-entity-data/.md). ## Fields in a DynamicArray[​](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md#fields-in-a-dynamicarray "Direct link to Fields in a DynamicArray") ### RowLookup[​](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md#rowlookup "Direct link to RowLookup") If the visibility depends on the result of another field within a [`DynamicArray`](https://docs.viktor.ai/docs/create-apps/user-input/tables-and-arrays/.md#dynamicarray), a [`RowLookup`](https://docs.viktor.ai/sdk/api/parametrization/.md#_RowLookup) can be used. Using the `RowLookup`, a field of a specific row within the array can be made dependent of another field **within the same row**: ``` import viktor as vkt class Parametrization(vkt.Parametrization): array = vkt.DynamicArray('Array') array.param_x = vkt.BooleanField('X') array.param_y = vkt.NumberField('Y', visible=vkt.RowLookup('param_x')) ``` caution Note that it is currently not possible to combine a `RowLookup` with one of the boolean operators above. For example, the following is NOT supported: `IsEqual(RowLookup("shape"), "Circular")` ### Using a function[​](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md#using-a-function-1 "Direct link to Using a function") Another option is to make use of a callback function. Make sure that such functions return a list of the constraint values, one for each row in the array. The length of this list must be equal to the number of rows in the array, otherwise (a warning is logged and) the constraint is ignored: ``` import viktor as vkt def param_y_visible(params, **kwargs): return [row.param_x for row in params.array] class Parametrization(vkt.Parametrization): array = vkt.DynamicArray('Array') array.param_x = vkt.BooleanField('X') array.param_y = vkt.NumberField('Y', visible=param_y_visible) ``` --- # Input validation New in v13.7.0 There are two types of input validation: * **generic**: automatically detected by the platform during user input * **specific**: custom logic to handle more complex validation Both types provide the possibility to mark fields invalid in the interface, which helps users to correct input mistakes. ## Generic field constraints[​](https://docs.viktor.ai/docs/create-apps/user-input/input-validation/.md#generic-field-constraints "Direct link to Generic field constraints") The following constraints are automatically assessed by the platform: * [Numeric min/max boundary](https://docs.viktor.ai/docs/create-apps/user-input/input-validation/.md#numeric-minmax-boundary) * [Non-existing option](https://docs.viktor.ai/docs/create-apps/user-input/input-validation/.md#non-existing-option) * [Non-existing coordinate](https://docs.viktor.ai/docs/create-apps/user-input/input-validation/.md#non-existing-coordinate) * [Invalid color value](https://docs.viktor.ai/docs/create-apps/user-input/input-validation/.md#invalid-color-value) * [Invalid date format](https://docs.viktor.ai/docs/create-apps/user-input/input-validation/.md#invalid-date-format) When any of these are violated, all actions are blocked until the user fixes the fields (invisible fields are not considered). This way it can be ensured that wrong inputs are never used in one of the calculations. The actions that are blocked are: * [action buttons](https://docs.viktor.ai/docs/create-apps/user-input/action-buttons/.md) * [view calculations](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md) * next-button on a [Step](https://docs.viktor.ai/docs/create-apps/layout-and-styling/steps/.md) caution When using an SDK version lower than v14, constraints do only block actions when the controller flag `viktor_enforce_field_constraints` is set to True (see [U83](https://docs.viktor.ai/sdk/upgrades#U83) for more detail). The platform currently **does not** automatically invalidate: * a [selected entity](https://docs.viktor.ai/docs/create-apps/user-input/entity-selection/.md) that has been deleted * a [selected file](https://docs.viktor.ai/docs/create-apps/user-input/upload-files/.md) that has been deleted ### Numeric min/max boundary[​](https://docs.viktor.ai/docs/create-apps/user-input/input-validation/.md#numeric-minmax-boundary "Direct link to Numeric min/max boundary") Input value is not within the [configured min/max](https://docs.viktor.ai/docs/create-apps/user-input/numeric-input/.md#setting-minmax) bounds: ``` NumberField("Number", min=10, max=20) # also on IntegerField / DynamicArray ``` ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAREAAABkCAYAAAChDARIAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAAudEVYdENyZWF0aW9uIFRpbWUARnJpIDI4IE9jdCAyMDIyIDA1OjA4OjA4IFBNIENFU1Tn0LJTAAAL90lEQVR4nO3dfWwUZ2LH8e++zK5fsGNTX1alwF0dR5Ci0BYfLnvlJRcQF6pwhqbZkwzcQUsIEXEqwlVBISS6FCKIAEd3IS0vUVA4cz0fp0KIsA45HCS5s3UpRIW6ilWfTwUrkoPLrne9a3vHu9M/bLAJJmd4Bo7A7/OPtc/MPjO7Wv/meZ55ZsbjOI6DiMgN8v6hd0BEvtwUIiJiRCEiIkYUIiJiRCEiIkYUIiJiRCEiIkYUIiJiRCEiIkYUIiJiRCEiIkYUIiJiRCEiIkYUIiJiRCEiIkYUIiJiRCEiIkYUIiJiRCEiIkYUIiJiRCEiIkYUIiJixDxEMm2kHltMdOVhMp9b1L+zmmjk4FXl7minpypC15vtN6V2ERkd11oizkc/I/VuzK3qRORLwrUQ8RSksX9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NTxDhwg+9FhkiOdYh03g8D9Z+nddYpsBrIf19F7upTAwyHDz5aPNbOU/kP12ClwzjXQ11SMFTatV+4WLk82CxFcWArjZhGYav3+1W8C67tVWP+7j67wEhJvRvGOc6dez7QZ+IvGYs2ddDkcrWXLCSQOEp//JIm9UXzTQpC6eHUAlMwjd0U+6SeXEnu0BtsXGjoNWzKP/E0zcHauI1YRIV7Thnda6QgBHCJn81qs1j10zYzQ9YMWrBefJWei+Wfz/e3T5H61ke65EWLLjsLyp8nV6V0ZJV2AJyJGNO1dRIwoRETEiEJERIwoRETEiEJERIwoRETEiEJERIwoRETEiEJERIwoRETEiEJERIwoRETEiEJERIwoRETEiEJERIwoRETEiEJERIwoRETEiEJERIwoRETEiEJERIz8P2hqG1H2SJARAAAAAElFTkSuQmCC) ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAREAAABkCAYAAAChDARIAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAAudEVYdENyZWF0aW9uIFRpbWUARnJpIDI4IE9jdCAyMDIyIDA1OjA5OjA0IFBNIENFU1SaQQ0oAAAN0ElEQVR4nO3df3DUdX7H8edm97ubHyYmCGakwPViHKCM3DVIZK8InjAoDhQoZ24mAQsW0TvANqIjIwrqgYMeGOuJFsQjNRc9I9fjh0NOJiKod0nPI06h6Zg2xhFSrzEpu9mwm/2R3W//2ADBhBvgs2CR1+MfZr+fb97fzy67r/18P/vZ7zps27YREblAaV93B0Tk8qYQEREjChERMaIQEREjChERMaIQEREjChERMaIQEREjChERMaIQEREjChERMaIQEREjChERMaIQEREjChERMaIQEREjChERMaIQEREjChERMaIQEREjChERMaIQEREj5iESbyU0fx6+JbuIf6Wpd/MKfCU7BmxPjTZ6SkvoerXtolQXkXOTspGI/dFbhN72p6qciFwmUhYijuwosReqiXanqqKIXA5SFCIWafPLcHOQ0LZmBv1JPX8dgeIVhJpOb4q9sALfkloSAN11dBev4MSr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8i/M83/3Ps46jyIvLV0306CTsBnCvLkiGXUaM+PbnCH7YlnzX/gLSJp9fFxKdPuzD1QS81ac35k4fOGHd6cPOyyMt8+QWi7T8q7Db/djknzV8z4kLzjwPi6Xyx1blGyiFTw8L19xbcJTXEsk5RsJ7F+5s69S5P4B9uJpgZYzMbT/DnQ/xqlUEDp9uj1XvIv7tAqjZQXT+MtyZA49y7tzJYw42MWHCOQb3ZD/hmr3YoQlkjklujv+igp6jM8l+/RGcnhjh8jKiZ6sRH7zFkXcVDu9Srt48/U8OER1D83AEPiERATIBYiTaT+AYl2sWIOSRlhck3hkEsoAYducJHDeY1pVvspSuE3EUTsd9TT092/xYc8cPfOL5gsm5hHiQxGeHiBxsg76Xmn10F6F/ycKz4XEyxv2Bnm2mHy1aOIcPId5QTzwSI15fR7TFqOCputZtN5KoqcOe7E2eygCJvvtGNEj8473EmmCwmVVHfj5pvmZiTUHs7lYibx8+FXRpkybh+mQXof3t2EDio10EB/uIdfgk3DccIbzlEIk4JD6uIdxYgPu2fMP7loU1uYDenbXEQmAfrSPSkIflNa0r32QpXmyWj2d2AQy/Bff4gR/tOibfRUZRKz3zF9P1UB2MGYOjN0gCP5GNb2HPKiN9VC6eH8/F8avthA1f9NbdpVifV9LlLaP7VR9pZ5moPV+Ookm4codgTRt9KiithYtwd+8gMOM+urf5cBblQ+j4wAAYOp2MxVlE71uAf1YFMWf+6Y9hh04na90k7M0r8ReXEKhoJa2oYJBRQD7p68uxWl6ha3IJXU82Y615kPRR5vfN+TfLyfhWPSemleBfuBcWLSdjtHld+ebSF/BExIiWvYuIEYWIiBhRiIiIEYWIiBhRiIiIEYWIiBhRiIiIEYWIiBhRiIiIEYWIiBhRiIiIEYWIiBhRiIiIEYWIiBhRiIiIEYWIiBhRiIiIEYWIiBhRiIiIEYWIiBhRiIiIkf8DbgTi32KEe1QAAAAASUVORK5CYII=) ### Non-existing option[​](https://docs.viktor.ai/docs/create-apps/user-input/input-validation/.md#non-existing-option "Direct link to Non-existing option") The selected option is no longer available, for example due to [dynamic options](https://docs.viktor.ai/docs/create-apps/user-input/options-and-selections/.md#dynamic-options): ``` OptionField("Please select...", options=dynamic) # also on MultiSelectField / AutocompleteField ``` ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAREAAABkCAYAAAChDARIAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAAudEVYdENyZWF0aW9uIFRpbWUARnJpIDI4IE9jdCAyMDIyIDA1OjEwOjU4IFBNIENFU1TaY9ZsAAAQWUlEQVR4nO3dcUyUd57H8fczzzzPwAwotqZzcdFEzg1ku9oUa8NEIxer3tFrI66WpmoTTTxsipql26bcYWtqZQO7rl5aaIrnRW49bGptVtOLJMqa6tpA0mBTqIlkPUyUNjs96oDDPMPMM88898cgKCKgD2Ld/b4SEofnN7/f73n4zcff7/fMgGLbto0QQtwj14PugBDi4SYhIoRwREJECOGIhIgQwhEJESGEIxIiQghHJESEEI5IiAghHJEQEUI4IiEihHBEQkQI4YiEiBDCEQkRIYQjEiJCCEckRIQQjkiICCEckRARQjgiISKEcERCRAjhiISIEMIRCREhhCMSIkIIR5yHiNWFsWY115646WvJK/TtbMIM3yjTRn9hCeGTjlv7kTAZKC+ht6oD+Xsb4m+de3Kq0XC9/CYZxX4gjv2XTmL7DtJfAdPqilAnp5G/TlYXRkkFibX7mfZS1oPujRB3bZJCBJQZftzzslMP5uXgnhakb/MJYpeK8M6drFaEED82kxYiIynzclBpJvktMEqIJM81EtnXROJqHGVeAE9lKemP+wCwL5/F2PMJ8S+7Id2PWrwR3/YCVBXAJHFsP5H6M1hBUOYtJO1ft5L+pG+w5gjmof0Yh1qwenVci4vxVq5FnzlKJ3s6MKr2E/uiG1v3435uHb7ypaie1GH7SivGrxuIn78Gj+aglW3F91w2yihVjVnWChKv+w+ix9uxwjquxUV4K9ejBRvoe/k4SQuo3sS1z9Yz/fBambmJh8r921jtCZEkA2XG7YfsC42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AaP5qCVbUUdZSmhbdmKp3If15cdRJmThzpDH73KmcvxvROkf9cWentAWVSMd1dBKhkDpfg212JsWU805sNVWIKvfD4KjBMAWejPLyBWU8r18F6mbywkbXsbxuulxNyz0VblomZGUsEy4VvXftJ2bsR651366iOpc68oR3d461vJL8Cd1YHyTO7Qi0VZ8gLpp/cRXbMJY9ZCPIE8lG8jJBn7f4wJX3OAzIVo+T6SPy8YWgmO1e6tP+Js0rYvJ7zzNULv+1CL8nCpkeFjdxojl1sxdnXg+XgHaaNtrl4+Tjj/eKovWdm415TjLZKlzFSQD+AJIRz5cbztXQjx0JIQEUI4IiEihHBEQkQI4YiEiBDCEQkRIYQjEiJCCEckRIQQjkiICCEckRARQjgiISKEcERCRAjhiISIEMIRCREhhCMSIkIIRyREhBCOSIgIIRyREBFCOCIhIoRwREJECOGIhIgQwpH/B235y9zzbjeWAAAAAElFTkSuQmCC) ### Non-existing coordinate[​](https://docs.viktor.ai/docs/create-apps/user-input/input-validation/.md#non-existing-coordinate "Direct link to Non-existing coordinate") Invalid latitude / longitude pair in a `GeoPointField`: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgoAAAB8CAYAAAAIJZigAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAAudEVYdENyZWF0aW9uIFRpbWUARnJpIDI4IE9jdCAyMDIyIDA1OjMxOjAzIFBNIENFU1RF5nrRAAAW8ElEQVR4nO3df3RU9Z3/8efkzo9kkkCgSFpN2CMbS2yKrcFS8l1WOCQbFquFrmzcInahpaCCnCL1mAWBIz9cWIW4Cm6hWLKNwbM0bsF6SOGkfoHyXThfD/FbaPwmNYaaZN2NUCa/Zibz487dPxJI0Fx+TkyQ1+OcOSdzf3w+75lz7p3XfO5nbhyWZVmIiIiI9CNhsAsQERGRoUtBQURERGwpKIiIiIgtBQURERGxpaAgIiIithQURERExJaCgoiIiNhSUBARERFbCgoiIiJiS0FBREREbC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ouiHb/5cjNw+krJ9w4Ces4uFeOxQGQFMHctQX/0ebub/MfQcLkS7dqtXZC6mgM7xWUkDoed+52wsdbMWpP4Zg6GwPA4yJWXU5g5SnMENDaArlX9+qssy1YgRMEC4sIXliaSUIHkDWTlA0RgjvX07YajMLZeJcVDN2fmIiIiNj4bCYzGtm4J7fStWc/VmAC3uzuxeZrJQQbZ5C6+2kMT4SuZQ/T30WEvhxpIyHwMbEodH/qX0oyrmnZBA/uJdSYhrskHQDrZDn+0gjenS/jTgezrJj2k5dopp85EI7UEThG3It3/zLcnovXWa3NWGNnkFI6G6ujga6nVuN/LZvhCzMuV7CIiMiQ8hl9yXXhmjae2J4qrMl53ZcdgJjP3z2SEPZjvrufSA39fihfJH087ttPEvr37lGI2MkTmP3OUeiWMDkPo3ofEc89uMf0LOzp1zL9xE6fIHS4GfqLKEY6CV9oIXK0GSvUSuSNI0TP1zdmAu5bTxLcfoqYCdZHJwi8UNW9/vf76FxUSqgFHN5kHKkuiISvcg6EiIjI4PvMRsMduZNwpo3ElT+u+7ID4HpkHu6OCtoLF9Gx04eRmw6Bc5f5QM0gcc3DJPyymNb8R+nY1QKp/c9RACB1Aq7cZBLyJ10YgHBM/luSchsIPjifth9XQXY2jqi/n5s7ZZC4tACr9El8f7mMwOlkEow+6zYtwvneNtryimj9wS+IZWdjGOCYPA/vAz6CRUX4Ji+nK/otvN8be+F1i4iI3Cj0b6ZFRETElubXiYiIiC0FBREREbGloCAiIiK2FBRERETEloKCiIiI2FJQEBEREVsKCiIiImJLQUFERERsKSiIiIiILQUFERERsaWgICIiIrYUFERERMSWgoKIiIjYUlAQERERWwoKIiIiYktBQURERGwpKIiIiIgtBQURERGxpaAgIiIithQURERExJaCgoiIiNhSUBARERFb/wO7pfO5zVYrjgAAAABJRU5ErkJggg==) ### Invalid color value[​](https://docs.viktor.ai/docs/create-apps/user-input/input-validation/.md#invalid-color-value "Direct link to Invalid color value") Invalid value in a `ColorField`: ![](/assets/images/input-validation-color-7460e78b5e21ddf86bde62b668647660.png) ### Invalid date format[​](https://docs.viktor.ai/docs/create-apps/user-input/input-validation/.md#invalid-date-format "Direct link to Invalid date format") Format in a `DateField` which does not adhere to *YYYY-MM-DD*: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAREAAABkCAYAAAChDARIAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAAudEVYdENyZWF0aW9uIFRpbWUARnJpIDI4IE9jdCAyMDIyIDA1OjEzOjAzIFBNIENFU1TJgVEFAAAOqklEQVR4nO3dfVBUV5rH8W/TLxchIDgCszOQbJSaSDq6STtqeteNTl4wWovGGUNlB0miYaNGY+E4UYKJRCeymIzRSjSuxiEmhmQGyajJlkbLnZiXXVKb0FZgO6uzSGrEzS6QSmNDN9xumrt/8M420HIbBpLnU+Ufdp9+zgNV/ePcc2/3NWiapiGEEMMU8eduQAgxvkmICCF0kRARQugiISKE0EVCRAihi4SIEEIXCREhhC4SIkIIXSREhBC6SIgIIXSREBFC6CIhIoTQRUJECKGLhIgQQhcJESGELhIiQghdJESEELpIiAghdJEQEULoIiEihNBFQkQIoYuEiBBCF5PuCoEavJkbaa3u+K8hJo4I2zyUVfcTaY3WXV4IMbaFaSViJiL7KWKPv0TMy+tQfnCBlpw8vOf9IVfwbV+B64kPkZvgCDG+6F+JdDLEJ2G6MRlIxjRjBhE8juf5E1jeXBa+SYQQY84I7YmYsSy7m4jqcnydhzk01dC6PY/GuZl8M3s5VzeU4WsEAhU0z1tK89uNaGd247JtpbWp4yXa5U/wrF6Na3YmroV5NP/zFVmpCDHGjNzGakoyEcZaApf9gAd1+1ZaaqYTdfggE3+3AXNdKZ7dFWjGmUSfeYPr7ovGcOda4sqfRokBmqrwrN1L200Pc13ZC1y3Kom2HTtpcY5Yx0KIYRi5Iw2TGYMFNC+ABfOq7cROnoIxDmAmSsYU1GMXCDATkxINRjOYLBgUMwag/cxR/BMWErP+dkxG4PpH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Fwim8r9egGacTfbyISGs05h2vEvv3SUAjrQUv4L/xUSZ+VELMUhet204EDzwhviNG5HDGMHsRE26LwxAzBbNtElpdIxpgusuG9q8O2oG2cxUw7w5MRsD2c2JeXoElDgyT7ZineWiv8ww+SV0Fvi+noeRMJ0KJxph+N6Y4S9Ch2qef0HbjQibcmYQhKglzho2IrnvTxP2Y6EN5TLBGgzEJy+3JaLX1A8xZjvr51M45zZh+ugjTV5X46ob5ixLiW2AUvu3d3H2TbIPNjslVgu/y7WifgGXLFAwAE/wEXn0Bz8dXOg4zvoKIuYNX1RqbISYR44B3puvR3tgM308KnpiKmXZHCd4tVQRUoLEObAPM+XUdmreClvRMWrofTSGiCUgaug8hvo1G95YRxmlY5jbSWnoSzTuTqGkdDwfe2E3L5YXEvLkZo+KndUMWAxyYdDPETQJvPe1twBD3so2Ii4dGFxp0hFYvWmUJnsN+og69hCUJAkfycFcOMGdMPIb4O4g6uQGL3LZOCGDUz86YMd85nfbSs2hz7R2HMkC7y9OxAvF5CJw/id8JQ240JE3HcmMl6u87Vi/tlRUEBtgTMcyaiem/ztJa6QH8BMqraO+q3zm3FvDQ/mUF6gdXoDvCrgOjj/avOw7HuH4mlh9U0nKg4/XaVxV4f32WNtkUEd9ho36K12C7HVPcJMx33dS9KjBnP4ylqQx3+iqaDrkw2pLA+w2Df9FJMpEFWUQcy6PxrtU0vVoHMcH3RJh8N1Gbb8L/y1W4Fv4Cr9OCoTPADHPvZ4KthpafreDqL8/CtGkY2jydF7fFYcmYQfvOR3EfvtIx585VmL7Yx1V7Jo2PHKV92jSMQ6yEhPg2ky8lEkLoMr4uNhNCjDkSIkIIXSREhBC6SIgIIXSREBFC6CIhIoTQRUJECKGLhIgQQhcJESGELhIiQghdJESEELpIiAghdJEQEULoIiEihNBFQkQIoYuEiBBCFwkRIYQu/wdo7vGkA+SANAAAAABJRU5ErkJggg==) ## Specific input validation[​](https://docs.viktor.ai/docs/create-apps/user-input/input-validation/.md#specific-input-validation "Direct link to Specific input validation") Custom logic can be implemented in the application code to handle specific or more complex validation. This is achieved by means of raising a `UserError`, accompanied by the input violations: ``` import viktor as vkt def calculate_block_volume(params): block_width = params.width block_length = params.length block_height = params.height violations = [] if block_width is None: violations.append(vkt.InputViolation("Input 'width' cannot be empty!", fields=['width'])) if block_length is None: violations.append(vkt.InputViolation("Input 'length' cannot be empty!", fields=['length'])) if block_height is None: violations.append(vkt.InputViolation("Input 'height' cannot be empty!", fields=['height'])) if violations: raise vkt.UserError("Cannot calculate block volume", input_violations=violations) return block_width * block_length * block_height ``` A `UserError` can be raised on the following actions: * [action buttons](https://docs.viktor.ai/docs/create-apps/user-input/action-buttons/.md) * [view calculations](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md) * next-button on a [Step](https://docs.viktor.ai/docs/create-apps/layout-and-styling/steps/.md#validation-of-user-input) The message defined in the `UserError` functions as a generic message to the user, while the message in the `InputViolation` is shown on the field itself and can be more specific: ![](/assets/images/input-validation-usererror-c69ec122e6953b07bd999c7964b02186.png) Multiple fields can be passed to the `InputViolation` if the message holds for all of them: ``` violations.append(InputViolation("Input cannot be empty!", fields=['width', 'length', 'height'])) ``` ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAxYAAAB9CAYAAAA/ZfWjAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAAtdEVYdENyZWF0aW9uIFRpbWUATW9uIDMxIE9jdCAyMDIyIDA5OjAwOjAwIEFNIENFVL14oDsAAB2gSURBVHic7d1/bFTnvefx95kzZ8aesWFM2Fgihr24VFilOKqJI6xSvCIuvc62wr2krgqbu0Y3NVFJsktCGquERCWhMrckrJofKjQR3qUmujTZBSWNtVwHBcKVrRKoCkkXK9T0goM6KcWD7bE9c+bM2T/G2Pzw2E6OCRA+LwkJ5jnnOc+Yeb7n+T7PM8eG67ouIiIiIiIiHviudwNEREREROTmp8RCREREREQ8U2IhIiIiIiKeKbEQERERERH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p5fJgk2riIQBGPR98gt62Rg+SourGuFkhKMVLbtPhMUWUx4SxXutseIVaym70ARuVtWYg11oKv7z6UCGCUFOD9/iFhlAwn+M+E1mTjI9CrCzy7EfemxzPvY2omvrHiUFcHJiwPZYjJECHynlPTmenqaujLHmsVYiwoxvrJgZBKCGMlfNDLw7s3wuwXkhmHmYXQ207NkJT2bO/Gv/yHB6QBF5DxShdv0KN3fWEv/qTC+Sz7XY/at6VWEf1pGauNqYotWEz9ZQahhIT7Aur+OQO/r9CxdTe8r3ZhlhdB/3tO9y6ioJ/xAmMTqlcTuaSARqCW8dn72/nOZ7HHAqKwjvCJAYvUquhetJt6Wh/XVUVYQJhwvJvBessTkUcdfMxYQmGNlvm9xsYLEEQbWbb/5f2+HfGaG67qf+1jQea2BnqM1RH6+UFtnrrPM42bjhN6qHx4MjXvO4e1c2FnMlF+MvU1DJLuhR9GWb2dK7afchCyT7rPE5NT2x4gHfjzuNg2RrIYeRet7+TlCc653Y251nyUmxxh4cAPuj14gVHpNGyc3EY0L5VNxY50M7jyKubRCHx6RW1T69EEG37ZGtn6KyK3FsXEO7Sb51wVYozz+X25dGhvKxDntxL/dQCJ4H6HqbF/oEpEvMvf32+n5/g7cmvrhrZ8icmtJNTXQ83QnVsP3JrzbQW4N12UrlIiIiIiIfLFoxUJERERERDxTYiEiIiIiIp4psRAREREREc+UWIiIiIiIiGdKLERERERExDMlFiIiIiIi4pkSCxERERER8UyJhYiIiIiIeKbEQkREREREPFNiISIiIiIinimxEBERERERz5RYiIiIiIiIZ0osRERERETEMyUWIiIiIiLimRILERERERHxTImFiIiIiIh4psRCREREREQ8U2IhIiIiIiKeKbEQERERERHPlFiIiIiIiIhnSixERERERMQzJRYiIiIiIuKZEgsREREREfFMiYWIiIiIiHimxEJERERERDxTYiEiIiIiIp4psRAREREREc+UWIiIiIiIiGdKLERERERExDMlFiIiIiIi4pkSCxERERER8UyJhYiIiIiIeKbEQkREREREPFNiISIiIiIinimxEBERERERz5RYiIiIiIiIZ0osRERERETEs/8PizxgsdPJbRcAAAAASUVORK5CYII=) In case there are multiple issues with a field, multiple messages can be provided: ``` violations.append(vkt.InputViolation("Message A", fields=['field'])) violations.append(vkt.InputViolation("Message B", fields=['field'])) violations.append(vkt.InputViolation("Message C", fields=['field'])) ``` ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQ8AAAB9CAYAAAC8suZAAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAAtdEVYdENyZWF0aW9uIFRpbWUATW9uIDMxIE9jdCAyMDIyIDA4OjUxOjA0IEFNIENFVP0Q52cAABP5SURBVHic7d1/cBT1/cfx597m7nK5BHKSGECiiNBgKVFMCGZEdJRv/BWmIJKqoAMjI1aknVRsmQElIlihaKZfEMGhhZl+o/U30doMKe0YShvCj4qJlgTSyBBFDhIuueTukrvc7fePIwdJLhXWNQnh/ZjJH9n97O7nNrlX9vO53XcUTdM0hBDiIpn6uwNCiEuThIcQQhcJDyGELhIeQghdJDyEELpIeAghdJHwEELoIuEhhNAlxsid1dfXU1paSk1NDYFAwMhdDypms5m0tDRycnJITU3t7+4IoYti1B2m9fX1bNiwQULjIpjNZpYsWSIBIi5Jhg1bSktLJTguUiAQoLS0tL+7IYQuhoVHTU2NUbu6rMh5E5cqw8JDrjr0kfMmLlXyaYsQQhcJDyGELhIeQghd+iw8VFWlsLCQhx56qMe6ESNGUFhYSE5OTl9153uzZMkSZs+e3d/dEOJ71+dXHunp6Vit1i7LsrKyCIVCfd0VwzkcDkaMGMGkSZNQVbW/uyPE98rQO0wvxPHjx7nxxhupqKgAwlckmZmZHD16tEu7a665hry8PBwOB4cPH+att97C7/djMpm4//77uemmmwgEAvzlL39hz549AIwePZo5c+YwbNgwjh8/TlFREc3NzQDcdttt3HHHHaiqSkVFBR999FHkWDk5OUybNg2Px8PRo0eJj49n+/btQDjY7r33XhRF4R//+Md/vS8jMzOTyspKUlJSuP766/n888+N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+o86+wvxXNC3QE0Brq8H9UheYPXOR4/wz+1cto/b86QphRkuxn5yG6t2unY8dGvNtqwufIuZvAZ/GoY+29vPZivH9znp3QLMbzh5oL65c6BvP/mAlseZdAE2jOvXjfqCcmNzP6L4avEt9jL+Dd70FT7Zgcdug4GzJNdfj3O2X+4zLS51ceMIrYtYsIrXqV5uwzMGwM5sVPoUYZMpgXPYV1eSHuO7ahXD0e1WGJvsuk6difd9K6ahFNDaBMnkncqpvDb4Dsx7Ev3Ih30Vx87XZMt+Vhz+/lL2sXiVhmpNO+9nHcLa8wdP5txP7sIN6lj9Mek4r5x2moCZ5woFzwR9ApxK6cT/D5F2je4gm/9mX5WHpsn0Lsc48TWlUYPkcJqcTMz8c+OcoQLmk69tVOPOufpmmZH2VsNtbl917wPIR54a+wrd+IJ/dtNGsKMY/8Avs9vYxDEqcRt7IOz6pFNDn9MDYb28rpqID2r2K8m6/E/mbvczhicJFiQEIIXWSoKoTQRcJDCKGLhIcQQhcJDyGELhIeQghdJDyEELpIeAghdJHwEELoIuEhhNBFwkMIoYuEhxBCFwkPIYQuEh5CCF0kPIQQukh4CCF0kfAQQujy/wBA+5miAN8eAAAAAElFTkSuQmCC) When you are using a nested parametrisation, you can refer to the field als follows: ``` violations.append(vkt.InputViolation("Message A", fields=['my_page_name.my_tab_name.field'])) ``` Invisible fields Be careful with marking fields invalid which have dynamic visibility. A user will not be able to fix an invisible field and might be stuck in the validation process! --- # LLM chat New in v14.21.0 A `Chat` enables the user to have a conversation with an LLM from within the app editor. ![](/assets/images/chat-73edacc407999cf81f9358cca8e66cc3.png) ``` import viktor as vkt class Parametrization(vkt.Parametrization): chat = vkt.Chat("Chatbot", method="call_llm") class Controller(vkt.Controller): ... def call_llm(self, params, **kwargs): conversation = params.chat messages = conversation.get_messages() ... # here code is added to call the LLM return vkt.ChatResult(...) ``` The `Controller` accesses user messages by calling the `get_messages` method on the `ChatConversation` object obtained from `params.chat` [`get_messages`](https://docs.viktor.ai/sdk/api/api-v1/.md#ChatConversation.get_messages) can be used to get the full history of the conversation, which returns a list of messages with format, where 'role' indicates who sent the message (user or assistant): ``` { 'role': str, # user | assistant 'content': str, # the actual message } ``` The current state of the conversation is sent to the LLM and retrieves its response, which is returned from the Chat method within a [`ChatResult`](https://docs.viktor.ai/sdk/api/result/.md#_ChatResult). Before the controller can pass the retrieved conversation history to any LLM client, the application must have access to a valid **API key**. The following section will explain how this is done for the different providers ## API key configuration[​](https://docs.viktor.ai/docs/create-apps/user-input/llm-chat/.md#api-key-configuration "Direct link to API key configuration") Integrating a Large Language Model (LLM) into a VIKTOR application requires an API key from the chosen LLM provider. This key must be securely stored and made accessible to the application using environment variables. ### Obtaining an API key[​](https://docs.viktor.ai/docs/create-apps/user-input/llm-chat/.md#obtaining-an-api-key "Direct link to Obtaining an API key") API keys are obtained directly from the respective LLM provider. The table below provides links to pages where you can find or generate your key toeg: | Provider | API key link | Safety | | ---------------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | | **OpenAI (GPT)** | [API keys](https://platform.openai.com/api-keys) | [Safety tips](https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety) | | **Anthropic (Claude)** | [API keys](https://console.anthropic.com/settings/keys) | [Key safety](https://support.anthropic.com/en/articles/9767949-api-key-best-practices-keeping-your-keys-safe-and-secure) | | **Google (Gemini)** | [API keys](https://aistudio.google.com/app/apikey) | [Security](https://ai.google.dev/gemini-api/docs/api-key#security) | ### Setting API keys as environment variables[​](https://docs.viktor.ai/docs/create-apps/user-input/llm-chat/.md#setting-api-keys-as-environment-variables "Direct link to Setting API keys as environment variables") You can set environment variables directly when running VIKTOR CLI commands using the `--env` or `-e` flag when running the `install`, `start` and `run` commands. For example, to start your app with a specific OpenAI API key: ``` viktor-cli start --env OPENAI_API_KEY="your-api-key" ``` Replace `"your-api-key"` with the actual API key you want to use for this session. The CLI will connect the local app code to your VIKTOR environment as usual, but with the addition that the environment variable has been set on the running Python process. ### Accessing API keys in application code:[​](https://docs.viktor.ai/docs/create-apps/user-input/llm-chat/.md#accessing-api-keys-in-application-code "Direct link to Accessing API keys in application code:") Environment variables can be accessed within `app.py` or other relevant Python modules using the built-in `os` module in combination with the `os.getenv()` function. ``` # app.py import viktor as vkt import os # Example: Accessing OpenAI API Key OPENAI_API_KEY = os.getenv("OPENAI_API_KEY") # OPENAI_API_KEY is now available for use with LLM clients if set in the environment class Parametrization(vkt.Parametrization): chat = vkt.Chat("Chatbot", method="call_llm") class Controller(vkt.Controller): parametrization = Parametrization def call_llm(self, params, **kwargs): conversation = params.chat messages = conversation.get_messages() ... # here code is added to call the LLM return vkt.ChatResult(...) ``` ## Calling the LLM from the controller[​](https://docs.viktor.ai/docs/create-apps/user-input/llm-chat/.md#calling-the-llm-from-the-controller "Direct link to Calling the LLM from the controller") With the correct API key set up, we can connect the app with the actual LLM. A multi-turn chat workflow can be implemented for each of the main LLM providers as shown below. Each provider requires the installation of its corresponding Python client and may need specific handling of the chat history to meet its role formatting requirements (e.g., user, assistant). * Viktor LLM * Anthropic Client * OpenAI Client * Gemini Client New in v14.29.0 The Viktor LLM service uses an OpenAI-compatible API — no external API key or third-party account is required. Add the `openai` Python library to your `requirements.txt` and reinstall before using this client. ``` import viktor as vkt from openai import OpenAI # don't forget to add in requirements.txt and re-install client = OpenAI( base_url=vkt.ViktorOpenAI.get_base_url(version="v1"), api_key=vkt.ViktorOpenAI.get_api_key(), ) class Parametrization(vkt.Parametrization): chat = vkt.Chat("Chat", method="call_llm") class Controller(vkt.Controller): parametrization = Parametrization def call_llm(self, params, **kwargs): conversation = params.chat if not conversation: return None vkt_messages = conversation.get_messages() messages = [ { "role": "system", "content": "You are a helpful assistant that responds with simple but formal British English.", } ] messages.extend(vkt_messages) completion = client.chat.completions.create( model="openai.gpt-oss-120b", messages=messages, ) return vkt.ChatResult(conversation, completion.choices[0].message.content) ``` Remark When using Viktor LLM's chat completion API, prepend a `system` message to the history manually, as VIKTOR's `ChatConversation` does not include the `system` role by default. For streaming responses, the LLM client yields parts of the response as they are generated, rather than waiting for the complete response. This can improve perceived performance for the user. The `ChatResult` can accept an iterable of strings for streaming. ``` import viktor as vkt from openai import OpenAI # don't forget to add in requirements.txt and re-install client = OpenAI( base_url=vkt.ViktorOpenAI.get_base_url(version="v1"), api_key=vkt.ViktorOpenAI.get_api_key(), ) class Parametrization(vkt.Parametrization): chat = vkt.Chat("Chat", method="call_llm") class Controller(vkt.Controller): parametrization = Parametrization def call_llm(self, params, **kwargs): conversation = params.chat if not conversation: return None vkt_messages = conversation.get_messages() messages = [ { "role": "system", "content": "You are a helpful assistant that responds with simple but formal British English.", } ] messages.extend(vkt_messages) stream = client.chat.completions.create( model="openai.gpt-oss-120b", messages=messages, stream=True, ) text_stream = ( chunk.choices[0].delta.content for chunk in stream if chunk.choices[0].delta.content is not None ) return vkt.ChatResult(conversation, text_stream) ``` For more details on the Viktor LLM service — including the Responses API with tool use — see the [Viktor LLM](https://docs.viktor.ai/docs/create-apps/viktor-llm/.md) section. To use the Anthropic client, you need to add the `anthropic` Python library to your `requirements.txt` file and install it for your app. ``` import os import viktor as vkt from anthropic import Anthropic # don't for get to add in requirements.txt and re-install client = Anthropic(api_key=os.getenv("ANTHROPIC_API_KEY")) class Parametrization(vkt.Parametrization): chat = vkt.Chat("LLM Chat", method="call_llm") class Controller(vkt.Controller): parametrization = Parametrization def call_llm(self, params, **kwargs): conversation = params.chat if not conversation: return None response = client.messages.create( model="claude-sonnet-4-6", # check model availability: https://platform.claude.com/docs/en/api/messages#model max_tokens=1024, messages=conversation.get_messages(), system="You are a helpful assistant that responds using simple and formal British English." ) return vkt.ChatResult(conversation, response.content[0].text) ``` For streaming responses, the LLM client yields parts of the response as they are generated, rather than waiting for the complete response. This can improve perceived performance for the user. The `ChatResult` can accept an iterable of strings for streaming. ``` import os import viktor as vkt from anthropic import Anthropic # don't for get to add in requirements.txt and re-install client = Anthropic(api_key=os.getenv("ANTHROPIC_API_KEY")) class Parametrization(vkt.Parametrization): chat = vkt.Chat("LLM Chat", method="call_llm") class Controller(vkt.Controller): parametrization = Parametrization def call_llm(self, params, **kwargs): conversation = params.chat if not conversation: return None llm_response_stream = client.messages.create( model="claude-sonnet-4-6", # check model availability: https://platform.claude.com/docs/en/api/messages#model max_tokens=1024, messages=conversation.get_messages(), system="You are a helpful assistant that responds using simple and formal British English.", stream=True, ) text_stream = map( lambda chunk: chunk.delta.text, filter( lambda chunk: chunk.type == "content_block_delta" and chunk.delta.text, llm_response_stream ) ) return vkt.ChatResult(conversation, text_stream) ``` To use the OpenAI client, you need to add the `openai` Python library to your `requirements.txt` file and install it for your app. Remark When using OpenAI's chat completion API, prepend a 'system' message to the history manually, as VIKTOR’s `ChatConversation` does not include the 'system' role by default. ``` import viktor as vkt import os from openai import OpenAI # don't for get to add in requirements.txt and re-install client = OpenAI(api_key=os.getenv("OPENAI_API_KEY")) class Parametrization(vkt.Parametrization): chat = vkt.Chat("LLM Chat", method="call_llm") class Controller(vkt.Controller): parametrization = Parametrization def call_llm(self, params, **kwargs): conversation = params.chat if not conversation: return None vkt_messages = conversation.get_messages() openai_messages = [ { "role": "system", "content": "You are a helpful assistant that responds with simple but formal British English.", } ] openai_messages.extend(vkt_messages) completion = client.chat.completions.create( model="gpt-4.1", messages=openai_messages ) return vkt.ChatResult(params.chat, completion.choices[0].message.content) ``` For streaming responses, the LLM client yields parts of the response as they are generated, rather than waiting for the complete response. This can improve perceived performance for the user. The `ChatResult` can accept an iterable of strings for streaming. ``` import viktor as vkt import os from openai import OpenAI # don't for get to add in requirements.txt and re-install client = OpenAI(api_key=os.getenv("OPENAI_API_KEY")) class Parametrization(vkt.Parametrization): chat = vkt.Chat("LLM Chat", method="call_llm") class Controller(vkt.Controller): parametrization = Parametrization def call_llm(self, params, **kwargs): conversation = params.chat if not conversation: return None vkt_messages = conversation.get_messages() openai_messages = [ { "role": "system", "content": "You are a helpful assistant that responds with simple but formal British English.", } ] openai_messages.extend(vkt_messages) stream = client.chat.completions.create( model="gpt-4.1", messages=openai_messages, stream=True, ) # Stream text from the event chunks text_stream = ( chunk.choices[0].delta.content for chunk in stream if chunk.choices[0].delta.content is not None ) return vkt.ChatResult(params.chat, text_stream) ``` To use the Gemini client, you need to add the `google-genai` Python library to your `requirements.txt` file and install it for your app. Remark Google's Gemini client handles multi-turn conversations using specific types like `UserContent`, `ModelContent`, and `Part`. You'll need to convert the VIKTOR message format (`{'role': str, 'content': str}`) into this structure for the chat history. ``` import os import viktor as vkt from google import genai # don't for get to add in requirements.txt and re-install from google.genai import types client = genai.Client(api_key=os.getenv("GEMINI_API_KEY")) def viktor_messages_to_genai(messages): history = [] for msg in messages: role = msg.get("role") text = msg.get("content", "") if role == "user": history.append(types.UserContent(parts=[types.Part(text=text)])) elif role == "assistant": history.append(types.ModelContent(parts=[types.Part(text=text)])) return history class Parametrization(vkt.Parametrization): chat = vkt.Chat("Chatbot", method="call_llm") class Controller(vkt.Controller): parametrization = Parametrization def call_llm(self, params, **kwargs): conversation = params.chat if not conversation: return None messages = conversation.get_messages() history_msgs = messages[:-1] user_msg = messages[-1] history = viktor_messages_to_genai(history_msgs) system_instruction = "You are a helpful assistant that responds with simple but formal British English" chat_session = client.chats.create( config=types.GenerateContentConfig( system_instruction=system_instruction, temperature=0.5, ), model="gemini-2.0-flash", history=history ) response = chat_session.send_message(user_msg["content"]) return vkt.ChatResult(params.chat, response.text) ``` For streaming responses, the LLM client yields parts of the response as they are generated, rather than waiting for the complete response. This can improve perceived performance for the user. The `ChatResult` can accept an iterable of strings for streaming. ``` import os import viktor as vkt from google import genai # don't for get to add in requirements.txt and re-install from google.genai import types client = genai.Client(api_key=os.getenv("GEMINI_API_KEY")) def viktor_messages_to_genai(messages): history = [] for msg in messages: role = msg.get("role") text = msg.get("content", "") if role == "user": history.append(types.UserContent(parts=[types.Part(text=text)])) elif role == "assistant": history.append(types.ModelContent(parts=[types.Part(text=text)])) return history class Parametrization(vkt.Parametrization): chat = vkt.Chat("Chatbot", method="call_llm") class Controller(vkt.Controller): parametrization = Parametrization def call_llm(self, params, **kwargs): conversation = params.chat if not conversation: return None messages = conversation.get_messages() history_msgs = messages[:-1] user_msg = messages[-1] history = viktor_messages_to_genai(history_msgs) system_instruction = "You are a helpful assistant that responds with simple but formal British English" chat_session = client.chats.create( config=types.GenerateContentConfig( system_instruction=system_instruction, temperature=0.5, ), model="gemini-2.0-flash", history=history ) chunk_iter = chat_session.send_message_stream(user_msg["content"]) text_stream = (chunk.text for chunk in chunk_iter) return vkt.ChatResult(params.chat, text_stream) ``` ## Publishing an app[​](https://docs.viktor.ai/docs/create-apps/user-input/llm-chat/.md#publishing-an-app "Direct link to Publishing an app") For published applications, API keys can be set, updated, or removed from the **'Apps'** section in your VIKTOR environment. Once configured, these environment variables are securely stored and available in the application’s code during runtime. This replaces the use of `.env` files or passing keys through the VIKTOR CLI for deployed apps. Detailed guidance is available in the [VIKTOR environment variables documentation](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/environment-variables/). ## More info[​](https://docs.viktor.ai/docs/create-apps/user-input/llm-chat/.md#more-info "Direct link to More info") The technical API reference, can be found here: [`Chat`](https://docs.viktor.ai/sdk/api/parametrization/.md#_Chat) Expand to see all available arguments In alphabetical order: * **first\_message** (optional): the first message that will appear on top of the empty conversation ``` chat = vkt.Chat(..., first_message="How can I help you?") ``` * **flex** (optional): the width of the field between 0 and 100 (default=33) ``` chat = vkt.Chat(..., flex=50) ``` * **method** (required): the controller method that will be triggered when the user clicks the "send" button ``` chat = vkt.Chat(..., method='call_llm') ``` * **placeholder** (optional): placeholder message in the user prompt ``` chat = vkt.Chat(..., placeholder="Ask anything") ``` * **visible** (optional): can be used when the visibility depends on other input fields ``` chat = vkt.Chat(..., visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ### Limitations[​](https://docs.viktor.ai/docs/create-apps/user-input/llm-chat/.md#limitations "Direct link to Limitations") note The VIKTOR SDK currently supports only the **'user'** and **'assistant'** roles for messages within the `ChatConversation`. For other roles (e.g., 'system', 'tool'), additional processing may be required depending on the specific LLM client being used. note The maximum response size in the [`ChatResult`](https://docs.viktor.ai/sdk/api/result/.md#_ChatResult) is 75000 characters. --- # Map features The geo-fields, enable the user to define geo-objects on a [`MapView`](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#mapview) / [`GeoJSONView`](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#geojsonview). Reference For a more technical API reference, please see the following pages: * [`GeoPointField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_GeoPointField) * [`GeoPolygonField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_GeoPolygonField) * [`GeoPolylineField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_GeoPolylineField) ## GeoPointField - draw a point[​](https://docs.viktor.ai/docs/create-apps/user-input/map-features/.md#geopointfield---draw-a-point "Direct link to GeoPointField - draw a point") The `GeoPointField` enables the user to draw a point on the map. It should be used in combination with a `MapView` or `GeoJSONView`. ``` import viktor as vkt class Parametrization(vkt.Parametrization): geo_point = vkt.GeoPointField('Draw a point') ``` ![](/assets/images/geopointfield-da6f4fd062c334530f1aa80c5f122f5c.svg) The user input can be obtained through the **params** argument and can have the following values: * `GeoPoint` object: when a point is drawn (see [link geo-fields to a view](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#linking-geo-fields-to-the-view) for an example of usage) * `None`: when empty Expand to see all available arguments In alphabetical order: * **default**: a default value will be prefilled ``` geo_point = vkt.GeoPointField('Draw a point', default=vkt.GeoPoint(lat=51.9225, lon=4.4719)) ``` * **description**: add a tooltip with additional information ``` geo_point = vkt.GeoPointField('Draw a point', description="This field represents the ...") ``` * **name**: defines the position of the parameter in the *params* ``` geo_point = vkt.GeoPointField('Draw a point', name="g") # obtained using params.g ``` * **visible**: can be used when the visibility depends on other input fields ``` geo_point = vkt.GeoPointField('Draw a point', visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ## GeoPolylineField - draw a (poly)line[​](https://docs.viktor.ai/docs/create-apps/user-input/map-features/.md#geopolylinefield---draw-a-polyline "Direct link to GeoPolylineField - draw a (poly)line") The `GeoPolylineField` enables the user to draw a polyline on the map. It should be used in combination with a `MapView` or `GeoJSONView`. ``` import viktor as vkt class Parametrization(vkt.Parametrization): geo_polyline = vkt.GeoPolylineField('Draw a polyline') ``` ![](/assets/images/geopolylinefield-966ca2d5eda12142232d16939fb7321c.svg) The user input can be obtained through the **params** argument and can have the following values: * `GeoPolyline` object: when a point is drawn (see [link geo-fields to a view](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#linking-geo-fields-to-the-view) for an example of usage) * `None`: when empty Expand to see all available arguments In alphabetical order: * **default**: a default value will be prefilled ``` geo_polyline = vkt.GeoPolylineField( 'Draw a polyline', default=vkt.GeoPolyline( vkt.GeoPoint(lat=51.9225, lon=4.4719), vkt.GeoPoint(lat=52.3600, lon=4.8853), ) ) ``` * **description**: add a tooltip with additional information ``` geo_polyline = vkt.GeoPolylineField('Draw a polyline', description="This field represents the ...") ``` * **name**: defines the position of the parameter in the *params* ``` geo_polyline = vkt.GeoPolylineField('Draw a polyline', name="g") # obtained using params.g ``` * **visible**: can be used when the visibility depends on other input fields ``` geo_polyline = vkt.GeoPolylineField('Draw a polyline', visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ## GeoPolygonField - draw a polygon[​](https://docs.viktor.ai/docs/create-apps/user-input/map-features/.md#geopolygonfield---draw-a-polygon "Direct link to GeoPolygonField - draw a polygon") The `GeoPolygonField` enables the user to draw a polygon on the map. It should be used in combination with a `MapView` or `GeoJSONView`. ``` import viktor as vkt class Parametrization(vkt.Parametrization): geo_polygon = vkt.GeoPolygonField('Draw a polygon') ``` ![](/assets/images/geopolygonfield-f3ce137f0b77b118dbd948909756d4a9.svg) The user input can be obtained through the **params** argument and can have the following values: * `GeoPolygon` object: when a point is drawn (see [link geo-fields to a view](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#linking-geo-fields-to-the-view) for an example of usage) * `None`: when empty Expand to see all available arguments In alphabetical order: * **default**: a default value will be prefilled ``` geo_polygon = vkt.GeoPolygonField( 'Draw a polygon', default=default=vkt.GeoPolygon( vkt.GeoPoint(lat=51.9225, lon=4.4719), vkt.GeoPoint(lat=52.3600, lon=4.8853), vkt.GeoPoint(lat=52.0908, lon=5.1216), ) ) ``` * **description**: add a tooltip with additional information ``` geo_polygon = vkt.GeoPolygonField('Draw a polygon', description="This field represents the ...") ``` * **name**: defines the position of the parameter in the *params* ``` geo_polygon = vkt.GeoPolygonField('Draw a polygon', name="g") # obtained using params.g ``` * **visible**: can be used when the visibility depends on other input fields ``` geo_polygon = vkt.GeoPolygonField('Draw a polygon', visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ## Visualize geo-objects on the map[​](https://docs.viktor.ai/docs/create-apps/user-input/map-features/.md#visualize-geo-objects-on-the-map "Direct link to Visualize geo-objects on the map") The above geo-fields let the user 'draw' geo-objects, but does not actually visualize it on the map. If visualizing the geo-objects on the map is desired, this can easily be achieved by making use of the class-method on the corresponding map feature as described [here](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#linking-geo-fields-to-the-view). ## Interact with geo-objects on the map[​](https://docs.viktor.ai/docs/create-apps/user-input/map-features/.md#interact-with-geo-objects-on-the-map "Direct link to Interact with geo-objects on the map") In addition to visualizing geo-objects, it is also possible to let the user [interact](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md#interaction-with-map-selecting-objects) with the geo-objects on the map. --- # Numeric input Reference For a more technical API reference, please see the following pages: * [`IntegerField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_IntegerField) * [`NumberField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_NumberField) ## NumberField - decimal numbers[​](https://docs.viktor.ai/docs/create-apps/user-input/numeric-input/.md#numberfield---decimal-numbers "Direct link to NumberField - decimal numbers") A `NumberField` is a generic numeric field that can contain numbers with decimals. It can be visualized as numerical input or slider variant: ``` import viktor as vkt class Parametrization(vkt.Parametrization): number = vkt.NumberField('Insert a Number here') slider = vkt.NumberField('Adjust the Number', min=0, max=8, variant='slider') ``` ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARsAAABlCAYAAAB9ckckAAANNElEQVR4Xu2dWYxOSRvHaxLfWENj0vrTtrGHWGIJE8tgpok9SNy4cCMSa0SsQSIhIXREYkvEjQtxhRBLpGfoCYIIQUjEFvtHZ+husZPMvP/68rzK6bPUu3S9bzv/uqLfOrX8qup/nuepOuf88E8iKSYSIAESqGUCP1BsapkwiycBEtAEKDacCCRAAk4IUGycYGYlJEACFBvOARIgAScEKDZOMLMSEiABig3nAAmQgBMCFBsnmFkJCZAAxYZzgARIwAkBio0TzKyEBEiAYsM5QAIk4IQAxcYJZlZCAiRAseEcIAEScEKAYuMEMyshARKg2HAOkAAJOCFAsXGCmZWQAAlQbDgHSIAEnBCg2DjBzEpIgAQoNpwDJEACTghQbJxgZiUkQAIUG84BEiABJwQoNk4wsxISIAGKDecACZCAEwIUGyeYWQkJkADFhnOABEjACQGKjRPMrIQESIBiwzlAAiTghADFxglmVkICJECx4RwgARJwQoBi4wQzKyEBEqDYcA6QAAk4IUCxcYI595UcP35clZeXq1mzZqmuXbs6a1Cu6k2ng1++fFEvX75UHz58UFVVVaqgoEA1aNBAtWzZUtWrVy+dInmNQSDrYrN9+3b16NEjtWnTpliCvn37ttqzZ49q166dmj9/fg0G8vuIESPUuHHjnDHK1aLPVb2pgn3w4IF6+vSpguB4E4SmTZs2qn379qkWy/xxFpvanvwiJmA8depUNXjw4G8mHMUm/9bfrVu31IsXLyIbVlRUpLp16xaZjxn8CcTOsnEpNvXr11crV65UjRo1StKn2OTXUoRF8/DhQ+tGwbrp0KGDdX5m/ErAidgsW7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6RskISIAEKC22ABEjAOwEKi3ekrJAESIDCQhsgARLwToDC4h0pKyQBEqCw0AZIgAS8E6CweEfKCsuJwCuvvFJO3Uncl4ceesipDgqLEyZmIgESiEOAwhKHFvOSAAk4EaCwOGFiJhIggTgEKCxxaDEvCZCAEwEKixMmZiIBEohDgMIShxbzkgAJOBGgsDhhYiYSIIE4BCgscWgxLwmQgBMBCosTJmYiARKIQ4DCEocW85IACTgRoLA4YWImEiCBOAT+Dy2FypVGl/0CAAAAAElFTkSuQmCC) The user input can be obtained through the **params** argument and can have the following values: * `float`: when user inputs a decimal number (e.g. 1.5) * `int`: when user inputs a whole number (e.g. 1) * `None`: when empty (not applicable to the slider variant) Expand to see all available arguments In alphabetical order: * **default**: a default value will be prefilled ``` number = vkt.NumberField('Insert a Number here', default=7.5) ``` * **description**: add a tooltip with additional information ``` number = vkt.NumberField('Insert a Number here', description="This number represents the ...") ``` * **flex**: the width of the field between 0 and 100 (default=33) ``` number = vkt.NumberField('Insert a Number here', flex=50) ``` * **max**: when the user enters a value higher than the maximum boundary, the field is [marked as invalid](https://docs.viktor.ai/docs/create-apps/user-input/input-validation/.md#numeric-minmax-boundary) ``` number = vkt.NumberField('Insert a Number here', max=10) ``` See ['Setting min/max'](https://docs.viktor.ai/docs/create-apps/user-input/numeric-input/.md#setting-minmax) for more information on setting a dynamic boundary. * **min**: when the user enters a value lower than the minimum boundary, the field is [marked as invalid](https://docs.viktor.ai/docs/create-apps/user-input/input-validation/.md#numeric-minmax-boundary) ``` number = vkt.NumberField('Insert a Number here', min=0) ``` See ['Setting min/max'](https://docs.viktor.ai/docs/create-apps/user-input/numeric-input/.md#setting-minmax) for more information on setting a dynamic boundary. * **name**: defines the position of the parameter in the *params* ``` number = vkt.NumberField('Insert a Number here', name="n") # obtained using params.n ``` * **num\_decimals**: defines the number of decimals shown in the interface ``` number = vkt.NumberField('Insert a Number here', num_decimals=2) ``` * **prefix**: a prefix will be put in front of the ui name ``` number = vkt.NumberField('Insert a Number here', prefix="€") ``` * **step**: stepping interval when clicking the increment / decrement buttons ``` number = vkt.NumberField('Insert a Number here', step=0.5) ``` * **suffix**: a suffix will be placed behind the ui name ``` number = vkt.NumberField('Insert a Number here', suffix="mm") ``` * **variant**: the field can be shown as slider, in this case specifying a `min` and `max` is required ``` number = vkt.NumberField('Adjust the Number', min=0, max=8, variant='slider') ``` ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARYAAABbCAYAAAC2/KpJAAAPSElEQVR4Xu2de4wVRRbGDzGrYEAQyCBPHxBeg5EACpgxguIAGpZF4+Ar2c0u69u4S1DRqMuuJERBwIhREfkLjIzRBEwExjGAjwDhEYgOsEaIAoIQ5KH4Aszu/YqcSU3f7nurb9e909z5KpnwmKrqql+d+vrUqeruVv/LJGEiARIgAY8EWlFYPNJkVSRAAoYAhYWGQAIk4J0AhcU7UlZIAiRAYaENkAAJeCdAYfGOlBWSAAlQWGgDJEAC3glQWLwjZYUkQAIUFtoACZCAdwIUFu9IWSEJkACFhTZAAiTgnQCFxTtSVkgCJEBhoQ2QAAl4J0Bh8Y6UFZIACVBYaAMkQALeCVBYvCNlhSRAAhQW2gAJkIB3AhQW70hZIQmQAIWFNkACJOCdAIXFO1JWSAIkQGGhDZAACXgn0OzCsmDBAtm7d6+88MILpnPbt2+XTz75RO68807p1KmT9w4nrfDxxx+XXr16ycMPP5y0qnOm/JdffimLFi2SUaNGyc0339ws7f7555/lrbfekkmTJiWyiw8++EA6duwoI0aMKKgfv/76q3z//feCP/HTtm1b85NGWy2og54KeROWd999VzZu3Ch33323XHXVVc7NCwoLBn7t2rXyyCOPSM+ePZ3rKVXGYgsL6r/gggvkySeflAsvvDCrW8W+fhjHNAjLnDlzTNMefPDBUC6u479v3z5ZuHCh3HLLLbHE5cyZM7J792757rvvQi/VunVr6d27t3Tu3Nm1KWWdz5uwPPPMM/Lbb79J3759ZcqUKc7QgsLiXLDAjK7XU4FDX9AnTcWe2KgfCeIMkQ6mYl8/jcKCsVi/fn2k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YWImEiCBOAT+Dy2FypVGl/0CAAAAAElFTkSuQmCC) note The variants are ignored within a [`Table`](https://docs.viktor.ai/docs/create-apps/user-input/tables-and-arrays/.md#table) * **visible**: can be used when the visibility depends on other input fields ``` number = vkt.NumberField('Insert a Number here', visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ## IntegerField - whole numbers[​](https://docs.viktor.ai/docs/create-apps/user-input/numeric-input/.md#integerfield---whole-numbers "Direct link to IntegerField - whole numbers") An `IntegerField` is a numeric field that can contain integers only. ``` import viktor as vkt class Parametrization(vkt.Parametrization): integer = vkt.IntegerField('Input an Integer') ``` ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAABxCAYAAABvGp7oAAAIMnpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjapZhtdvQoDoX/s4pZghGIj+UgEOfMDnr5/eCqZN5UMme6MuWUTdmAQPfqSk7wv/69w7/4SLlayFpb6aVcfHLPXQaNdj0+4z7HK9/n+yPz2Ypf74f6bFzCrcQ1PX628rjGj/sf/Z7XOGjpHxO1+XxgXx/0/Jy/vUwkj0s6Kzrt9ZyoPydK8ngQnxOMx7au0lv9cwvmj+tz/MMNfMM55fZ12d9+V7y3FDtJxFNMF+eU5LGAdL4S0qDROKd0OsaUacdUOOe7a3w45Cc/fX46K9pnqfnHTl9Q+Wy9oPXEhK29oJXl2SW9OLl8Xn+8H6K+PEif9uVPy7k9W/L1vscH68L14v3z3Xu1fe+ZXYxccHV5bupji3eLfoaJY7oFllauyleZot5H52iwekKFdc3LOGbsUYBrxxxXHHFHv68zTpaYxYNUGiJT0n2zpSpdZnrgxxG31NTTAllJ84YdND/XEm+z/ZrhttawvCJdJTJZPLx49wjvDtj7hEK8XVwevmJdIsfZLOMgd850A5G4n07V28Efx+vn4JpAUI+XT4h0HGuPKUzjf5Qg3UAnOirXRwzGup4T4CJMK4uJCQRALSaNJV5VpMaIIx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00NjMxLWFjM2QtMzAyMjc1YTU4NDk1IgogICAgICBzdEV2dDpzb2Z0d2FyZUFnZW50PSJHaW1wIDIuMTAgKExpbnV4KSIKICAgICAgc3RFdnQ6d2hlbj0iMjAyMi0wOC0zMFQxNDoxNjo0MiswMjowMCIvPgogICAgPC9yZGY6U2VxPgogICA8L3htcE1NOkhpc3Rvcnk+CiAgPC9yZGY6RGVzY3JpcHRpb24+CiA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgCjw/eHBhY2tldCBlbmQ9InciPz4Vw5OpAAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5ggeDBAqFBwbsQAAC0NJREFUeNrt3V9MW2UDx/Gfr7gWYkYZvGWMUWZHkC0ZJbxZSqMm3Zzuj1EmN8ZwMWMaEnVLNDHc6MUSr/RiMWHeNLtwMY0XipoZx+LcqGMEugRCmSEMAaGMDci6FobAGGbvhekZh8L+OWbZvp9kyXL+9HnO6Tk/nuc5f/rEzZs3bwoAVoD/sAsAEFgAQGABILAAgMACAAILAIEFAAQWABBYAAgsACCwAIDAAkBgAQCBBQAEFgACCwAILAAgsAAQWABAYAEAgQWAwAIAAgsACCwABBYAEFgAQGABILAAgMACQGABAIEFAAQWHjOTk5Oam5tjR0BpqVKR48ePKxgMyufzqbi4mG/mMd8nIyMjGh4e1uTk5K2DNS1NOTk5KiwslNVq5QChhQVJOnz4sGpra1d82NXW1qqnp2dF1Xtubk5tbW26cOGCKawS80ZGRhQKhTQyMsKBSmAB/25YhcPhpKBazIULFwgtuoSp19KRpJdfflnHjh3T2NiYLBaLPB6P9uzZYyxXW1srr9er6elpdXR06Pr167Lb7XrjjTdUUFCQtNz8dXt6enTkyBF5vV5JUjAYNC3vcDi0f//+JesYDod18uRJjY2NSZKKi4u1c+dOo9zE51dXV6u3t9eon8PhUGVlpal+dyOxDenp6WpubtbExIRWr16tV199VS6XyygvIfH/zz77zJjW2NhoWre8vNy0Tx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pl588XmtWvXUbde930H3lAiswcFBbdu2TRs3btQ333xjPIrR2dmpvXv3qqysTN999x1HEJAigTU/rJ55pkAez//U3x9Ra2v7XYXWir5KePz4cUnSW2+9ZXpurLS0VK+88oo6OjroGgIppKWl3RRWkuR0OlRRUa5YbFwtLe3LUm5K3IeV+HGBhe9bkm69iC4SidAtBFJEQUGe1q7N0bPPbjRNdzodWrUqTbOzc8tSbkq0sBI/4RSJRJZc5nYv0gPwcDmdjqSwSli/fp2cTsejG1jPPfecJOnLL780vTc8Ho/r1KlTHB0AUqdLmBir+umnn7Rr166kq4R/N0EL+LYAAis11NXVKT8/Xz/88IP8fr/sdrvxvnW/37/o+BaAx0vKvw9r3759ampqUnt7O2+eBB6i293W0N8f0ezsDZWUJI9jXbx4SbOzc7cdx3okH34eHBxUU1OTysrKCCsghQwNXVZ7+3m1trYnBdmZM+c0NHR5WcpN2cDq7Ow0flL9gw8+4AgBUojHUy6bLdO4WTQRVq2t7bLZMuXxlC9LuSn1PqympiY1Nzfr3Llzxo9nfvLJJ3rhhRc4QoAUsmrVU9qx43n98stZ9fdH9OefUxodvSKbLVM7dtz50ZxHooXV3Nwsv9+va9eu6c0331RjY+OiP3QKIHVCy2bLfChhJfEjFACWcLdvHJ2dvaFYLK6sLNtdh9X9DrrzimQA/7illZv734dSFi/wA7BiEFgAVgzGsADQwgIAAgsAgQUABBYAEFgACCwAILAAgMACQGABQGpJiYefv/jiC74J4DHy3nvv3dd6PJoDgC4hABBYAAgsACCwAIDAAkBgAQCBBQAEFgACCwAILAAgsAAQWABAYAEAgQWAwAIAAgsACCwABBYAEFgAQGABILAAgMACAAILAIEFAAQWABBYAFac/wNjxVDd3Jq4mwAAAABJRU5ErkJggg==) The user input can be obtained through the **params** argument and can have the following values: * `int`: when user inputs a number (e.g. 1) * `None`: when empty Expand to see all available arguments In alphabetical order: * **default**: a default value will be prefilled ``` integer = vkt.IntegerField('Input an Integer here', default=7.5) ``` * **description**: add a tooltip with additional information ``` integer = vkt.IntegerField('Input an Integer here', description="This number represents the ...") ``` * **flex**: the width of the field between 0 and 100 (default=33) ``` integer = vkt.IntegerField('Input an Integer here', flex=50) ``` * **max**: when the user enters a value higher than the maximum boundary, the field is [marked as invalid](https://docs.viktor.ai/docs/create-apps/user-input/input-validation/.md#numeric-minmax-boundary) ``` integer = vkt.IntegerField('Input an Integer here', max=10) ``` See ['Setting min/max'](https://docs.viktor.ai/docs/create-apps/user-input/numeric-input/.md#setting-minmax) for more information on setting a dynamic boundary. * **min**: when the user enters a value lower than the minimum boundary, the field is [marked as invalid](https://docs.viktor.ai/docs/create-apps/user-input/input-validation/.md#numeric-minmax-boundary) ``` integer = vkt.IntegerField('Input an Integer here', min=0) ``` See ['Setting min/max'](https://docs.viktor.ai/docs/create-apps/user-input/numeric-input/.md#setting-minmax) for more information on setting a dynamic boundary. * **name**: defines the position of the parameter in the *params* ``` integer = vkt.IntegerField('Input an Integer here', name="i") # obtained using params.i ``` * **prefix**: a prefix will be put in front of the ui name ``` integer = vkt.IntegerField('Input an Integer here', prefix="€") ``` * **step**: stepping interval when clicking the increment / decrement buttons ``` integer = vkt.IntegerField('Input an Integer here', step=3) ``` * **suffix**: a suffix will be placed behind the ui name ``` integer = vkt.IntegerField('Input an Integer here', suffix="mm") ``` * **visible**: can be used when the visibility depends on other input fields ``` integer = vkt.IntegerField('Input an Integer here', visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ## Setting min/max[​](https://docs.viktor.ai/docs/create-apps/user-input/numeric-input/.md#setting-minmax "Direct link to Setting min/max") The min and max value of the field can be set using the `min` and `max` arguments respectively: ``` vkt.NumberField('X', min=0, max=10) # also on IntegerField ``` When the user enters a value that exceeds these bounds, the fields are [marked as invalid](https://docs.viktor.ai/docs/create-apps/user-input/input-validation/.md#numeric-minmax-boundary). If the value for min or max needs to be calculated 'dynamically', one of the below methods can be used. ### Depending on another field[​](https://docs.viktor.ai/docs/create-apps/user-input/numeric-input/.md#depending-on-another-field "Direct link to Depending on another field") If the constraint depends on another numeric field, the easiest solution is to use a `Lookup`: ``` import viktor as vkt class Parametrization(vkt.Parametrization): param_x = vkt.NumberField('X') param_y = vkt.NumberField('Y', min=vkt.Lookup('param_x')) ``` In case of a nested parametrization structure, the dotted path should be used: ``` vkt.Lookup('tab.section.param_x') ``` When the target field cannot be found, a warning is logged in your terminal and **the constraint is ignored**. ### Inside a DynamicArray[​](https://docs.viktor.ai/docs/create-apps/user-input/numeric-input/.md#inside-a-dynamicarray "Direct link to Inside a DynamicArray") If the value for min or max depends on the result of another numeric field within a `DynamicArray`, a `RowLookup` can be used. Using the `RowLookup`, a field of a specific row within the array can be made dependent of another field **within the same row**: ``` import viktor as vkt class Parametrization(vkt.Parametrization): array = vkt.DynamicArray('Array') array.param_x = vkt.NumberField('X') array.param_y = vkt.NumberField('Y', min=vkt.RowLookup('param_x')) ``` ### Using a function[​](https://docs.viktor.ai/docs/create-apps/user-input/numeric-input/.md#using-a-function "Direct link to Using a function") The most generic way to dynamically set the min/max value is to use a **callback function**. Upon evaluation of the min or max constraint, the platform passes the `params`, `entity_id`, `entity_name`, and `workspace_id` (>= v14.7.1) to the custom function: ``` import viktor as vkt def param_y_min(params, **kwargs): return params.param_x class Parametrization(vkt.Parametrization): param_x = vkt.NumberField('X') param_y = vkt.NumberField('Y', min=param_y_min) ``` For constraints that have to be applied to fields within a `DynamicArray`, make sure that the callback function returns a list of the constraint values, one for each row in the array. The length of this list must be equal to the number of rows in the array, otherwise (a warning is logged and) the constraint is ignored: ``` import viktor as vkt def param_y_min(params, **kwargs): return [row.param_x for row in params.array] class Parametrization(vkt.Parametrization): array = vkt.DynamicArray('Array') array.param_x = vkt.NumberField('X') array.param_y = vkt.NumberField('Y', min=param_y_min) ``` tip All individual `kwargs` can be added explicitly in the signature if needed: ``` def param_y_min(params, entity_id, entity_name, workspace_id, **kwargs): ... ``` When the value for min/max depends on data from another entity, the `entity_id` can be used to navigate and obtain data using the [SDK API](https://docs.viktor.ai/docs/api/sdk/handling-entity-data/.md). --- # Options & selections Reference For a more technical API reference, please see the following pages: * [`AutocompleteField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_AutocompleteField) * [`MultiSelectField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_MultiSelectField) * [`OptionField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_OptionField) ## OptionField - single option[​](https://docs.viktor.ai/docs/create-apps/user-input/options-and-selections/.md#optionfield---single-option "Direct link to OptionField - single option") To present a dropdown list with options to select from, an `OptionField` can be used. ``` import viktor as vkt fruits = ['Avocado', 'Banana', 'Coconut'] class Parametrization(vkt.Parametrization): option = vkt.OptionField('Pick your favorite fruit', options=fruits) radio_v = vkt.OptionField('Pick your favorite fruit', options=fruits, variant='radio') radio_h = vkt.OptionField('Pick your favorite fruit', options=fruits, variant='radio-inline') ``` ![](/assets/images/optionfield-77b9894a62eaa38ba7e0a14265abad69.png) ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARMAAACXCAYAAAA2/7/CAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAAtdEVYdENyZWF0aW9uIFRpbWUAVGh1IDE5IERlYyAyMDI0IDA1OjIyOjI3IFBNIENFVOQJcIgAAB5uSURBVHic7d17XFTV/v/xFw4MIidoFJhIQBxNUQFFEMJQyeDn9wukZpjHY5pKXjI9J03DMjtqaWrH+91UrFRMtG/mpWOgpUDETRRQyQua4gVEEQyVGQZ+fwymlSLCNtI+z8fDxwNmr7322hvnPWutvWdvs8rKykqEEKKOGtR3A4QQjwYJEyGEIiRMhBCKkDARQihCwkQIoQgJEyGEIiRMhBCKkDARQihCwkQIoQgJEyGEIiRMhBCKkDARQihCwkQIoQgJEyGEIpQNk/IjzHvWHXv7W/+c2vWgz7hosopvlknm350DGfnV1XvXV7qDIa6B/DtZ0VY+GJeTmTe4J+1aevPM1IN/8M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VcM70zS3mHMfHoNH82YQYLUGkfnjsipMmzQ0pWJsSNYvWIJL226Yrgq9+IUxrs3bRDd0rG+TpeXSGRoIgBSSxuUPmHMjFACEFBPbOqjGPYsw3/+nLlRqWDbi2DvXijyKvmjoQTjHsykoWtYNWMaCW0deTyoO24dz6MpA6wavUs3tEZMLX3GMU+XxKrP4hhzrhKs7HELGMfs5w0xrbefWnowOVbNyhULGbPsChL7Xoyc/gKBNoDNcGZHJ7Es/m3Cy0De1ZXRsRH4WNHgm4VyWBjBeRuY9VwKEltnBjrWGdWb9cIvwJoFH8wgZkwsC5+2v3tFxlJjBIcOHakZFjKxJmzkyzWnTp1p9HrHj5+sGTlscs3w0Ek1RwqOG6MpDzwRa+MTMTU9RvmunL19J8zNzMjNPcqe3dl06dIZBwe7+pIh6XsPsnD+KvT6KiZOfpZBvp7NbcZfgoi18YmYmh6j/uzJvxN38EXCtwDY2dkYfjaivytduyrQV1Vx+tRZsn78iX0ZOVy69Dtt2rThxYnPEPrUE8Zqwl+GiLXxiZiaDqP/UNzBA/msWLaJixd/r7ecvb0tU/45FlfXnsbc/F+KiLXxiZiaBqMnJgCdTs+P+3M5eLCA334r4ULpRWjTBvu/daJ7jy54PNYb78f7YWYmfnK8uUSsjU/EtPXdl8QkCILQHCLlC4JgckRiEgTB5IjEJAiCyRGJSRAEkyMSkyAIJkckJkEQTI5ITIIgmByRmARBMDkiMQmCYHJEYhIEweSIxCQIgskRiUkQBJMjEpMgCCZHJCZBEEyOSEyCIJgckZgEQTA5IjEJgmByRGISBMHkiMQkCILJEYlJEASTIxKTIAgmRyQmQRBMjkhMgiCYHJGYBEEwOSIxCYJgckRiEgTB5Pw/U8HICfVfKgMAAAAASUVORK5CYII=) The user input can be obtained through the **params** argument and can have the following values: * `int` / `float` / `str`: when user selects an option * `None`: when empty Expand to see all available arguments In alphabetical order: * **autoselect\_single\_option**: (default=False) automatically select when only a single option is available, relevant in case of [dynamic options](https://docs.viktor.ai/docs/create-apps/user-input/options-and-selections/.md#dynamic-options) ``` option = vkt.OptionField('Pick your favorite fruit', options=fruits, autoselect_single_option=True) ``` * **default**: a default value will be prefilled ``` option = vkt.OptionField('Pick your favorite fruit', options=fruits, default="Coconut") ``` * **description**: add a tooltip with additional information ``` option = vkt.OptionField('Pick your favorite fruit', options=fruits, description="This input represents the ...") ``` * **flex**: the width of the field between 0 and 100 (default=33) ``` option = vkt.OptionField('Pick your favorite fruit', options=fruits, flex=50) ``` * **name**: defines the position of the parameter in the *params* ``` option = vkt.OptionField('Pick your favorite fruit', options=fruits, name="o") # obtained using params.o ``` * **options**: available options a user can select from can be defined as list of strings ``` option = vkt.OptionField('Pick your favorite fruit', options=['Avocado', 'Banana', 'Coconut']) ``` ..or as list of numbers ``` option = vkt.OptionField('...', options=[1, 2, 3]) ``` ..or as list of `OptionListElement` objects ``` option = vkt.OptionField( 'Pick your favorite fruit', options=[ OptionListElement(value=1, label="Avocado"), # when selected, params.option will be 1 OptionListElement(value=2, label="Banana"), OptionListElement(value=3, label="Coconut"), ] ) ``` * **prefix**: a prefix will be put in front of the ui name ``` option = vkt.OptionField('Pick your favorite fruit', options=fruits, prefix="..") ``` * **suffix**: a suffix will be placed behind the ui name ``` option = vkt.OptionField('Pick your favorite fruit', options=fruits, suffix="..") ``` * **variant**: the field can be shown as radio buttons ``` option = vkt.OptionField('Pick your favorite fruit', options=fruits, variant='radio') ``` ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARMAAACXCAYAAAA2/7/CAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAAtdEVYdENyZWF0aW9uIFRpbWUAVGh1IDE5IERlYyAyMDI0IDA1OjIyOjI3IFBNIENFVOQJcIgAAB5uSURBVHic7d17XFTV/v/xFw4MIidoFJhIQBxNUQFFEMJQyeDn9wukZpjHY5pKXjI9J03DMjtqaWrH+91UrFRMtG/mpWOgpUDETRRQyQua4gVEEQyVGQZ+fwyml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45lr4DZ7Gp9BkmTghEC6jbhvPeK01ImjaJvn0nMfdQC0ZMDMEJwK0X741y4cd5/6Zv+FtM29OIlyb1x9/mXm2yIWhQCNqM5QzuO5bIjcVotLdNEOv8CG51mpUR04nKue9DJMRDQZHv5mRkHGbK5AWo1RbMmf9Oja+CPXbsFJHjZ1FRUcmMmW/Stp2c6hDiYaXId3O8vNry8sBe6PUGIifMJjUls9rylZWV7Nubyrtvz8VorGDYiH4SJEI85BS9BcHn0dvZsH4bAFqtnekWBD7uuLo6YSgv5/RP50j+4SCJCelcvnwFMzMzXh3ej7Dnn1WqCUKIeqL4zZHSUrNYungdly5dqbaco6MDo/81EHf3VkpuXghRTxQPEwC93sAP32eQlpbNqVN5XCy4BGZmOD5hT4uWzfDq2Ba/pzugUsktaIV4VDyQMBFC/PVI10AIoQgJEyGEIiRMhBCKkDARQihCwkQIoQgJEyGEIiRMhBCKkDARQihCwkQIoQgJEyGEIiRMhBCKkDARQihCwkQIoQgJEyGEIiRMhBCKkDARQihCwkQIoQgJEyGEIiRMhBCK+P/U9Mo9i/WfpAAAAABJRU5ErkJggg==) ``` option = vkt.OptionField('Pick your favorite fruit', options=fruits, variant='radio-inline') ``` ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASYAAABWCAYAAABikTuvAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAAtdEVYdENyZWF0aW9uIFRpbWUAVGh1IDE5IERlYyAyMDI0IDA1OjIyOjUwIFBNIENFVIqtFFgAABccSURBVHic7d17WFTV+sDxr8HMoBQ4inCQAXU0BQWUUAhFJIOH8wPyFlhkGkqph7STnhKLtDQx7Yb31PKaREfRsoSOBywVlEARA1SyxBS8DI4S2KAzA/L7Y1AxFRBGmGPr8zw8DzN77bXXfvead9bae2Z2m5qamhoEQRBMyEOt3QBBEIQ/E4lJEASTIxKTIAgmRyQmQRBMjkhMgiCYHJGYBEEwOSIxCYJgck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EyCIJgckZgEQTA5IjEJgmByRGISBMHkiMQkCILJEYlJEASTIxKTIAgmRyQmQRBMjkhMgiCYHJGYBEEwOSIxCYJgckRiEgTB5Pw/U8HICfVfKgMAAAAASUVORK5CYII=) note The variants are ignored within a [`Table`](https://docs.viktor.ai/docs/create-apps/user-input/tables-and-arrays/.md#table) * **visible**: can be used when the visibility depends on other input fields ``` option = vkt.OptionField('Pick your favorite fruit', options=fruits, visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ### Autocomplete[​](https://docs.viktor.ai/docs/create-apps/user-input/options-and-selections/.md#autocomplete "Direct link to Autocomplete") If there are many options, it might be desirable for the user to filter options by typing. This is possible using the `AutocompleteField`. ``` import viktor as vkt fruits = ['Avocado', 'Banana', 'Coconut'] class Parametrization(vkt.Parametrization): option = vkt.AutocompleteField('Pick your favorite fruit (type to filter)', options=fruits) ``` Expand to see all available arguments In alphabetical order: * **default**: a default value will be prefilled ``` option = vkt.AutocompleteField( 'Pick your favorite fruit (type to filter)', options=fruits, default="Coconut" ) ``` * **description**: add a tooltip with additional information ``` option = vkt.AutocompleteField( 'Pick your favorite fruit (type to filter)', options=fruits, description="This input represents the ..." ) ``` * **flex**: the width of the field between 0 and 100 (default=33) ``` option = vkt.AutocompleteField( 'Pick your favorite fruit (type to filter)', options=fruits, flex=50 ) ``` * **name**: defines the position of the parameter in the *params* ``` option = vkt.AutocompleteField( 'Pick your favorite fruit (type to filter)', options=fruits, name="o" ) # obtained using params.o ``` * **options**: available options a user can select from can be defined as list of strings ``` option = vkt.AutocompleteField( 'Pick your favorite fruit (type to filter)', options=['Avocado', 'Banana', 'Coconut'] ) ``` ..or as list of numbers ``` option = vkt.AutocompleteField('...', options=[1, 2, 3]) ``` ..or as list of `OptionListElement` objects ``` option = vkt.AutocompleteField( 'Pick your favorite fruit (type to filter)', options=[ OptionListElement(value=1, label="Avocado"), # when selected, params.option will be 1 OptionListElement(value=2, label="Banana"), OptionListElement(value=3, label="Coconut"), ] ) ``` * **prefix**: a prefix will be put in front of the ui name ``` option = vkt.AutocompleteField( 'Pick your favorite fruit (type to filter)', options=fruits, prefix=".." ) ``` * **suffix**: a suffix will be placed behind the ui name ``` option = vkt.AutocompleteField( 'Pick your favorite fruit (type to filter)', options=fruits, suffix=".." ) ``` * **visible**: can be used when the visibility depends on other input fields ``` option = vkt.AutocompleteField( 'Pick your favorite fruit (type to filter)', options=fruits, visible=vkt.Lookup("another_field") ) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ### Selecting an entity[​](https://docs.viktor.ai/docs/create-apps/user-input/options-and-selections/.md#selecting-an-entity "Direct link to Selecting an entity") In case you need to create an option field with entities as options, you can make use of dedicated [entity selection fields](https://docs.viktor.ai/docs/create-apps/user-input/entity-selection/.md). ## MultiSelectField - multiple options[​](https://docs.viktor.ai/docs/create-apps/user-input/options-and-selections/.md#multiselectfield---multiple-options "Direct link to MultiSelectField - multiple options") If multiple options need to be selectable, a `MultiSelectField` can be used. ``` import viktor as vkt fruits = ['Avocado', 'Banana', 'Coconut'] class Parametrization(vkt.Parametrization): options = vkt.MultiSelectField('Pick your favorite fruit(s)', options=fruits) ``` The user input can be obtained through the **params** argument and can have the following values: * `list`: when user selects one or multiple options * empty list when nothing is selected Expand to see all available arguments In alphabetical order: * **default**: a default value will be prefilled ``` options = vkt.MultiSelectField( 'Pick your favorite fruit(s)', options=fruits, default=["Avocado", "Coconut"] ) ``` * **description**: add a tooltip with additional information ``` options = vkt.MultiSelectField( 'Pick your favorite fruit(s)', options=fruits, description="This input represents the ..." ) ``` * **flex**: the width of the field between 0 and 100 (default=33) ``` options = vkt.MultiSelectField( 'Pick your favorite fruit(s)', options=fruits, flex=50 ) ``` * **name**: defines the position of the parameter in the *params* ``` options = vkt.MultiSelectField( 'Pick your favorite fruit(s)', options=fruits, name="o" ) # obtained using params.o ``` * **options**: available options a user can select from can be defined as list of strings ``` options = vkt.MultiSelectField( 'Pick your favorite fruit(s)', options=['Avocado', 'Banana', 'Coconut'] ) ``` ..or as list of numbers ``` options = vkt.MultiSelectField('...', options=[1, 2, 3]) ``` ..or as list of `OptionListElement` objects ``` options = vkt.MultiSelectField( 'Pick your favorite fruit(s)', options=[ OptionListElement(value=1, label="Avocado"), # when selected, params.options will be [1] OptionListElement(value=2, label="Banana"), OptionListElement(value=3, label="Coconut"), ] ) ``` * **prefix**: a prefix will be put in front of the ui name ``` options = vkt.MultiSelectField( 'Pick your favorite fruit(s)', options=fruits, prefix=".." ) ``` * **suffix**: a suffix will be placed behind the ui name ``` options = vkt.MultiSelectField( 'Pick your favorite fruit(s)', options=fruits, suffix=".." ) ``` * **visible**: can be used when the visibility depends on other input fields ``` options = vkt.MultiSelectField( 'Pick your favorite fruit(s)', options=fruits, visible=vkt.Lookup("another_field") ) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ### Selecting entities[​](https://docs.viktor.ai/docs/create-apps/user-input/options-and-selections/.md#selecting-entities "Direct link to Selecting entities") In case you need to create an option field with entities as options, you can make use of dedicated [entity selection fields](https://docs.viktor.ai/docs/create-apps/user-input/entity-selection/.md). ## Dynamic options[​](https://docs.viktor.ai/docs/create-apps/user-input/options-and-selections/.md#dynamic-options "Direct link to Dynamic options") Sometimes it is desired to create options dynamically (depending on other parameters). This can be achieved in several ways: * [Dynamically setting options using a callback function](https://docs.viktor.ai/docs/create-apps/user-input/options-and-selections/.md#using-a-function) * [Setting the visibility of the `OptionListElement`](https://docs.viktor.ai/docs/create-apps/user-input/options-and-selections/.md#optionlistelement-visibility) ### Using a function[​](https://docs.viktor.ai/docs/create-apps/user-input/options-and-selections/.md#using-a-function "Direct link to Using a function") The most generic way to dynamically set the options is to use a 'callback function'. Upon evaluation of the options, the platform passes the `params`, `entity_id`, `entity_name`, and `workspace_id` (>= v14.7.1) to the custom function. For example, material options can be set based on a pre-selected material type as follows: ``` import viktor as vkt def get_material_options(params, **kwargs): if params.material_group == 'Aluminium': return ['Aluminium 5083', 'Aluminium 6082'] elif params.material_group == 'Steel': return ['Steel S355', 'Steel S690'] else: return [] class Parametrization(vkt.Parametrization): material_group = vkt.OptionField('Material group', options=['Aluminium', 'Steel']) material_type = vkt.OptionField('Material', options=get_material_options) ``` ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAhcAAACGCAYAAABufKiHAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AACAASURBVHic7d15WFRl4z7wm9nYREAQ3HABTTb1FZSvYrmmaFqIoZaZe24YueT6mllm/srKcknzbXNB88UETV41Ulxyy10TJQERQUEFxQWHYZbfHzjTzDAzDHBAyPtzXVwzc+ac5zxY53DPs42NRqPRgIiIiEggoqddASIiIvpnYbggIiIiQTFcEBERkaAYLoiIiEhQDBdEREQkKIYLIiIiEhTDBREREQmK4YKIiIgExXBBREREgmK4ICIiIkExXBAREZGgGC6IiIhIUJKnXQEierbwuxKJqp6Njc1TPT/DBREJjgGC6OmydA1WR/BguCAiQTBQENUO+tdqVQUNhgsiqjAGCqLaraqCBsMFEZWbtaGC4YOo5igrPGivVyFCho2GVz8RlYOlW0ZFbie8BRFVXkUCgaVjKhswGC6IyCrmbhXl3U5ET4+50FDe7WWeh+GCiMpibYAwtR9vMURPn6mQYLxNyIDBcEFEFlkTGPRfM2AQ1SxlBQtrQkZ5AwbDBRGZVVZQsOa5uXKIqHpYCg/WPLe0zRzOFiEiq5kKENZsY9ggqj6mwoS5sKA/Q0Sj0ej2039eoTqw5YKITLGm68P4Ua1Wm9xuqjwiqnqmWiO0jyKRyOT28naZmDwvwwURGStPsFCr1WbDhqmQYe4cRFR5lrozLD2aCxqmyrQmYLBbhIisph8W9Fsp9Lfr/+gfY/zcVLlEVH7WzPLQDw2mukm017NIJCrVRVIRgoWLpUuX4u7du1iwYAHs7OxKvf/FF18gJycHH3zwA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GvNqPS5GS6ISCjsDiGq+aoqUOj7/zgboMNzp5/6AAAAAElFTkSuQmCC) tip All individual `kwargs` can be added explicitly in the signature if needed: ``` def get_material_options(params, entity_id, entity_name, workspace_id, **kwargs): ... ``` With a callback function it is also possible to make use of the `entity_id` to navigate to and obtain data from other entities [using the API](https://docs.viktor.ai/docs/api/sdk/handling-entity-data/.md). ### OptionListElement visibility[​](https://docs.viktor.ai/docs/create-apps/user-input/options-and-selections/.md#optionlistelement-visibility "Direct link to OptionListElement visibility") The same dynamic options as above can be achieved by making use of the `visible` argument on an `OptionListElement`. By using the `IsEqual` and `Lookup` operators, we can make use of the visibility to hide/show options, similar as [hiding/showing fields](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md): ``` import viktor as vkt material_options = [ vkt.OptionListElement('Aluminium 5083', visible=vkt.IsEqual(vkt.Lookup('material_group'), 'Aluminium')), vkt.OptionListElement('Aluminium 6082', visible=vkt.IsEqual(vkt.Lookup('material_group'), 'Aluminium')), vkt.OptionListElement('Steel S355', visible=vkt.IsEqual(vkt.Lookup('material_group'), 'Steel')), vkt.OptionListElement('Steel S690', visible=vkt.IsEqual(vkt.Lookup('material_group'), 'Steel')) ] class Parametrization(vkt.Parametrization): material_group = vkt.OptionField('Material group', options=['Aluminium', 'Steel']) material_type = vkt.OptionField('Material', options=material_options) ``` ### Inside a DynamicArray[​](https://docs.viktor.ai/docs/create-apps/user-input/options-and-selections/.md#inside-a-dynamicarray "Direct link to Inside a DynamicArray") New in v14.8.0 If the options should be filled depending on another field within a DynamicArray, a callback function can be used to return a **list of lists**. Each sublist represents the options of the corresponding array row. Make sure that the length of the list is equal to the number of rows in the array: ``` import viktor as vkt def get_material_options(params, **kwargs): options = [] for row in params.array: if row['material_group'] == 'Aluminium': options.append(['Aluminium 5083', 'Aluminium 6082']) elif row['material_group'] == 'Steel': options.append(['Steel S355', 'Steel S690']) return options class Parametrization(vkt.Parametrization): array = vkt.DynamicArray('Array') array.material_group = vkt.OptionField('Material group', options=['Aluminium', 'Steel']) array.material_type = vkt.OptionField('Material', options=get_material_options) ``` --- # Other fields Reference For a more technical API reference, please see the following pages: * [`BooleanField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_BooleanField) * [`ColorField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_ColorField) * [`DateField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_DateField) * [`HiddenField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_HiddenField) ## BooleanField - toggle true / false[​](https://docs.viktor.ai/docs/create-apps/user-input/other-fields/.md#booleanfield---toggle-true--false "Direct link to BooleanField - toggle true / false") The `BooleanField` acts as a toggle button which can be either `True` or `False`. ``` import viktor as vkt class Parametrization(vkt.Parametrization): is_true = vkt.BooleanField('False / True') ``` ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAScAAAB7CAYAAAA2YUZ5AAAJMnpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHja5Zhdlty6DYTfuYosgQQJglwOwZ9zsoMsPx/VPRPP2Dcnvn5Myy1p1BIJogqFksP+1z9P+AcfqaWGotZqrzXyKb10GZy0+PqMZ59iefbPR+x9lr5eD+bvh4RLmWN+/dnq65g+rr8f+DimwZn+MFCb7x/86w+9vMdv3waS1yHfiO75eg/U3wNlef2Q3gOM17Ji7c1+XILv1/H9/CsNfMPdlfY17J/+NrK3lHmyyM4pR/Y5yyuAfL8S8uCksc/53phy4fy1l9zfg5GQX+Xp88N94dxQyy9v+oLK59k3tOo7BeE7WkXet+RvSa6fx19eD0m//ZA/55cfZy7tfSZfr5Pj/oroW/bv95zVzrNmVjFKJdX1vaiPJT5n3AcLy526BUKr0fgqQ9izdbYGqydUWHFGZ5upJwGuk0paaaST9nOcaRJikR3EOBGZkp+LLZt0mfmFH1s6YrnnBbKS5wN7yfIZS3qm7XGGZ7bGzCtxqyQGS5cXv7uF333gnFsKKd1c1vHkirhEbrIJ4yJ399wGIum8k6pPgj+275+LawZBvVkOD3wj+msI1/Qf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RvclRvb2w9IkdJTVAgMi4xMCIKICAgeG1wOk1ldGFkYXRhRGF0ZT0iMjAyMjowODozMFQxNDoxNDoyOSswMjowMCIKICAgeG1wOk1vZGlmeURhdGU9IjIwMjI6MDg6MzBUMTQ6MTQ6MjkrMDI6MDAiPgogICA8eG1wTU06SGlzdG9yeT4KICAgIDxyZGY6U2VxPgogICAgIDxyZGY6bGkKICAgICAgc3RFdnQ6YWN0aW9uPSJzYXZlZCIKICAgICAgc3RFdnQ6Y2hhbmdlZD0iLyIKICAgICAgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo2OTZjMjlkZC00OTIwLTRjOTEtYjEwMS1lNjgwZDk1ZDhkNDYiCiAgICAgIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkdpbXAgMi4xMCAoTGludXgpIgogICAgICBzdEV2dDp3aGVuPSIyMDIyLTA4LTMwVDE0OjE0OjI5KzAyOjAwIi8+CiAgICA8L3JkZjpTZXE+CiAgIDwveG1wTU06SGlzdG9yeT4KICA8L3JkZjpEZXNjcmlwdGlvbj4KIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAKPD94cGFja2V0IGVuZD0idyI/PoD2zsoAAAAGYktHRAAAAAAAAPlDu38AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfmCB4MDh144IFhAAANiUlEQVR42u3df0yTdx4H8LcH52MrVIGtoq11Aj6ryuhJjEDcaSERFjxDgNMl17/Ocf5hvD+WGBJz++Fu98e5XHaXQLzEIRdiulymwh93YtDENQixzTa0boOmUJQiAR6tsG4r9uL0/uj62NKW37SI71dCIm2fnz7Pu5/v9/k+DyuePHnyFERES0zyihUruBeIaMn5BXcBETGciIgYTkTEcCIiYjgREcOJiIjhRETEcCIihhMREcOJiBhOREQMJyJiOBERMZyIiBhORMRwIiJiOBERw4mIiOFERAwnIiKGExERw4mIGE5ERAwnImI4ERExnIiIGE5ExHAiIpqFZO4CWqoePXoEj8eDx48fAwBSUlKQkZHB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beETLNpx2/ysxfUzv7QHe2jG7ac7eDIRUkFYFdP6eBx7RdJ67cU5nbyYmmN6fQzABgWne3xNeUZ29yQOPaNmF0z9siWnKHd4x9+kP7wjMI5HbQMRwWkRtrsSMY3pvz9ymO/0lMPpj5Dy8/vC+KCJ6zsPpxr34L/Pgtuk7v6P5y3XgVCdwqTfwu1YVXj0lYluIGE6LpPt+/JdZqJn9NB+0A590AUfyw0eIh97SkohtIWI4LZKh7+O/zG2zvOz/QTvQeDMQTH/6dex5JWJbiBhOiyQRV+lmE05/7YwdTJPntVRvtyFiOM2BJjWxy3/gA6rPA70PowfTP7+MHUxLbVuIGE4LaC4d0/PVE9I39ATA/R+BQxeAO+OzD6bQeSViW4gYTkugibVQvg0JFLUSuHAIUP4SOHQecHtnVzGFzmsbb2EhWj7hVKSN/zKtQ+G/q5XAhYOAkAzs/zQQTH/cNbOm3JX+Z/8OHVZARM95OJVlA6kr47vM893A0KTO6/UpwPmDgQrqSD5wvGj6+Qx5nw28TF2ZmKAlYjgtorcL47/MD9ojX1ufAlz+3cwqpsnzSMQ2EDGcFtlbO+J/pavNFRgiMFm6YmbTN958VjVpUud2AzERw+k58MmBxFRPjXN4mkDjzWdVU+rKxKw70fOIT8KcpbLswCNQNNMMBRjyBkIp9AZfPgmT6AUIp0QGVDCkSrMCT7Xc+vOwgJ6Qx/SGhlLqSuD9vQwmohcmnIBAGPzhP0v3XjVNaqApx0fzEr1g4RR09mbg79Z9/7+lsT6pKwNX5dj5TfSCh1NQmyv8L/7Gq6LSpD77i79l2RzHRMRwIqJl6RfcBUTEcCIiYjgREcOJiIjhREQMJyIihhMREcOJiBhOREQMJyJiOBERMZyIiOFERMRwIiJiOBERw4mIiOFERAwnIiKGExExnIiIGE5ERAwnImI4ERExnIiI4URExHAiImI4ERHDiYiI4UREDCciIoYTETGciIgYTkREDCcieg78H9bGGHBJ9AtYAAAAAElFTkSuQmCC) The user input can be obtained through the **params** argument and can have the following values: * `True`: when toggled true * `False`: when toggled false Expand to see all available arguments In alphabetical order: * **default**: a default value will be prefilled ``` is_true = vkt.BooleanField('False / True', default=True) ``` * **description**: add a tooltip with additional information ``` is_true = vkt.BooleanField('False / True', description="This field represents the ...") ``` * **flex**: the width of the field between 0 and 100 (default=33) ``` is_true = vkt.BooleanField('False / True', flex=50) ``` * **name**: defines the position of the parameter in the *params* ``` is_true = vkt.BooleanField('False / True', name="b") # obtained using params.b ``` * **visible**: can be used when the visibility depends on other input fields ``` is_true = vkt.BooleanField('False / True', visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ## ColorField - select a color[​](https://docs.viktor.ai/docs/create-apps/user-input/other-fields/.md#colorfield---select-a-color "Direct link to ColorField - select a color") New in v14.0.0 The `ColorField` enables a user to select a color from a color palette. ``` import viktor as vkt class Parametrization(vkt.Parametrization): color = vkt.ColorField('Pick a color') ``` ![](/assets/images/colorfield-8a9cef03845389cc64871c4f75f57007.png) The user input can be obtained through the **params** argument and can have the following values: * [`Color`](https://docs.viktor.ai/sdk/api/core/.md#_Color) object: when user selects a color * `None`: when empty Expand to see all available arguments In alphabetical order: * **default**: a default value will be prefilled ``` color = vkt.ColorField('Pick a color', default=vkt.Color.red()) ``` * **description**: add a tooltip with additional information ``` color = vkt.ColorField('Pick a color', description="This field represents the ...") ``` * **flex**: the width of the field between 0 and 100 (default=33) ``` color = vkt.ColorField('Pick a color', flex=50) ``` * **name**: defines the position of the parameter in the *params* ``` color = vkt.ColorField('Pick a color', name="c") # obtained using params.c ``` * **visible**: can be used when the visibility depends on other input fields ``` color = vkt.ColorField('Pick a color', visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ## DateField - select a date[​](https://docs.viktor.ai/docs/create-apps/user-input/other-fields/.md#datefield---select-a-date "Direct link to DateField - select a date") The `DateField` enables a user to select a date on a calendar. ``` import viktor as vkt class Parametrization(vkt.Parametrization): date = vkt.DateField('Pick a date') ``` ![](/assets/images/datefield-b4121de4959ee60c53e55fe4de1e42ab.svg) The user input can be obtained through the **params** argument and can have the following values: * [`datetime.date`](https://docs.python.org/3/library/datetime.html#date-objects) object: when user selects a data * `None`: when empty Expand to see all available arguments In alphabetical order: * **default**: a default value will be prefilled ``` date = vkt.DateField('Pick a date', default=datetime.date(2021, 3, 14)) ``` * **description**: add a tooltip with additional information ``` date = vkt.DateField('Pick a date', description="This field represents the ...") ``` * **flex**: the width of the field between 0 and 100 (default=33) ``` date = vkt.DateField('Pick a date', flex=50) ``` * **name**: defines the position of the parameter in the *params* ``` date = vkt.DateField('Pick a date', name="d") # obtained using params.d ``` * **visible**: can be used when the visibility depends on other input fields ``` date = vkt.DateField('Pick a date', visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ## HiddenField - store JSON data[​](https://docs.viktor.ai/docs/create-apps/user-input/other-fields/.md#hiddenfield---store-json-data "Direct link to HiddenField - store JSON data") The purpose of the `HiddenField` is to store JSON-type data in the `params`, without showing this information to the user in the editor. For example, when doing [upload file processing](https://docs.viktor.ai/docs/create-apps/managing-files/uploading-files/.md#file-processing). ``` import viktor as vkt class Parametrization(vkt.Parametrization): json_data = vkt.HiddenField('') ``` caution Use the `HiddenField` with moderation. Prefer to store specific type of data on its corresponding field (e.g. number on a `NumberField`), if necessary with `visible=False` to hide if from the user. Also, prevent storing very large amounts of data if not necessary, as this might make your application slow and unstable! The input can be obtained through the **params** argument and can have the following values: * `json`: when data is stored * `None`: when empty Expand to see all available arguments In alphabetical order: * **name**: defines the position of the parameter in the *params* ``` json_data = vkt.HiddenField('', name="h") # obtained using params.h ``` --- # Read-only fields ![](/img/docs/cards/outputfield.png) ## [Show output](https://docs.viktor.ai/docs/create-apps/inform-end-user/output-field/.md) Show a (dynamic) value using an OutputField ![](/img/docs/cards/static-text.svg) ## [Static text](https://docs.viktor.ai/docs/create-apps/inform-end-user/text-blocks/.md) Show a static text using Text ![](/img/docs/cards/static-image.svg) ## [Static image](https://docs.viktor.ai/docs/create-apps/inform-end-user/static-image/.md) Show a static image using Image --- # Set params using a button A [set params action](https://docs.viktor.ai/docs/create-apps/user-input/action-buttons/.md#set-params-action) enables the user to click a button to directly set some or all values on the `params`. ## Example use case[​](https://docs.viktor.ai/docs/create-apps/user-input/set-params-using-button/.md#example-use-case "Direct link to Example use case") One can filter entries in a table. For example in the ground layers, one could filter out all layers that are thinner than some threshold, while also allowing the user to reset the table to the start. ## Implementation[​](https://docs.viktor.ai/docs/create-apps/user-input/set-params-using-button/.md#implementation "Direct link to Implementation") 1. Add a [`SetParamsButton`](https://docs.viktor.ai/sdk/api/parametrization/.md#_SetParamsButton) in the parametrization class 2. Implement the button method on the corresponding controller class Adding a button in the parametrization: ``` import viktor as vkt class Parametrization(vkt.Parametrization): set_params = vkt.SetParamsButton('Set params to some fixed value', method='set_params') clear_params = vkt.SetParamsButton('Reset params', method='clear_params') ``` Implementing the method on the controller: The first example would be how to set parameters, the second example is how you can clear a parameter. * You do not need to specify every parameter, if you do not specify a parameter it will not be altered. * If you on the other hand specify a parameter that has no associated field in the input specification, it will be ignored. ``` import viktor as vkt class Controller(vkt.Controller): def set_params(self, params, **kwargs): return vkt.SetParamsResult({ "number": 12.3, "integer": 12, "text": "abcd", "textarea": "defg", "date": datetime.date(2054, 1, 23), "bool": True, "select": "Green", "autocomp": "Green", "multiselect": ["Red", "Green"], "table": [{"c1": 123, "c2": 123}, {"c1": 321, "c2": 123}], "geopoint": vkt.GeoPoint(...), "geopolyline": vkt.GeoPolyline(...), "geopolygon": vkt.GeoPolygon(...), "entity": vkt.api_v1.API().get_entity(...), "color": vkt.Color(...), # (>= v14.0.0) }) def clear_params(self, params, **kwargs): return vkt.SetParamsResult({ "number": None, "integer": None, "text": "", "textarea": "", "date": None, "bool": False, "select": None, "autocomp": None, "multiselect": [], "table": [], "geopoint": None, "geopolyline": None, "geopolygon": None, "entity": None, "color": None, }) ``` In case of a nested parametrization structure, the return value is a nested dictionary: ``` vkt.SetParamsResult({ "tab": { "section": { "number": None, ... } } }) ``` --- # Tables & arrays Both a `Table` and a `DynamicArray` can be used if the user must be able to make a dynamic number of objects sharing the same properties. The similarities and differences between the two are discussed below. ![](/assets/images/editor-table-array-5680e2d6870a0463cd05e9b2bd1f7d0d.png) *Table (top) and DynamicArray (bottom)* Reference For a more technical API reference, please see the following pages: * [`Table`](https://docs.viktor.ai/sdk/api/parametrization/.md#_Table) * [`DynamicArray`](https://docs.viktor.ai/sdk/api/parametrization/.md#_DynamicArray) ## Table[​](https://docs.viktor.ai/docs/create-apps/user-input/tables-and-arrays/.md#table "Direct link to Table") Set up a `Table` and add fields using the dot-notation as follows: ``` import viktor as vkt class Parametrization(vkt.Parametrization): table = vkt.Table('Table') table.col_1 = vkt.TextField('TextField as table column') ``` Expand to see all available arguments In alphabetical order: * **default**: a default value will be prefilled ``` table = vkt.Table('Table', default=[{'col1': 'A', 'col2': 'B'}, {'col1': 'C', 'col2': 'D'}]) ``` * **description**: add a tooltip with additional information ``` table = vkt.Table('Table', description="This input represents the ...") ``` * **name**: defines the position of the parameter in the *params* ``` table = vkt.Table('Table', name="t") # obtained using params.t ``` * **visible**: can be used when the visibility depends on other input fields ``` table = vkt.Table('Table', visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. Let's assume a user has entered two rows of data in the table as shown in the figure below. ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAw4AAACuCAYAAACftlo+AAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AABjiSURBVHic7d17dFXlva/xxxrXopYEhICXUGKDWDFYEqkmqITskoQWgrtErFxaBd0iaBW0JXgDtgg9BY6WqJVLsaD1Ah4KFoEOS2w1UE1oN8QKxg2FNmg0kACaoMOVpub8AQ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iQpkMFBkiRJUiCDgyRJkqRADXqr0va33mmsOupl9573iERqWrQGSZIkqbm1bdO62edsUHDo2KF9Y9Xxpa5BkiRJak41NZFmn9OtSpIkSZICGRwkSZIkBTI4SJIkSQpkcJAkSZIUyOAgSZIkKZDBQZIkSVIgg4MkSZKkQAYHSZIkSYEMDpIkSZICGRwkSZIkBTI4SJIkSQpkcJAkSZIUyOAgSZIkKZDBQZIkSVIgg4MkSZKkQAYHSZIkSYEMDpIkSZICGRwkSZIkBTI4SJIkSQpkcJAkSZIUyOAgSZIkKZDBQZIkSVIgg4MkSZKkQAYHSZIkSYEMDpIkSZICRbV0AZIkSZLqJykpqdnmalBweL+qurHqqJe9H3xAOBxq0RokSZKk5vbVVs1/Ddyg4HBmx9jGquNLXYMkSZLUnKqqqpp9Tp9xkCRJkhTI4CBJkiQpkMFBkiRJUiDfqiRJkiR9yV133XVHPfb44483yhzecZAkSZK+5I4WDhorNIDBQZIkSTohHB4SGjM0gMFBkiRJOmEcCAuNHRrA4CBJkiSdUJoiNIDBQZIkSdIXYHCQJEmSFMjgIEmSJCmQwUGSJElSIIODJEmSpEAN+uTo0tLSxqqjATV80NIlSJIkSSe8U+rq6upaughJkiRJxze3KkmSJEkKZHCQJEmSFMjgIEmSJCmQwUGSJElSIIODJEmSpEAGB0mSJEmBDA6SJEmSAhkcJEmSJAUyOEiSJEkKZHCQJEmSFMjgIEmSJCmQwUGSJElSIIODJEmSpED/H7ntQ5uP5GzPAAAAAElFTkSuQmCC) The data entered in the table is available as a list of dictionaries in your app code and can be accessed using `params.table`. The resulting data has the following format: `[{"col_1": "entry1"}, {"col_1": "entry2"}]`. ## DynamicArray[​](https://docs.viktor.ai/docs/create-apps/user-input/tables-and-arrays/.md#dynamicarray "Direct link to DynamicArray") Set up a `DynamicArray` and add fields using the dot-notation as follows: ``` import viktor as vkt class Parametrization(vkt.Parametrization): array = vkt.DynamicArray('Array') array.col_1 = vkt.TextField('TextField as array field') ``` Expand to see all available arguments In alphabetical order: * **copylast**: copy the last row when clicking the + button (takes precedence over field defaults) ``` array = vkt.DynamicArray('Array', copylast=True) ``` * **default**: a default value will be prefilled ``` array = vkt.DynamicArray('Array', default=[{'col1': 'A', 'col2': 'B'}, {'col1': 'C', 'col2': 'D'}]) ``` * **description**: add a tooltip with additional information ``` array = vkt.DynamicArray('Array', description="This input represents the ...") ``` * **max**: maximum number of rows in the array ``` array = vkt.DynamicArray('Array', max=30) ``` * **min**: minimum number of rows in the array ``` array = vkt.DynamicArray('Array', min=3) ``` * **name**: defines the position of the parameter in the *params* New in v14.18.0 ``` array = vkt.DynamicArray('Array', name="a") # obtained using params.a ``` * **row\_label**: label to be shown at each row (max. 30 characters) ``` array = vkt.DynamicArray('Array', row_label="Item") ``` * **visible**: can be used when the visibility depends on other input fields ``` array = vkt.DynamicArray('Array', visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. Let's consider the same example as above, but now the user has entered the data in the array. ![](/assets/images/dynamic-array-params-example-1538adeb70c814c54f30f8d6578c4eb2.png) Again, the data entered in the table is available as a list of dictionaries in your app code and can be accessed using `params.array`. The resulting data has the following format: `[{"col_1": "entry1"}, {"col_1": "entry2"}]`. ## Differences Table vs. DynamicArray[​](https://docs.viktor.ai/docs/create-apps/user-input/tables-and-arrays/.md#differences-table-vs-dynamicarray "Direct link to Differences Table vs. DynamicArray") In addition to visual difference, there are more practical differences between the input fields which may determine the best solution for your use-case. The following comparison can be made: | Table | DynamicArray | | ------------------------------------------------------- | ------------------------------------------------------------- | | Compact | Less compact | | Rectangular | Not necessarily rectangular | | Defaults when adding a new row **is not** supported | Defaults when adding a new row **is** supported | | Options in OptionField **cannot** make use of a `label` | Options in OptionField **can** make use of a `label` | | Supports copy-paste of complete table content | Supports copy-paste per input field only | | User can create rows | User can create rows | | User **cannot** create columns | User **cannot** create fields, but may use dynamic visibility | Furthermore, not all regular fields can be used in both of these multi-row fields. The table below shows which fields are supported in the `Table` and `DynamicArray` | Field | Table | DynamicArray | | ----------------------------- | ----- | ---------------- | | Text | ❌ | ❌ | | TextField | ✅ | ✅ | | TextAreaField | ❌ | ✅ | | NumberField | ✅ | ✅ | | IntegerField | ✅ | ✅ | | BooleanField | ✅ | ✅ | | DateField | ❌ | ✅ | | OutputField | ❌ | ✅ (>= v14.20.0) | | HiddenField | ❌ | ❌ | | LineBreak | ❌ | ✅ | | OptionField | ✅ | ✅ | | MultiSelectField | ❌ | ✅ | | AutocompleteField | ✅ | ✅ | | EntityOptionField | ❌ | ✅ | | ChildEntityOptionField | ❌ | ✅ | | SiblingEntityOptionField | ❌ | ✅ | | EntityMultiSelectField | ❌ | ✅ | | ChildEntityMultiSelectField | ❌ | ✅ | | SiblingEntityMultiSelectField | ❌ | ✅ | | FileField | ❌ | ✅ | | MultiFileField | ❌ | ✅ | | GeoPointField | ❌ | ✅ | | GeoPolylineField | ❌ | ✅ | | GeoPolygonField | ❌ | ✅ | | ColorField | ❌ | ✅ | | GeometrySelectField | ❌ | ✅ | | GeometryMultiSelectField | ❌ | ✅ | | Chat | ❌ | ❌ | | AutodeskFileField | ❌ | ✅ | | ActionButton | ❌ | ❌ | | DownloadButton | ❌ | ❌ | | OptimizationButton | ❌ | ❌ | | SetParamsButton | ❌ | ❌ | In the comparison, rectangular means that each row in the `Table` contains the same columns visually as well as in the parameter set. Rows in a `DynamicArray` on the other hand could contain different input fields, by [hiding](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) certain fields when, for example, the user triggers a toggle. ``` import viktor as vkt class Parametrization(vkt.Parametrization): field = vkt.TextField('This is an example field') # table table = vkt.Table('Table') table.col_1 = vkt.TextField('TextField as table column') table.col_2 = vkt.BooleanField('BooleanField') table.col_3 = vkt.NumberField('NumberField') # visible not supported # dynamic array array = vkt.DynamicArray('Array') array.col_1 = vkt.TextField('TextField as array field') array.col_2 = vkt.BooleanField('BooleanField') array.col_3 = vkt.NumberField('NumberField', visible=vkt.RowLookup('col_2')) ``` In this example, a `DynamicArray` row in which the toggle (`col_2`) is active will also show the NumberField (`col_3`). In a `Table` `col_3` is always visible. ![](/assets/images/editor-table-array2-166018ede00e1d2b8ae6c1cf9d01c48a.png) *Visibility of columns/fields* --- # Textual input Reference For a more technical API reference, please see the following pages: * [`Text`](https://docs.viktor.ai/sdk/api/parametrization/.md#_Text) * [`TextAreaField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_TextAreaField) * [`TextField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_TextField) ## TextField - short texts[​](https://docs.viktor.ai/docs/create-apps/user-input/textual-input/.md#textfield---short-texts "Direct link to TextField - short texts") A `TextField` is a simple textual input field. ``` import viktor as vkt class Parametrization(vkt.Parametrization): text = vkt.TextField('This is a TextField') ``` ![](/assets/images/textfield-8cc52f6dfda628891aaca87a2476fabc.png) The user input can be obtained through the **params** argument and can have the following values: * `str`: when user inputs a text (e.g. "some text") * empty string when empty Expand to see all available arguments In alphabetical order: * **default**: a default value will be prefilled ``` text = vkt.TextField('This is a TextField', default="John Doe") ``` * **description**: add a tooltip with additional information ``` text = vkt.TextField('This is a TextField', description="This input represents the ...") ``` * **flex**: the width of the field between 0 and 100 (default=33) ``` text = vkt.TextField('This is a TextField', flex=50) ``` * **name**: defines the position of the parameter in the *params* ``` text = vkt.TextField('This is a TextField', name="t") # obtained using params.t ``` * **prefix**: a prefix will be put in front of the ui name ``` text = vkt.TextField('This is a TextField', prefix="..") ``` * **suffix**: a suffix will be placed behind the ui name ``` text = vkt.TextField('This is a TextField', suffix="..") ``` * **visible**: can be used when the visibility depends on other input fields ``` text = vkt.TextField('This is a TextField', visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ## TextAreaField - longer texts[​](https://docs.viktor.ai/docs/create-apps/user-input/textual-input/.md#textareafield---longer-texts "Direct link to TextAreaField - longer texts") For lengthier inputs, the `TextAreaField` can be used. ``` import viktor as vkt class Parametrization(vkt.Parametrization): text = vkt.TextAreaField('This is a TextAreaField') ``` ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASoAAACECAYAAAAnW2YFAAAWeElEQVR4Xu1dZ8gexRYeQbB3UbFjQ6NR+cRG7EGjMRELKuIPRYIYOxr1EzWIBbvYlSBBf2h+BAt2kahgJBoLauxRsSQQxfbZ/SH33meu5+W8883szu5bdnb3GQjGN7O7Z5458+yZM2fPWek//2uGjQgQASKQMAIrkagSnh2KRgSIgEWAREVFIAJEIHkESFTJTxEFJAJEgERFHSACRCB5BEhUyU8RBSQCRIBERR0gAkQgeQRIVMlPEQUkAkSAREUdIAJEIHkESFTJTxEFJAJEgERFHSACRCB5BEhUyU8RBSQCRIBERR0gAkQgeQRIVMlPEQUkAkSAREUdIAJEIHkESFTJTxEFJAJEgERFHSACRCB5BEhUyU8RBSQCRIBERR0gAkQgeQRIVMlPEQUkAkSAREUdIAJEIHkESFR9nqJnnnnGvPzyy2bGjBlmhx12CN79hx9+MPPmzTM777yzOfjggwtJcfHFF5stt9zSnH322YWuK9v5/vvvN6uttpo5+eSTy96i8uswL4sWLTJ///23Oeigg8zUqVMrl6lKAf766y+zfPly89tvv9k/q666qv2z4YYbmo033rhK0bzPLk1UsQsypRGLzGuvvba5/PLLM0nkhhtusP+eRzjuTWJxAVHddtttZvfddzfHHXdcIZj6RVSffvqpAQnlLdybb77Zyjdr1qxCcqbS+bXXXjOPPvqofXFsuummZrvtthv3EpF5y5O5qD7k3a+Kf//ss88sSYUaCAsv0DXXXLMK8ZpLVHfddZf5+uuvzY033pgJrFbGLIV75JFHzOuvv943ooqVL1Yrhk1UsXKl2g9kDFLO0g/8OxawtC+++MLq1G677WbWW2+9zu9777232WCDDfoy1NgXRV8e9u9NPv74Y/Ptt9/m3nLllVe2Y0+FrBphUcUSgRDVKqusYnbcccfgVuaKK66wE4ltQtE3qM+iipUvV3v+7UCiikXq//3K4B9rGReTpLv3sIlqxYoV5pNPPhkn8jrrrGOwFYS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AMmAvVDgERVvzmjxESgdQiQqFo35RwwEagfAiSq+s0ZJSYCrUOARNW6KeeAiUD9ECBR1W/OKDERaB0C/wW8PRfdlPTTxwAAAABJRU5ErkJggg==) The user input can be obtained through the **params** argument and can have the following values: * `str`: when user inputs a text (e.g. "some very very very ... long text") * empty string when empty Expand to see all available arguments In alphabetical order: * **default**: a default value will be prefilled ``` text = vkt.TextAreaField('This is a TextAreaField', default="Multiple lines \n are possible") ``` * **description**: add a tooltip with additional information ``` text = vkt.TextAreaField('This is a TextAreaField', description="This input represents the ...") ``` * **flex**: the width of the field between 0 and 100 (default=100) ``` text = vkt.TextAreaField('This is a TextAreaField', flex=50) ``` * **name**: defines the position of the parameter in the *params* ``` text = vkt.TextAreaField('This is a TextAreaField', name="t") # obtained using params.t ``` * **visible**: can be used when the visibility depends on other input fields ``` text = vkt.TextAreaField('This is a TextAreaField', visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ## Text - static text blocks[​](https://docs.viktor.ai/docs/create-apps/user-input/textual-input/.md#text---static-text-blocks "Direct link to Text - static text blocks") For more information on how to add a static text to the parametrization, that cannot be modified by the user, see [`Text`](https://docs.viktor.ai/docs/create-apps/inform-end-user/text-blocks/.md). There is no value associated with an `Text` field within the `params`. --- # Upload files Reference For a more technical API reference, please see the following pages: * [`FileField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_FileField) * [`MultiFileField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_MultiFileField) ## FileField - upload a file[​](https://docs.viktor.ai/docs/create-apps/user-input/upload-files/.md#filefield---upload-a-file "Direct link to FileField - upload a file") The `FileField` lets the user upload a single file. Explicit permission for certain file types can optionally be set using the `file_types` argument. The max size in bytes of the file to be uploaded can be set with `max_size`. ``` import viktor as vkt class Parametrization(vkt.Parametrization): file = vkt.FileField('Upload a file') ``` ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARYAAABVCAYAA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gOO7oKAHwQgFj8oow4QiBgBiCViA47ugoAfBCAWPyijDhCIGAGIJWIDju6CgB8EIBY/KKMOEIgYAYglYgOO7oKAHwQgFj8oow4QiBgBiCViA47ugoAfBFyLZd++fX60D3WAwKAlsH79+kHbdq8Ndy0WrxUjPwiAQHgJQCzhHVv0DAQCIwCxBIYeFYNAeAlALOEdW/QMBAIjALEEhh4Vg0B4CUAs4R1b9AwEAiMAsQSGHhWDQHgJQCzhHVv0DAQCIwCxBIYeFYNAeAlALOEdW/QMBAIjALEEhh4Vg0B4CfwHVoy+XCsy+MYAAAAASUVORK5CYII=) The user input can be obtained through the **params** argument and can have the following values: * `FileResource` object: when a file is selected (see [uploading files](https://docs.viktor.ai/docs/create-apps/managing-files/uploading-files/.md) for an example of usage) * `None`: when empty Expand to see all available arguments In alphabetical order: * **description**: add a tooltip with additional information ``` file = vkt.FileField('Upload a file', description="This field represents the ...") ``` * **file\_types**: optional restriction of file type(s) (case-insensitive) ``` file = vkt.FileField('Upload a file', file_types=[".png", ".jpg", ".jpeg"]) ``` * **flex**: the width of the field between 0 and 100 (default=33) ``` file = vkt.FileField('Upload a file', flex=50) ``` * **max\_size**: optional restriction on file size in bytes (e.g. 10\_000\_000 = 10 MB) ``` file = vkt.FileField('Upload a file', max_size=10_000_000) ``` * **name**: defines the position of the parameter in the *params* ``` file = vkt.FileField('Upload a file', name="f") # obtained using params.f ``` * **visible**: can be used when the visibility depends on other input fields ``` file = vkt.FileField('Upload a file', visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ## MultiFileField - upload multiple files[​](https://docs.viktor.ai/docs/create-apps/user-input/upload-files/.md#multifilefield---upload-multiple-files "Direct link to MultiFileField - upload multiple files") If multiple files need to be uploaded at the same time, the `MultiFileField` can be used. ``` import viktor as vkt class Parametrization(vkt.Parametrization): files = vkt.MultiFileField('Upload Multiple Files') ``` ![](data:image/png;base64,iVBORw0KGgoAAAAN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MFQxNDoxNTowOSswMjowMCIKICAgeG1wOk1vZGlmeURhdGU9IjIwMjI6MDg6MzBUMTQ6MTU6MDkrMDI6MDAiPgogICA8eG1wTU06SGlzdG9yeT4KICAgIDxyZGY6U2VxPgogICAgIDxyZGY6bGkKICAgICAgc3RFdnQ6YWN0aW9uPSJzYXZlZCIKICAgICAgc3RFdnQ6Y2hhbmdlZD0iLyIKICAgICAgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo5NmE5OGRlZC0wN2RjLTQ1MzctOTU3Zi1lNDcwOWUzNmU5ZDYiCiAgICAgIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkdpbXAgMi4xMCAoTGludXgpIgogICAgICBzdEV2dDp3aGVuPSIyMDIyLTA4LTMwVDE0OjE1OjA5KzAyOjAwIi8+CiAgICA8L3JkZjpTZXE+CiAgIDwveG1wTU06SGlzdG9yeT4KICA8L3JkZjpEZXNjcmlwdGlvbj4KIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAKPD94cGFja2V0IGVuZD0idyI/PukQwcMAAAAGYktHRAAAAAAAAPlDu38AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfmCB4MDwl7IWRdAAAMeklEQVR42u3db0xT5x4H8O+uxNK624vAGE4sAaXpdFBidC2Jix3RedW4xep2b9bshUsvL5xLtsV0b/aC3O3NFq65iY4XrHfLstRkmdRsrmu4vPBENLTBcVtUxA6YFDDyd7Ui2DsX7gt2zqX/CxYo8P0kSyY9p+ec55x++3ue57R9Ynp6ehpEREvkD2wCImIIERFDiIiIIUREDCEiIoYQETGEiIgYQkTEECIiYggREUOIiIghREQMISIihhARMYSIiBhCRMQQIiJiCBERQ4iIiCFERAwhIiKGEBExhIiIGEJExBAiImIIERFDiIiIIUREDCEiotnW1NbW1i7Xnff5fPj444/x66+/oqysbFG3bbFYcOvWLTz//PPL4vitVitu3ryJioqKOW3jhx9+wGeffYbi4mLk5eUt+DGNjY3h888/x4MHD1BSU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tMK4U7ucZvA/85fdv8T36bPSNiN90znycIxXBEPCv/wC1uxlCRATg/n/nFlT66K+FCvssWSqae+cfQuyOEa0wf1y7+NsceIzuGEOIaIXRL7OvNmIIEa0w+zYv/jb3PsZXfnBMiGiFeXXrzEBxKtP0wMwAtGvw8bpXjxN8vFmRaA4ePXqElpYWPHr0KLV3+awsvPDCC4v+W/X9QWC/LbVB6nRUQdZD81+fIUQ0Rz/99BO++OKLpEGUlZWFY8eOoaysbEn2sz8I/O1C6hXRfAPoHy8Bf5IxhIgyKoiWOoBm+6Zz5gZG10D6KqO9pTNdsHR80RlDiCjNQZRJAbQccHaMaJ7Kyspw7NixsPEeBhArIaIlq4gAMIAYQkRLQ/zRRf46DEOIiJYZjgkREUOIiBhCREQMISJiCBERMYSIiCFERMQQIiKGEBERQ4iIGEJERAwhImIIERExhIho5ViUnwD49NNP2dJECbz11lur9tj5fUJExO4YETGEiIgYQkTEECIiYggREUOIiIghREQMISIihhARMYSIiBhCRMQQIiJKq/8BIx0eis2foXEAAAAASUVORK5CYII=) The user input can be obtained through the **params** argument and can have the following values: * list of `FileResource` objects: when a file is selected (see [uploading files](https://docs.viktor.ai/docs/create-apps/managing-files/uploading-files/.md) for an example of usage) * empty list when empty Expand to see all available arguments In alphabetical order: * **description**: add a tooltip with additional information ``` files = vkt.MultiFileField('Upload Multiple Files', description="This field represents the ...") ``` * **file\_types**: optional restriction of file type(s) (case-insensitive) ``` files = vkt.MultiFileField('Upload Multiple Files', file_types=[".png", ".jpg", ".jpeg"]) ``` * **flex**: the width of the field between 0 and 100 (default=33) ``` files = vkt.MultiFileField('Upload Multiple Files', flex=50) ``` * **max\_size**: optional restriction on file size in bytes (e.g. 10\_000\_000 = 10 MB) ``` files = vkt.MultiFileField('Upload Multiple Files', max_size=10_000_000) ``` * **name**: defines the position of the parameter in the *params* ``` files = vkt.MultiFileField('Upload Multiple Files', name="f") # obtained using params.f ``` * **visible**: can be used when the visibility depends on other input fields ``` files = vkt.MultiFileField('Upload Multiple Files', visible=vkt.Lookup("another_field")) ``` See ['Hide a field'](https://docs.viktor.ai/docs/create-apps/user-input/hide-field/.md) for elaborate examples. ## Autodesk files[​](https://docs.viktor.ai/docs/create-apps/user-input/upload-files/.md#autodesk-files "Direct link to Autodesk files") Files residing on Autodesk cloud storage do not have to be downloaded and uploaded to VIKTOR, you can use the [AutodeskFileField](https://docs.viktor.ai/docs/create-apps/user-input/autodesk-files/.md) to reference a file on cloud directly instead. --- # Integrating with LLMs New in v14.29.0 Viktor LLM is a built-in large language model service — no external API key or third-party account required. It uses an OpenAI-compatible API, so you can use the standard `openai` Python client directly in your app. ## Why use Viktor LLM[​](https://docs.viktor.ai/docs/create-apps/viktor-llm/.md#why-use-viktor-llm "Direct link to Why use Viktor LLM") * **No setup** — no API key, no third-party account, no environment variables to manage * **OpenAI-compatible** — use the standard `openai` Python client * **Works in App Builder** — the `openai` package is pre-installed. ## How chat completions work[​](https://docs.viktor.ai/docs/create-apps/viktor-llm/.md#how-chat-completions-work "Direct link to How chat completions work") LLMs are **stateless** — the model has no memory of previous messages. Every request must include the complete conversation history from the beginning of the session. The model reads the full history, generates the next reply, and discards all state. The next message will need to include that reply in the history too. Messages are passed as an ordered list, each with a `role` and `content`: | Role | Who sends it | Purpose | | ----------- | --------------- | ---------------------------------------------------------------------------------------------- | | `system` | You (developer) | Sets the model's persona, constraints, and task context. Sent first, before any user messages. | | `user` | The end user | The user's input in each turn. | | `assistant` | The model | The model's reply from previous turns. | VIKTOR's `ChatConversation` (from `params.chat`) tracks only the `user` and `assistant` turns — it does not store `system` messages. Call `conversation.get_messages()` to retrieve the full conversation history, then prepend your `system` message before passing to the API. ## Basic usage[​](https://docs.viktor.ai/docs/create-apps/viktor-llm/.md#basic-usage "Direct link to Basic usage") The following example shows a complete chat integration with a system prompt and streaming. The [`ViktorOpenAI`](https://docs.viktor.ai/sdk/api/llm/.md#_ViktorOpenAI) helper provides the base URL and API key needed to configure the client: ``` import openai import viktor as vkt from openai import OpenAI # add to requirements.txt if not using App Builder client = OpenAI( base_url=vkt.ViktorOpenAI.get_base_url(version="v1"), api_key=vkt.ViktorOpenAI.get_api_key(), ) class Parametrization(vkt.Parametrization): chat = vkt.Chat("Chat", method="call_llm") class Controller(vkt.Controller): parametrization = Parametrization def call_llm(self, params, **kwargs): conversation = params.chat if not conversation: return None messages = [ {"role": "system", "content": "You are a helpful assistant."}, *conversation.get_messages(), ] try: stream = client.chat.completions.create( model="openai.gpt-oss-120b", messages=messages, stream=True, ) except openai.RateLimitError: raise vkt.UserError("Fair usage limit reached. Please try again later.") text_stream = ( chunk.choices[0].delta.content for chunk in stream if chunk.choices[0].delta.content is not None ) return vkt.ChatResult(conversation, text_stream) ``` note The VIKTOR SDK supports only the `user` and `assistant` roles in `ChatConversation`. Prepend `system` messages manually, as shown above. Fair usage The service enforces fair-usage limits. If your app exceeds the allowed token usage, the API returns a `429 Too Many Requests` response, which the `openai` library raises as `openai.RateLimitError`. Catch it and raise a `UserError` to surface a clear message, as shown above. ## Next steps[​](https://docs.viktor.ai/docs/create-apps/viktor-llm/.md#next-steps "Direct link to Next steps") * To give the LLM access to your app's functions — running calculations, fetching data, querying models — see [Tool Use](https://docs.viktor.ai/docs/create-apps/viktor-llm/tool-use/.md). * To analyze images using the built-in vision model — see [Vision](https://docs.viktor.ai/docs/create-apps/viktor-llm/vision/.md). * To let an external AI agent run your apps instead of your app calling a model, see [Connect agents via MCP](https://docs.viktor.ai/docs/create-apps/mcp/.md). --- # Tool use New in v14.29.0 Tool use lets the LLM call functions in your app — running calculations, fetching data, querying models — before composing its final response. For simple chat without tool calling, return to the [Viktor LLM overview](https://docs.viktor.ai/docs/create-apps/viktor-llm/.md). Viktor LLM supports OpenAI's function-calling schema via the Responses API. It maintains conversation context on the server side: instead of re-sending the full message history on each call, you chain requests using `previous_response_id`. ## Tool schema definition[​](https://docs.viktor.ai/docs/create-apps/viktor-llm/tool-use/.md#tool-schema-definition "Direct link to Tool schema definition") Define tools using the standard OpenAI function schema: ``` WEATHER_TOOL = { "type": "function", "name": "get_weather", "description": "Retrieve the current temperature for a given city.", "parameters": { "type": "object", "properties": { "city_name": { "type": "string", "description": "The name of the city to get the weather for.", }, "unit": { "type": "string", "enum": ["Celsius", "Fahrenheit", "Kelvin"], "description": "The temperature unit to return the result in.", }, }, "required": ["city_name", "unit"], }, } ``` ## Tool handler[​](https://docs.viktor.ai/docs/create-apps/viktor-llm/tool-use/.md#tool-handler "Direct link to Tool handler") Implement a Python function that executes when the model requests the tool: ``` def call_weather_tool(city_name: str, unit: str) -> str: # Replace with your actual data source or calculation return f"22 {unit}s" ``` ## Agentic loop[​](https://docs.viktor.ai/docs/create-apps/viktor-llm/tool-use/.md#agentic-loop "Direct link to Agentic loop") The agentic loop runs non-streamed calls until all tool requests are resolved, then streams the final answer. ``` import json import openai import viktor as vkt from openai import OpenAI class Parametrization(vkt.Parametrization): chat = vkt.Chat("Chat", method="submit_responses") class Controller(vkt.Controller): parametrization = Parametrization def submit_responses(self, params, **kwargs) -> vkt.ChatResult: client = OpenAI( base_url=vkt.ViktorOpenAI.get_base_url(version="v1"), api_key=vkt.ViktorOpenAI.get_api_key(), ) conversation = params.chat input_messages = conversation.get_messages() tool_call_display = "" previous_response_id = None try: # Initial non-streamed call response = client.responses.create( model="openai.gpt-oss-120b", input=input_messages, tools=[WEATHER_TOOL], max_output_tokens=96000, ) previous_response_id = response.id # Agentic loop: resolve tool calls until none remain while any(item.type == "function_call" for item in response.output): tool_inputs = [] for output_item in response.output: if output_item.type != "function_call": continue args = json.loads(output_item.arguments) if output_item.name == "get_weather": result = call_weather_tool( city_name=args["city_name"], unit=args["unit"], ) tool_call_display += f"Tool called: {output_item.name}, result: {result}\n\n" tool_inputs.append({ "type": "function_call_output", "call_id": output_item.call_id, "output": result, }) if not tool_inputs: break # No recognised tool calls — avoid infinite loop # Feed tool results back, chaining via previous_response_id response = client.responses.create( model="openai.gpt-oss-120b", input=tool_inputs, previous_response_id=previous_response_id, tools=[WEATHER_TOOL], max_output_tokens=96000, ) previous_response_id = response.id except openai.APIStatusError as exc: raise vkt.UserError(f"API error {exc.status_code}: {exc.message}") except openai.APIConnectionError as exc: raise vkt.UserError(f"Network error while calling the API: {exc}") def response_generator(): try: if tool_call_display: yield tool_call_display # Stream the final answer with client.responses.create( model="openai.gpt-oss-120b", input=[], previous_response_id=previous_response_id, tools=[WEATHER_TOOL], max_output_tokens=96000, stream=True, ) as stream: for event in stream: if event.type == "response.output_text.delta": yield event.delta except openai.APIStatusError as exc: raise vkt.UserError(f"API error {exc.status_code}: {exc.message}") except openai.APIConnectionError as exc: raise vkt.UserError(f"Network error while calling the API: {exc}") return vkt.ChatResult(conversation, response_generator()) ``` ### Key patterns[​](https://docs.viktor.ai/docs/create-apps/viktor-llm/tool-use/.md#key-patterns "Direct link to Key patterns") * **Non-streamed tool loop** — use `client.responses.create(stream=False)` for tool-call iterations so you can inspect `response.output` items synchronously. * **`previous_response_id` chaining** — pass the ID of the previous response to maintain context without re-sending the full history. * **`function_call_output` items** — feed tool results back as `input` in the next call. * **Streamed final answer** — once all tool calls are resolved, make one final streamed call with `input=[]` and the last `previous_response_id`. --- # Vision VIKTOR includes a built-in vision model that lets you analyze images directly in your app. Upload an image, send it to the model, and get a text description back — no external API key or third-party account needed. For basic text chat, see the [Viktor LLM overview](https://docs.viktor.ai/docs/create-apps/viktor-llm/.md). Chat Completions API only The built-in vision model is only supported via the Chat Completions API. The Responses API is not supported for this model. ## Example[​](https://docs.viktor.ai/docs/create-apps/viktor-llm/vision/.md#example "Direct link to Example") The following example shows a complete app that accepts an image upload and sends it to the vision model for analysis. Note that `vkt.ViktorOpenAI` handles authentication automatically — no API key setup is required on your end: ``` import base64 import viktor as vkt from openai import OpenAI client = OpenAI( base_url=vkt.ViktorOpenAI.get_base_url(version="v1"), api_key=vkt.ViktorOpenAI.get_api_key(), ) class Parametrization(vkt.Parametrization): title = vkt.Text("# AI Image Analyzer") image_file = vkt.FileField( "Upload Image", file_types=[".jpg", ".jpeg"], description="Upload a JPG image to be analyzed by the AI model.", ) class Controller(vkt.Controller): parametrization = Parametrization @vkt.WebView("Image Analysis") def analyze_image(self, params, **kwargs): if not params.image_file: return vkt.WebResult(html="<p>Please upload an image to get started.</p>") image_bytes = params.image_file.file.getvalue_binary() base64_image = base64.b64encode(image_bytes).decode("utf-8") image_url = f"data:image/jpeg;base64,{base64_image}" messages = [ { "role": "user", "content": [ {"type": "text", "text": "Describe what is shown in this image."}, {"type": "image_url", "image_url": {"url": image_url}}, ], } ] response = client.chat.completions.create( model="mistral.ministral-3-14b-instruct", messages=messages, ) result_text = response.choices[0].message.content html = f""" <html><body style="font-family:sans-serif;max-width:900px;margin:auto;padding:20px"> <img src="{image_url}" style="max-width:100%;border-radius:8px"> <p style="margin-top:16px;line-height:1.6">{result_text}</p> </body></html> """ return vkt.WebResult(html=html) ``` This is how your application should look: ![Sample app showing image analysis with vision LLM](/assets/images/vision-llm-example-app-3744d390d464265fa39b574e940a5fe2.jpg) ### Key patterns[​](https://docs.viktor.ai/docs/create-apps/viktor-llm/vision/.md#key-patterns "Direct link to Key patterns") * **Base64 encoding** — read the image as bytes, encode with `base64.b64encode`, and wrap in a `data:image/jpeg;base64,...` data URI. * **Vision message format** — the `content` field is a list containing a `text` item (your prompt) and an `image_url` item (the base64 data URI). * **Model** — use `mistral.ministral-3-14b-instruct` as the model ID. ## Image extension and MIME type[​](https://docs.viktor.ai/docs/create-apps/viktor-llm/vision/.md#image-extension-and-mime-type "Direct link to Image extension and MIME type") VIKTOR's LLM endpoint supports different image formats. For example, to use a PNG in the previous example, keep the base64 encoding the same and change the MIME type in `image_url` from `image/jpeg` to `image/png`. Use the matching MIME type for other supported formats: * JPG / JPEG → `image/jpeg` * PNG → `image/png` * WEBP → `image/webp` ``` image_url = f"data:image/png;base64,{base64_image}" image_url = f"data:image/webp;base64,{base64_image}" ``` Make sure the `FileField` also allows these file types. ## Limitations[​](https://docs.viktor.ai/docs/create-apps/viktor-llm/vision/.md#limitations "Direct link to Limitations") * VIKTOR's LLM endpoint only supports base64-encoded data URIs for images. HTTP URLs, such as `https://example.com/image.jpg`, are not supported. Images must be encoded inline. * Although the `chat.completions` endpoint supports the optional `detail` field in `image_url`, VIKTOR's LLM endpoint does not support detail levels such as `"low"`, `"high"`, or `"original"`. * The service enforces fair-usage limits. If your app exceeds the allowed token usage, the API returns a `429 Too Many Requests` response, which the `openai` library raises as `openai.RateLimitError`. Catch it and raise a `UserError` to show a clear message, as shown above. --- # FAQs tip Can’t find your question or solution here? Please reach out to our [Community Forum](https://community.viktor.ai/), so our community can help you! ## Account[​](https://docs.viktor.ai/docs/faq/.md#account "Direct link to Account") **What is my Personal Access Token and where can I find it?** Your Personal Access Token is a personal unique token, that can be used to securely access the API without needing a username and password. It looks something like: `vktrpat_●●●●●●●●●●●●●●_●●●●●●●●●●●●●●●●●●●●●●●●●●`. To access it: 1. Log in to your VIKTOR environment (`{company}.viktor.ai` or `cloud.viktor.ai`) 2. Go to the settings page by clicking the three dots next to your name in the top-right corner and after that clicking 'Settings'. Select the 'Access Tokens' tab. 3. Click on *Generate new personal access token*. 4. Copy the token and **store it somewhere safe**. ![](/assets/images/generate-pat-a31dd3a9d856b96c760ac0630d44f1c4.png) Storing your Personal Access Token Your Personal Access Token can be used to **access or alter your sensitive data**. You should therefore treat it the same as a (username &) password. Make sure to **securely store this token** (e.g. in a password manager or Key Management System) and never store it directly in source-code or share it with someone else. If you cannot store it securely, consider rotating your token (by generating a new token) each time after use. **What is my developer token and where can I find it?** Your developer token is a unique key needed to [configure the CLI](https://docs.viktor.ai/docs/create-apps/references/cli#configure). To access it: 1. Log in to your VIKTOR environment (`{company}.viktor.ai` or `cloud.viktor.ai`) 2. Go to the settings page by clicking the three dots next to your name in the top-right corner and after that clicking 'Settings'. Select the 'Developer Account' tab. 3. Click on *Generate new token*. 4. Copy the token and use it directly in the CLI configuration ![](/assets/images/generate-token-6324916ce9c4cafb13a000f0c633bcb7.png) *How to generate a new token* Sharing your Developer Token Your Developer Token can be used to **access or alter your development data** on your behalf. Make sure not to share it with anyone else. ## Using the CLI[​](https://docs.viktor.ai/docs/faq/.md#using-the-cli "Direct link to Using the CLI") **I get the error *"the provided email address and token are not registered at VIKTOR. Please rerun the 'configure' command with valid credentials"*** * Do you have a VIKTOR account? If not, you can create one for free [here](https://www.viktor.ai/try-for-free). * Make sure you provide the email you used to create your account. * Make sure you are using a valid token. To generate a new token you need to log in to VIKTOR, click the three dots next to your name and select 'Settings'. Subsequently, select 'Developer Account' and click the 'Generate new token' button. The token can be inserted into the CLI by running the following command: ``` viktor-cli configure ``` * If the steps above do not fix this problem for you, reach out to our [community forum](https://community.viktor.ai/) so that we can help you find a solution. **My command-line interface seems to be frozen** In case you accidentally clicked somewhere in the command prompt window, it could cause the process to freeze. You can resume the process by hitting enter. The frozen state can also completely be avoided by disabling "QuickEdit Mode": * Open a command prompt * Right-click the title bar and select "Properties" * Uncheck "QuickEdit Mode" * In addition, you can enable copy-pasting with Ctrl+C / Ctrl+V by deselecting "Use legacy console" and selecting "Enable Ctrl key shortcuts" * Restart the command prompt ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAooAAAEaCAIAAAAZmOEFAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9TtVUqDnYQcchQxcGCqKijVqEIFUKt0KqDyaUfQpOGJMXFUXAtOPixWHVwcdbVwVUQBD9AHJ2cFF2kxP81hRYxHhz34929x907QKgWmWa1jQKabpvJeExMZ1bEwCs60YEghjElM8uYlaQEPMfXPXx8vYvyLO9zf45uNWsxwCcSzzDDtInXiSc3bYPzPnGYFWSV+Jx4xKQLEj9yXXH5jXO+zgLPDJup5BxxmFjMt7DSwqxgasQTxBFV0ylfSLusct7irBXLrHFP/sJQVl9e4jrNAcSxgEVIEKGgjA0UYSNKq06KhSTtxzz8/XW/RC6FXBtg5JhHCRrkuh/8D353a+XGx9ykUAxof3Gcj0EgsAvUKo7zfew4tRPA/wxc6U1/qQpMf5J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AIJ4BAADxDAAA8QwAAIhnAACIZwAAQDwDAADiGQAA4hkAABDPAAAQzwAAgHgGAIB4BgAAxDMAACCeAQAgngEAAPEMAADxDAAAiGcAAIhnAABAPAMAQDwDAADiGQAAEM8AAAAAAKzf/wdC5yRw/mNDGgAAAABJRU5ErkJggg==) ![](/assets/images/cmd-enable-ctrl-keys-f92e05f63950e42fd2b5bc424f843ffd.png) **I’m not able to install my app and get the error *"Exiting because of an error: no requirements.txt file"*** When you run `viktor-cli install`, you ask VIKTOR to install the app stored inside the folder where you run the command. The error occurs when there is no `requirements.txt` file in the folder, or there is no app stored in that folder at all. To solve the latter: 1. Inside your command-line shell, first navigate to the folder with the app files. 2. Then, run: ``` viktor-cli install ``` **I get the error *"Manifest is invalid: Manifest misses entity type XXXX, which is present in the database"*** This error commonly occurs when you start a new app while the database still has information about a previously run app. The solution is to clear the database by running the following command in your command-line shell: ``` viktor-cli clear ``` **I’m not able to install my app and get an `SSLError`** Some companies use a proxy that modifies the SSL certification chain. This may cause an error when installing Python packages, or when performing requests within the app. See the [enterprise IT guide](https://docs.viktor.ai/docs/manage-apps/enterprise-it/.md#ssl-certificates) for possible solutions. **I get the error *"ModuleNotFoundError: No module named "XXXX”"*** This error commonly occurs when you try to use an external library in your app, but you did not install the library. You can solve this problem by: 1. Open the `requirements.txt` file found in your app folder. 2. Add the library name you want to use and save the file. 3. Install your app again by running `viktor-cli install` in the command-line shell. 4. Start your app with `viktor-cli start`. For example, if you want to use NumPy in your app, the `requirements.txt` file should look something like this: ``` viktor==X.X.X numpy ``` **I use an Anaconda / Miniconda distribution of Python and I get an error while using VIKTOR** An error often seen when using Anaconda / Miniconda is a *"SLL module not available"* error. The Anaconda distribution of Python is structured differently than the official distribution. Some modules (including the SSL module) are installed at a different location. A solution to use VIKTOR with an Anaconda / Miniconda distribution is to use the `viktor-cli` from the Anaconda (Powershell) Prompt, instead of Windows' own Powershell. You can open the Anaconda (Powershell) Prompt from the Windows start menu. #### Using Anaconda Prompt in PyCharm[​](https://docs.viktor.ai/docs/faq/.md#using-anaconda-prompt-in-pycharm "Direct link to Using Anaconda Prompt in PyCharm") In order to use the Anaconda Prompt within Pycharm, you can change the terminal path at `settings -> tools -> terminal`: 1. Right-click 'Anaconda Powershell Prompt' in the start menu and select 'Open file location'. 2. Right-click 'Anaconda Powershell Prompt' in file explorer and select 'Properties'. 3. Under the tab 'Shortcut', copy the entry at 'Target', excluding the first part ending with ".exe". For example, if the entry at 'Target' is... `%windir%\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy ByPass -NoExit -Command "& 'C:\ProgramData\Anaconda3\shell\condabin\conda-hook.ps1' ; conda activate 'C:\ProgramData\Anaconda3' "` ...only copy: `-ExecutionPolicy ByPass -NoExit -Command "& 'C:\ProgramData\Anaconda3\shell\condabin\conda-hook.ps1' ; conda activate 'C:\ProgramData\Anaconda3' "` 4. In PyCharm, go to `settings -> tools -> terminal`. Paste the above by appending to the existing powershell path (don't overwrite!) and press 'Apply' and 'OK'. This will then look similar to: `powershell.exe -ExecutionPolicy ByPass -NoExit -Command "& 'C:\ProgramData\Anaconda3\shell\condabin\conda-hook.ps1' ; conda activate 'C:\ProgramData\Anaconda3' "` 5. Restart the terminal in PyCharm. ## Running apps[​](https://docs.viktor.ai/docs/faq/.md#running-apps "Direct link to Running apps") **When I open my app I get the error *"failed to load the editor"*** This error occurs when your app loses connection with the CLI, for example, because: 1. You closed the command-line shell used to `viktor-cli start` your app. 2. You were inactive for an extended period, and the CLI disconnected automatically. The solution is simple. In your command-line shell, start your app again by running the following command: ``` viktor-cli start ``` **How do I use a Python package which is not available on Windows?** Some dependencies do not provide a [wheel](https://packaging.python.org/en/latest/glossary/#term-Wheel) for Windows on PyPI. In this case you can download unofficial Windows wheels provided by a third party such as [Christoph Gohlke](https://www.lfd.uci.edu/~gohlke/pythonlibs/) from the University of California. Because wheels are OS and Python version dependent, you will need to add [environment markers](https://www.python.org/dev/peps/pep-0508/#environment-markers) to `requirements.txt` for condition-based installation of dependencies. An example implementation is shown below for `some_dependency` that doesn't provide Windows wheels on PyPI. In that case your app can be structured as follows: ``` my-app ├── app ├── local-wheels │ └── some_dependency-1.0.0-cp312-cp312-win_amd64.whl ├── requirements.txt └── viktor.config.toml ``` and refer to the wheel in the `requirements.txt` as shown below: ``` viktor==X.X.X ./local-wheels/some_dependency-1.0.0-cp312-cp312-win_amd64.whl; platform_system == "Windows" some_dependency==1.0.0; platform_system != "Windows" ``` **Why is my published application not behaving the same as during development?** The apps you publish on the VIKTOR platform run on Linux. When you choose to develop using a Python virtual environment (venv), there will be several differences with respect to published apps on the platform. It is good to be aware of these differences to prevent unexpected errors after publishing an app. An overview of most common issues are listed below: **Python package works during development but not in production** If you are using a virtual environment on Windows you will be running the app and its Python dependencies on Windows. Some Python dependencies are not available on Linux, causing your app to break in production while it works without any problems during development. You can find the information on which operating systems you can use for a certain package on the [Python Package Index](https://pypi.org). **Python feature works during development but not in production** The application can be published on a specific Python version by setting the `python_version` in the [viktor.config.toml file](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#python_version), which could differ from the Python version you are using for development. If you are developing with a newer version, please make sure that you are not using features that are not supported by the Python version used for publishing. **System dependencies work during development but not in production** If you are using a virtual environment during development, you will be able to use Python packages that require system dependencies (e.g. `OpenCV`). System dependencies can be included in your published application by setting the `packages` in the [viktor.config.toml file](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#packages). **I can access my filesystem during development but not in production** When using a Python virtual environment as isolation mode it is possible to access the entire filesystem from the app code during development. If you publish an application on the platform however, only the folder containing the app is uploaded. If you access any resources outside this folder your app will not work. **My application is working during development but running out of memory in production** It is not possible to limit the memory usage of the Python process when using a virtual environment. Please keep in mind that standard apps on the platform have 500 MB of RAM available. Memory heavy operations that work in your virtual environment might not work in production. ## Docker[​](https://docs.viktor.ai/docs/faq/.md#docker "Direct link to Docker") **I am experiencing network / WiFi problems after changes in Hyper-V settings** If one experiences network or WiFi problems after turning on Hyper-V, then possible solutions are described on the [Docker website](https://docs.docker.com/docker-for-windows/troubleshoot/#networking-issues). This is a known issue that sometimes occurs during the Docker installation. **I get the error *"Deny write access to fixed drives not protected by Bitlocker"*** Please see <https://github.com/docker/for-win/issues/1297> for more information. **I get a warning *"WARNING: Running pip as the 'root' user..."* when I install my app** You can ignore this warning. --- # Get started with VIKTOR New to VIKTOR? Then you're in the right place. This is your go-to place for all the important info you need to start using VIKTOR. Here, you’ll find links to everything from the basics of VIKTOR, how it works and is organized, to creating apps and understanding the VIKTOR interface. Happy exploring! ## Using VIKTOR[​](https://docs.viktor.ai/docs/getting-started/.md#using-viktor "Direct link to Using VIKTOR") [![VIKTOR logo](/img/icons/icon-viktor-logo.svg)](https://docs.viktor.ai/docs/getting-started/what-is-viktor/.md) ### [What is VIKTOR?](https://docs.viktor.ai/docs/getting-started/what-is-viktor/.md) [* Why use VIKTOR?* How VIKTOR works* What can you do with VIKTOR?](https://docs.viktor.ai/docs/getting-started/what-is-viktor/.md) [![Widgets icon](/img/icons/icon-widgets.svg)](https://docs.viktor.ai/docs/getting-started/how-is-viktor-organized/.md) ### [How is VIKTOR organized?](https://docs.viktor.ai/docs/getting-started/how-is-viktor-organized/.md) [* Build apps* Connect apps* Share & use apps](https://docs.viktor.ai/docs/getting-started/how-is-viktor-organized/.md) ## Creating apps[​](https://docs.viktor.ai/docs/getting-started/.md#creating-apps "Direct link to Creating apps") Want to start creating your own app? **We recommend you start with the App Builder**. It’s the easiest and quickest way to create an app. Prefer your own IDE. It's also possible to install and develop VIKTOR apps locally. See [Two ways to build a VIKTOR app](https://docs.viktor.ai/docs/app-builder/choosing-development-approach/.md) for more information about the differences in build methods. ### Getting started with the App builder[​](https://docs.viktor.ai/docs/getting-started/.md#getting-started-with-the-app-builder "Direct link to Getting started with the App builder") You can start a new app directly from the Home page in the VIKTOR environment. 1. Describe the app you want to build in the prompt field at the top of the Home page. Make clear that you want to create a new app, for example "Create an app that calculates the bending moment of a beam". You can also click one of the example prompts below the field to fill it in. 2. The agent finds existing apps that match your request and offers **Start building**. 3. Click **Start building** to open the App Builder with your prompt carried over. ![](/assets/images/app-builder-1-55842f2349df2666acc78fb7b280c6c3.png) ![](/assets/images/app-builder-2-34667146396c9acf0c7957c488c9b417.png) Go to **[App Builder](https://docs.viktor.ai/docs/app-builder/.md)** for more detailed information on how to use the App builder, its features and limitations. ### Getting started with Local development[​](https://docs.viktor.ai/docs/getting-started/.md#getting-started-with-local-development "Direct link to Getting started with Local development") To start developing apps locally you need to install Python and VIKTOR on your own computer. That is assuming you already have an [IDE](https://docs.viktor.ai/docs/getting-started/installation/local-development/.md#ide-integrated-development-environment) installed. 1. Go to your **personal settings > local development**. 2. Here you click on **Install VIKTOR**. 3. The pop-up will guide you through the installation process. ![](/assets/images/local-installation-1-959d1885b3638c326d2a178362f489f3.png) ![](/assets/images/local-installation-2-0244832ab03dc514c87db8fc816cad6a.png) After you complete the installation, you can continue to the next step, the starter guide. * **Starter guide** Learn the basics of developing an app in VIKTOR [Learn more](https://docs.viktor.ai/docs/getting-started/starter-guide/.md) <!-- --> [ ](https://docs.viktor.ai/docs/getting-started/starter-guide/.md) Go to **[local development](https://docs.viktor.ai/docs/getting-started/installation/local-development/.md#tools)** to learn all about the different tools you will be working with. ### Fundamentals[​](https://docs.viktor.ai/docs/getting-started/.md#fundamentals "Direct link to Fundamentals") Whether you start with the App Builder or develop your app locally. It’s good to know some basics. [![Layers icon](/img/icons/icon-layers.svg)](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure/.md) ### [Basic app structure](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure/.md) [* App file structure* Inputs (parametrization)* Results & visualizations](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure/.md) [![Category icon](/img/icons/icon-category.svg)](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md) ### [App types](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md) [* Editor type* Simple type* Tree type](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md) ### VIKTOR components[​](https://docs.viktor.ai/docs/getting-started/.md#viktor-components "Direct link to VIKTOR components") Learn about the different types of fields and visualizations VIKTOR has to offer. [![Inputs illustration](/img/illustrations/Illustration-inputs-frame.svg)](https://docs.viktor.ai/docs/create-apps/user-input/.md) ### [Inputs](https://docs.viktor.ai/docs/create-apps/user-input/.md) [Add fields, sliders, uploads, etc so users can give your app the information it needs.](https://docs.viktor.ai/docs/create-apps/user-input/.md) [![Results illustration](/img/illustrations/Illustration-results-frame.svg)](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md) ### [Results](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md) [Show plots, charts, 3D models, tables and maps to visualize the results.](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md) [![Layouts illustration](/img/illustrations/illustration-layouts-frame.svg)](https://docs.viktor.ai/docs/create-apps/layout-and-styling/.md) ### [Layouts](https://docs.viktor.ai/docs/create-apps/layout-and-styling/.md) [Arrange how inputs, results, and other elements appear to make your app easy and intuitive to use.](https://docs.viktor.ai/docs/create-apps/layout-and-styling/.md) ### Integrations[​](https://docs.viktor.ai/docs/getting-started/.md#integrations "Direct link to Integrations") Eliminate manual data transfers between different software packages and disciplines. * **Integrations** Learn more about the integration options VIKTOR offers. [Learn more](https://docs.viktor.ai/docs/create-apps/software-integrations/.md) <!-- --> [ ](https://docs.viktor.ai/docs/create-apps/software-integrations/.md) ### Collaboration[​](https://docs.viktor.ai/docs/getting-started/.md#collaboration "Direct link to Collaboration") Share your apps and collaborate with your team. * **Sharing your app** Learn how to collaborate with other users on your app. [Learn more](https://docs.viktor.ai/docs/publish-apps/.md) <!-- --> [ ](https://docs.viktor.ai/docs/publish-apps/.md) --- # Fundamentals Gaining a good understanding of the fundamental building blocks of a VIKTOR app will help you in creating the most effective applications. We have split these fundamentals in the **core concepts**, which elaborates on the absolute minimum knowledge of creating an app, and **advanced concepts** which are relevant if you have more experience with VIKTOR. * #### Core concepts[​](https://docs.viktor.ai/docs/getting-started/fundamentals/.md#core-concepts "Direct link to Core concepts") Basic app structure - get familiar with the app files, and building blocks required to create a basic app. [Learn more](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure/.md) * App code execution flow - learn how and when the VIKTOR platform triggers your application code, and the stateless behavior when running calculations. [Learn more](https://docs.viktor.ai/docs/getting-started/fundamentals/call-flow/.md) - #### Advanced concepts[​](https://docs.viktor.ai/docs/getting-started/fundamentals/.md#advanced-concepts "Direct link to Advanced concepts") App types - VIKTOR offers different app types, each having their own pros and cons. [Learn more](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md) - Entity vs. entity type - dive into the differences between a so-called *entity* and an *entity-type*. [Learn more](https://docs.viktor.ai/docs/getting-started/fundamentals/entities-and-entity-types/.md) --- # App types The type of app can be set in the [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml#app_type) file by means of the `app_type` entry. App layout, requirements and corresponding feedback errors might differ depending on the chosen app type. Currently, the following types are available: [Editor](https://docs.viktor.ai/docs/tutorials/app-type-editor/.md) [The app consists of a single editor. Every user gets a 'fresh' editor upon entry and data is not saved.](https://docs.viktor.ai/docs/tutorials/app-type-editor/.md) [Simple](https://docs.viktor.ai/docs/tutorials/app-type-simple/.md) [The app consists of a single entity type. Users can create, save and edit instances of this type. Entities are shared among multiple users.](https://docs.viktor.ai/docs/tutorials/app-type-simple/.md) [Tree](https://docs.viktor.ai/docs/tutorials/app-type-tree/.md) [The app consists of multiple entity types in a developer-specified hierarchy. Entities are shared among multiple users.](https://docs.viktor.ai/docs/tutorials/app-type-tree/.md) ## Editor-type app[​](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md#editor-type-app "Direct link to Editor-type app") The simplest app structure consists of a single editor only. The user automatically enters the editor when opening the app instance, with no additional navigation functionalities. When a user opens the app instance, a unique session is created. Sessions are not shared among multiple users, and are automatically closed when leaving the editor (state is not saved). info The following are not available for the 'editor' app type: * [`InitialEntity`](https://docs.viktor.ai/sdk/api/core/.md#_InitialEntity) * [`ParamsFromFile`](https://docs.viktor.ai/sdk/api/core/.md#_ParamsFromFile) * [`Summary`](https://docs.viktor.ai/sdk/api/views/.md#_Summary) - **Create an editor-type app** [Tutorial](https://docs.viktor.ai/docs/tutorials/app-type-editor/.md) <!-- --> [ ](https://docs.viktor.ai/docs/tutorials/app-type-editor/.md) ## Simple-type app[​](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md#simple-type-app "Direct link to Simple-type app") The `simple` is similar to the `editor` type, however the user is able to create multiple entities of an entity type and the state of an entity can be saved. Changes are saved automatically and earlier created revisions can be restored if desired, see [saving and revisions](https://docs.viktor.ai/docs/getting-started/fundamentals/saving-and-revisions/.md). The user enters a folder and can navigate to the desired entity by selecting from the entity table. * **Create a simple-type app** [Tutorial](https://docs.viktor.ai/docs/tutorials/app-type-simple/.md) <!-- --> [ ](https://docs.viktor.ai/docs/tutorials/app-type-simple/.md) ## Tree-type app[​](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md#tree-type-app "Direct link to Tree-type app") More complex apps, consisting of an entity type hierarchy, can be created by choosing the `tree` app type. ### Recommended folder structure[​](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md#recommended-folder-structure "Direct link to Recommended folder structure") The `app.py` file can quickly become cluttered with a lot of code if your app grows in size. For tree-type apps we recommend to separate the code in sub-folders. This can be done by replacing the `app.py` file with a file called `__init__.py` within a folder named `app` and add sub-folders per entity type. Furthermore, it might be desirable to also split the controller and parametrization classes into separate files. For a hypothetical app with entity types `BlueType` and `GreenType` this looks as follows: ``` my-folder ├── app │ ├── blue_type │ │ ├── __init__.py │ │ ├── controller.py │ │ └── parametrization.py │ ├── green_type │ │ ├── __init__.py │ │ ├── controller.py │ │ └── parametrization.py │ └── __init__.py <- this is the new entry point of your app, replacing app.py ├── requirements.txt └── viktor.config.toml ``` note The `__init__.py` files in the entity type sub-folders are required to make Python treat directories containing the file as [packages](https://docs.python.org/3/tutorial/modules.html#packages) and can be left empty. ### Importing controllers[​](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md#importing-controllers "Direct link to Importing controllers") If the controller class is in a separate file, it can be imported in the app's `__init__.py` file using Python's `import` command. For example, a controller class named `BlueType` in a file `blue_type/controller.py` can be imported in `__init__.py` as follows: ``` from .blue_type.controller import BlueType # defines entity type 'BlueType' ``` If the class name itself does not equal the entity type name, you can import as an alias. For example, a class named `Controller` in a file `blue_type/controller.py` can be imported in the app's `__init__.py` file to act as the controller for the `BlueType` entity type as follows: ``` from .blue_type.controller import Controller as BlueType # defines entity type 'BlueType' ``` ### Initial entities[​](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md#initial-entities "Direct link to Initial entities") For a `tree` app type, it's required to define initial entities in code, since the top layer is not editable by the user. Initial entities can be set by means of the `initial_entities` variable in `app.py`, which is a list of [`InitialEntity`](https://docs.viktor.ai/sdk/api/core/.md#_InitialEntity) objects. For example, adding an entity with name "An example entity" of type "ExampleType" would look like: ``` import viktor as vkt class ExampleType(vkt.Controller): ... initial_entities = [ vkt.InitialEntity("ExampleType", name="An example entity", params=...) ] ``` note In your development workspace, the initial entities **including their children** are applied **on every start**. In a production app instance, however, **only the top level entities** are applied the **first time the app instance is created**. Click to see all available InitialEntity arguments `InitialEntity` has the following arguments: * **entity\_type\_name** (obligatory): Refers to the class name of the entity-type's controller (or its [alias](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md#importing-controllers)). * **name** (obligatory): Name of the entity which is shown in the interface. * **params**: params of the initial entity. If not defined, the default params will be set. Assume we have a parametrization with inputs `width` and `length`, the initial values can be set using a dictionary notation: ``` vkt.InitialEntity(..., params={"width": 300, "length": 500}) ``` or by pointing to a .json file located relative to the app file: ``` vkt.InitialEntity(..., params='initial_dimensions.json') ``` with `initial_dimensions.json`: ``` { "width": 300, "length": 500 } ``` * **children** info * [tree-type app](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md#tree-type-app) only List of children defined as `InitialEntity` objects. If not defined, no children will be added. Each child must be a valid child-type of its parent (i.e. the child-type must be defined as one of the `children` on the parent controller). ``` vkt.InitialEntity("ParentType", ..., children=[ vkt.InitialEntity("ChildType", ...), ... ]) ``` * **show\_on\_dashboard** (New in v13.7.0) info * [tree-type app](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md#tree-type-app) only * Top-level entities only This flag controls which top-level entities are shown as cards on the dashboard (default=`True`) * **use\_as\_start\_page** (New in v14.18.0) info * Not available for [editor-type app](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md#editor-type-app) * Single, top-level entity only This flag can be set on a single top-level entity to appoint it as starting page for the user, instead of the dashboard (default) - **Create a tree-type app** [Tutorial](https://docs.viktor.ai/docs/tutorials/app-type-tree/.md) <!-- --> [ ](https://docs.viktor.ai/docs/tutorials/app-type-tree/.md) --- # Basic app structure Terminology On this page you will encounter terms that are highlighted. These terms are core concepts and are used throughout our entire documentation. If you ever need a quick refresher, you can click on the section below to get a nice overview! Remind me! In alphabetical order: App files: * app.py: this file contains the **controller**, and additional logic of your application. * requirements.txt: all Python dependencies of your project are listed in this file. It should **at least** specify which version of the VIKTOR SDK your app should be using. * viktor.config.toml: additional configuration settings are listed in this file. Core: * controller: contains the code that defines the **parametrization** and one or multiple **views**. * editor: the place where users can create and adjust their designs, perform calculations, and inspect results. * parametrization: the parametrization consists of the **input fields**, **sliders**, and **buttons** a user can interact with. These fields are available on the left-hand side of the editor. * params: the Python object that can be used to access the **user input** in your app code. * view: a view is a visualization shown on the right-hand side of an editor. You can show **3D models**, **maps**, **graphs**, **reports**, **pictures** and much more. You can define **multiple views**. ***Not a reader?** feel free to follow this video* The core of a VIKTOR app is the editor. This is the place where users can create and adjust their designs, perform calculations, and inspect results. The image below shows the editor of a VIKTOR app: ![](/assets/images/viktor-app-5701f40445ec2c0461fa80a2f034f1ff.svg) An editor can be created by defining a so-called controller, which holds the code for: 1. Parametrization: the parametrization consists of the **input fields**, **sliders**, and **buttons** a user can interact with. These fields are available on the left-hand side of the editor. 2. View: a view is a visualization shown on the right-hand side of an editor. You can show **3D models**, **maps**, **graphs**, **reports**, **pictures** and much more. While each editor consists of a single parametrization, **multiple views** can be present. Before diving into these concepts more, let's have a look at what files you will need to build a VIKTOR app. ## App files[​](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure/.md#app-files "Direct link to App files") The minimum file structure of a VIKTOR app looks as follows: ``` my-app ├── app.py ├── requirements.txt └── viktor.config.toml ``` * app.py: this file contains the **controller**, and additional logic of your application. * requirements.txt: all Python dependencies of your project are listed in this file. It should **at least** specify which version of the VIKTOR SDK your app should be using. * viktor.config.toml: additional configuration settings are listed in this file. ## The controller[​](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure/.md#the-controller "Direct link to The controller") To define a controller you will need to inherit from the `ViktorController` class: ``` import viktor as vkt class Controller(vkt.Controller): ... ``` info You can specify controller attributes if desired. Click to see all available controller attributes * `parametrization`: defines the editor's [parametrization](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure/.md#defining-a-parametrization). * `summary`: to [show a summary](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/show-summary/.md). * `label` : name of the entity type as shown in the interface. * `children`: ([tree-type app](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md#tree-type-app) only) define this entity-type's children. Not providing the key is equal to having no children. * `show_children_as` (**mandatory when `children` is defined**): ([tree-type app](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md#tree-type-app) only) defines how to visualize the children ('Table' | 'Cards'). * `allow_saving`: Specify whether user is allowed to save entities of this entity-type. May only be set for root entity types in tree-type app. <!-- --> * When this value is set as `False` more than one user can run calculations on same editor, and the entities of this entity type becomes read-only. This value defaults to `True`. * methods for [views](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md). * methods for [action buttons](https://docs.viktor.ai/docs/create-apps/user-input/action-buttons/.md). * method for processing of a [file upload](https://docs.viktor.ai/docs/create-apps/managing-files/uploading-files/.md#upload-using-file-like-entity-type). ### Defining a parametrization[​](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure/.md#defining-a-parametrization "Direct link to Defining a parametrization") To create the editor's parametrization, you need to define a class that inherits from `ViktorParametrization` and assign it to the controller class using the `parametrization` attribute. [Input fields and action buttons](https://docs.viktor.ai/docs/create-apps/user-input/.md) can be added to the editor by adding them as attributes on the parametrization class: ``` import viktor as vkt class Parametrization(vkt.Parametrization): input_1 = vkt.TextField('This is a text field') # add a field for textual input input_2 = vkt.NumberField('This is a number field') # add a field for numeric input class Controller(vkt.Controller): parametrization = Parametrization # assign the parametrization class to the controller class ``` The above editor will look as follows in the interface: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA74AAAD8CAYAAABQBnj7AAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAAudEVYdENyZWF0aW9uIFRpbWUAV2VkIDA3IEF1ZyAyMDI0IDAyOjUxOjM0IFBNIENFU1TM2sovAAAgAElEQVR4nO3de1hVVeLG8Rc5ckhCRLmU4A3zwnirSE0TKy9DpmOFOr/McjSbNMvSyrwUmaaVZVo6WVqWlWZjaeWITqndsLzVqOmI2YiBYYEIAoIcBM7vjwMKcsfDxeX38zznAc5ee691trie/bLW2tvFbrfbBQAAgIvS+Zdydrtddrvk4lLwvV2Si+yyy6WUfVAyFxfHGXOcQRdJdrm4uMjFxeXsOS4oc/4+AOoWF4IvAADAxa3gcs4RyOxF3nOENsLuhXJxcTl7Lgt+Pvt+ofMPoG4i+AIAABig8CVd4TB2/jZUXeFge/45JvQCdRvBFwAAwCBFLu1cXBjtdaKCUV8ReIGLDsEXAADAQFziVS8CL3BxscTGxtZ2GwAAAAAAqDaM+AIAAAAAjFavthsAAAAAAEB1IvgCAAAAAIxG8AUAAAAAGI3gCwAAAACFJCefrO0mwMkIvgAAAAAAo1lquwEAAAAAcDE6kyel26SsHIlH5VSOiyR3i+RplerXwHAswRcAAAAAKulMnnQ8g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AwGgEXwAAAACA0Qi+AAAAAACjEXwBAAAAAEYj+AIAAAAAjEbwBQAAAAAYjeALAAAAADAawRcAAAAAYDSCLwAAAADAaARfAAAAAIDRCL4AAAAAAKMRfAEAAAAARiP4AgAAAACMRvAFAAAAABiN4AsAAAAAMBrBFwAAAABgNIIvAAAAAMBoBF8AAAAAgNEIvgAAAAAAoxF8AQAAAABGI/gCAAAAAIxG8AUAAAAAGI3gCwAAAAAwGsEXAAAAAGA0gi8AAAAAwGgEXwAAAACA0Qi+AAAAAACjEXwBAAAAAEYj+AIAAAAAjEbwBQAAAAAYjeALAAAAADAawRcAAAAAYDSCLwAAAADAaARfAAAAAIDRCL4AAAAAAKMRfAEAAAAARiP4AgAAAACMRvAFAAAAABiN4AsAAAAAMBrBFwAAAABgNIIvAAAAAMBoBF8AAAAAgNEIvgAAAAAAoxF8AQAAAABGI/gCAAAAAIxG8AUAAAAAGI3gCwAAAAAwGsEXAAAAAGA0gi8AAAAAwGgEXwAAAACA0Qi+AAAAAACjEXwBAAAAAEYj+AIAAAAAjEbwBQAAAAAYjeALAAAAADAawRcAAAAAYDSCLwAAAADAaARfAAAAAIDRCL4AAAAAAKMRfAEAAAAARiP4AgAAAACM9v+2KItuFvVILAAAAABJRU5ErkJggg==) *Example parametrization* ### Defining a view[​](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure/.md#defining-a-view "Direct link to Defining a view") Views can be added to the editor by defining a method on the controller class and [decorate](https://docs.python.org/3/glossary.html#term-decorator) it with one of our [available views](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md). The `label` argument is obligatory and defines the name of the view as shown in the interface. The view method should return the view result that corresponds to the chosen view type (e.g. `TableResult` for a `TableView`): ``` import viktor as vkt class Controller(vkt.Controller): @vkt.TableView("Results") def results(self, params, **kwargs): data = [ [1, 2], [3, 4], ] row_headers = ["Row 1", "Row 2"] col_headers = ["Col 1", "Col 2"] return vkt.TableResult(data, row_headers=row_headers, column_headers=col_headers) ``` info The view `label` is required, however more arguments can be specified if desired. Click to see all available view arguments * `label` (obligatory): name of the view as shown in the interface. * `duration_guess`: tells the platform whether the view should be rendered as a quick or slow visualization: <!-- --> * <= 3: Quick visualization, which updates with every change of one of the [input parameters it uses](https://docs.viktor.ai/docs/getting-started/fundamentals/call-flow/.md#view-input-parameters). * \> 3: Slow visualization, which is not updated automatically, but only by clicking its update button. * `description`: provide more information to the user through a tooltip (supports [Markdown](https://docs.viktor.ai/docs/create-apps/layout-and-styling/style-text/.md)). * `update_label`: change the default text presented on the update button. * `visible` (>= v14.22.0): set the view's visibility based on other input fields. See ['Hide a view'](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/hide-view/.md). The above editor will look as follows in the interface: ![](/assets/images/fundamentals-view-1b412298dd7ed354831a6055321a209b.png) *Example view* ### `params` - connecting input to output[​](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure/.md#params---connecting-input-to-output "Direct link to params---connecting-input-to-output") In the sections above we have seen how to define the **parametrization** and the **views**. You may have noticed that the example mentioned *params* in the signature of the view method: ``` def results(self, params, **kwargs): ``` which is not used elsewhere in the code.. This params argument is used by the VIKTOR platform to inject the **user input** into your application logic. Let's combine the examples we saw earlier into a single controller. The input value can be obtained by referencing the attribute names, for example `params.input_1`: ``` import viktor as vkt class Parametrization(vkt.Parametrization): input_1 = vkt.TextField('This is a text field') input_2 = vkt.NumberField('This is a number field') class Controller(vkt.Controller): parametrization = Parametrization @vkt.TableView("Results") def results(self, params, **kwargs): data = [ [params.input_1, 2], # retrieving the user input value of the TextField [3, params.input_2], # retrieving the user input value of the NumberField ] row_headers = ["Row 1", "Row 2"] col_headers = ["Col 1", "Col 2"] return vkt.TableResult(data, row_headers=row_headers, column_headers=col_headers) ``` The above editor will look as follows in the interface: ![](/assets/images/fundamentals-params-c84cf50222e542c001e1f4955fcca1ae.png) *Example editor* --- # App execution flow (Jobs) As a developer it is important that you fully understand how the VIKTOR platform triggers code when a user interacts with an application within the browser, in order to write effective code and prevent unexpected bugs. The app code execution flow is referred to as a job, and VIKTOR's execution flow might be different from the approach you are familiar with, especially if you are used to writing standalone (Python) scripts. ## Triggering actions[​](https://docs.viktor.ai/docs/getting-started/fundamentals/call-flow/.md#triggering-actions "Direct link to Triggering actions") A job is triggered if (and only if) one of the following actions take place: * **Modifying input** Probably the most occurring trigger of the app's code is by changing the value of an input field. The entry point in the code is the currently active view-method. The view-method is only triggered if the view actually uses the modified input field. If the changed field is not part of the view's [input parameters](https://docs.viktor.ai/docs/getting-started/fundamentals/call-flow/.md#view-input-parameters), the view keeps its current result and no job is started. note If the current view is 'slow' (i.e. `duration_guess>3`), the method is **not** triggered automatically. * **Refreshing a view** Similar to modifying the input, the currently active view-method is triggered if the user refreshes the view. This takes place when: * entering the editor * switching to another view tab * clicking the view's update button * **Clicking an action button** The third way of triggering the code is by clicking an action button (e.g. `DownloadButton`). The entry point in the code is the method linked to the button that is clicked. * **Clicking a next step button** In case of a [stepwise editor](https://docs.viktor.ai/docs/create-apps/layout-and-styling/steps/.md), the 'on-next' function is triggered when a user navigates to the next step. * **Pre-process upload file** A less typical case occurs when [defining an entity type as file](https://docs.viktor.ai/docs/create-apps/managing-files/uploading-files/.md#upload-using-file-like-entity-type). During the uploading of the file, the method decorated with the `ParamsFromFile` is triggered. In all cases, a method on the corresponding controller class is called, which ends with returning the required result to the platform. A job is completed after this return and code execution is terminated, waiting for a next trigger (which might already be present in the queue). The next trigger follows the same procedure (and if it is the same action it actually runs the same piece of code again!). ## View input parameters[​](https://docs.viktor.ai/docs/getting-started/fundamentals/call-flow/.md#view-input-parameters "Direct link to View input parameters") Each view has its own set of **input parameters**: the fields of the parametrization that the view-method consumes. VIKTOR determines this set automatically by analysing the code of the view-method, so you do not have to declare it yourself. It is used to decide which views are affected by an input change: a view is only recomputed (or marked out-of-date, in case of a 'slow' view) when one of its own input parameters changes. Views that do not use the changed field are left untouched. For example, in an app with a `NumberField` for the length of a beam and a `TextField` for the name of the project, a view that only uses the length is not recomputed when the user edits the project name. note The analysis is deliberately **conservative**: whenever the set of used parameters cannot be determined with certainty, VIKTOR falls back to the complete parametrization, so the view is recomputed on any input change. This can happen if, for example: * parameters are accessed dynamically, or the whole `params` object is passed on / copied * the view-method reads data that VIKTOR cannot see, such as files from [storage](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/storing-results/.md#persistent-storage) or data retrieved through the [VIKTOR API](https://docs.viktor.ai/docs/api/sdk/.md) ### Updating a view manually[​](https://docs.viktor.ai/docs/getting-started/fundamentals/call-flow/.md#updating-a-view-manually "Direct link to Updating a view manually") Every view has an **update** button, together with a timestamp indicating when its result was last updated. Use it to recompute a view without changing the input, for example to re-fetch data from storage or the VIKTOR API. For a 'slow' view (`duration_guess>3`) this is the same button that is used to update an out-of-date result. ## Stateless code[​](https://docs.viktor.ai/docs/getting-started/fundamentals/call-flow/.md#stateless-code "Direct link to Stateless code") A consequence of above-mentioned repetitive call flow is that the app's Python code is **stateless** (though within a call-cycle the code can still be stateful). This means that data is **not** stored within the code (e.g. on a global variable) for using it in the next call cycle. Instead, the data is recalculated each time it is requested. The only data that **is** stored (and thus can be used for the next call cycle) are the parameters (`params`) on each of the entities within the app. VIKTOR's stateless design is clarified in the following example. Imagine a cube defined by its length, width, and height, that can be set by the user. We want to show results based on these inputs to the user, by creating a `TableView`: ``` import viktor as vkt class Parametrization(vkt.Parametrization): length = vkt.NumberField("Length", default=1) width = vkt.NumberField("Width", default=1) height = vkt.NumberField("Height", default=1) class Controller(vkt.Controller): parametrization = Parametrization @vkt.TableView("Results") def results(self, params, **kwargs): volume = params.length * params.width * params.height surface = 2 * (params.length * params.width + params.length * params.height + params.width * params.height) data = [ [volume, "m³"], [surface, "m²"], ] row_headers = ["Volume", "Surface"] column_headers = ["Value", "Unit"] return vkt.TableResult(data, row_headers=row_headers, column_headers=column_headers) ``` Note that even though we calculate the surface area and volume of the cube, we never store this data. Each time the result is requested (e.g. when updating one of the dimensions in the editor), the above code is rerun. Similarly: * A report is generated and returned as download each time the user clicks the `DownloadButton` (the report is never stored). * A 3D-model is created and visualized in a `GeometryView` each time the user refreshes the corresponding view tab or modifies the input within the editor (the 3D-model is never stored). * A plot of the results is drawn and visualized in an `ImageView` each time the user refreshes the corresponding view tab or modifies the input within the editor (the figure is never stored). * etc. ## Single source[​](https://docs.viktor.ai/docs/getting-started/fundamentals/call-flow/.md#single-source "Direct link to Single source") The examples of output above (report, 3D-model, plot) can be seen as representations of one and the same model (defined solely by its parametrization). Besides it is not possible to store these alternative representations, it is also not desired. What would happen if we would store the 3D-model of the cube and subsequently modify its length? Exactly, the visualization would be outdated, possibly without the user even noticing. The concept of defining a 'model' by its minimal set of independent parameters is called **single source** modelling. ## Long-running results[​](https://docs.viktor.ai/docs/getting-started/fundamentals/call-flow/.md#long-running-results "Direct link to Long-running results") Sometimes, recalculating the results each time the information is requested is too time-consuming (e.g. if doing some long-running analysis to calculate results) and therefore not an option. We call such type of output **long-running results**. Below are solutions to two of the most common cases. ### Slow views[​](https://docs.viktor.ai/docs/getting-started/fundamentals/call-flow/.md#slow-views "Direct link to Slow views") For example, a user would not expect (nor desire) a plot of the results of a long calculation (e.g. a structural analysis with third-party software) to be cleared if he or she (accidentally) changes the value in a `NumberField`. Here **slow views** come in handy. A slow view is a `View` that is refreshed by clicking its 'update' button. It is triggered by [setting a high `duration_guess`](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure/.md#defining-a-view). The user is notified by means of a warning if the result has become outdated, but the figure would remain visible. ### Memoize[​](https://docs.viktor.ai/docs/getting-started/fundamentals/call-flow/.md#memoize "Direct link to Memoize") Another common example is the implementation of a `DownloadButton` (e.g. generating a result report) and a `View` (e.g. for showing the results in a plot) calling the same analysis. If a user wants to visualize the results within the view **and** download the report to its local hard disk, running the analysis twice would be undesirable. Preferably, the result is stored internally, so that it will return instantly on the second (or third) call. The [`memoize`](https://docs.viktor.ai/sdk/api/utils/.md#_memoize) function can be used to cache a calculation and achieve exactly this. ### Persistent storage[​](https://docs.viktor.ai/docs/getting-started/fundamentals/call-flow/.md#persistent-storage "Direct link to Persistent storage") VIKTOR offers storage which can be used to store and retrieve files within an app that is added to a project. The storage is persistent, meaning that the data will remain available with no time limit. This can be very helpful in cases where (intermediate) results need to be shared between jobs. For example, a long-running task is performed in job A, of which the results can be accessed in job B without the need to rerun the task. Read our [guide](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/storing-results/.md#persistent-storage) for more detail! ## Local files persistence between jobs[​](https://docs.viktor.ai/docs/getting-started/fundamentals/call-flow/.md#local-files-persistence-between-jobs "Direct link to Local files persistence between jobs") When writing data to a file in the filesystem of your development workspace, this file will be available between different jobs because it is actually saved on disk. However, the production environment works in a different way. An application is running in production in multiple processes, to support executing multiple jobs by multiple users working in parallel. Each of those processes has its own disk space. This means that the files stored in the disk of a specific process will be available to all jobs executed by that process, but not to other jobs executed by other processes. You as developer cannot control these processes or in which one a job will run, which could result in unpredictable behavior. Therefore we advise against working with local files! You can instead use the Persistent Storage. Read our [guide](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/storing-results/.md#persistent-storage) for more detail! --- # Entity vs. entity type A common source of confusion is the distinction between the terms 'entity' and 'entity type'. It is important to fully understand this terminology before diving deeper into VIKTOR's [call-flow](https://docs.viktor.ai/docs/getting-started/fundamentals/call-flow/.md). In short, an 'entity type' is the **definition** of a certain object, it's attributes and behavior (logic) specified in (Python) code. An 'entity' is a single **instance** of an entity type. An entity always has a certain entity type and multiple entities can be created with the same type. For example, an entity-**type** 'Cube' might be defined by its width, length and height. A 3 x 3 x 3 cube would be an **entity** of the type Cube, just as a 4 x 4 x 4 cube would be an(other) **entity** of the same type. As a metaphor (thinking in terms of the Python language): the entity type would be a 'class', whereas an entity would be an 'instance' of the class. ## Developer vs. User[​](https://docs.viktor.ai/docs/getting-started/fundamentals/entities-and-entity-types/.md#developer-vs-user "Direct link to Developer vs. User") Entity **types** are created by the app **developer**. The entity-type's definition and logic are defined in a [controller class](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure/.md#the-controller). Entity types are created during development. On the other hand, **entities** (of the predefined types) are typically created by the **user** within the app, they are created and modified at run-time. Two entities of the same type share the same behavior and the same set of attributes (since they share the same underlying code), but do not necessarily have the same attribute **values**. For example, the user might create a new cube entity (with different width, length and height values) that resides next to the already existing two, or modify the 4 x 4 x 4 cube mentioned above to a 4 x 4 x 5 cube by updating the corresponding height field within the entity's editor in the app. ![](/assets/images/cube-entity-vs-entity-type-50cf052b9e55d15a994a2b88198e7d3b.png) *Entity vs. entity type* note It is also possible for the developer to [create initial **entities**](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md#initial-entities) at development time. In contrast, it is not possible for the user to create entity **types** (as he/she is not able to modify the underlying app-code). ## Example[​](https://docs.viktor.ai/docs/getting-started/fundamentals/entities-and-entity-types/.md#example "Direct link to Example") Below are two example controllers (partly defined), in which the developer has defined 2 entity types: 'Project' and 'Design' (the latter being a child-type of the former). ``` import viktor as vkt class Project(vkt.Controller): label = 'Project' children = ['Design'] show_children_as = 'Cards' class Design(vkt.Controller): label = 'Design' ``` The figure below shows a snapshot of the current live application, as seen by the user. We can see that the user created an entity of type 'Project' (and named it 'My Project'). Within the created project, the user created 3 entities of type 'Design' (notice that 'Design' is its label seen by the user) and named them 'Design A', 'Design B', and 'Design C' respectively. ![](/assets/images/entity-vs-entity-type-7a5f8281df12d60584a0839de04b26b6.png) *Entity vs. entity type in VIKTOR* Since the designs are of the same entity type, opening their corresponding editor shows the same parametrization (after all, their logic is defined in the [parametrization class](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure/.md#defining-a-parametrization) of the entity type). Nevertheless, the attribute values assigned by the user make them unique: ![](/assets/images/design-a-vs-design-b-a2fb141a5192a2f2f3e6f315452002ad.png) *Entities 'Design A' (top) and 'Design B' (bottom) have equal parametrization but differ by value* --- # Saving and revisions Every time the state of an [entity](https://docs.viktor.ai/docs/getting-started/fundamentals/entities-and-entity-types/.md) is saved, VIKTOR stores a **revision**: a complete snapshot of the entity's input at that moment. Revisions are created automatically while a user works, and can also be created manually to mark a meaningful point in time. A revision stores the entity's input parameters. Results and views are not stored; they are recomputed when the entity is opened. ## Autosave[​](https://docs.viktor.ai/docs/getting-started/fundamentals/saving-and-revisions/.md#autosave "Direct link to Autosave") In `simple` and `tree` type apps, changes a user makes in the editor are saved automatically. The user does not have to press save to keep their work: closing the editor, an interrupted internet connection or an unexpected logout no longer means losing input. In `editor` type apps nothing is saved. Every user gets a fresh editor upon entry and the state is discarded when they leave. See [app types](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md) for the differences between the types. ## Pausing autosave[​](https://docs.viktor.ai/docs/getting-started/fundamentals/saving-and-revisions/.md#pausing-autosave "Direct link to Pausing autosave") A user can pause autosave to try something out without persisting the result: change inputs, look at what the app computes, and leave the entity as they found it. Pausing and resuming are offered in the save menu in the editor toolbar. A pause holds for the current session on the entity it was paused on. Opening that entity again, or opening another one, starts with autosave active. While autosave is paused, changes stay in the editor but are not stored. Manual saving remains available and does not end the pause, so a user can store a state they want to keep and continue afterwards. Leaving the entity while paused discards the changes that were not saved. VIKTOR warns before that happens, so the user can still save or resume autosave first. ## Manual saves[​](https://docs.viktor.ai/docs/getting-started/fundamentals/saving-and-revisions/.md#manual-saves "Direct link to Manual saves") A user can save manually at any time, and give that revision a name. Use it to mark a finished set of changes: a named revision is easy to find back later, and it tells colleagues reviewing the entity what that state represents. A manual save always stores the **complete** current state, including everything that was already saved automatically before it. It is not limited to the changes made since the last autosave. Saving manually is always possible, also when nothing has changed since the last save. ## Revision history[​](https://docs.viktor.ai/docs/getting-started/fundamentals/saving-and-revisions/.md#revision-history "Direct link to Revision history") The history panel lists the revisions of an entity, with the author and the moment they were created. Manually saved revisions are shown by default; automatic saves are grouped and collapsed underneath them, so the history stays readable. Any revision can be restored. Restoring does not erase anything: the state before restoring remains available as a revision of its own. Any two revisions can also be compared, by selecting them both in the history panel. Automatic saves can be selected as well, by expanding the group they are collapsed into. A comparison lists the input parameters that differ, with the section each one belongs to and its value in both revisions. Parameters that are the same in both are left out, so the list is the set of changes between the two states of the entity. ## Retention[​](https://docs.viktor.ai/docs/getting-started/fundamentals/saving-and-revisions/.md#retention "Direct link to Retention") Manually saved revisions and the current state of an entity are kept indefinitely. Of the automatic saves, VIKTOR keeps: * all of them within 15 minutes of the entity's most recent revision, so the latest editing session stays detailed; * one per 15 minutes before that, for each user that edited the entity. --- # How is VIKTOR organized? In this page, we explain how you can build, share, connect and use apps with VIKTOR. ## Build apps[​](https://docs.viktor.ai/docs/getting-started/how-is-viktor-organized/.md#build-apps "Direct link to Build apps") VIKTOR is built around the core idea of creating apps by defining what you want to automate. With VIKTOR, you can automate engineering workflows and turn ideas into working applications in minutes. You have two ways to build apps: the [App Builder](https://docs.viktor.ai/docs/app-builder/.md) generates and runs your code in the browser with no setup, while [local development](https://docs.viktor.ai/docs/getting-started/installation/local-development/.md) lets you write code in your own IDE for more complex apps. See [Two ways to build a VIKTOR app](https://docs.viktor.ai/docs/app-builder/choosing-development-approach/.md) for a side-by-side comparison. ### [Try VIKTOR](https://www.viktor.ai/start-now) [Tired of boring tasks? Create apps to automate any process, no matter how simple or complex. From no-code to full-code: you decide how it's built.](https://www.viktor.ai/start-now) ## Connect apps[​](https://docs.viktor.ai/docs/getting-started/how-is-viktor-organized/.md#connect-apps "Direct link to Connect apps") VIKTOR connects directly to the software you already use, such as Excel and any engineering applications from Autodesk, Bentley and Trimble, and much more by means of [integrations](https://docs.viktor.ai/docs/create-apps/software-integrations/.md). This means no more exporting, copying, and re-importing data between different tools and software. Instead, you can make everything work together in one connected and centralized workflow. As a result, your work becomes easier to manage, changes are applied more consistently, and you reduce errors caused by manual steps. What this means in practice: * **Works with your engineering tools:** Connects to the software and data you already use * **Reduces manual work:** No more copying and pasting between systems * **Everything in one flow:** Your data stays connected throughout the entire process * **Fewer errors:** Less risk of mistakes from manual transfers ## Share apps[​](https://docs.viktor.ai/docs/getting-started/how-is-viktor-organized/.md#share-apps "Direct link to Share apps") Once your app is ready, you can easily [share](https://docs.viktor.ai/docs/publish-apps/.md) it with your team. They can use it without having to understand the underlying logic. VIKTOR takes care of things like data storage and access rights in the background, so you don't have to worry about it. Publishing a new version does not change what your colleagues run straight away. An app has a **testing** version and a **production** version: testing always reflects your latest published version, and you decide when to release that version to production. People working in your projects run the production version. See [testing and production versions](https://docs.viktor.ai/docs/publish-apps/.md#testing-and-production-versions). What this means in practice: * **Easy to share:** Let others use your app (without exposing the logic behind it) * **You decide when updates land:** Try a new version out first, then release it to your projects * **Controlled access:** Decide who can use each app (specific users or your whole environment) ## Use apps[​](https://docs.viktor.ai/docs/getting-started/how-is-viktor-organized/.md#use-apps "Direct link to Use apps") To use an app in VIKTOR, you add it to a [project](https://docs.viktor.ai/docs/manage-projects/.md). Once added, the app gets its own version within that project, with its own data. ![How VIKTOR is organized](/assets/images/viktor-organization-2065265bb5cc0ad065222576d167d743.png) *Apps in the Library hold the logic. App instances in your projects hold the data and the people who use it.* ### What is a project?[​](https://docs.viktor.ai/docs/getting-started/how-is-viktor-organized/.md#what-is-a-project "Direct link to What is a project?") Think of a [project](https://docs.viktor.ai/docs/manage-projects/.md) like a folder for your work. Just like you would create a folder in SharePoint and add files to it, a VIKTOR project contains everything you need for a specific job to be done: * Your apps * Your data * Your team Each project is separate, so everything stays organized and relevant to that specific project. **How apps work inside a project** When you add an app to a project, you create a separate instance of that app.That means the app is copied, so the data is unique to that project. So, if you use the same app in two different projects, they won’t affect each other. **Why is this useful?** This setup helps you keep control and stay organized: * **Keep data separate**: Each project has its own data, even if you use the same app elsewhere * **Reuse apps easily**: Build an app once and use it across multiple projects * **Control who sees what**: Decide which users or teams can access each project and its data --- # Install VIKTOR There are 3 setup options to get started with VIKTOR: * **Standard installation (Recommended)** Install VIKTOR on your local computer [.](https://docs.viktor.ai/docs/getting-started/installation/local-development-venv/.md) * **Using GitHub Codespaces** If you are not able to install locally, for instance because you don't have permission to do so, or because you are running macOS you can use a cloud-based setup [.](https://docs.viktor.ai/docs/getting-started/installation/cloud-based-development/.md) * **Using Docker** A more advanced setup for experienced developers. Your development environment will closely match production, reducing unexpected differences when you deploy. [.](https://docs.viktor.ai/docs/getting-started/installation/installation-using-docker/.md) ## Restarting the installation[​](https://docs.viktor.ai/docs/getting-started/installation/.md#restarting-the-installation "Direct link to Restarting the installation") If you accidentally closed the installation pop-up or need to reinstall VIKTOR on an already activated account, see the guide on how to [restart the installation workflow](https://docs.viktor.ai/docs/getting-started/installation/restart-install-workflow/.md). Need help? If you encounter any problems during installation, check the [FAQ](https://docs.viktor.ai/docs/faq/.md) for common solutions. Still stuck? Our developers are ready to help you on the [Community Forum](https://community.viktor.ai/). --- # Cloud-based setup (using GitHub codespaces) If you are not allowed to install VIKTOR locally at your organization or your computer does not meet all the [requirements](https://docs.viktor.ai/docs/manage-apps/enterprise-it/.md#device-settings) for development with the VIKTOR platform, for instance because you have an Apple device, you can choose to use a remote development environment. A remote development environment is an environment that is hosted in the cloud and can be used together with a code editor in the browser. Examples of remote development environments are GitHub Codespaces, GitPod, and Replit. # Setup instructions Follow the steps below for a cloud-based setup using GitHub codespaces: 1. Go to your **Personal settings** 2. In the menu go to **Local development** 3. Here you click on **Install VIKTOR** ![](/assets/images/local-installation-1-959d1885b3638c326d2a178362f489f3.png) ![](/assets/images/local-installation-2-0244832ab03dc514c87db8fc816cad6a.png) 4. In the pop-up select **Use GitHub codespaces** ![](/assets/images/cloud-based-development-42b902978aa70a6e4d486016f4a1b0eb.png) 5. The pop-up will guide you through the rest of the installation process. Congratulations, you are now ready to start coding your first VIKTOR app! We recommend continuing with the [starter guide](https://docs.viktor.ai/docs/getting-started/starter-guide/.md) to learn how to do this. <!-- -->🚀 You can find all your codespaces, grouped by repository, in the dashboard: <https://github.com/codespaces>. For more info about codespaces please refer to the official [codespaces docs](https://docs.github.com/en/codespaces). --- # Install VIKTOR with Docker <!-- --> caution The installation procedure to run VIKTOR using Docker is **not recommended** for first-time users. By using Docker, running the code in development will more closely resemble production, so the chance of encountering differences between development and production is smaller. We recommend Docker only for experienced developers, as setting up Docker for Windows is not always convenient and, depending on your company size, may require a paid subscription. ## Prerequisites[​](https://docs.viktor.ai/docs/getting-started/installation/installation-using-docker/.md#prerequisites "Direct link to Prerequisites") Enterprise IT If you want to use VIKTOR within an enterprise IT-environment, please contact your IT-department to verify that your machine meets all [requirements](https://docs.viktor.ai/docs/manage-apps/enterprise-it/.md). Alternatively, you can consider using a [cloud-based development environment](https://docs.viktor.ai/docs/getting-started/installation/cloud-based-development/.md). Before you start the installation procedure, you can go through the following checklist to make sure your setup is ready for installation: * Machine should run on Windows 10 Home/Pro/Enterprise or Linux. * Python (64-bit); the programming language used by VIKTOR. * You will need personal VIKTOR credentials ([try for free!](https://www.viktor.ai/try-for-free)). * Virtualization needs to be turned on on your machine.<br />Go to `Task manager → Performance` and see if "Virtualization" is enabled. ![docker-bios-virtualization](/assets/images/docker-bios-virtualization-218246bb1b85fcfd75220b2102497e4d.png) caution If enabling of "Virtualization" is not allowed, it must be enabled in the BIOS of the machine first. In the BIOS, enable “Virtualization Technology (VTx)” (location and name may vary per machine) to do so. Please contact your IT department if you don't have the necessary permissions to make adjustments in your BIOS. ## What will I install?[​](https://docs.viktor.ai/docs/getting-started/installation/installation-using-docker/.md#what-will-i-install "Direct link to What will I install?") In order to use the VIKTOR platform, you need to install the following tools: * [Docker](https://docs.viktor.ai/docs/getting-started/installation/installation-using-docker/.md#installing-docker): software used by the CLI to run your app code in an isolated 'container' in the background. * [VIKTOR](https://docs.viktor.ai/docs/getting-started/installation/installation-using-docker/.md#installing-viktor): the standard local installation, including VIKTOR's command-line interface (CLI), which you then [switch to Docker](https://docs.viktor.ai/docs/getting-started/installation/installation-using-docker/.md#switching-to-docker). ## Installing Docker[​](https://docs.viktor.ai/docs/getting-started/installation/installation-using-docker/.md#installing-docker "Direct link to Installing Docker") Linux If you are using Linux, Docker can be installed using the package manager. There are two ways to install / use Docker on Windows: * Hyper-V virtualization (default): [system requirements](https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/hyper-v-requirements) * Windows Subsystem for Linux 2 (WSL2): [system requirements](https://docs.microsoft.com/en-us/windows/wsl/install-win10#step-2---check-requirements-for-running-wsl-2) The benefits and drawbacks of running on WSL2 are listed below: `+` installation and starting an app is fast<br />`+` installation of an app does not fail when deep dependency trees are present<br />`+` WSL2 is available for Windows Home, whereas Hyper-V is not<br />`-` WSL2 is not supported on all Windows versions<br />`-` conceptually more complex due to the separate Linux filesystem and command-line interface<br />`-` setting up requires more time We recommend to choose the default Hyper-V method and only choose WSL2 if you use Windows Home or you are experiencing issues during app development. * Hyper-V * WSL2 Estimated time: 1 hour 1. Install [Docker](https://docs.docker.com/docker-for-windows/install/) on your machine. When prompted, ensure "Enable Hyper-V Windows Features" is **selected** or "Install required Windows components for WSL 2" is **deselected** (options differ per installation version). 2. Open the Docker settings and **disable** the checkbox to use the WSL2 based engine in the "General" section, if this isn't the case yet: ![docker-hyper-v-backend](/assets/images/docker-hyper-v-backend-1f891168655e0ef6b197c48f6d574020.png) 3. Make sure that you share your user folder (`C:\Users\<username>`). Allowing sharing of drives or folders (shared drives) is necessary when using Linux containers. If this was not done during the installation, you can set it in `Docker → Settings → Resources → File Sharing`. 4. In the start menu, type “Turn Windows features on or off” (“Turn windows features on or off”) and make sure that Hyper-V is checked: ![docker-windows-features-hyper-v](/assets/images/docker-windows-features-hyper-v-d640af4ba0d841951cf8b9e95094bf72.png) 5. You can check all required Hyper-V features by running the `systeminfo` command in `cmd.exe`. All requirements should have a value "yes". If this is not the case, please visit the [website of Microsoft](https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/hyper-v-requirements) for more information. Estimated time: 1 to 1.5 hours An alternative method of running VIKTOR is by using Windows Subsystem for Linux 2 (WSL2). WSL2 is a dedicated part of Windows which can be used to run Linux processes, providing an alternative to Hyper-V virtualization. In order to run Docker with WSL2, you will need to meet the stated [requirements](https://docs.microsoft.com/en-us/windows/wsl/install-win10#step-2---check-requirements-for-running-wsl-2). 1. Install [Docker](https://docs.docker.com/docker-for-windows/install/) on your machine. When prompted, ensure "Enable Hyper-V Windows Features" is **deselected** or "Install required Windows components for WSL 2" is **selected** (options differ per installation version). 2. Install [WSL2](https://docs.microsoft.com/en-us/windows/wsl/install-manual). * When asked for a Linux distribution, we recommend choosing the latest Ubuntu LTS version. * It is NOT necessary to create an account for the distribution. In case you do not have access to the Microsoft store, a manual download of a Linux distribution can be found [here](https://docs.microsoft.com/en-us/windows/wsl/install-manual#downloading-distributions). 3. Start Ubuntu from the start menu. This action will open a command-line shell and ask you to create a user account. 4. Open the Docker settings and configure the following: * General: enable the checkbox to use the WSL2 based engine * Resource → WSL integration: enable the checkbox "Enable integration ..." and manually select the correct Ubuntu distro ![docker-wsl2-backend](/assets/images/docker-wsl2-backend-c90a7dc5b1b0180183111f48ea52fb25.png) 5. Reboot your machine. 6. Start Ubuntu and type the following path in the file explorer address bar: `\\wsl$\Ubuntu-20.04` (replace "Ubuntu-20.04" with your distribution name) to get started. ## Installing VIKTOR[​](https://docs.viktor.ai/docs/getting-started/installation/installation-using-docker/.md#installing-viktor "Direct link to Installing VIKTOR") Install VIKTOR using the standard installation flow for local development: 1. Go to your **Personal settings** 2. In the menu go to **Local development** 3. Here you click on **Install VIKTOR**. 4. Complete all steps in the pop-up. The pop-up detects your operating system. If you use WSL2, click **I have a different operating system** and select Linux, and run the installation steps in your Ubuntu shell. See [Standard installation](https://docs.viktor.ai/docs/getting-started/installation/local-development-venv/.md) for more details on this flow. ## Switching to Docker[​](https://docs.viktor.ai/docs/getting-started/installation/installation-using-docker/.md#switching-to-docker "Direct link to Switching to Docker") The standard installation sets up VIKTOR's command-line interface (CLI) with the default isolation mode. To run your apps in Docker instead, open your command-line shell and run: ``` viktor-cli configure ``` The configure command goes through your current settings one by one. Press Enter to keep each setting as it is, and change only the isolation mode to `docker`. ## System check[​](https://docs.viktor.ai/docs/getting-started/installation/installation-using-docker/.md#system-check "Direct link to System check") Run the following command to verify the installation: ``` viktor-cli check-system --docker ``` The check system command performs several checks. The conclusion of the checks are printed at the end of the message: ``` Starting VIKTOR system check... V Operating system internet access V Docker runs V Docker using correct container V Docker access to user directory V Docker internet access V Docker access to PyPI V Docker access to VIKTOR domains The system check has been completed with the following conclusions: V Your system is ready to use VIKTOR with isolation mode 'docker' ``` If all checks succeeded, a "V" will be printed in front of *Your system is ready to use VIKTOR with isolation mode 'docker'*. If any of the system checks fails, additional information can be printed to the command-line by using the `--verbose` flag as follows: ``` viktor-cli check-system --docker --verbose ``` --- # Standard installation To start developing apps locally you need to install Python and VIKTOR on your own computer. 1. Go to your **Personal settings** 2. In the menu go to **Local development** 3. Here you click on **Install VIKTOR**. 4. The pop-up will guide you through the installation process. ![](/assets/images/local-installation-1-959d1885b3638c326d2a178362f489f3.png) ![](/assets/images/local-installation-2-0244832ab03dc514c87db8fc816cad6a.png) After completing the installation we recommend continuing with the [starter guide](https://docs.viktor.ai/docs/getting-started/starter-guide/.md) ## FAQs[​](https://docs.viktor.ai/docs/getting-started/installation/local-development-venv/.md#faqs "Direct link to FAQs") **I get a warning that "viktor-cli-installer.msi isn't commonly downloaded". How do I proceed?** Click "Keep", "Show more" and "Keep anyway" to download the installer. For more information have a look at the gif below: ![](/assets/images/windows-warning-1975206f95d781da9e71494d8f47fc41.gif) **Windows defender does not allow me to install the VIKTOR CLI** Sometimes, Windows defender prevents the CLI installer from running. To solve this: 1. Click “More info”. 2. Click on “Run anyway”. ![](/assets/images/windows-defender-8dcdc78ceb8ce76493ca69e075080def.png) *Windows defender* **What if I'm not allowed to install VIKTOR on my computer at my company?** If your company has set restrictions on either your computer or the company's network that make it impossible to install locally, we recommend using the [App Builder](https://docs.viktor.ai/docs/app-builder/.md). If you ran into the limits of the App Builder and need advanced functionalities, you can [Use GitHub Codespaces](https://docs.viktor.ai/docs/getting-started/installation/cloud-based-development/.md) Need Help? Couldn't find an answer to your problem? Our developers are ready to help you on the **[Community Forum](https://community.viktor.ai/)** --- # Local development Local development means writing your VIKTOR app in Python on your own machine, using your preferred IDE (such as VS Code or PyCharm) and connecting to the VIKTOR platform through the VIKTOR CLI. It gives you full control over your code, packages, and tooling — the right choice once your app outgrows the [App Builder](https://docs.viktor.ai/docs/app-builder/.md) or when you want to use features like Git, automated testing, or desktop software integrations. This page walks you through installing VIKTOR locally, running your first app, and getting familiar with the [tools](https://docs.viktor.ai/docs/getting-started/installation/local-development/.md#tools) you'll use day-to-day. ## Getting started with Local development[​](https://docs.viktor.ai/docs/getting-started/installation/local-development/.md#getting-started-with-local-development "Direct link to Getting started with Local development") Follow the steps below to get started with local development: 1. [Install VIKTOR](https://docs.viktor.ai/docs/getting-started/installation/local-development-venv/.md) To start developing apps locally you need to install Python and VIKTOR on your own computer. [Learn more](https://docs.viktor.ai/docs/getting-started/installation/.md) <!-- --> [ ](https://docs.viktor.ai/docs/getting-started/installation/.md) 2. [Create your first app](https://docs.viktor.ai/docs/getting-started/starter-guide/.md) Follow our starter guide to learn how to create your first app step by step. [Learn more](https://docs.viktor.ai/docs/getting-started/starter-guide/.md) <!-- --> [ ](https://docs.viktor.ai/docs/getting-started/starter-guide/.md) 3. [Learn the fundamentals](https://docs.viktor.ai/docs/create-apps/.md#fundamentals) Learn about the basic structure of a VIKTOR app and the available app types, inputs, results and layouts. [Learn more](https://docs.viktor.ai/docs/publish-apps/.md) <!-- --> [ ](https://docs.viktor.ai/docs/publish-apps/.md) 4. [Try one of our tutorials](https://docs.viktor.ai/docs/tutorials/.md) To see some more examples and improve your skills, pick one of our tutorials and learn more about creating awesome VIKTOR apps! [Learn more](https://docs.viktor.ai/docs/tutorials/.md) <!-- --> [ ](https://docs.viktor.ai/docs/tutorials/.md) ## Tools[​](https://docs.viktor.ai/docs/getting-started/installation/local-development/.md#tools "Direct link to Tools") At the start of your developer journey, all the different terms can feel a bit overwhelming. So here’s a quick summary of the main tools you’ll be using: ![Tools](/assets/images/Illustration-local-development-cceb8d785ce09913a532f399f82f729c.svg) ### IDE (Integrated Development Environment)[​](https://docs.viktor.ai/docs/getting-started/installation/local-development/.md#ide-integrated-development-environment "Direct link to IDE (Integrated Development Environment)") This is the program you use to develop your VIKTOR app. Popular choices are [Visual Studio Code](https://code.visualstudio.com/) or [PyCharm](https://www.jetbrains.com/pycharm/). These IDEs include a couple of helpful features: * **Code editor**: where you write and edit your app’s code. * **Terminal**: a place where you can type commands to your computer. You’ll use it to run your app and connect it to VIKTOR platform using the [VIKTOR CLI](https://docs.viktor.ai/docs/create-apps/references/cli). For more information on how to setup your code editor, go to: [Setting up code editor](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/ide/.md). ### Python[​](https://docs.viktor.ai/docs/getting-started/installation/local-development/.md#python "Direct link to Python") This is the programming language used to write VIKTOR apps. We chose Python because it is designed to be readable and beginner-friendly. VIKTOR supports Python 3.10 - 3.14 (64-bit). Python can be downloaded from the [official website](https://www.python.org/). ### VIKTOR SDK (Software Development Kit)[​](https://docs.viktor.ai/docs/getting-started/installation/local-development/.md#viktor-sdk-software-development-kit "Direct link to VIKTOR SDK (Software Development Kit)") The **VIKTOR SDK** is a Python package that gives your app everything it needs to become a VIKTOR app: ready-made components and helpful utilities that you use to build your app. You install it on your computer and use it in your Python code. That’s why you put `import viktor as vkt` at the start of your `app.py` file — it tells Python that you want to use the tools from the VIKTOR SDK in your app. ### VIKTOR CLI (Command Line Interface)[​](https://docs.viktor.ai/docs/getting-started/installation/local-development/.md#viktor-cli-command-line-interface "Direct link to VIKTOR CLI (Command Line Interface)") A small helper program you use in the terminal to start your app and connect it to the VIKTOR platform. For more information about the CLI and all available commands, go to [VIKTOR CLI](https://docs.viktor.ai/docs/create-apps/references/cli). ### VIKTOR Platform (in the browser)[​](https://docs.viktor.ai/docs/getting-started/installation/local-development/.md#viktor-platform-in-the-browser "Direct link to VIKTOR Platform (in the browser)") This is where your app actually runs and is displayed. While you write your code and start your app from your computer, the VIKTOR platform runs your app in the cloud. You can open it in your browser to see the app, interact with it, and check your results — exactly as your users will. ### Packages & dependencies[​](https://docs.viktor.ai/docs/getting-started/installation/local-development/.md#packages--dependencies "Direct link to Packages & dependencies") When developing locally, app dependencies need to be specified in your app's requirements.txt file. For more information about packages & dependencies, go to [Using Python Packages](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/use-python-packages/.md). NEED HELP If you encounter any problems during installation, or starting with local development check the [FAQ](https://docs.viktor.ai/docs/faq/.md) for common solutions. Still stuck? Our developers are ready to help you on the [Community Forum](https://community.viktor.ai/). --- # Reinstall If you need to reinstall VIKTOR (whether you previously installed it locally, used it with GitHub Codespaces, or are setting it up on a new device), you can reset your installation through your user settings. Steps to reinstall: 1. Go to your **Personal settings** 2. In the menu go to **Local development** 3. Here you click on **Reinstall VIKTOR button**. 4. The pop-up will guide you through the (re)installation process. ![](/assets/images/local-installation-1-959d1885b3638c326d2a178362f489f3.png) ![](/assets/images/reinstall-c9838337bc369e13183319a508078073.png) --- # Starter guide Great to see you are ready to learn how to use VIKTOR! Here you will learn the basics of creating VIKTOR apps! Before you continue, please make sure you completed the [installation / activation instructions](https://docs.viktor.ai/docs/getting-started/installation/.md) which include: * Installing Python on your computer * Installing a code editor on your computer (e.g. [PyCharm](https://www.jetbrains.com/pycharm/download/) or [VS Code](https://code.visualstudio.com/Download)) * Activating your VIKTOR development account New to Python? Writing VIKTOR apps requires basic Python knowledge. If you are entirely new to this programming language, we advise to check out ["Python for Non-Programmers"](https://wiki.python.org/moin/BeginnersGuide/NonProgrammers) which lists learning resources including some nice interactive courses. ## Create app[​](https://docs.viktor.ai/docs/getting-started/starter-guide/.md#create-app "Direct link to Create app") Before you can start developing, the app needs to exist on the VIKTOR platform. The `create-app` command takes care of this: it registers a new app on the platform and — with the `--init` flag — also generates the initial app code in a local folder on your machine so you can start building right away. Before you continue Make sure that you **have a code editor installed on your computer.** We recommend using [**VS Code**](https://code.visualstudio.com/Download) or [**PyCharm**](https://www.jetbrains.com/pycharm/download/). If you use GitHub Codespaces make sure that you have a Codespace open, which you probably have if you followed the installation process. Open Windows PowerShell using Start (or a terminal if you use Linux/Mac) and run the command below. If you use GitHub Codespaces simply run the command in the terminal of your Codespace. ``` viktor-cli create-app "Hello VIKTOR" --init --app-type editor ``` The `--init` flag generates an initial app structure in a new `hello-viktor` folder in your current directory. The `--app-type editor` sets the app type to **editor**, which allows each user to create and manage their own instances of the app — the recommended choice when getting started. Learn more about the different [app types](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md). Once the command completes, open the `hello-viktor` folder in your code editor. From within the folder, install the app's dependencies and start it against the platform by running: ``` viktor-cli clean-start ``` This is shorthand for running `viktor-cli install`, `viktor-cli clear`, and `viktor-cli start` in sequence — the full first-time setup in one command. **Do not close the terminal** as this will break the connection with your app. When to use which CLI command * **`viktor-cli clean-start`** — first-time setup for a new app. Installs dependencies, clears the database, and starts the app. * **`viktor-cli start`** — daily use. Reconnects an already-installed app to the platform. * **`viktor-cli install`** — after changing `requirements.txt`. Reinstalls dependencies without clearing data. * **`viktor-cli clear`** — when your code introduces a breaking change to the database schema (you'll see an "App definition is not compatible..." error). After clearing, run `viktor-cli start`. See the [CLI reference](https://docs.viktor.ai/docs/create-apps/references/cli) for the full command list. Need help? **When I try to open the app code I see a warning message regarding trusting the project** You may first see a security warning about trusting projects located in the `hello-viktor` directory. * PyCharm * VS Code Go ahead and tick the checkbox, followed by clicking the "Trust Project" button: ![](/assets/images/starter-guide-pycharm-trust-3d2323d3b9ecf4ba4dfe96d3e5daacb5.png) PyCharm should now open and look similar as shown below: ![](/img/docs/starter-guide-pycharm.png) Go ahead and click the "Trust Folder & Continue"" button: ![](/assets/images/starter-guide-vscode-trust1-8ba0ce9af63d704f9958b38bdb765fa7.png) Subsequently you can click the checkbox to automatically trust all your future apps, and click "Yes, I trust the authors": ![](/assets/images/starter-guide-vscode-trust2-230654bcc4f9c7fbc7bdd0d461b2ccae.png) VS Code should now open and look similar as shown below: ![](/img/docs/starter-guide-vscode.png) **I get the following error message 'viktor-cli not recognized'** If you activated your account, continued with the starter guide and installed a code editor in the same session you might encounter the following error: ``` viktor-cli : The term 'viktor-cli' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + viktor-cli + ~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (viktor-cli:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException ``` You can solve this error by closing and restarting your code editor. After doing so you can run the command without any problems. The problem is caused because your code editor inherits the environment variables of the process that launched it and because you installed the VIKTOR CLI in the same session it requires a restart to be recognized properly. **I cannot find my code editor's terminal** You can find the terminal as shown below: * PyCharm * VS Code ![](/img/docs/new-terminal-pycharm.png) ![](/img/docs/new-terminal-vscode.png) **Where is the app located on my computer?** When you run the `create-app` command with `--init`, a new `hello-viktor` folder is created in the directory where you ran the command. ## Open the development workspace[​](https://docs.viktor.ai/docs/getting-started/starter-guide/.md#open-the-development-workspace "Direct link to Open the development workspace") Each app has its own development workspace — this is where you can see what your app looks like in the browser and try out its functionality. You can enter the development workspace in two different ways: 1. By clicking the **Develop** button on the app card. The 3 latest apps you created are shown on the **Develop** page. Alternatively, you can find all your apps on the **Develop** page. ![](/img/docs/development-workspace-app-card.png) 2. By following the URL that is shown in the terminal when your app code connects to the VIKTOR platform. This is a direct link to the corresponding development workspace. ``` INFO : Connecting to cloud.viktor.ai... INFO : Connection is established (use Ctrl+C to close) INFO : INFO : Navigate to the link below to see your app in the browser INFO : https://cloud.viktor.ai/workspaces/XXX/app INFO : INFO : App code loaded, waiting for jobs... ``` After entering the development workspace, you'll see your (still empty) app — ready to be built out in the next sections. ## Create input fields[​](https://docs.viktor.ai/docs/getting-started/starter-guide/.md#create-input-fields "Direct link to Create input fields") Open the `app.py` file in your code editor. This is where you will write the code of your app. The content should look like this: ``` import viktor as vkt class Parametrization(vkt.Parametrization): pass # Welcome to VIKTOR! You can add your input fields here. Happy Coding! class Controller(vkt.Controller): parametrization = Parametrization ``` The `app.py` file consists of 3 parts: * **(line 1) imports**: this is where you import Python modules you use in your app * **(lines 4-5) Parametrization class**: this is where you define the inputs of your app * **(lines 8-9) Controller class**: this is where you define the outputs (such as visualizations) of your app A detailed explanation of the folder structure and above concepts can be found [here](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure/.md). App connection * The app will update automatically after adjusting and saving the `app.py` file (as long as you don't close the terminal!) * Closed your code editor or the terminal inside your editor? Use `viktor-cli start` to reconnect the app. Let's replace the `pass` statement with a welcome message and a `NumberField` by copying the **highlighted** lines of code below. The `vkt.Text` widget displays formatted text in your app, and `vkt.NumberField` adds a numeric input. Your `app.py` file should look like this: ``` import viktor as vkt class Parametrization(vkt.Parametrization): welcome = vkt.Text("# 👋 Welcome to your first VIKTOR app! 👋\n## Let's start with the basics") length = vkt.NumberField("Length") class Controller(vkt.Controller): parametrization = Parametrization ``` Save the `app.py` file. This action triggers a reload of your app. This reload is shown in the terminal. If you made a coding mistake, errors will also be printed in the terminal. ``` INFO : Reloading app... INFO : App code loaded, waiting for jobs... ``` Refresh your webpage in the browser to see the "Length" input we just added: ![](/img/docs/starter-guide-inputs-1.png) Go ahead and click in the box just beneath "Length" to start typing. In many cases it is helpful to guide the user by providing a default value for the input fields. You can add a default value of 1 like this: ``` import viktor as vkt class Parametrization(vkt.Parametrization): welcome = vkt.Text("# 👋 Welcome to your first VIKTOR app! 👋\n## Let's start with the basics") length = vkt.NumberField("Length", default=1) class Controller(vkt.Controller): parametrization = Parametrization ``` Save the `app.py` file and refresh your webpage in the browser. Any pop-up regarding unsaved changes may be ignored. After reloading, your app will show the default value: ![](/img/docs/starter-guide-inputs-2.png) To conclude the parametrization of our design, we will add 2 more number fields representing the "Width" and "Height" respectively. Copy the **highlighted** lines of code below such that your `app.py` file looks similar: ``` import viktor as vkt class Parametrization(vkt.Parametrization): welcome = vkt.Text("# 👋 Welcome to your first VIKTOR app! 👋\n## Let's start with the basics") length = vkt.NumberField("Length", default=1) width = vkt.NumberField("Width", default=1) height = vkt.NumberField("Height", default=1) class Controller(vkt.Controller): parametrization = Parametrization ``` Save the `app.py` file and refresh your webpage in the browser: ![](/img/docs/starter-guide-inputs-3.png) ## Create visualizations[​](https://docs.viktor.ai/docs/getting-started/starter-guide/.md#create-visualizations "Direct link to Create visualizations") Now let's see how we can use these input fields in a result! In this example we will use the length, width, and height defined in the parametrization as dimensions of a cube. The cube's volume and outer surface area are the results we will show in a table view. Copy the **highlighted** lines of code below, such that your `app.py` file looks like this: ``` import viktor as vkt class Parametrization(vkt.Parametrization): welcome = vkt.Text("# 👋 Welcome to your first VIKTOR app! 👋\n## Let's start with the basics") length = vkt.NumberField("Length", default=1) width = vkt.NumberField("Width", default=1) height = vkt.NumberField("Height", default=1) class Controller(vkt.Controller): parametrization = Parametrization @vkt.TableView("Results") def results(self, params, **kwargs): data = [ [1, 2], [3, 4], ] row_headers = ["Row 1", "Row 2"] column_headers = ["Col 1", "Col 2"] return vkt.TableResult(data, row_headers=row_headers, column_headers=column_headers) ``` Save the `app.py` file and refresh your webpage in the browser: ![](/img/docs/starter-guide-view-1.png) Great, now let's connect the input values (obtained using the **params** argument) to the output. We will also rename the row and column headers to be more specific for our app: ``` import viktor as vkt class Parametrization(vkt.Parametrization): welcome = vkt.Text("# 👋 Welcome to your first VIKTOR app! 👋\n## Let's start with the basics") length = vkt.NumberField("Length", default=1) width = vkt.NumberField("Width", default=1) height = vkt.NumberField("Height", default=1) class Controller(vkt.Controller): parametrization = Parametrization @vkt.TableView("Results") def results(self, params, **kwargs): volume = params.length * params.width * params.height surface = 2 * (params.length * params.width + params.length * params.height + params.width * params.height) data = [ [volume, "m³"], [surface, "m²"], ] row_headers = ["Volume", "Surface"] column_headers = ["Value", "Unit"] return vkt.TableResult(data, row_headers=row_headers, column_headers=column_headers) ``` Save the `app.py` file and refresh your webpage in the browser: ![](/img/docs/starter-guide-view-2.png) Well done! You can now adjust the dimensions of the cube and directly see its effect on the volume and outer surface area. ## Publish and share[​](https://docs.viktor.ai/docs/getting-started/starter-guide/.md#publish-and-share "Direct link to Publish and share") So far your app only runs against your local code. To make it available to your colleagues, you need to publish it to the VIKTOR platform. Once published, the app becomes accessible to users in your organization's environment without them needing any local setup. Head over to the [Publish apps](https://docs.viktor.ai/docs/publish-apps/.md) section for step-by-step instructions on publishing your app and adding it to a project. ## Automate the boring\![​](https://docs.viktor.ai/docs/getting-started/starter-guide/.md#automate-the-boring "Direct link to Automate the boring!") <!-- --> With these basic instructions you now have the skills to build your very own apps! This is just the tip of the iceberg however. With VIKTOR you can also create 3D models, interactive data visualizations, automated reports, geographic maps and much more... Click the button below to continue your journey! * What's next [Go to tutorials](https://docs.viktor.ai/docs/tutorials/.md) --- # What is VIKTOR? On this page you'll understand how VIKTOR revolutionizes engineering workflows. This page provides a comprehensive overview of VIKTOR’s capabilities, benefits, and how it can transform your engineering processes. ## Why use VIKTOR?[​](https://docs.viktor.ai/docs/getting-started/what-is-viktor/.md#why-use-viktor "Direct link to Why use VIKTOR?") As an engineer, you already know the problem: the same calculations, checks, and data transfers keep coming back in every project. Excel grows uncontrolled, scripts live on personal machines, and small changes mean manual rework across tools. VIKTOR exists to turn that kind of engineering logic into reusable, shareable tools that fit into real projects. Instead of rebuilding the same solution over and over, you can: * Capture engineering logic once and reuse it across projects * Automate tasks that normally sit between Excel, CAD, FEM, and reports * Test more design variants without increasing manual effort * Share your work with colleagues without becoming their support desk * Keep calculations transparent and checkable, not hidden in black boxes VIKTOR is built specifically for engineering work. The platform takes care of deployment, access control, data handling, and governance, so you can focus on the engineering logic itself. That makes it suitable for safety-critical calculations and real project delivery, not just prototypes or one-off scripts. ## How VIKTOR works[​](https://docs.viktor.ai/docs/getting-started/what-is-viktor/.md#how-viktor-works "Direct link to How VIKTOR works") VIKTOR is built around three core ideas: **build**, **connect**, and **share**. ### Build[​](https://docs.viktor.ai/docs/getting-started/what-is-viktor/.md#build "Direct link to Build") You create tools by describing what you want to automate. If you have little or no coding experience, we recommend starting with the [App Builder](https://docs.viktor.ai/docs/app-builder/.md): you can go from idea to working tool in minutes, directly from your browser, with no installation required. If you prefer to write code in your own IDE on your own computer, follow the [local development](https://docs.viktor.ai/docs/getting-started/installation/local-development/.md) installation instructions. The goal is always the same: turn engineering logic into something repeatable and usable by others. ### Connect[​](https://docs.viktor.ai/docs/getting-started/what-is-viktor/.md#connect "Direct link to Connect") VIKTOR connects directly to the tools you already use, such as Autodesk platforms, Rhino, FEM software, geotechnical tools, and data sources. Instead of exporting, copy-pasting, and re-importing, data flows through a single workflow. This makes changes easier to manage and reduces errors caused by manual transfers. ### Share[​](https://docs.viktor.ai/docs/getting-started/what-is-viktor/.md#share "Direct link to Share") Once a tool works, you can share it with your team. Others can use it without touching the underlying logic. The platform handles versioning, access rights, validation, and updates, so improvements propagate automatically. This allows engineering knowledge to scale beyond individual experts and projects. ## What can you do with VIKTOR?[​](https://docs.viktor.ai/docs/getting-started/what-is-viktor/.md#what-can-you-do-with-viktor "Direct link to What can you do with VIKTOR?") VIKTOR can be used for both small, everyday tasks and larger, multi-tool workflows. Examples include: * Automating recurring calculations such as foundations, reinforcement, settlements, or stability checks * Replacing Excel-based workflows with structured, reusable tools * Linking CAD, BIM, FEM, and geotechnical models in a single flow * Running parametric studies and comparing design alternatives quickly * Standardizing calculation methods across teams and projects * Turning expert knowledge into tools that colleagues can safely reuse * Generating consistent outputs such as reports, dashboards, or design summaries In practice, this means less manual rework, fewer copy-paste errors, and more time spent on actual engineering decisions. VIKTOR is not about removing engineering judgment. It is about removing unnecessary manual steps, so you can focus on designing, checking, and improving solutions that matter. --- # What's next? Congratulations, you have successfully installed VIKTOR and built your first app! Now you are ready to follow your own path. What is the next step? Well, that all depends on your interests. * Do some concepts still raise questions for you? Don't worry, we advise you to check out the following pages: Basic app structure - get familiar with the app files, and building blocks required to create a basic app. [Learn more](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure/.md) * App code execution flow - learn how and when the VIKTOR platform triggers your application code, and the stateless behavior when running calculations. [Learn more](https://docs.viktor.ai/docs/getting-started/fundamentals/call-flow/.md) - Explore all VIKTOR features and learn by following code examples: Tutorials - ramp up your VIKTOR skill by following one of the instructive tutorials [Learn more](https://docs.viktor.ai/docs/tutorials/.md) - Guides - get an overview of all features in our documentation. Many input fields, results & visualization, layout options and more are available [Learn more](https://docs.viktor.ai/docs/create-apps/.md) * Gain inspiration by checking out example applications: Example apps - we have many example apps you can use as inspiration to create your own apps. Source code included! [Learn more](https://www.viktor.ai/apps-gallery) Happy coding! And remember... **Automate the boring. Engineer the awesome!** ## Community VIKTOR is not only a platform for quickly creating apps; we are also a community of enthusiastic and ambitious developers searching for new ways to engineer the awesome. Join our community and ask for support, share ideas and learn about the latest features. [Community Page](https://community.viktor.ai/) ![](/img/illustrations/illustration-community.svg) --- # Administrator This section covers all the tools and settings administrators can use to manage your organization's VIKTOR environment. From controlling who has access, to tracking activity, configuring organizational integrations, and customizing the platform. Select a tile below to learn more. [All apps](https://docs.viktor.ai/docs/manage-apps/all-apps/.md) [Manage every app in your organization: details, versions, variables and archiving.](https://docs.viktor.ai/docs/manage-apps/all-apps/.md) [User & access management](https://docs.viktor.ai/docs/manage-apps/access-management/.md) [Learn about the different roles in VIKTOR and how user access is managed.](https://docs.viktor.ai/docs/manage-apps/access-management/.md) [Activity dashboard](https://docs.viktor.ai/docs/manage-apps/activity-dashboard/.md) [See who is using the apps. Several different views are available, each with their own level of detail.](https://docs.viktor.ai/docs/manage-apps/activity-dashboard/.md) [Integrations](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md) [Connect VIKTOR apps to other software and systems to automate workflows and share data.](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md) [Labels](https://docs.viktor.ai/docs/manage-apps/labels/.md) [Organize apps with labels to keep everything easy to find.](https://docs.viktor.ai/docs/manage-apps/labels/.md) [Customized appearance](https://docs.viktor.ai/docs/manage-apps/organization-setting/.md) [Tailor the look and feel of your VIKTOR environment to match your company's branding.](https://docs.viktor.ai/docs/manage-apps/organization-setting/.md) ## Security & compliance[​](https://docs.viktor.ai/docs/manage-apps/.md#security--compliance "Direct link to Security & compliance") Maintaining the security and confidentiality of our customers’ data is a core commitment at VIKTOR. We use industry-standard technologies and cloud provider capabilities to protect your data. In addition, internal policies and processes are in place to help ensure the confidentiality, availability, and integrity of customer data. For more details about our security and compliance practices, visit our [Trust Center](https://www.viktor.ai/trust-center) * **Security & data flow** See where your data goes when you use VIKTOR, how it is protected, and who can access it. [Learn more](https://docs.viktor.ai/docs/manage-apps/security-and-data-flow/.md) <!-- --> [ ](https://docs.viktor.ai/docs/manage-apps/security-and-data-flow/.md) * **Regional hosting** As part of our enterprise grade security we offer the option to host your data in a specific geographical location. [Learn more](https://docs.viktor.ai/docs/manage-apps/regional-hosting/) <!-- --> [ ](https://docs.viktor.ai/docs/manage-apps/regional-hosting/) --- # User & access management This page explains the controls that VIKTOR has to manage access to data and logic. These are divided into three categories: environment, app, and app instances. App vs. app instance An **app** contains only the logic — the code that defines the tool. It has no data and no users, and is created and maintained by developers. An **app instance** is a running copy of an app that users open and work in. It holds the data, the users, and the access settings (such as visibility and permissions). A single app can have multiple app instances — for example, one per project or team. *(App instances were previously known as workspaces.)* ## Environment access[​](https://docs.viktor.ai/docs/manage-apps/access-management/.md#environment-access "Direct link to Environment access") Access to the environment can be setup in two ways: * login with username and password * [Single Sign-On](https://docs.viktor.ai/docs/manage-apps/single-sign-on/.md) ## Environment rights[​](https://docs.viktor.ai/docs/manage-apps/access-management/.md#environment-rights "Direct link to Environment rights") Each user has two access attributes that determine the role they have. The possible combinations, together with their name are listed below. The tables below show the permissions for each role. | Access level | Developer access | Role | | ------------- | ---------------- | ------------------ | | User | | Internal user | | User | ✓ | Internal developer | | Admin | | Admin user | | Admin | ✓ | Admin developer | | External user | | External user | | External user | ✓ | External developer | ✓ Allowed. ✕ Not allowed. ### User management[​](https://docs.viktor.ai/docs/manage-apps/access-management/.md#user-management "Direct link to User management") | Permission | External user | External developer | Internal user | Internal developer | Admin user | Admin developer | | ------------------------------ | ------------- | ------------------ | ------------- | ------------------ | ---------- | --------------- | | Invite users to organization | ✕ | ✕ | ✕ | ✕ | ✓ | ✓ | | Edit users on organization | ✕ | ✕ | ✕ | ✕ | ✓ | ✓ | | Delete users from organization | ✕ | ✕ | ✕ | ✕ | ✓ | ✓ | ### App development[​](https://docs.viktor.ai/docs/manage-apps/access-management/.md#app-development "Direct link to App development") | Permission | External user | External developer | Internal user | Internal developer | Admin user | Admin developer | | ------------------------- | ------------- | ------------------ | ------------- | ------------------ | ---------- | --------------- | | See develop page | ✕ | ✕ | ✓ | ✓ | ✓ | ✓ | | Create an app | ✕ | ✕ | ✕ | ✓ | ✓ | ✓ | | Publish new app version | ✕ | ✓ if maintainer | ✕ | ✓ if maintainer | ✕ | ✓ | | Change live versions | ✕ | ✓ if maintainer | ✕ | ✓ if maintainer | ✕ | ✓ | | Manage app details | ✕ | ✓ if maintainer | ✕ | ✓ if maintainer | ✓ | ✓ | | Archive an app | ✕ | ✕ | ✕ | ✓ if maintainer | ✓ | ✓ | | Access and share test app | ✕ | ✕ | ✓ | ✓ | ✓ | ✓ | ### Integrations[​](https://docs.viktor.ai/docs/manage-apps/access-management/.md#integrations "Direct link to Integrations") | Permission | External user | External developer | Internal user | Internal developer | Admin user | Admin developer | | ---------------------------------------- | ------------- | ------------------ | ------------- | ------------------ | ---------- | --------------- | | Create and manage (OAuth) integrations | ✕ | ✕ | ✕ | ✕ | ✓ | ✓ | | Create and manage organizational workers | ✕ | ✕ | ✕ | ✕ | ✓ | ✓ | | Create and manage personal workers | ✕ | ✓ | ✓ | ✓ | ✓ | ✓ | ### Browsing apps[​](https://docs.viktor.ai/docs/manage-apps/access-management/.md#browsing-apps "Direct link to Browsing apps") | Permission | External user | External developer | Internal user | Internal developer | Admin user | Admin developer | | ---------------------------- | ------------- | ------------------ | ------------- | ------------------ | ---------- | --------------- | | See library page | ✕ | ✕ | ✓ | ✓ | ✓ | ✓ | | Set app visibility to public | ✕ | ✕ | ✕ | ✕ | ✓ | ✓ | | Can visit public app URL | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ### Projects[​](https://docs.viktor.ai/docs/manage-apps/access-management/.md#projects "Direct link to Projects") | Permission | External user | External developer | Internal user | Internal developer | Admin user | Admin developer | | ------------------------------- | ------------- | ------------------ | ---------------------------- | ---------------------------- | ---------- | --------------- | | Access internal project | ✕ | ✕ | ✓ | ✓ | ✓ | ✓ | | Access private project | ✓ if invited | ✓ if invited | ✓ if invited | ✓ if invited | ✓ | ✓ | | Create internal projects | ✕ | ✕ | ✓ | ✓ | ✓ | ✓ | | Create private projects | ✕ | ✕ | ✓ if allowed by organization | ✓ if allowed by organization | ✓ | ✓ | | Edit project details | ✕ | ✕ | ✓ if owner | ✓ if owner | ✓ | ✓ | | Manage project members | ✕ | ✕ | ✓ if owner | ✓ if owner | ✓ | ✓ | | Add apps to internal projects | ✕ | ✕ | ✓ if allowed by organization | ✓ if allowed by organization | ✓ | ✓ | | Add apps to private projects | ✕ | ✕ | ✓ | ✓ | ✓ | ✓ | | Add unverified apps to projects | ✕ | ✕ | ✓ if allowed by organization | ✓ if allowed by organization | ✓ | ✓ | | Archive an app instance | ✕ | ✕ | ✓ if owner | ✓ if owner | ✓ | ✓ | ### Administrator panel[​](https://docs.viktor.ai/docs/manage-apps/access-management/.md#administrator-panel "Direct link to Administrator panel") | Permission | External user | External developer | Internal user | Internal developer | Admin user | Admin developer | | ------------------------------------------ | ------------- | ------------------ | ------------- | ------------------ | ---------- | --------------- | | View activity dashboard | ✕ | ✕ | ✕ | ✕ | ✓ | ✓ | | Manage all apps on organization | ✕ | ✕ | ✕ | ✕ | ✓ | ✓ | | Manage organization permissions | ✕ | ✕ | ✕ | ✕ | ✓ | ✓ | | Create, manage, delete organization labels | ✕ | ✕ | ✕ | ✕ | ✓ | ✓ | Besides rights on the environment, there are more granular controls on apps and their instances. ## App instance rights[​](https://docs.viktor.ai/docs/manage-apps/access-management/.md#app-instance-rights "Direct link to App instance rights") App instance rights (what a user can do when they enter the app instance) are configured using usergroups. You define what this usergroup is allowed to do and assign users to this group. The possible permissions per object type are: | category | detail | explanation | | -------- | -------- | ------------------------------------------------------------------------------------------ | | Read | Navigate | Minimum (navigation) access, excluding summary info and excluding editor access | | Read | Basic | Makes an object and its summary information accessible to a user, not including the editor | | Read | All | Gives access to all object information including the editor | | | | | | Write | Create | Allows the user to create an object | | Write | Update | Allows the user to update an object | | Write | Rename | Allows the user to rename an object | | | | | | Delete | | Allows the user to delete an object | Usergroup assignment differs between internal and private app instances: * `private` app instances: users are explicitly invited to get access. During invitation, the appropriate usergroup (and thus access level) is selected * `internal` app instances: users automatically get access when they are invited to the environment. They are added to the default user group of each internal app instance. This default can be configured per app instance. ## App access[​](https://docs.viktor.ai/docs/manage-apps/access-management/.md#app-access "Direct link to App access") All users (except for external users/developers) can access the Library and find the applications that have been published. Here they can checkout app details and learn about the application and which developers maintain the app. Apps are not used by users directly; these are app instances that are added to projects. The apps only contain the logic, without data and no users. Users can contact (one of) the maintainers to get access. Internal developers and admin users can create apps. Developers are automatically assigned as the first maintainer on the app. Managing apps happens outside of the Library. Developers manage the apps they maintain on the [Develop page](https://docs.viktor.ai/docs/manage-apps/workspaces-and-apps/.md). Administrators manage every app in the organization from the ["All apps" page](https://docs.viktor.ai/docs/manage-apps/all-apps/.md) in the Administrator panel. ## App rights[​](https://docs.viktor.ai/docs/manage-apps/access-management/.md#app-rights "Direct link to App rights") Only app maintainers can publish new versions of an app. They are treated as being allowed to have access to the code. This means that error reports (with tracebacks containing code) are available to them. Publishing a version and deciding which version is live are separate actions. An app has a **Testing** version and a **Production** version, and app maintainers decide which version each line points at. See [Version history](https://docs.viktor.ai/docs/manage-apps/workspaces-and-apps/.md#version-history). App maintainers are not allowed to create app instances. They can use their development workspace when developing, but need explicit access to relevant app instances to get access to production data. ## Agent access via MCP[​](https://docs.viktor.ai/docs/manage-apps/access-management/.md#agent-access-via-mcp "Direct link to Agent access via MCP") info [MCP](https://docs.viktor.ai/docs/create-apps/mcp/.md) lets users connect an external AI agent to your environment, so the agent can run VIKTOR apps on their behalf. It is currently in **BETA**. What to know as an administrator: * **Users approve the access explicitly.** Agents authenticate with OAuth. After the normal VIKTOR login, a consent screen states which account is being accessed and what is granted: seeing the logged-in user, seeing the available tools, and running them. The user has to click **Allow**, and the access granted is short-lived. * **Users cannot exceed their own access.** Each user authenticates as themselves, and every app run is checked against their access at the moment it runs. An agent reaches exactly the apps its user already reaches. There is no separate allow-list for MCP yet, so every published app a user can access is available to their agent. * **Agents run calculations, they do not access projects.** An agent can only run an app with the inputs it supplies in that call. It cannot read data from your projects, and it cannot write data to them. * **Your organization chooses the agent.** Inputs an agent sends to an app, and the results it receives, are handled by the agent's model provider, as with any other content shared with that agent. If your organization has policies on which AI providers may process engineering data, share them with your users. --- # Activity dashboard Administrators can inspect the activity within their organization using the activity dashboard in the Administator menu. Several different views, each with their own level of detail are available. The different options are described in the sections below. ![](/assets/images/user-activity-ae752fbcf994766a68a189f18e1a9076.png) ## Users[​](https://docs.viktor.ai/docs/manage-apps/activity-dashboard/.md#users "Direct link to Users") A summary of the activity of all users is available on the Users tab. The activity data is presented as time series graphs and is split into three key metrics: 1. Total users (all users within the organization including developers) 2. Monthly active users (unique users that logged in to the environment at least once during a month) 3. Daily logins (a daily login is defined as a user that uses an app instance in a project on a single day, excluding development and public apps) ## Developers[​](https://docs.viktor.ai/docs/manage-apps/activity-dashboard/.md#developers "Direct link to Developers") The Developers tab provides a summary of the activity of Developers in the organization. The Developer activity is presented as time series graphs and is split into three key metrics: 1. Total developers (all users within the organization that have developer access) 2. Monthly active developers (unique users with developer access that logged in to the environment at least once during a month) 3. Daily developer logins (a daily developer login is defined as a user that uses his/her development workspace(s) on a single day) ## Apps[​](https://docs.viktor.ai/docs/manage-apps/activity-dashboard/.md#apps "Direct link to Apps") The Apps tab provides an overview of the user activity of selected apps within the organization. The Apps activity is presented as a time series graph of the monthly active users per app. The activity is measured on all app instances of the selected apps, (apps on projects, test apps), but excludes the activity of the app in development. ## App Builder[​](https://docs.viktor.ai/docs/manage-apps/activity-dashboard/.md#app-builder "Direct link to App Builder") The App Builder tab shows how much the [App Builder](https://docs.viktor.ai/docs/app-builder/.md) is used across your organization. Usage is presented as a bar chart per month. ## Audit logs[​](https://docs.viktor.ai/docs/manage-apps/activity-dashboard/.md#audit-logs "Direct link to Audit logs") ![](/assets/images/audit-logs-925cf4cde9014505e47c46d7f830666a.png) Historical data The bulk of the user events have been introduced in the platform release of April 2023. Before this time only a limited number of events are available. While the Users, Developers and Apps tabs give insights into the activity of your organization over time, it does not give insights into who was active and what activities were performed. The Audit log enables administrators to generate detailed activity overviews. These overviews are presented in tabular form and can be exported in CSV format. It is possible to generate an overview of daily user logins, daily developer logins, monthly user activity and monthly developer activity by selecting the corresponding activity type from the dropdown. The results can be filtered on users, app instances (daily user logins only), start and end date. Furthermore, a detailed audit log is available by selecting 'Event' from the activity type dropdown. Events are recorded for specific actions performed by users within your organization. Each event entry shows the relevant information for that event, such as: * The user that performed the action * The type of action that was performed * (if applicable) The app instance that was affected by the event or the event occurred in * (if applicable) The app that was affected by the event * (if applicable) The entity that was affected by the event * The date and time of the event * Event specific information ### Event types[​](https://docs.viktor.ai/docs/manage-apps/activity-dashboard/.md#event-types "Direct link to Event types") The table below gives an overview of the events that are currently available: | Event type | Description | | ----------------------------- | --------------------------------------------------------------------------------------------- | | `APP.ARCHIVE` | The user archived an app | | `APP.CREATE` | The user created an app | | `APP.PUBLISH` | The user published a new app version | | `APP.PUBLISH_FAIL` | The user published a new app version with errors | | `APP.UNARCHIVE` | The user unarchived an app | | `APP.UPDATE` | The user updated the app information | | `EDITOR.COMPUTE` | The user performed a calculation within the editor | | `EDITOR.ENTER` | The user entered the editor | | `EDITOR.EXIT` | The user exited the editor | | `ENTITY.COPY` | The user copied the entity | | `ENTITY.COPY_RECURSIVE` | The user copied the entity recursively | | `ENTITY.CREATE` | The user created the entity | | `ENTITY.DELETE` | The user deleted the entity | | `ENTITY.RENAME` | The user renamed the entity | | `ENTITY.REVISE` | The user restored a previous revision of the entity | | `ENTITY.SAVE` | The user saved the entity | | `ORG.DELETE_USERS` | The user deleted users from the organization | | `ORG.INVITE_USERS` | The user invited users to the organization | | `USER.CLI_DOWNLOAD` | The user downloaded the CLI in the onboarding process | | `USER.DEV_PAIRING_ACTIVATE` | The user activated their development account in the onboarding process | | `USER.DEV_PAIRING_RETRIEVE` | The user retrieved an activation code for their development account in the onboarding process | | `USER.DEV_PAIRING_VERIFY` | The token / username combination was verified in the onboarding process | | `USER.LOCK` | The user account was locked | | `USER.LOGIN` | The user logged in to the environment | | `USER.LOGIN_FAIL` | The login for the user account failed | | `USER.LOGOUT` | The user logged out of the environment | | `WORKSPACE.ARCHIVE` | The user archived the workspace | | `WORKSPACE.CHANGE_VISIBILITY` | The user changed the workspace visibility | | `WORKSPACE.CREATE` | The user created the workspace | | `WORKSPACE.DELETE_USERS` | The user deleted users from the workspace | | `WORKSPACE.ENTER` | The user entered the workspace | | `WORKSPACE.INVITE_USERS` | The user invited users to the workspace | | `WORKSPACE.UNARCHIVE` | The user unarchived the workspace | Below an overview of the available columns per event type and corresponding value types are shown: | Event type | Column | Example value | | ---------------------------------------------------------------- | ------------ | ------------------------------------------------------------------------------ | | All event types | Name | John Doe | | All event types | Email | JohnDoe\@viktor.ai | | All event types | Event | USER.LOGIN | | All event types | Date | January 23, 2023, 09:44 | | `APP.` events | App | my-first-app | | `WORKSPACE.`, `ENTITY.`, `EDITOR.` events | Workspace | My First Workspace | | `ENTITY.`, `EDITOR.` events | Entity | My First Entity | | `ORG.INVITE_USERS`, `ORG.DELETE_USERS`, `WORKSPACE.INVITE_USERS` | Users | Jane Doe, Jess Doe | | `WORKSPACE.CHANGE_VISIBILITY` | Old | INTERNAL (one of INTERNAL, PRIVATE, PUBLIC) | | `WORKSPACE.CHANGE_VISIBILITY` | New | PRIVATE (one of INTERNAL, PRIVATE, PUBLIC) | | `EDITOR.COMPUTE` | Type | view (one of view, parametrization, step, button, preprocess) | | `EDITOR.COMPUTE` | Result | result (one of created, error, error\_user, result, started, stopped, expired) | | `EDITOR.COMPUTE` | Duration (s) | 2.38 | | `EDITOR.COMPUTE` | Method Name | get\_geometry\_view | | `EDITOR.COMPUTE` | Method Label | 3D Model | --- # All apps Administrators manage the apps of their organization from the "All apps" page in the Administrator panel. Developers see only the apps they maintain, on their own Develop page. The "All apps" page lists every app on the platform, including any unpublished apps. On any of these apps you can make the same edits that its maintainers can, whether or not you maintain the app yourself. Publishing a new version is the one exception, see [Version history](https://docs.viktor.ai/docs/manage-apps/all-apps/.md#version-history). Keep in mind what each page is for: * **Library**: where users discover apps that are available to them. See [Library](https://docs.viktor.ai/docs/manage-apps/workspaces-and-apps/.md#library). * **Develop**: where developers manage the apps they maintain. See [Managing your app](https://docs.viktor.ai/docs/manage-apps/workspaces-and-apps/.md). * **All apps**: where administrators manage all apps, described on this page. ## Finding an app[​](https://docs.viktor.ai/docs/manage-apps/all-apps/.md#finding-an-app "Direct link to Finding an app") All apps in the organization are listed on the page. To narrow down the list, you can make use of filters such as: * Verification * Visibility * Labels * Build type * Maintainer Setting up the labels you filter on is described in [Labels](https://docs.viktor.ai/docs/manage-apps/labels/.md). ## Inspecting an app[​](https://docs.viktor.ai/docs/manage-apps/all-apps/.md#inspecting-an-app "Direct link to Inspecting an app") Click on a listed app or select "Edit app details" button under the "Actions" column to open the details page of that app. Here you find all the details that a maintainer would be able to see when managing their app. ## Editing app details[​](https://docs.viktor.ai/docs/manage-apps/all-apps/.md#editing-app-details "Direct link to Editing app details") On the details page, click on the three dots in the top-right corner and select "Edit app". This walks through the same steps as when the app was first created, and lets you correct the app information or change the [labels](https://docs.viktor.ai/docs/manage-apps/labels/.md#add-a-label-to-an-app) that determine where users find the app. Every field a maintainer can change here is available to you as well. ## Version history[​](https://docs.viktor.ai/docs/manage-apps/all-apps/.md#version-history "Direct link to Version history") The versions tab on the details page lists all versions of the app: the version tag, where each version is live, and the maintainer and date that published it. The tab is described in full in [Version history](https://docs.viktor.ai/docs/manage-apps/workspaces-and-apps/.md#version-history). Publishing a new version is not an administrator action: only the maintainers of an app can publish. An administrator with developer access can therefore publish versions of the apps they maintain themselves, but not of other apps. Which version is deployed is a separate matter from publishing. An app has a **testing** version and a **production** version, and the tab shows which version each line currently points at. ## Environment variables[​](https://docs.viktor.ai/docs/manage-apps/all-apps/.md#environment-variables "Direct link to Environment variables") The variables tab on the details page is available to administrators and to the maintainers of the app. On this tab, environment variables can be created, adjusted, or deleted. For more information please refer to [using environment variables](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/environment-variables/.md). ## Archiving apps[​](https://docs.viktor.ai/docs/manage-apps/all-apps/.md#archiving-apps "Direct link to Archiving apps") Apps that are no longer used can be archived, in either of these two ways: * Click the three dots under the "Actions" column of the overview table and select "Archive app". * Open the details page of the app, then click the three dots in the top-right corner of the screen and select "Archive". Archived apps remain available for inspection through the "View archive" button in the top-right corner of the page, and can be brought back with the "Unarchive" button. Note that an app **cannot be archived** when: * the app has active workspaces associated to it Solution: archive the active workspaces first Note that an app **cannot be unarchived** when: * the apps limit has been reached Solution: [Contact VIKTOR](https://www.viktor.ai/contact) ## Creating apps[​](https://docs.viktor.ai/docs/manage-apps/all-apps/.md#creating-apps "Direct link to Creating apps") Apps are always created from the "Develop" page, also by administrators. See [Creating a new app](https://docs.viktor.ai/docs/manage-apps/workspaces-and-apps/.md#creating-a-new-app). ## FAQs[​](https://docs.viktor.ai/docs/manage-apps/all-apps/.md#faqs "Direct link to FAQs") **Can I create an app from the "All apps" page?** No. Creating an app happens on the "Develop" page, for administrators and developers alike. Once the app exists it shows up on the "All apps" page. **Can I publish a new version of an app I do not maintain?** No. Publishing a new version is reserved for the maintainers of an app, because they are treated as being allowed to access the app code. Ask one of the maintainers listed on the details page to publish, or have yourself added as a maintainer of that app. **What is the difference between "All apps" and the Library?** The Library is the place where users discover the apps available to them: it shows what an app does and who maintains it. "All apps" is a management view for administrators, with the actions described on this page, and it also shows apps that users cannot use yet. --- # Enterprise IT VIKTOR is a low-code application development platform based on Python. This guide outlines the prerequisites to use VIKTOR within an enterprise IT environment. ## Device settings[​](https://docs.viktor.ai/docs/manage-apps/enterprise-it/.md#device-settings "Direct link to Device settings") In order to develop applications on the VIKTOR platform the machine of a developer needs to meet the following requirements: * The machine runs a Windows or Linux operating system. * Python 3.10 - 3.14 (**64-bit**) is available or can be installed by the developer. * A code editor is available or can be installed by the developer. * The machine has internet access (TCP over port 443, TLS >= v1.2). ## Network / proxy settings[​](https://docs.viktor.ai/docs/manage-apps/enterprise-it/.md#network--proxy-settings "Direct link to Network / proxy settings") The CLI is used to connect local application code (hosted on the machine of the developer) to a cloud-based development environment. This requires an internet connection with network settings specified below. ### Domains[​](https://docs.viktor.ai/docs/manage-apps/enterprise-it/.md#domains "Direct link to Domains") The following domains should be accessible on the machine of the developer in order to be able to use VIKTOR. * `*.viktor.ai` (`viktor.ai` and all of its subdomains) * `*.amazonaws.com` (all subdomains of `amazonaws.com`) If you want to be more restrictive, it is possible be more selective on the allowed urls, note these domains are subject to change, so we strongly recommend to whitelist all subdomains of `viktor.ai` & `amazonaws.com` Do replace `<region>` with one of `eu1` for Frankfurt, `ap1` for Australia, `eu2` for London, `us1` for the US. Also do `<company>` with your viktor subdomain (e.g. `acme` for `acme.viktor.ai`). * `addons.viktor.ai` (used in environments in Frankfurt) * `addons.<region>.viktor.ai` (for the other regions) * `api-<company>.viktor.ai` (still used but deprecated, for environments in Frankfurt) * `api-<company>.<region>.viktor.ai` (still used but deprecated, for environments in other regions) * `cloud.viktor.ai` * `community.viktor.ai` * `<company>.viktor.ai` (for environments in Frankfurt, for example acme.viktor.ai) * `<company>.<region>.viktor.ai` (for environments in other regions, for example acme.eu2.viktor.ai) * `connect.viktor.ai` (deprecated, used in some environments in Frankfurt) * `connect.<region>.viktor.ai` * `developers.viktor.ai` (for environments in Frankfurt) * `developers.<region>.viktor.ai` (for environments in other regions) * `docs.viktor.ai` * `errors.viktor.ai` * `sys.viktor.ai` (for environments in Frankfurt) * `sys.<region>.viktor.ai` (for environments in other regions) * `viktor.ai` * `viktor-storage.s3.amazonaws.com` (still used but deprecated, for environments in Frankfurt) * `viktor-storage-<region>.s3.amazonaws.com` * `viktor-system.s3.amazonaws.com` Furthermore, installation of third-party Python packages requires access to: * `files.pythonhosted.org` * `pypi.org` * `pypi.python.org` ### SSL certificates[​](https://docs.viktor.ai/docs/manage-apps/enterprise-it/.md#ssl-certificates "Direct link to SSL certificates") If a proxy is configured in such a way that the SSL certification chain is modified by replacing the root CA's certificate by a self-signed certificate, the developer may run into SSL cert verification errors while either installing or running an app locally: **errors while installing the app** The VIKTOR CLI installs apps with pip and uv (Python package managers). Whether they trust the certificate of the proxy depends on the selected isolation mode: * Virtual environment (venv) * Docker pip and uv use the [system certificate store](https://pip.pypa.io/en/stable/topics/https-certificates/) of your computer, so installing works once your organization has added its root certificate to this store. note With Python versions older than 3.12.5, the first installation of an app can still fail with an SSL error, because the pip version that comes with Python may not use the system certificate store yet. In that case, install the app once with the root certificate of your organization. On Windows, you first need to export this certificate to a file: 1. In the start menu, type "Manage user certificates" and open it. 2. Go to **Trusted Root Certification Authorities** > **Certificates** and find the root certificate of your organization (ask your IT department which one). 3. Right-click the certificate, choose **All Tasks** > **Export...**, select **Base-64 encoded X.509 (.CER)** and save it, e.g. as `C:\certificates\organization-ca.cer`. Then run the installation with the path to the certificate: ``` viktor-cli install --env PIP_CERT=C:\certificates\organization-ca.cer ``` On Linux, use the path to the certificate file (in PEM format) instead, e.g. in `/usr/local/share/ca-certificates/`. Later installations of the app no longer need `PIP_CERT`, unless its `venv` folder is removed. Docker containers do not use the system certificate store of your computer. Save the root certificate of your organization in the app folder (on Windows, export it as described in the venv tab), and pass it to pip and uv on every installation: ``` viktor-cli install --env PIP_CERT=/usr/src/app/organization-ca.cer --env SSL_CERT_FILE=/usr/src/app/organization-ca.cer ``` To keep the certificate out of your published app, add it to the [`.viktorignore` file](https://docs.viktor.ai/docs/publish-apps/.md). Alternatively, use the venv isolation mode, which you can select with the command `viktor-cli configure`. **errors while running the app** By default Python's `requests` package does not use the system certificate store, but uses a bundled CA certificate store to establish secure connections. Because the certificate of the proxy is not present in the bundled CA certificate store an error will occur. VIKTOR automatically mounts the system certificates when making requests since SDK version `v14.15.2`. Therefore, the easiest solution is to develop apps using this version or higher. --- # Labels Labels are a powerful feature in VIKTOR apps that allow you to organize, categorize, and streamline the discovery of your applications. By leveraging labels, users can quickly find relevant tools, enhancing both app management and user adoption. ## What are labels for?[​](https://docs.viktor.ai/docs/manage-apps/labels/.md#what-are-labels-for "Direct link to What are labels for?") Labels serve multiple purposes within VIKTOR apps: * Organization & categorization: Group apps into meaningful categories to help users navigate the Library more efficiently. * Discovery: Enable users to find relevant apps quickly through filtering and search in the Library. * Filtering: Allow users to narrow down app options based on multiple criteria. ## Labels on apps[​](https://docs.viktor.ai/docs/manage-apps/labels/.md#labels-on-apps "Direct link to Labels on apps") Labels can be added to apps. The labels on an app are pre-selected when a new workspace is created from that app. Besides filtering on labels, users can also filter on workspace visibility, app name and the maintainer(s) of the app. ![workspaces with GIS label](/assets/images/labels_gis-f004beeb0975d2cb026c405096485a11.png) ## Create a label[​](https://docs.viktor.ai/docs/manage-apps/labels/.md#create-a-label "Direct link to Create a label") Creating a label in VIKTOR is straightforward: ![](/assets/images/labels-create-label-29e77747817eae24eecf2bac728ee585.png) 1. Navigate to the Administrator panel, and select Labels 2. Click **"Create label"** 3. Fill in a name, description, and choose a color for your new label 4. Click **"Create"** Your environment comes with a starting list of labels. In the enterprise tier these labels can be edited and removed, and new labels can be created. ![managing labels page](/assets/images/labels_manage-dd13e251a16a96139017328eb071f568.png) ## Add a label to an app[​](https://docs.viktor.ai/docs/manage-apps/labels/.md#add-a-label-to-an-app "Direct link to Add a label to an app") Adding a label to an app ensures it is properly categorized and discoverable: ![](/assets/images/labels-add-label-a2456c813cbe1bcb25f5033b55882691.png) 1. Navigate to your **"Develop"** page 2. For the app you'd like to add the labels to, click on **"Details"** 3. Click on the three dots in the top-right corner, and select **"Edit app"** 4. Click through to step 2 and add the new label(s) 5. **"Review and save"** your changes As an administrator you can label any app in the organization, also the ones you do not maintain. Start from the ["All apps"](https://docs.viktor.ai/docs/manage-apps/all-apps/.md) page in the Administrator panel instead of the "Develop" page, the remaining steps are the same. ## Label inspiration[​](https://docs.viktor.ai/docs/manage-apps/labels/.md#label-inspiration "Direct link to Label inspiration") In the enterprise tier, labels can freely be generated and changed to meet specific needs of your company. To give some inspiration on potential use cases: * industry (in the starting list) * discipline (in the starting list) * integration/software package (in the starting list) * project name (on workspace) * development status (on app) ## FAQs[​](https://docs.viktor.ai/docs/manage-apps/labels/.md#faqs "Direct link to FAQs") **Can I delete a label?** Yes. You can delete a label. Deleting a label will removed it from any of the apps that it is assigned to. You will no longer be able to filter by that label. **Can I edit a label?** Yes, you can edit a label after it has been created. Here's how: 1. Navigate to the **Administrator** panel and select **Labels** from the menu. 2. Find the label you wish to edit and click on the **three dots** next to it. 3. Click **Edit**. 4. Make the necessary changes to the label details. 5. **Save** your changes. Your label will now be updated with the new information. --- # Customized appearances Maintain brand consistency by adding your logo, company colors, and much more. ## Changing your environment appearance[​](https://docs.viktor.ai/docs/manage-apps/organization-setting/.md#changing-your-environment-appearance "Direct link to Changing your environment appearance") Opening `Settings > Appearance` leads to a configuration page on which the admin can adjust the global theme of the company environment. This includes customization of the following elements: * logo's * login image * button colors ![](/assets/images/org_settings_appearance-095ba8e6e8122d794bb9ed9bca422515.png) --- # Regional hosting VIKTOR allows customers to specify the precise geographic location for storing their customer data. This may be necessary for handling sensitive projects or complying with government legislation. ![](/assets/images/hosting-regions-6a6191f0f0ac83d97034814775c8cb9e.svg) ## Regions[​](https://docs.viktor.ai/docs/manage-apps/regional-hosting/.md#regions "Direct link to Regions") VIKTOR is currently is available in the following regions: | region | abbreviation | status | | ----------------------- | ----------------- | ------------------- | | EU (Frankfurt) | `*.viktor.ai` | available (default) | | United Kingdom (London) | `*.eu2.viktor.ai` | available | | Australia (Sydney) | `*.ap1.viktor.ai` | available | | United States (Oregon) | `*.us1.viktor.ai` | available | We consider additional regions on a customer request basis. Please contact us at `support@viktor.ai` if you have specific requirements. ## Multi regional setup[​](https://docs.viktor.ai/docs/manage-apps/regional-hosting/.md#multi-regional-setup "Direct link to Multi regional setup") In addition to hosting in a single region, VIKTOR also offers the capability of storing data in multiple regions and sync apps and users. This brings about several benefits: * User synchronization: Users are provisioned only once and enjoy a unified login experience across all regions. * App synchronization: Apps published in one region become automatically available in other regions, promoting consistency and accessibility. * App instance data stored in specified regions: VIKTOR ensures compliance with regulations by storing data in designated regions. --- # Security & data flow This page gives IT and security teams a high-level overview of where data goes when you use VIKTOR, how it is protected, and who can access it. For certifications and policies, visit our [Trust Center](https://www.viktor.ai/trust-center). ![How your data flows through VIKTOR](/assets/images/security-data-flow-91108e13a0162890a8aea65f1101fd6f.png) *How your data flows through VIKTOR* ## Connecting to VIKTOR[​](https://docs.viktor.ai/docs/manage-apps/security-and-data-flow/.md#connecting-to-viktor "Direct link to Connecting to VIKTOR") * All connections between your organization and VIKTOR are encrypted using TLS 1.2 or higher. This applies to the web browser, the Python SDK and CLI, and the REST API. Your other software, such as pipelines or a CRM, can connect through the REST API in the same way. * Users can sign in through your own identity provider using [single sign-on](https://docs.viktor.ai/docs/manage-apps/single-sign-on/.md) (OpenID Connect). * [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md) connects your apps to software installed on your own machines. The connection is always made outbound from your machine over port 443, so no ports need to be opened to the internet. See [Integrations](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#workers) for details. * The network requirements for developers are listed on the [Enterprise IT](https://docs.viktor.ai/docs/manage-apps/enterprise-it/.md) page. ## Your environment[​](https://docs.viktor.ai/docs/manage-apps/security-and-data-flow/.md#your-environment "Direct link to Your environment") * Each customer environment has its own database and is logically separated from other customers. * The apps you build run in isolated sandboxes, separate from the platform services. Sandboxes accept no inbound connections from the internet. * Access within your environment is controlled per user and role. See [User & access management](https://docs.viktor.ai/docs/manage-apps/access-management/.md). ## Data storage and backups[​](https://docs.viktor.ai/docs/manage-apps/security-and-data-flow/.md#data-storage-and-backups "Direct link to Data storage and backups") * Your data is stored in the [region](https://docs.viktor.ai/docs/manage-apps/regional-hosting/.md) you choose: EU (Frankfurt, default), United Kingdom (London), United States (Oregon) or Australia (Sydney). Additional regions are considered on request. When you use several regions, users and apps are synced between them, while app data stays in the region where it was created. * Databases, file storage and backups are encrypted at rest using AES-256. * The database is backed up nightly and monthly. Nightly backups are kept for 35 days and monthly backups for 365 days, in the same region as your data. * The recovery point objective (RPO) is 8 office hours. ## AI features[​](https://docs.viktor.ai/docs/manage-apps/security-and-data-flow/.md#ai-features "Direct link to AI features") AI features run on AWS Bedrock inside VIKTOR's own AWS account. Your data is not used to train AI models and is not shared with AI model providers. The model processes requests ephemerally and does not keep your data. Your prompts and the AI output are stored with your project data in your region, under the same retention and deletion terms. Some AI requests may be processed outside your hosting region: App Builder code generation requests from the United Kingdom region may be processed in the EU, and image generation requests from all regions are processed in the United States region. Customers can opt out of image generation. See the [AI-Specific Addendum](https://www.viktor.ai/ai-specific-addendum) for details. ## Audit log[​](https://docs.viktor.ai/docs/manage-apps/security-and-data-flow/.md#audit-log "Direct link to Audit log") The [Activity dashboard](https://docs.viktor.ai/docs/manage-apps/activity-dashboard/.md) records platform events such as sign-ins, failed sign-ins, account lockouts, invitations, removed users, published apps and the use of AI features. You can export the log as CSV. ## Services your apps connect to[​](https://docs.viktor.ai/docs/manage-apps/security-and-data-flow/.md#services-your-apps-connect-to "Direct link to Services your apps connect to") Apps can connect to external services that you choose, for example through [OAuth 2.0 integrations or API tokens](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md), or by using your own API keys for an [LLM provider](https://docs.viktor.ai/docs/create-apps/user-input/llm-chat/.md). The data sent to those services is determined by your app, and is governed by your own agreements with those providers. ## Sub-processors[​](https://docs.viktor.ai/docs/manage-apps/security-and-data-flow/.md#sub-processors "Direct link to Sub-processors") Within VIKTOR, AWS is the only sub-processor that handles your project data. Account and contact details used for support and communication are handled as described in our [sub-processor list](https://www.viktor.ai/subprocessor-list). --- # Single Sign On (SSO) The VIKTOR platform supports Single Sign On using the OpenID Connect protocol. In this guide the configuration on Microsoft Entra ID is laid out. This guide will walk you through all the required steps to configure your VIKTOR application, so that it uses OpenID Connect to authenticate to your Microsoft Entra ID, forcing your users to access it using their Entra ID account. Once you have completed this configuration you can enable an OpenID Connect "Log in with Microsoft Entra ID" button for your VIKTOR application. ![](/assets/images/login_screen_entra_id-8fb9a56b7089be03fd26043a2551223b.png) Upon request, we can customize the provider name "Microsoft Entra ID" in your login button label, with the label of your choosing. Additionally, to this guide you can see [Microsoft Entra ID - Register An App Quickstart Guide](https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app) as a reference. If Single Sign On is enabled, users will sign in using your Microsoft Entra ID, but there is no active synchronization between the Microsoft Entra ID and the VIKTOR environment. When you remove a user from your Microsoft Entra ID, this user will be blocked when trying to sign in through SSO, but the user will still be present in the users-list in the VIKTOR environment. note Users with a developer account have a second method of authentication, which is used when commands are executed from the [CLI](https://docs.viktor.ai/docs/create-apps/references/cli) (such as listing apps or publishing apps). The developer token expires 1 month after the last login, meaning that in case you revoke access (in Entra ID) for a developer user, he/she will automatically lose developer access after this month. Alternatively, you can revoke developer access immediately by manually deleting the developer user in the VIKTOR environment. ## Create a new Microsoft Entra ID Application[​](https://docs.viktor.ai/docs/manage-apps/single-sign-on/.md#create-a-new-microsoft-entra-id-application "Direct link to Create a new Microsoft Entra ID Application") First, you need to open your Microsoft Entra ID portal, either by logging in to your Microsoft Entra admin center and then selecting the Microsoft Entra ID service, or by directly visiting [entra.microsoft.com](https://entra.microsoft.com). To create a new application, go to `App Registrations > New Registration`, as shown in the screenshots below. ![](/assets/images/sso1-83b1ae36d574f1958cd2ad7a2e19f0a5.png) ![](/assets/images/sso2-c7d8dab7386f01ff812f37a496c64f35.png) ![](/assets/images/sso3-ca7f44b9b2b6cdffdf755b42ecefeebc.png) Here we have configured our application’s Redirect URI. If your VIKTOR application is running at `https://{subdomain}.viktor.ai`, this value should be `https://{subdomain}.viktor.ai/api/oidc/callback/`. To avoid naming inconsistencies and to make it easier for your admins and users to discover the application, you can standardize the name of your VIKTOR applications as "VIKTOR {subdomain}". ## Set up the Microsoft Entra ID Application[​](https://docs.viktor.ai/docs/manage-apps/single-sign-on/.md#set-up-the-microsoft-entra-id-application "Direct link to Set up the Microsoft Entra ID Application") 1. Application IDs After you have created the new application, you can find its IDs in the "Overview" page, as shown below. The Application (client) ID and Directory (tenant) ID will be used later to setup your VIKTOR application. ![](/assets/images/sso4-663ad90f26fb3dc4d7af69b9959201a0.png) 2. Configure permissions Next, you need to enable the required permissions for VIKTOR to be able to read the logged-in user’s basic information and register them to your VIKTOR application, after they have successfully logged in. Go to "API Permissions" and clear existing permissions. Add the required permissions by navigating to: Add a permission > Microsoft Graph > Delegated permissions. Select email, offline\_access, openid and profile, and click "Add permissions". Click "Grant admin consent for {tenant}". ![](/assets/images/sso5-31c5be96c949d51a0b5b3169c3401728.png) ![](/assets/images/sso6-d077e137756b489182d5465f30bb0639.png) ![](/assets/images/sso7-208988fae2c2214966eafa011f2f6123.png) ![](/assets/images/sso8-5ad5506786bd703b827db7722730fe86.png) 3. Setup for Single Logout To enable your VIKTOR application to log out a user when they log out from Microsoft Entra ID, you need to specify your application’s Logout URL, in the "Authentication" page. If your VIKTOR application is running at `https://{subdomain}.viktor.ai`, this value should be `https://{subdomain}.viktor.ai/api/oidc/logout/`. ![](/assets/images/sso9-644d8dd9559197dbb8f5e03e68af2b71.png) 4. Create a client secret Last, you need to create a client secret for your VIKTOR application to prove its identity when authenticating the user. Go to "Certificates & secrets" and add a client secret. Use description "Default" and expiration "Never". Copy the value of the secret for later use. If you have other requirements concerning the expiration of this secret you are free to choose so. Please remember that when changing this secret you will have to relay the new value with us. ![](/assets/images/sso10-0005c6045770dbb500072a99b40a1463.png) ![](/assets/images/sso11-949faee07c61694546045c73884fa11a.png) ![](/assets/images/sso12-bc4b5facdea1324bd5c4b3e2368d18f2.png) 5. Configure the application URL and logo If you decide to make this application discoverable to your user via their Access Panel or the O365 app launcher, then you may want to set up your application’s home page URL, to allow redirecting to the app, and logo. To do so go to "Branding". Here we have configured our application’s Home page URL. This value should be your VIKTOR application address `https://{subdomain}.viktor.ai`. Should you choose to use the VIKTOR logo, you can save and upload our official logo. ![](/assets/images/sso13-5141ba30efb0fc56dbf0a827e2be87f6.png) ### (Optional) Provision 'Guest' users with reduced access rights[​](https://docs.viktor.ai/docs/manage-apps/single-sign-on/.md#optional-provision-guest-users-with-reduced-access-rights "Direct link to (Optional) Provision 'Guest' users with reduced access rights") It is possible to have new 'guest' users in Microsoft Entra ID added as [external user](https://docs.viktor.ai/docs/manage-apps/access-management/.md#environment-rights) to the VIKTOR environment. In order to do so, Microsoft Entra ID needs to include the user's account status in the claims. Navigate to "Token Configuration", and click the "+ Add Optional Claim" button. For the Token type, select "ID", then under 'Claim' tick the "acct" option. Confirm your choices by clicking the "Add" button. ![](/assets/images/sso22-43ac1ac6d7e09e2626e6158af9b90fa5.png) info The guest role is set in VIKTOR when the user logs in for the first time. Updating the user role in VIKTOR at a later stage will permanently overwrite the setting. Modifying the account status in Microsoft Entra ID after the user has logged in to VIKTOR has no effect. ## Set up the VIKTOR Application[​](https://docs.viktor.ai/docs/manage-apps/single-sign-on/.md#set-up-the-viktor-application "Direct link to Set up the VIKTOR Application") Now that your application is ready on Microsoft Entra ID, we will need the information below to setup your VIKTOR application: * Application (client) ID * Directory (tenant) ID * Client secret * (Optional) Custom provider name label to be shown in the login button, instead of "Microsoft Entra ID" in "Log in with Microsoft Entra ID". You can send this information via email to your contact person. \*\* Note: make sure to place the client secret in a file and lock it with password before sharing. Send the password separately, via SMS or phone call. \*\* If you have different policies for sharing password or secrets, feel free to follow them. In any case, do not send the secret as plain text. ## Provision the Application[​](https://docs.viktor.ai/docs/manage-apps/single-sign-on/.md#provision-the-application "Direct link to Provision the Application") At this point the VIKTOR App is registered in your Microsoft Entra ID and can be used. To manage operational settings go to "Enterprise Applications" from the Microsoft Entra ID main page and search for "VIKTOR". Below you can find some settings you might want to consider. ### Assign application owners[​](https://docs.viktor.ai/docs/manage-apps/single-sign-on/.md#assign-application-owners "Direct link to Assign application owners") To allow other users to configure and maintain the application, you can assign them as Owners. Go to Owners > Add and select the desired users. ![](/assets/images/sso14-7738a37e6a2385fb6465a8599de65a33.png) ### Assign users to the application[​](https://docs.viktor.ai/docs/manage-apps/single-sign-on/.md#assign-users-to-the-application "Direct link to Assign users to the application") By default, your Microsoft Entra ID application will be configured to allow all your users to sign in. To allow only selected users to sign in, navigate to "Properties" and enable "User assignment required". If you want the application to be visible to the assigned users in their Access Panel and the O365 app launcher, also enable "Visible to users". ![](/assets/images/sso15-faff4f161b5346ebad56fcf5aad7f51b.png) To assign users to your application, go to Users and groups > Add user and select the desired users. ![](/assets/images/sso16-39a47d44c0c68cd1a4a40076b56d5355.png) For further information on how to set up user access follow [this guide](https://learn.microsoft.com/en-us/entra/identity-platform/howto-restrict-your-app-to-a-set-of-users). ## Enable self-service access[​](https://docs.viktor.ai/docs/manage-apps/single-sign-on/.md#enable-self-service-access "Direct link to Enable self-service access") Self-service application access is a great way to allow users to self-discover your VIKTOR application from the [My Apps](https://myapps.microsoft.com/) portal. To allow your users to self-discover your VIKTOR application, you need to enable self-service application access first. A user who has requested access will be able to log in to the app only after his/her request has been approved. note Self-service application access is not available for guest users, only for members of your organization with a P1 or P2 license. ### Setup your application[​](https://docs.viktor.ai/docs/manage-apps/single-sign-on/.md#setup-your-application "Direct link to Setup your application") To enable self-service you first need to create a group and assign it to your application. All user that will be approved to use the application via self-service will land in this group, thus acquiring access for your application. First go to "Groups" from the Microsoft Entra ID main page and create a "New group". In our case, we created a group called "Test group". Then go back to the Microsoft Entra ID main page, select "Enterprise applications", find your "VIKTOR" application and open "Users and groups". From this screen, assign the group you just created to your application, as shown below. ![](/assets/images/sso17-339ec1feedd6d347b7b0792725208695.png) Next, go to "Self-service". From here you can: * enable the self-service for your application * select the group where the users will land once they get access * select whether approval will be required before the user is able to login * select the users responsible for approving self-service requests ![](/assets/images/sso18-b2dd018a581c8a1b52ecaae926876cf4.png) To allow a member of your organization to self-service you need to assign a P1 or P2 license to them. From the Microsoft Entra ID main page, go to Licenses –> All products, select your "Microsoft Entra ID Premium P1" or "Microsoft Entra ID Premium P2" license, click "Assign" and select your users. ![](/assets/images/sso19-84e93491ce1142c9150460bc89c917ea.png) Alternatively, you can assign the licenses via your [Microsoft 365 admin center](https://admin.microsoft.com/#/licenses). ### The self-service flow in action[​](https://docs.viktor.ai/docs/manage-apps/single-sign-on/.md#the-self-service-flow-in-action "Direct link to The self-service flow in action") After setting up self-service in your application, you have now enabled your users to request for application access via their [My Apps](https://myapplications.microsoft.com/) page. By clicking on "Add self-service apps", they will see a list of application they can request access for, like shown below. ![](/assets/images/sso20-b15891859d43eb4dc0e85cf784c7eda2.png) The user assigned to approve the self-service request will get an email for the application access requested by the user, like the one shown below. Approving the request will allow the user to login to the application. ![](/assets/images/sso21-8d9946d3f707c6d7d70c3b2ae3e60fd9.png) --- # Integrations There are different ways to connect to third-party software from a VIKTOR app. Some external programs run locally, while others are accessed online. Summarizing the different methods to integrate with third-party software: | Integration | Installation | Usage | Admin required | | ------------------- | ------------ | -------- | -------------- | | Personal worker | local | personal | no | | Organization worker | local | shared | yes | | API tokens | cloud | shared | no | | OAuth 2.0 | cloud | personal | yes | More information can be found inside the [Develop apps](https://docs.viktor.ai/docs/create-apps/software-integrations/.md) page. ## Workers[​](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#workers "Direct link to Workers") A **worker** is a program created by VIKTOR that can be used to establish a connection between the VIKTOR platform and third-party software that runs outside the platform. With a worker a user is able to execute tasks using the third-party software and retrieve the results through the VIKTOR application. ### Architecture[​](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#architecture "Direct link to Architecture") The diagram below shows how workers communicate with the VIKTOR cloud (personal workers are managed with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md)). Communication between the worker and the VIKTOR cloud is established by a TCP connection encrypted using TLS 1.2 or higher. This connection originates from the worker to the VIKTOR cloud. In this manner it is not required to open ports to the public internet on the machine or company network. ![How workers connect to VIKTOR](/assets/images/worker-connection-3e9c24b1ddac7bac67e704ea253671d6.png) *How workers connect to VIKTOR. See [Security & data flow](https://docs.viktor.ai/docs/manage-apps/security-and-data-flow/.md) for the full picture.* ### Requirements[​](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#requirements "Direct link to Requirements") This section outlines the requirements of the VIKTOR worker. The VIKTOR worker can be installed on any machine that is used to run the third-party software to be integrated with. #### Minimum requirements[​](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#minimum-requirements "Direct link to Minimum requirements") * Processor: 64-bit AMD or Intel * Operating system: Windows * The third-party software that is to be integrated is installed and licenses are available * The VIKTOR worker requires outgoing TCP access to the internet over port 443. This is same port that is used for internet using HTTPS. #### Recommended requirements[​](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#recommended-requirements "Direct link to Recommended requirements") * Processor: 64-bit AMD or Intel * Operating system: Windows Server * The third-party software that is to be integrated is installed and licenses are available * The VIKTOR worker requires outgoing TCP access to the internet access over port 443. This is same port that is used for internet using HTTPS. #### Considerations for server requirements[​](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#considerations-for-server-requirements "Direct link to Considerations for server requirements") The requirements posed by the VIKTOR worker are negligible. the system requirements of the third-party software that is integrated with are leading. The recommended requirements for these software packages should provide you with a good starting point. Often performance bottlenecks can be traced back to the following causes: * The machine is not running an operating system that is tailored to servers (for example Windows Server). This will often lead to a lower uptime because of unexpected updates or reboots. * Engineering software often does not use parallelization to write results, the only thing that you can facilitate in this good read and write speed. We therefore recommend equipping the server with SSDs. * Not all engineering software uses multiple cores and some programs have been built for 32-bit processors instead of 64-bit processors. In this case the maximum amount of RAM that can be used is 4GB. In conclusion more cores and more RAM does always improve performance. * Most engineering software only use graphics cards (GPU) for the the user interface and not to solve models, which is restricted to the central processing unit (CPU). Therefore, it might not be required to equip the server with high- performance GPUs. * If hardware is no longer a bottleneck the amount of available licenses might be the bottleneck. This can happen when all licenses are in use by other users. Some software allows pinning the license to make sure it is always available. * VIKTOR applications allow for parallelization of external analysis tasks with the worker. If enough licenses are available and the machine has enough capacity the worker can be configured to execute tasks in parallel. ### Installation[​](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#installation "Direct link to Installation") Environment administrators can set up integrations for the entire organization, while developers and users (unless disabled\*) can create and set up integrations for personal use only. Select the correct tab below and follow the steps. \* The use of personal workers in **app instances in projects** is allowed by default. Developers can disable it for their maintained apps in the [app edit dialog](https://docs.viktor.ai/docs/manage-apps/workspaces-and-apps/.md#editing-an-existing-app). App Builder Using the ETABS, PLAXIS, Revit, SAP2000, Tekla, or Python worker integrations **inside the [App Builder](https://docs.viktor.ai/docs/app-builder/.md#python-based-worker-integrations)** requires a separate opt-in, because there the agent generates and runs that code without a review step. See the App Builder guide for details. * Personal worker * Organization worker A personal worker connects the software that is installed on your own machine, for your own use. Personal workers are installed and managed with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md): one app to install, authenticate, run, and monitor all your personal workers. 1. Download VIKTOR Desktop (a single signed .msi Microsoft Installer) from the "My integrations" tab in your personal settings, or directly from the [VIKTOR Desktop page](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#download-and-install-viktor-desktop), and install it (first time only) 2. Launch VIKTOR Desktop and log in with your VIKTOR account via the browser 3. Click "Add" and select the software of choice 4. Follow the instructions to complete the worker configuration 5. Start the worker See the [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md) page for details. Existing workers are not migrated Personal workers that were installed with the previous per-worker installers keep running, but they are not migrated into VIKTOR Desktop. To fix this, re-install the worker via VIKTOR Desktop: add and configure it again, and uninstall the old installation using the "Add or remove programs" feature of Windows to avoid two workers with different configurations competing for the same tasks. See [Migrate existing workers to VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#migrate-existing-workers-to-viktor-desktop). New personal workers can only be added through VIKTOR Desktop: the per-worker installer download and the connection-key flow are no longer available on the "My integrations" page for personal workers. An organization worker connects software that runs on a machine managed by your organization, such as a virtual or remote machine, and is shared by the users of the app instance(s) you select. caution You need to be an environment administrator in order to install an organization worker. 1. Navigate to the "Integrations" tab in the Administrator panel 2. Select the "Workers" tab 3. Click "Add worker" 4. Follow the steps provided in the modal ![](/assets/images/create-worker-integration-admin-4ccfb74c49d984e1f19a9fa6d3d67806.png) 4.1. Select the software of choice 4.2. Select the app instance(s) the integration should be available to 4.3. Download the worker .msi (Microsoft Installer) and run it on the machine of choice 4.4. Copy the generated **connection key** and paste it when the installer asks for it Connection Key The generated connection key **should be copied immediately** as VIKTOR will not preserve this data for security reasons. ### Operation[​](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#operation "Direct link to Operation") Personal workers are started, stopped, and managed inside [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#run-and-stop-workers). The options below apply to organization workers and personal workers installed with the previous per-worker installers. After installation the worker can be operated in two ways, namely: * Starting the worker manually via the desktop shortcut. During installation a shortcut to the VIKTOR worker is created on the desktop. You can start the worker by double-clicking the shortcut. * (requires Administrator privileges) As scheduled task. During installation, you are asked to create a scheduled task for the worker. If this option has been selected the worker will automatically start after (re)boot of the server. We advise to run the worker as a scheduled task to make sure it is always connected to the platform. #### Creating a scheduled task manually[​](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#creating-a-scheduled-task-manually "Direct link to Creating a scheduled task manually") note Creating a scheduled task requires Administrator privileges on your machine. When you have selected the option ‘Create scheduled task’ during installation of the worker, the worker will launch upon (re)boot of the server. You can check if a scheduled task has been created using the Windows Task Scheduler. You will need to start the Task Scheduler with administrator rights. The program can be started using the 'Start Menu' or through 'Start' > 'Windows Administrative Tools' > 'Windows Task Scheduler'. If the scheduled task for the VIKTOR worker is not present you can create a task as follows: 1. Select 'Create task' in the side menu . This action will open a new window. 2. Supply a name for the task in the tab 'General', for example `Viktor for <software package> <version>` 3. Under 'Security options' : <!-- --> 1. Select a user with the appropriate execution rights in the field 'When running the task, use the following user account' 2. Check 'Run whether user is logged on or not' <!-- --> * To use this option the user account requires 'Log on as a batch job' rights 4. Add a new trigger on the tab 'Triggers' using the 'New…' button. <!-- --> 1. Begin the task: At startup 5. Add a new action on the tab 'Actions' using the 'New…' button. <!-- --> 1. Action: Start a program. 2. Program/script: `C:\Program Files\Viktor for <software package> ``<version>\viktor-worker-...-<version>.exe` 3. Start in (optional): `C:\Program Files\Viktor for <software package> <version>\` 6. Uncheck 'Stop the task if it runs longer than' in the tab 'Settings' 7. Save and start the task. #### Activity monitoring[​](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#activity-monitoring "Direct link to Activity monitoring") Personal workers managed with VIKTOR Desktop have formatted logs [inside the app](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#view-logs). The log-file locations below apply to organization workers and personal workers installed with the previous per-worker installers. A log is kept displaying all activity of the worker. This log shows at what time tasks have been started and completed. The location of the log file depends on the environment variables of the server. The logs are written to the `C:\ProgramData` folder or the first of the following variables `%TMP%`, `%TEMP%` en `%USERPROFILE%`. In the exceptional case that none of these variables are set the worker stores the log files in the Windows folder. #### Shared licenses[​](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#shared-licenses "Direct link to Shared licenses") The VIKTOR worker only uses a license during execution of a task (e.g. running a simulation using the software package). If the program uses floating licenses this means that a licenses will only be taken from the license pool during the task. The license will be released upon completion of the task. ### Upgrading / Revoking[​](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#upgrading--revoking "Direct link to Upgrading / Revoking") An update of the VIKTOR worker might become available. For organization workers, you can install the new version as follows: 1. Uninstall the old version of the VIKTOR worker using the 'Add or remove programs' feature of Windows. 2. Install the new version of the worker by running the Windows Installer and completing the installation wizard. For personal workers, updating is done via [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md): when a worker update is available, VIKTOR Desktop prompts you to update, and once you confirm, the worker updates automatically. There is no per-worker installer to uninstall or rerun. Personal workers installed with the previous per-worker installers cannot be re-installed this way anymore, as the per-worker installers are no longer available: [migrate the worker to VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#migrate-existing-workers-to-viktor-desktop) to keep receiving updates. If the worker is no longer used or needed, please contact your environment administrator to revoke the worker through the administration panel or remove personal workers through the "My integrations" tab. Subsequently, the worker can be uninstalled from the machine. For personal workers managed with VIKTOR Desktop, removal and revocation are done per user: stop or remove the worker inside the app, and revoke access for the machine by clicking your profile in the top-right corner of VIKTOR Desktop and selecting "Log out". There are no per-worker connection keys to revoke. VIKTOR Desktop itself is updated the same way as its workers: when a new version of the app is available, you are prompted to update, and once you confirm, it updates automatically. There is no need to reinstall the .msi. ### Security[​](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#security "Direct link to Security") In this section we highlight the measures taken to incorporate security in the design of the VIKTOR worker. First of all, the worker only requires an outgoing connection to connect to the platform. Therefore, there is no need to open ports for incoming traffic or port-forwarding of incoming traffic to the machine from the outer network perimeter. For personal workers, VIKTOR Desktop authenticates with a browser-based login (OAuth 2.1 with PKCE) that is bound to your VIKTOR account, instead of per-worker connection keys. See the [requirements](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#requirements) on the VIKTOR Desktop page for the details relevant to IT administrators. Furthermore, a VIKTOR worker is built for a specific software package, so a worker is only able to perform one specific task. The exception to this is the generic worker, which we have developed to allow for integrations with software we do not have a specific integration with (yet). The following paragraph describes the way the generic worker can be used in more detail. The generic worker can be used to execute executables on the machine. In order to prevent abuse, the executables that can be called using the worker are defined in the worker configuration file and thus are controlled by the administrator of the server. The configuration file can be found in `C:\Program Files\Viktor\Viktor for <software package> <version>\config.yaml`, unless you have chosen a different installation location. The worker is not allowed to call any other executables than the ones defined in the configuration file. Furthermore, any additional arguments that are used to call the executable with are fixed. These arguments are defined in the configuration file as well. In conclusion the administrator of the server is in full control of the executables that can be called using the generic worker and can be limited to only those that are required to run the analyses required by the application. ### Troubleshooting[​](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#troubleshooting "Direct link to Troubleshooting") If the worker is not able to connect to the platform or successfully complete tasks the following checks can be performed to fix the problem yourself: 1. Inspect the log file. You can find this file in `C:\ProgramData\Viktor\Viktor for <software package> ``<version>\logs\worker.log`. All errors that the worker encounters are logged in this file. In the exceptional case that `%ProgramData%` is not defined as an environment variable the log files are written to a different directory. In that case you can find the log in one of the following: `[ %TMP% | %TEMP% | %USERPROFILE% | C:\Windows ]` `\Viktor\Viktor for <software package> <version>\logs\worker.log`. 2. Inspect the configuration file of the worker. You can find this file in `C:\Program Files\Viktor\Viktor for <software package> <version>\config.yaml`, unless you have chosen a different installation directory during installation of the worker. 3. Inspect the availability of the licenses of the third-party software that is to be integrated with. In most cases this can simply be done by manually launching the program via the start menu. ### Known issues[​](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#known-issues "Direct link to Known issues") #### SCIA Engineer[​](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#scia-engineer "Direct link to SCIA Engineer") The solver of SCIA Engineer cannot be executed from a Windows service or scheduled task, due to ‘session 0 isolation’. Therefore, it is required that the VIKTOR worker integration with SCIA Engineer run in a user environment. This implies that a user account should always be logged on to make sure that tasks can be completed successfully. The vendor of the software is aware of this problem and looking into ways to fix this. In order to do this it is convenient to set up an account that logs on automatically upon (re)boot of the server. This account should have access to a SCIA Engineer license. To set up a VIKTOR worker to integrate with SCIA Engineer please proceed as follows: 1. Create a new user account with appropriate access rights. 2. Enable automatic logon for the account created in step 1, as described in [this article](https://support.microsoft.com/en-us/help/324737/how-to-turn-on-automatic-logon-in-windows). We want to stress that this logon procedure is “only advised when the computer has been physically protected and steps have been taken to prevent unauthorized users remotely accessing the register”. 3. The VIKTOR worker is supplied as a Windows Installer (.msi file). You can configure the worker by completing the installation wizard. 4. After installation a shortcut for the VIKTOR worker can be found on the Desktop and in the Start menu as `Viktor for <software package> <version>`. By starting the application you enable the connection between the VIKTOR platform and the worker. 5. It is also possible to create a scheduled task that runs the VIKTOR worker. The task should be run by the account created in step 1. Furthermore, make sure to check the box ‘Run only when the user is logged on’. #### COM permissions[​](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#com-permissions "Direct link to COM permissions") Several workers communicate using Windows COM. The following integrations use COM: * Excel * AxisVM * RFEM The user account running the workers needs to have the correct permissions. Although the permissions might be already correct for operating the worker from the desktop, running the worker as a scheduled task might require additional configuration. When you encounter problems it is helpful to inspect the 'Windows Logs' to see if any errors were raised during execution of the worker. The logs can be accessed using the following steps: 1. Open 'Component Services' (Start > Component Services). 2. Select 'Event Viewer (Local)'. 3. Select 'Windows Logs'. 4. Select 'System', this will open a list of logs of your system. 5. Inspect these logs for any errors related to the usage of Windows COM, this can be done by looking at the source of the log, which will be labeled 'DistributedCOM'. An error related to a lack of permissions might look like the example below: ![](/assets/images/com_error_log-610e0de6cf563965193e79f275adf977.png) *Example of Windows error log* The information from this log can be used to correctly configure permissions. First of all, the permissions for the CLSID and APPID should be set in the registry. Please follow the steps below: 1. Open the 'Registry Editor' as administrator. 2. Go to `Computer\HKEY_CLASSES_ROOT\CLSID\{INSERT_CLSID_FROM_LOG}`. Use the right mouse button to select 'Permissions'. 3. Add or select the user account you use to run the worker and select 'Full Control'. Click 'Apply' to store the new permissions. 4. Go to `Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AppID\{INSERT_APPID_FROM_LOG}`. Use the right mouse button to select 'Permissions'. 5. Add or select the user account you use to run the worker and select 'Full Control'. Click 'Apply' to store the new permissions. Now the right permissions should be set in the DCOM config. Please follow the steps below to set the correct permissions: 1. Open 'Component Services' as administrator and select DCOM Config (Console Root > Computer > My Computer > DCOM Config). 2. To be able to see the corresponding AppIDs click 'View' and subsequently 'Detail', subsequently find the corresponding AppID from the event log. 3. Click the entry with the right-mouse button and open 'Properties', select the 'Security' tab. 4. Now select the option 'Customize' in 'Launch and Activation Permissions' and press 'Edit'. 5. Add or select the user account you use to run the worker and select 'Local Activation' and close the window by clicking 'Ok'. Finally close the 'Properties' window by pressing 'Apply'. Now the permissions should be configured correctly to run the worker from a local user account. #### Microsoft Excel UI elements[​](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#microsoft-excel-ui-elements "Direct link to Microsoft Excel UI elements") The scheduled task that is created by the installer to run analyses with Microsoft Excel is able to run without problems in most cases. However, when the scheduled task is run from the SYSTEM account with the setting 'Run whether user is logged on or not' it is not possible for Excel to load any UI elements. This will cause any macro that uses 'User forms' to hang. These forms are sometimes used for progress bars during macro calculations. We advise that any user forms are stripped from Excel workbooks that are used for analyses using the VIKTOR worker. Microsoft has published an article with some considerations for server-side automation of Office programs, please read [this article](https://support.microsoft.com/en-us/topic/considerations-for-server-side-automation-of-office-48bcfe93-8a89-47f1-0bce-017433ad79e2). #### Microsoft Excel cells not updating[​](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#microsoft-excel-cells-not-updating "Direct link to Microsoft Excel cells not updating") There can be differences in the behaviour of a macro when running Excel headless as compared to using the GUI. Notably, if your macro changes the value of a given cell, the values of the cells that are dependent on that value will not be updated automatically if the GUI is not open. This can be fixed by using the `Worksheet.Calculate` function in your marco to make sure the cells are updated as needed. More information on how to use `Worksheet.Calculate` function can be found in [this article](https://docs.microsoft.com/en-us/office/vba/api/excel.worksheet.calculate\(method\)) ## OAuth 2.0 integrations[​](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#oauth-20-integrations "Direct link to OAuth 2.0 integrations") **OAuth 2.0** (Open Authorization) is an industry-standard protocol that allows secure authorization to third-party software, without sharing their credentials. This enables users to access their third-party data from within a VIKTOR application, without exposing their login password. ### How it works (on a high level)[​](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#how-it-works-on-a-high-level "Direct link to How it works (on a high level)") Once the integration is set up by an organization admin and added to an application by a developer, the end user will be able to log in to the third-party software. Here is how it will work for an end user on a high level. 1. **User initiates connection:** In an application, VIKTOR will redirect the user to the third-party software to request access. 2. **User grants permission:** The user logs in (if not already), reviews the access request, and approves or denies it. 3. **Temporary authorization code issued:** If approved, the third-party software sends a short-lived code to VIKTOR. 4. **Token exchange:** VIKTOR exchanges that code for an access token — a credential we can use to access specific data or perform limited actions on behalf of the user. ### Architecture[​](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#architecture-1 "Direct link to Architecture") OAuth 2.0 enables secure, token-based access to third-party services without exposing user credentials. When a VIKTOR application needs to access external data, OAuth 2.0 facilitates a secure handshake between VIKTOR, the third-party service, and the end user. The process uses industry-standard security measures including encrypted communication, time-limited tokens, and scope-limited permissions to ensure that access is both secure and controllable. The diagram below shows how the protocol communicates with VIKTOR. ![](/assets/images/oauth-2-integration-protocol-10df4374587e3a6f0aba7ed32d29b1dd.png) *Diagram of OAuth 2.0 integration protocol* ### Requirements[​](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#requirements-1 "Direct link to Requirements") * The third-party software to integrate with should support OAuth 2.0 in accordance with [RFC 6749](https://datatracker.ietf.org/doc/html/rfc6749). * OAuth 2.0 URLs should use **HTTPS** encryption. * Support for **PKCE** (Proof Key for Code Exchange) is recommended for enhanced security. * **Refresh tokens** should be supported for long-lived integrations without requiring frequent re-authentication, so it is highly recommended to add `offline-access` scope whenever possible. * **Scope-based permissions** can be set to limit access to only specific data and operations required by the VIKTOR application. ### Creating an OAuth 2.0 integration[​](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md#creating-an-oauth-20-integration "Direct link to Creating an OAuth 2.0 integration") caution You need to be an environment administrator in order to set up an OAuth 2.0 integration. **Environment administrators** are able to set up the OAuth 2.0 integration for all applications. **Developers** are able to use existing integrations in their applications. The diagram below outlines how administrators, users, and developers engage with OAuth 2.0 integrations at different stages. ![](/assets/images/oauth-2-sequence-flow-ebb1ad6b393db243726146c960c4bd70.png) *Diagram of OAuth 2.0 flow* Go to our list of [supported software](https://docs.viktor.ai/docs/create-apps/software-integrations/.md#supported-software) and choose the software that you would like to integrate with for the installation guide. 1. Navigate to the "Integrations" tab in the Administrator panel 2. Select the "OAuth 2.0 integrations" tab 3. Click "Add OAuth 2.0 integration" 4. Follow the steps provided in the modal ![](/assets/images/create-oauth-integration-admin-6294dcc35560eaff3a66c2546dd37259.png) 1. Select the software of choice 2. Fill in the basic information of the integration, including the app that the integration should be available to. You can choose to limit the integration to specific apps or allow all apps on the environment to use it. 3. Fill in the credentials needed to establish a connection. These credentials can found in your third-party software app. ![](/assets/images/create-oauth-integration-admin-configuration-details-7ced0828b6c88d9e12e5bb50d011c85e.png) *Credentials required for an OAuth 2.0 integration* Client secret For security reasons, the client secret will not be retrievable from within VIKTOR once the integration is created. --- # Managing your app This page explains how you manage the apps you maintain: where to find them in the interface and what can be configured. ## Library[​](https://docs.viktor.ai/docs/manage-apps/workspaces-and-apps/.md#library "Direct link to Library") Apps can be found in the Library page of the environment. All users (except for external users/developers) have access to this page, allowing easy discovery and seeing what's available. On the **Details** page of the app the user can find images, a description and more information about the app. ![overview of apps](/assets/images/library-walkthrough-dd942eb3704520458c09a109a5c3f08f.webp) ## Managing your apps from the Develop page[​](https://docs.viktor.ai/docs/manage-apps/workspaces-and-apps/.md#managing-your-apps-from-the-develop-page "Direct link to Managing your apps from the Develop page") The Library is meant for discovery: it shows users which apps are available and what they do. You manage the apps you maintain from the "Develop" page instead. The sections below describe the actions available there. ADMINISTRATORS Administrators manage all apps in the organization, including apps they do not maintain, from the "All apps" page in the Administrator panel. See [All apps](https://docs.viktor.ai/docs/manage-apps/all-apps/.md). ### Creating a new app[​](https://docs.viktor.ai/docs/manage-apps/workspaces-and-apps/.md#creating-a-new-app "Direct link to Creating a new app") Apps can be created by administrators and developers, and only from the "Develop" page. Developers are automatically assigned as the first maintainer on the app they create. In the "Develop" menu, click on the "Create app" button to create a new app. You can choose between: * **App Builder** — build directly in your browser with AI assistance. See the [App Builder guide](https://docs.viktor.ai/docs/app-builder/.md). * **Create a blank app** — a temporary placeholder that shows the CLI instructions for setting up an app locally. This option will be removed in the future; local development will happen entirely through the [VIKTOR CLI](https://docs.viktor.ai/docs/getting-started/installation/.md). ### Editing an existing app[​](https://docs.viktor.ai/docs/manage-apps/workspaces-and-apps/.md#editing-an-existing-app "Direct link to Editing an existing app") The details of an existing app can be updated by navigating to the "Develop" menu, followed by clicking on the "Details" button on the app card. On the details page, click on the three dots in the top-right corner, and select "Edit app" to go through the same steps as when you first created the app. ### Version history[​](https://docs.viktor.ai/docs/manage-apps/workspaces-and-apps/.md#version-history "Direct link to Version history") All versions of your app are listed on the versions tab of the app details page. The tab shows what each version is and which version is currently deployed on [testing or production](https://docs.viktor.ai/docs/publish-apps/.md#testing-and-production-versions). ![The versions tab of an app, listing each version with its version tag and where it is deployed](/assets/images/app-versions-162d8be9d9b5dbc742b14dfcfcae4bd3.png) Every row shows the **version tag** of the version, where it is deployed, and the maintainer and date it was published. A version can be deployed on **testing**, on **production**, on both, or on neither. Expand a row to see the app type, the SDK version, and the Python version. The tab lists every version ever published, not only the ones currently deployed, so you can find older code. It does not mark which previous version was deployed on production. #### Change which version is deployed[​](https://docs.viktor.ai/docs/manage-apps/workspaces-and-apps/.md#change-which-version-is-deployed "Direct link to Change which version is deployed") MAINTAINERS ONLY 1. Open the **Details** page of your app and go to the versions tab. 2. Select the version you would like to deploy to production, expand the row in the table. 3. Confirm the change. You can select any version in the list for production, including an older one. This is how you take production back to a known-good version after a bad release, without having to fix forward. Testing always reflects the latest published version and cannot be moved to an older one. VIKTOR validates the change when you confirm it rather than in advance. When the two versions are not interchangeable the change is refused and you are told the reason. See [Move a line to another version](https://docs.viktor.ai/docs/publish-apps/.md#move-a-line-to-another-version) for the causes. When the change would delete stored data, you first see which entity types are affected and how many entities that involves. Nothing changes until you accept it. If you reject, both lines stay as they were. ### Environment variables[​](https://docs.viktor.ai/docs/manage-apps/workspaces-and-apps/.md#environment-variables "Direct link to Environment variables") ADMIN & MAINTAINERS ONLY Administrators and app maintainers can access the variables tab on the app. On this tab, environment variables can be created, adjusted, or deleted. For more information please refer to [using environment variables](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/environment-variables/.md). ![app variables page](/assets/images/app_details_variables-d64e0def95e4d027d3ba9c6a408080b1.png) ### Apps archive[​](https://docs.viktor.ai/docs/manage-apps/workspaces-and-apps/.md#apps-archive "Direct link to Apps archive") ADMIN & MAINTAINERS ONLY Apps that are no longer being used can be archived from the "Develop" page, in either of these two ways: * Click the **Details** button on the app to open its **Details** page, then click the three dots in the top-right corner of the screen and select the **Archive** option. * Click the **Select** button on the **Develop** page, select the app you want to archive, and archive it from there. Archived apps can be inspected by clicking the "Archive" button in the top-right corner of the page. Apps can be unarchived by clicking the **Unarchive** button. Note that an app **cannot be archived** when: * the app has active app instances associated to it Solution: archive the active app instances first Note that an app **cannot be unarchived** when: * the apps limit has been reached Solution: [Contact VIKTOR](https://www.viktor.ai/contact) ## Labels[​](https://docs.viktor.ai/docs/manage-apps/workspaces-and-apps/.md#labels "Direct link to Labels") An admin can add labels to apps and their instances. This enables users to filter and quickly find the tools relevant for them. For example, the labels can be used to distinguish between industry disciplines, such that a newly registered GIS user can quickly find the relevant app instances for the user. Besides filtering on labels, a user can also filter on visibility and app name. The labels on your app are also pre-selected when a new app instance is created from it. Adding labels is part of editing the app details, described in [Add a label to an app](https://docs.viktor.ai/docs/manage-apps/labels/.md#add-a-label-to-an-app). The labels you can choose from are managed by an administrator, see [Labels](https://docs.viktor.ai/docs/manage-apps/labels/.md). --- # Manage projects This page explains what projects are on VIKTOR, how they work, and who can create or manage these projects. ## What are projects?[​](https://docs.viktor.ai/docs/manage-projects/.md#what-are-projects "Direct link to What are projects?") Think of projects as folders designed to organize and manage your apps efficiently. Each project acts as a dedicated container where you can have various apps. You can add specific applications that are relevant to your work. Each app will contain data unique to that project. ![How VIKTOR is organized](/assets/images/viktor-organization-2065265bb5cc0ad065222576d167d743.png) *Each project holds app instances with their own data. See [How is VIKTOR organized?](https://docs.viktor.ai/docs/getting-started/how-is-viktor-organized/.md).* ## Project visibility[​](https://docs.viktor.ai/docs/manage-projects/.md#project-visibility "Direct link to Project visibility") Project visibility refers to the level of access and information available to different users within an environment. It ensures that relevant parties can view project details and apps. Visibility can be controlled to maintain confidentiality and ensure data security. Levels of project visibility include: * **Private**: Accessible only to users who are explicitly invited. * **Internal**: Accessible to all users except external ones. Project visibility can be set during the creation of a project or updated by following these steps: 1. Navigate to Projects and find the project you wish to edit 2. Click on the three dots and select "Edit" 3. Change the visibility and click "update" ![](/assets/images/manage-projects-visibility-b6e738b017404beb92bb9e27102ccb6c.png) ## Create and share projects[​](https://docs.viktor.ai/docs/manage-projects/.md#create-and-share-projects "Direct link to Create and share projects") Projects are a way for you to collaborate with users. You can create a project, add apps to it and share the project with your colleagues so that they can collaborate with you on your project. ### Create a project[​](https://docs.viktor.ai/docs/manage-projects/.md#create-a-project "Direct link to Create a project") A project can be created by following these steps: 1. Navigate to Projects and click on the "Create project" button in the top right hand corner. 2. Add the details of your project like name and description, choose the project's visibility and who you'd like to have access. 3. Click "Create" 4. Your project will automatically open and you can start adding tools and inviting colleagues ![](/assets/images/manage-projects-create-ed486a576c6101c2b3e74afcca3a6e22.png) ### Add apps to a project[​](https://docs.viktor.ai/docs/manage-projects/.md#add-apps-to-a-project "Direct link to Add apps to a project") You can add apps, that are available in your company [Library](https://docs.viktor.ai/docs/manage-apps/workspaces-and-apps/.md#library), to your project. You can add apps to your project by following these steps: 1. Navigate to Projects and find the project you wish to add apps to. If you are creating a new project, follow the steps in how to create a project first. 2. Open the project and click on "Add app" in the top right of the screen. 3. In the pop up, select the app you would like to add to you project. 4. Click "Add to project" ### Share a project[​](https://docs.viktor.ai/docs/manage-projects/.md#share-a-project "Direct link to Share a project") You can invite your colleagues to collaborate on your project. Inviting your colleagues means that they will have access to view your project details and use the apps that you have added to your project. You can share a project by following these steps 1. Navigate to Projects and find the project you wish to share. If you are creating a new project, follow the steps in how to create a project - you are able to add people you'd like to give access to your project. 2. Click on the three dots and select "Invite user". 3. Search for and select the users you'd like to share your project with. 4. Click "Invite". ### Roles in projects[​](https://docs.viktor.ai/docs/manage-projects/.md#roles-in-projects "Direct link to Roles in projects") Projects have 2 roles. * **Project owner**: responsible for managing the project, with permissions to access and use all project apps, edit project details, invite and manage users, and assign additional project owners. * **Member**: can access and use the project apps and view project details, but cannot make any changes to the project settings or manage other users.\* \*External users on the environment can be added as members to a project but cannot by made a project owner. ## Editing project details[​](https://docs.viktor.ai/docs/manage-projects/.md#editing-project-details "Direct link to Editing project details") You can edit the project name, description, and visibility after a project has been created. Project visibility can be set during the creation of a project or updated by following these steps: 1. Navigate to Projects and find the project you wish to edit 2. Click on the three dots and select "Edit" 3. Change the desired details and click "update" ![](/assets/images/manage-projects-edit-d5bf26d1996ce92fbef71998cd5fa6b4.png) ## FAQs[​](https://docs.viktor.ai/docs/manage-projects/.md#faqs "Direct link to FAQs") **Can I delete a project?** Yes. You can delete a project. To delete a project you will first need to archive the tools in it. Once you have done this you can delete the project. **Can I enforce a naming convention on projects?** No. Unfortunately you cannot enforce naming conventions on projects. **I don't see a "Create project" button** The ability to create projects may be controlled by your environment administrators. If you cannot find the "Create Project" button, it is likely that this feature has been disabled on your environment. If you believe this feature should be available to you, please reach out to your environment administrators for further assistance. They can confirm whether project creation is disabled and help you enable it if necessary. --- # Publishing & sharing your app Publishing uploads your app's source code to the VIKTOR platform and places that version on a delivery line, which determines who runs it. Your source code is secure and **cannot** be inspected by users that have access to the online VIKTOR environment. note Free-tier VIKTOR developers (`cloud.viktor.ai`) can only publish [editor-type apps](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md#editor-type-app) with a [public visibility](https://docs.viktor.ai/docs/manage-apps/access-management/.md#app-instance-rights) on the app instance. ## Testing and production versions[​](https://docs.viktor.ai/docs/publish-apps/.md#testing-and-production-versions "Direct link to Testing and production versions") Each app has two delivery lines, and each line points at exactly one version of your app: | Line | What runs it | What it is for | | -------------- | ------------ | ----------------------------------------------------------------------------- | | **Testing** | Testing apps | For checking a version before release, reviewing, and user acceptance testing | | **Production** | Project apps | The version your end users work with | You set each line separately. Publishing to testing leaves the production version untouched, so you can push a version out for testing without changing what your projects run. Releasing to production is a deliberate choice. Testing always reflects the latest published version. Production is independent and can stay on an older version until you decide to release; it can never point at a newer version than testing. note A testing app is not the same as the development workspace described in the [starter guide](https://docs.viktor.ai/docs/getting-started/starter-guide/.md). The development workspace shows the code you are running locally while you build the app. A testing app runs a published version: the one the testing line points at. You can move the production line to another version afterwards, including an older one, from the versions tab of your app. See [Version history](https://docs.viktor.ai/docs/manage-apps/workspaces-and-apps/.md#version-history). ## Publish a new app[​](https://docs.viktor.ai/docs/publish-apps/.md#publish-a-new-app "Direct link to Publish a new app") There are two ways to develop and publish apps on the VIKTOR platform: * **[App Builder](https://docs.viktor.ai/docs/app-builder/.md)**: A fully in-browser development experience with AI assistance. You can develop and publish apps directly from your browser without any local setup. * **Local development with CLI**: The traditional approach using your local development workspace and the VIKTOR CLI (described below). To make an app available for others to use, you will need to follow these two steps: 1. Publish the application source code 2. Add the app to a project note It might be the case that your company doesn't allow users to create projects themselves. In this case you need to ask the environment administrator to create a project for you. The following sections describe the local development publishing flow using the CLI. If you're using the App Builder, you can publish directly from the browser by clicking the **Publish** button. ### 1. Publish the application source code[​](https://docs.viktor.ai/docs/publish-apps/.md#1-publish-the-application-source-code "Direct link to 1. Publish the application source code") Once your app is ready, the developer can publish the source code by using the [`publish`](https://docs.viktor.ai/docs/create-apps/references/cli#publish) command of the CLI: ``` viktor-cli publish ``` You can also override the tag and app name of your new published version by running the CLI command such below: ``` viktor-cli publish --registered-name <insert-app-name-here> --tag v0.1.0 ``` The `registered-name` is specified when the app is created by the developer and can be inspected using the [`apps`](https://docs.viktor.ai/docs/create-apps/references/cli#apps) command of the CLI: ``` >>> viktor-cli apps The following apps are connected to your account: Name | Full name | Latest tag | SDK version | Status crane-demo | crane-demo.viktor.demo | v2.1 | 13.6.2 | published monitoring-demo | monitoring-demo.viktor.demo | v1.1 | 13.6.1 | published ... ``` Alternatively, find your app on the Develop page and navigate to the app details page. note * Although we use the term 'tag' as a variable for the publish command, this is not linked to the git tag. The CLI will not check out the tag you specify in the publish command, you will have to do this **manually** first (e.g. `git checkout <TAG>`). * If you are using git the CLI respects the .gitignore file and uses git to gather the files for uploading to VIKTOR. * You can force the CLI to upload all files in the app folder by using the `--use-filesystem` flag. * If you have any uncommitted changes or unstaged files, the `publish` command will fail as a safety mechanism. #### Choose where a version goes[​](https://docs.viktor.ai/docs/publish-apps/.md#choose-where-a-version-goes "Direct link to Choose where a version goes") By default, `viktor-cli publish` sends the new version to both the testing and the production line. To publish to testing only and leave the production version untouched, add the `--skip-production` flag: ``` viktor-cli publish --skip-production ``` Use this when you want to try a version out in a testing app before your end users get it. Once you are satisfied, point the production line at that version from the versions tab, described in [Version history](https://docs.viktor.ai/docs/manage-apps/workspaces-and-apps/.md#version-history). If you publish from the browser instead, the **Publish** dialog offers the same choice. See [Publishing](https://docs.viktor.ai/docs/app-builder/.md#publishing) in the App Builder guide. tip In a CI/CD pipeline, use the same flag on `viktor-cli ci-publish` so that an automated build does not release to production on every commit. See [Continuous deployment](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/ci/.md#continuous-deployment). #### Excluding files from publication[​](https://docs.viktor.ai/docs/publish-apps/.md#excluding-files-from-publication "Direct link to Excluding files from publication") You can exclude specific files and directories from publication by creating a `.viktorignore` file in your app's root directory. This is useful for keeping development-only content out of your published app, such as: * Test files and directories * Documentation * Log files * Data files * Build artifacts * IDE configuration files The `.viktorignore` file uses the same syntax as `.gitignore`: .viktorignore ``` # Exclude test directories and files tests/ test_*.py # Exclude documentation docs/ *.md # Exclude log and data files logs/ *.log *.csv # Exclude IDE files .vscode/ .idea/ ``` **Pattern syntax:** * `directory/` - Exclude a directory and all its contents * `*.log` - Exclude all files with `.log` extension * `data/**/*.tmp` - Recursively exclude files matching the pattern * `# comment` - Lines starting with `#` are ignored caution Do not exclude files that are required for your app to run, such as: * `app.py` or your main application file * `requirements.txt` or dependency files * `viktor.config.toml` configuration file * Source code directories containing your app logic * Any modules imported by your application Excluding critical files will cause your app to fail during publication or at runtime. tip The `.viktorignore` patterns work in addition to `.gitignore`. Files excluded by either will not be published. After pressing enter you will see a spinner which you can use to monitor the publish process. Once you see the spinner it is not possible to cancel the process. It is not a problem if you accidentally close the CLI at this point, publishing will continue in the background. During publication several checks will be performed. If any problems occur you will be presented with the reason for failure. Please contact VIKTOR in case you are stuck. ### 2. Add the app to a project[​](https://docs.viktor.ai/docs/publish-apps/.md#2-add-the-app-to-a-project "Direct link to 2. Add the app to a project") Once your app is published (either via the App Builder or CLI), you need to add it to a project to make it available for use. To do this: 1. Navigate to the projects page 2. Click the **Create project** button (if the desired project doesn't exist yet) 3. Click the **Add app** button 4. Select the desired app from the list 5. Click **Add to project** The app is now added to the project and can be used by project members. note In case your company does not allow users to create projects, you will need to contact your environment administrator to create a project for you before you can add your app. ## Publish a new version of an existing app[​](https://docs.viktor.ai/docs/publish-apps/.md#publish-a-new-version-of-an-existing-app "Direct link to Publish a new version of an existing app") Every new addition or change to the application source code requires a new release, which is done by directly [publishing the source code](https://docs.viktor.ai/docs/publish-apps/.md#1-publish-the-application-source-code). Publishing a new version can be automated using [Continuous Deployment](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/ci/.md#continuous-deployment) (CD) tools. Make sure to keep [backward compatibility](https://docs.viktor.ai/docs/publish-apps/backward-compatibility/.md) in mind when creating new releases. caution In case of an entity type incompatible publish, follow these steps: 1. Use the `publish` command with the new app code 2. Wait for it to fail due to the incompatible change 3. Notify your contact person at VIKTOR (or send a message to <support@viktor.ai>) and mention the incompatible change(s) 4. Await VIKTOR to republish with necessary adjustments in the database ### Move a line to another version[​](https://docs.viktor.ai/docs/publish-apps/.md#move-a-line-to-another-version "Direct link to Move a line to another version") Publishing is not the only way to change what runs where. From the versions tab of your app you can point the production line at any other version in the list, including an older one. The test app always reflects the latest published version and cannot be moved to an older one. Moving production to an older version is how you return it to a known-good state when a release turns out to be broken, instead of having to fix forward. VIKTOR validates the change at the moment you confirm it and refuses it when the two versions are not interchangeable, for example when the [app type](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md) differs or when the change does not meet the [backward compatibility](https://docs.viktor.ai/docs/publish-apps/backward-compatibility/.md) rules. You are told the specific reason, so you can decide what to do next. When a change would delete stored data, you have to accept that explicitly before it is applied. For the steps, see [Version history](https://docs.viktor.ai/docs/manage-apps/workspaces-and-apps/.md#version-history). ## Limitations[​](https://docs.viktor.ai/docs/publish-apps/.md#limitations "Direct link to Limitations") The following cases cannot be handled without intervention from VIKTOR. If you want to publish an app and encounter one of these limitations, please reach out to your contact person at VIKTOR to publish the application. * It is not possible to clear the database of an app before publishing. * It is not possible to publish an app that has incompatible entity type changes, e.g: <!-- --> * Removal / renaming of entity types that are already present in the database * Changing names of top-level entities The same entity type rules apply when you point a delivery line at a different version, not only when you publish. A version change that would remove an entity type already present in the database is blocked at the moment you confirm it. ## FAQs[​](https://docs.viktor.ai/docs/publish-apps/.md#faqs "Direct link to FAQs") **Why do my end users not see the new version after publishing?** Most likely the version went to testing only. Project apps run the production version, so a publish with `--skip-production`, or a browser publish that targets testing alone, leaves them on the previous version. Open the versions tab of your app and point the production line at the new version. A version that has just been released also takes time to reach every app, and the versions tab shows this while it is in progress. On an app with many project apps this is normal and is not a failure. **Can I go back to an older version?** Yes. You can deploy to an older version from the versions tab. VIKTOR validates the change when you confirm it, so a version that is not interchangeable with the current one is refused with the reason. See [Move a line to another version](https://docs.viktor.ai/docs/publish-apps/.md#move-a-line-to-another-version). **Why is my version change blocked?** The two versions are not interchangeable. The usual causes are a different [app type](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md), a deprecated or unsupported SDK or Python version, an entity type that exists in one version but not the other, or app variables that the other version needs and your app no longer has. VIKTOR names the specific cause when it refuses the change. App variables are not part of a version, so keeping them aligned with the version you select is your responsibility. See [using environment variables](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/environment-variables/.md). --- # Backward compatibility In a VIKTOR application, a lot of valuable data and knowledge is gathered over time. It is very important that, even after numerous updated to the application logic, data that is saved years ago can still successfully be processed by the application logic today, and that it results in the same output. This ensurance is called backward compatibility. ## Backward incompatible changes[​](https://docs.viktor.ai/docs/publish-apps/backward-compatibility/.md#backward-incompatible-changes "Direct link to Backward incompatible changes") The five most common cases for applications to become backward incompatible are: * An entity type is removed or the entity type has been renamed * An entity type is moved to a different parent entity type (i.e. the hierarchy is changed) * A parameter in the parametrization has been moved to a different path (e.g. `tab1.parameter` -> `tab2.parameter`) * A parameter in the parametrization has been renamed (e.g. `tab.section.parameter1` -> `tab.section.parameter2`) * A parameter is used in a different way (e.g. units are now in "m" instead of "mm") ## Testing backward compatibility[​](https://docs.viktor.ai/docs/publish-apps/backward-compatibility/.md#testing-backward-compatibility "Direct link to Testing backward compatibility") The following manual steps can be performed to test compatibility of your code changes: 1. Install and start the app on the current deployed version 2. Start the app, create a few entities and make sure to save the input data 3. Stop the app and switch to the to-be-deployed version 4. Start the app (do not clear the database!) 5. Check if there are no unexpected errors or incorrect calculation results ## Best practices to avoid compatibility issues[​](https://docs.viktor.ai/docs/publish-apps/backward-compatibility/.md#best-practices-to-avoid-compatibility-issues "Direct link to Best practices to avoid compatibility issues") Most of the backward compatibility issues can be avoided with some careful planning. Always keep backward compatibility in mind when setting up a new architecture or updating your current architecture: * When adding a new entity type, take some extra time to think about a proper name * When adding a new parameter to the Parametrization, take some extra time to think about a proper name * When defining a unit for a parameter, try to be consistent with the rest of the parameters in the app --- # Continuous Deployment (CD) Please refer to the [CI/CD](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/ci/.md#continuous-deployment) guide for more information on continuous integration/deployment, and for example files for frequently used CI/CD platforms. --- # Platform limits Here you can find explanations on certain limits that are applied when developing VIKTOR apps and when they are running on production environments. ## Disk storage limit of 5 GB[​](https://docs.viktor.ai/docs/publish-apps/limits/.md#disk-storage-limit-of-5-gb "Direct link to Disk storage limit of 5 GB") If your use case requires writing files to disk, keep in mind that we enforce a limit of 5 GB of available disk space. If this limit is exceeded, the job will fail. If your app requires more than that limit, please contact us. caution Note that writing files to disk can be unpredictable on production environments and it is usually advised against. For more details check how [files are persisted between jobs](https://docs.viktor.ai/docs/getting-started/fundamentals/call-flow/.md#local-files-persistence-between-jobs). You can instead use the Persistent Storage, where also this limit does not apply. Read our [guide](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/storing-results/.md#persistent-storage) for more detail! --- # Upgrade VIKTOR version To upgrade the version of the VIKTOR [SDK](https://docs.viktor.ai/sdk/api/.md) used in your app, modify your `requirements.txt` with the desired version: ``` viktor==14.37.0 ``` The latest SDK version and a list of all notable changes can be found in the [changelog](https://docs.viktor.ai/sdk/changelog). Don't forget to (re)[install](https://docs.viktor.ai/docs/create-apps/references/cli#install) your app after modifying the VIKTOR version (or any of the other Python dependencies), using: ``` viktor-cli install ``` note When [creating an empty app using the CLI](https://docs.viktor.ai/docs/create-apps/references/cli#create-app), the latest VIKTOR version (at that time) is automatically set in `requirements.txt`. ## Versioning[​](https://docs.viktor.ai/docs/publish-apps/upgrade-viktor-version/.md#versioning "Direct link to Versioning") VIKTOR uses [semantic versioning](https://semver.org/) to denote different versions of the SDK. The convention that is used for the version number has format v**X**.**Y**.**Z**, where: * **X** is the major: increments when a backwards incompatible change is introduced. * **Y** is the minor: increments when a new functionality is added, without breaking compatibility with older versions. * **Z** is the patch: increments when the code can drop-in replace the previous code, or when documentation is added/changed. ## Release cycle[​](https://docs.viktor.ai/docs/publish-apps/upgrade-viktor-version/.md#release-cycle "Direct link to Release cycle") **Major** versions of the SDK are released infrequently and are announced well in advance. When a new major version is released, the previous major version remains supported for 15 months. **Minor** versions of the SDK are released more frequently, typically every month or two. **Patches** might be released in between minor versions containing bug fixes or changes to the docstring. Apps using an unsupported version of the SDK can still be accessed after the support period ends. However, archived apps cannot be unarchived in this case. We will notify developers of upcoming end-of-life dates well in advance so there is enough time to upgrade apps to a newer version of the SDK. ## Upgrades & deprecations[​](https://docs.viktor.ai/docs/publish-apps/upgrade-viktor-version/.md#upgrades--deprecations "Direct link to Upgrades & deprecations") ### Patch (`v1.2.3` -> `v1.2.4`)[​](https://docs.viktor.ai/docs/publish-apps/upgrade-viktor-version/.md#patch-v123---v124 "Direct link to patch-v123---v124") Patch versions of the SDK are backwards compatible and, therefore, these releases can be used without modifying the code of your application. ### Minor (`v1.2.3` -> `v1.3.0`)[​](https://docs.viktor.ai/docs/publish-apps/upgrade-viktor-version/.md#minor-v123---v130 "Direct link to minor-v123---v130") Minor versions of the SDK are backwards compatible and, therefore, these releases can be used without modifying the code of your application. Minor versions include deprecation warnings, that inform the developer on upcoming breaking changes that need to be addressed in order to use the next major release. Deprecation warnings are logged by the CLI if the code of your application requires modification. It is not mandatory to fix deprecation warnings when updating to a minor version. To make addressing deprecations easier we have started shipping automated code fixes. These automated fixes can be applied using the CLI [`fix`](https://docs.viktor.ai/docs/create-apps/references/cli#fix) command. ### Major (`v1.2.3` -> `v2.0.0`)[​](https://docs.viktor.ai/docs/publish-apps/upgrade-viktor-version/.md#major-v123---v200 "Direct link to major-v123---v200") Migration guide v13->v14 A guide on how to migrate your app from v13 to v14 is available [here](https://docs.viktor.ai/sdk/v13-to-v14). A new major release introduces backwards incompatible changes. This means that the code of your application should be updated in order to use the new major version of the SDK. To make this process as easy as possible we provide you with [upgrade instructions](https://docs.viktor.ai/sdk/upgrades) for each change. To speed up the process of updating your app we have started shipping automated code fixes. These automated fixes can be applied using the CLI [`fix`](https://docs.viktor.ai/docs/create-apps/references/cli#fix) command. note From experience, upgrading your application to the next major version can be done in the order of a day development time. If you are having difficulty updating your application to new version of the SDK please do not hesitate to contact us. --- # Tutorials To see some more examples and improve your skills, pick one of our tutorials and learn more about creating awesome VIKTOR apps! ## Beginner level[​](https://docs.viktor.ai/docs/tutorials/.md#beginner-level "Direct link to Beginner level") ![](/img/docs/cards/basic-three-d-tutorial.svg) ## [Basic 3D Models](https://docs.viktor.ai/docs/tutorials/basic-3d-model/.md) Learn how to generate and visualise 3D models in a VIKTOR app ![](/img/docs/cards/map-tutorial.png) ## [Maps](https://docs.viktor.ai/docs/tutorials/interactive-maps/.md) Learn how to display data on an interactive map in a VIKTOR app ![](/img/docs/cards/data-graph-tutorial.png) ## [Graphs & Data](https://docs.viktor.ai/docs/tutorials/plots-and-data/.md) Process data with Pandas and show it on a Plotly graph in a VIKTOR app ![](/img/docs/cards/reporting-tutorial.svg) ## [Automatic reporting](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md) Learn how to generate parametric reports in a VIKTOR app ![](/img/docs/cards/calculationspreadsheet-tutorial.svg) ## [Spreadsheet calculation](https://docs.viktor.ai/docs/tutorials/spreadsheet-calculator/.md) Learn how to execute a spreadsheet calculation in a VIKTOR app ![](/img/docs/cards/script-to-app-tutorial.svg) ## [Python script to app](https://docs.viktor.ai/docs/tutorials/python-script-to-app/.md) Convert your Python project to a VIKTOR app ![](/img/docs/cards/post-process-etabs-data-card.svg) ## [Process ETABS data](https://docs.viktor.ai/docs/tutorials/process-etabs-data/.md) Post-process ETABS base reactions data into a heatmap ![](/img/docs/cards/staadpro-tutorial-card.png) ## [Process STAAD.Pro data](https://docs.viktor.ai/docs/tutorials/process-staad-data/.md) Post-process STAAD.Pro Analysis results ## Intermediate level[​](https://docs.viktor.ai/docs/tutorials/.md#intermediate-level "Direct link to Intermediate level") ![](/img/docs/cards/three-d-tutorial.jpg) ## [Advanced 3D Models](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md) Learn how to generate and visualise advanced 3D models in a VIKTOR app ![](/img/docs/cards/scia-tutorial.jpg) ## [SCIA Engineer](https://docs.viktor.ai/docs/tutorials/integrate-scia/.md) Learn how to create and analyse a SCIA Engineer model in a VIKTOR app ![](/img/docs/cards/dynamo-tutorial.png) ## [Dynamo integration](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md) Learn how to parametrically influence a Dynamo model in a VIKTOR app ![](/img/docs/cards/grasshopper-tutorial.svg) ## [Rhino/Grasshopper](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper/.md) Learn how to parametrically influence a Grasshopper model in a VIKTOR app ![](/img/docs/cards/etabs-sap2000-tutorial.png) ## [ETABS/SAP2000](https://docs.viktor.ai/docs/tutorials/integrate-etabs-sap2000/.md) Learn how to parametrically influence an ETABS or SAP2000 model in a VIKTOR app ![](/img/docs/cards/staadpro-tutorial-card.png) ## [Bentley STAAD.Pro](https://docs.viktor.ai/docs/tutorials/integrate-staadpro/.md) Learn how to integrate STAAD.Pro and parametrically design & analyse a frame in a VIKTOR app ![](/img/docs/cards/forma-site-tutorial-card.png) ## [Forma Site Design](https://docs.viktor.ai/docs/tutorials/integrate-forma-site-design/.md) Learn how to create workflows with Autodesk Forma Site Design ![](/img/docs/cards/acc-tutorial-card.webp) ## [Autodesk Forma / ACC](https://docs.viktor.ai/docs/tutorials/integrate-autodesk-construction-cloud/.md) Learn how to visualize, quantify, and validate Revit models from Autodesk Forma and ACC ![](/img/docs/cards/plant3d-tutorial-card.webp) ## [Plant 3D in Forma / ACC](https://docs.viktor.ai/docs/tutorials/integrate-plant3d/.md) Review equipment, color valves, explore relationships, and prepare quantity takeoffs ![](/img/docs/cards/autocad-tutorial-card.webp) ## [AutoCAD](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md) Learn how to create 2D details and 3D structural models in AutoCAD ![](/img/docs/cards/civil3d-tutorial-card.webp) ## [Civil 3D](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md) Learn how to create road alignments, set-out points, profiles, and cross sections in Civil 3D --- # Creating an editor-type app In this tutorial we will create an editor-only application, that can be used to visualize world population and life expectancy data in a few different ways: 1. bar chart of the Netherlands 2. animated scatter plot per continent 3. world map surface plot The end result can be downloaded [here](https://docs.viktor.ai/files/docs/editor-tutorial-complete.zip). tip For more examples of applications, please visit the [sample apps](https://www.viktor.ai/apps-gallery) ## Creating an empty app[​](https://docs.viktor.ai/docs/tutorials/app-type-editor/.md#creating-an-empty-app "Direct link to Creating an empty app") Let's create, install and start an empty app. This will be the starting point for the rest of the tutorial. But before we start, make sure to shut down any app that is running (like the demo app) by closing the command-line shell (for example Powershell) or end the process using `Ctrl + C`. Follow these steps to create, install and start an empty app: 1. Open a terminal and run the following command to create the app on the VIKTOR platform and generate the initial code locally: ``` viktor-cli create-app "Editor tutorial" --init --app-type editor ``` 2. Open the newly created folder in your code editor and run `viktor-cli clean-start` in the terminal to install dependencies and connect the app to the platform. If all went well, your empty app is installed and connected to your development workspace. **Do not close the terminal** as this will break the connection with your app. The terminal in your code editor should show something like this: ``` INFO : Connecting to cloud.viktor.ai... INFO : Connection is established (use Ctrl+C to close) INFO : INFO : Navigate to the link below to see your app in the browser INFO : https://cloud.viktor.ai/workspaces/XXX/app INFO : INFO : App code loaded, waiting for jobs... ``` Re-starting your app * You only need to create an app template and install it once for each new app you want to make. * The app will update automatically once you start adding code in `app.py`, as long as you don't close the terminal or your code editor. * Did you close your code editor? Use `viktor-cli start` to start the app again. No need to install, clear, etc. ## Folder structure[​](https://docs.viktor.ai/docs/tutorials/app-type-editor/.md#folder-structure "Direct link to Folder structure") The app has the following folder structure: ``` editor-tutorial ├── app.py ├── CHANGELOG.md ├── README.md ├── requirements.txt ├── tests │ └── __init__.py └── viktor.config.toml ``` Note that the app type ('editor') has been defined in `viktor.config.toml`: ## Dependencies[​](https://docs.viktor.ai/docs/tutorials/app-type-editor/.md#dependencies "Direct link to Dependencies") Navigate to the newly created folder and open `requirements.txt` and add `plotly` as additional requirement. We will use this package to create the (interactive) visualizations. ``` viktor==X.X.X plotly ``` ## Installation[​](https://docs.viktor.ai/docs/tutorials/app-type-editor/.md#installation "Direct link to Installation") After adding the additional requirement the app needs to be installed again. Navigate to your terminal in the code editor, close the connection using Ctrl+C and enter the following command: ``` viktor-cli install ``` And afterwards: ``` viktor-cli start ``` Go to your browser and refresh the page to verify that the app is installed and running as expected. You should see the app's editor, which is currently a blank page. note If you see the "Workspaces" menu upon logging in, click the "Open" button on the "Development" workspace. After opening, you will be redirected to the app's editor. ## Defining the editor (input / output)[​](https://docs.viktor.ai/docs/tutorials/app-type-editor/.md#defining-the-editor-input--output "Direct link to Defining the editor (input / output)") Open `app.py` and replace it with the following code: ``` import viktor as vkt import plotly.express as px class Parametrization(vkt.Parametrization): graph = vkt.OptionField( "Life expectancy:", options=["The Netherlands", "Continents", "Global"], default="Continents", variant="radio", flex=100 ) class Controller(vkt.Controller): parametrization = Parametrization(width=20) @vkt.PlotlyView("Life Expectancy") def plotly_view(self, params, **kwargs): df = px.data.gapminder() if params.graph == 'The Netherlands': data = df.query("country == 'Netherlands' ") fig = px.bar(data, x='year', y='pop', color='lifeExp') elif params.graph == 'Continents': fig = px.scatter( df, x="gdpPercap", y="lifeExp", animation_frame="year", animation_group="country", size="pop", color="continent", hover_name="country", facet_col="continent", log_x=True, size_max=75, range_x=[100, 100000], range_y=[25, 90] ) elif params.graph == 'Global': fig = px.choropleth( df, locations='iso_alpha', color='lifeExp', hover_name='country', animation_frame='year', color_continuous_scale=px.colors.sequential.Plasma, projection='natural earth' ) else: raise NotImplementedError return vkt.PlotlyResult(fig) ``` In your browser, refresh the page to reload the editor. On the left side, you will now see radio buttons with the defined options. Go ahead and select another option and see how it influences the results on the right-hand side. ![](/assets/images/tutorial-editor-a56b0f7883dce450c93a5c59434320a1.png) --- # Creating a simple-type app In this tutorial we will create a simple-type application; an app that consists of only one single [entity type](https://docs.viktor.ai/docs/getting-started/fundamentals/entities-and-entity-types/.md). note The main difference with the [editor-type app](https://docs.viktor.ai/docs/tutorials/app-type-editor/.md) is that with the simple-type app you can create as many objects (entities) as you want. Each object editor stores its own (unique) data. The app visualizes world population and life expectancy data in a few different ways: 1. bar chart of the Netherlands 2. animated scatter plot per continent 3. world map surface plot The end result can be downloaded [here](https://docs.viktor.ai/files/docs/simple-tutorial-complete.zip). tip For more examples of applications, please visit the [sample apps](https://www.viktor.ai/apps-gallery) ## Creating an empty app[​](https://docs.viktor.ai/docs/tutorials/app-type-simple/.md#creating-an-empty-app "Direct link to Creating an empty app") Let's create, install and start an empty app. This will be the starting point for the rest of the tutorial. But before we start, make sure to shut down any app that is running (like the demo app) by closing the command-line shell (for example Powershell) or end the process using `Ctrl + C`. Follow these steps to create, install and start an empty app: 1. Open a terminal and run the following command to create the app on the VIKTOR platform and generate the initial code locally: ``` viktor-cli create-app "Simple tutorial" --init --app-type simple ``` 2. Open the newly created folder in your code editor and run `viktor-cli clean-start` in the terminal to install dependencies and connect the app to the platform. If all went well, your empty app is installed and connected to your development workspace. **Do not close the terminal** as this will break the connection with your app. The terminal in your code editor should show something like this: ``` INFO : Connecting to cloud.viktor.ai... INFO : Connection is established (use Ctrl+C to close) INFO : INFO : Navigate to the link below to see your app in the browser INFO : https://cloud.viktor.ai/workspaces/XXX/app INFO : INFO : App code loaded, waiting for jobs... ``` Re-starting your app * You only need to create an app template and install it once for each new app you want to make. * The app will update automatically once you start adding code in `app.py`, as long as you don't close the terminal or your code editor. * Did you close your code editor? Use `viktor-cli start` to start the app again. No need to install, clear, etc. ## Folder structure[​](https://docs.viktor.ai/docs/tutorials/app-type-simple/.md#folder-structure "Direct link to Folder structure") The app has the following folder structure: ``` simple-tutorial ├── app.py ├── CHANGELOG.md ├── README.md ├── requirements.txt ├── tests │ └── __init__.py └── viktor.config.toml ``` Note that the app type ('simple') has been defined in `viktor.config.toml`: ## Dependencies[​](https://docs.viktor.ai/docs/tutorials/app-type-simple/.md#dependencies "Direct link to Dependencies") Navigate to the newly created folder and open `requirements.txt` and add `plotly` as additional requirement. We will use this package to create the (interactive) visualizations. ``` viktor==X.X.X plotly ``` ## Installation[​](https://docs.viktor.ai/docs/tutorials/app-type-simple/.md#installation "Direct link to Installation") After adding the additional requirement the app needs to be installed again. Navigate to your terminal in the code editor, close the connection using Ctrl+C and enter the following command: ``` viktor-cli install ``` And afterwards: ``` viktor-cli start ``` Go to your browser and refresh the page to verify that the app is installed and running as expected. You should see the app's editor, which is currently a blank page. note If you see the "Workspaces" menu upon logging in, click the "Open" button on the "Development" workspace. After opening, you will be redirected to the app's editor. ## Defining the editor (input / output)[​](https://docs.viktor.ai/docs/tutorials/app-type-simple/.md#defining-the-editor-input--output "Direct link to Defining the editor (input / output)") Open `app.py` and replace it with the following code: ``` import viktor as vkt import plotly.express as px class Parametrization(vkt.Parametrization): graph = vkt.OptionField( "Life expectancy:", options=["The Netherlands", "Continents", "Global"], default="Continents", variant="radio", flex=100 ) class Controller(vkt.Controller): parametrization = Parametrization(width=20) @vkt.PlotlyView("Life Expectancy") def plotly_view(self, params, **kwargs): df = px.data.gapminder() if params.graph == 'The Netherlands': data = df.query("country == 'Netherlands' ") fig = px.bar(data, x='year', y='pop', color='lifeExp') elif params.graph == 'Continents': fig = px.scatter( df, x="gdpPercap", y="lifeExp", animation_frame="year", animation_group="country", size="pop", color="continent", hover_name="country", facet_col="continent", log_x=True, size_max=75, range_x=[100, 100000], range_y=[25, 90] ) elif params.graph == 'Global': fig = px.choropleth( df, locations='iso_alpha', color='lifeExp', hover_name='country', animation_frame='year', color_continuous_scale=px.colors.sequential.Plasma, projection='natural earth' ) else: raise NotImplementedError return vkt.PlotlyResult(fig) ``` In your browser, click on "+ Create", as shown in the image below. ![](/assets/images/create-entity-dc7424d74c6322e4d62ba5c33b78f08f.png) Fill in a name in the pop-up, and click “Create and open”, to create the object (entity) and open its editor. On the left side, you will now see radio buttons with the defined options. Go ahead and select another option and see how it influences the results on the right-hand side. Save your changes by clicking the disk icon in the top-right corner of the screen (encircled in red in the image below). ![](/assets/images/tutorial-simple-279d67b1cd21c33288855438c52baa96.png) --- # Creating a tree-type app In this tutorial we will create an application that implements a 'tree' entity type hierarchy, consisting of two [entity types](https://docs.viktor.ai/docs/getting-started/fundamentals/entities-and-entity-types/.md) (with parent-child relation). The child entity type allows the user to click on a map to define a `GeoPoint`. The parent entity type collects the locations on each child entity and shows them together on a single map, making use of the [API](https://docs.viktor.ai/docs/api/sdk/.md). The end result can be downloaded [here](https://docs.viktor.ai/files/docs/tree-tutorial-complete.zip). tip For more examples of applications, please visit the [sample apps](https://www.viktor.ai/apps-gallery) ## Creating an empty app[​](https://docs.viktor.ai/docs/tutorials/app-type-tree/.md#creating-an-empty-app "Direct link to Creating an empty app") Let's create, install and start an empty app. This will be the starting point for the rest of the tutorial. But before we start, make sure to shut down any app that is running (like the demo app) by closing the command-line shell (for example Powershell) or end the process using `Ctrl + C`. Follow these steps to create, install and start an empty app: 1. Open a terminal and run the following command to create the app on the VIKTOR platform and generate the initial code locally: ``` viktor-cli create-app "Tree tutorial" --init --app-type tree ``` 2. Open the newly created folder in your code editor and run `viktor-cli clean-start` in the terminal to install dependencies and connect the app to the platform. If all went well, your empty app is installed and connected to your development workspace. **Do not close the terminal** as this will break the connection with your app. The terminal in your code editor should show something like this: ``` INFO : Connecting to cloud.viktor.ai... INFO : Connection is established (use Ctrl+C to close) INFO : INFO : Navigate to the link below to see your app in the browser INFO : https://cloud.viktor.ai/workspaces/XXX/app INFO : INFO : App code loaded, waiting for jobs... ``` Re-starting your app * You only need to create an app template and install it once for each new app you want to make. * The app will update automatically once you start adding code in `app.py`, as long as you don't close the terminal or your code editor. * Did you close your code editor? Use `viktor-cli start` to start the app again. No need to install, clear, etc. ## Folder structure[​](https://docs.viktor.ai/docs/tutorials/app-type-tree/.md#folder-structure "Direct link to Folder structure") The app has the following folder structure: ``` tree-tutorial ├── app │ ├── my_entity_type │ │ ├── __init__.py │ │ └── controller.py │ ├── my_folder │ │ ├── __init__.py │ │ └── controller.py │ └── __init__.py ├── CHANGELOG.md ├── README.md ├── requirements.txt ├── tests │ └── __init__.py └── viktor.config.toml ``` Note that the app type ('tree') has been defined in `viktor.config.toml`: ``` app_type = 'tree' ``` To keep things simple, we will stick to the current entity type and corresponding folder names within this tutorial. ## Installation[​](https://docs.viktor.ai/docs/tutorials/app-type-tree/.md#installation "Direct link to Installation") Login to the app in your browser to verify that the app is installed and running as expected. You will be redirected to the app's dashboard. note If you see the "Workspaces" menu upon logging in, click the "Open" button on the "Development" workspace. After opening, you will be redirected to the app's dashboard. The tree-type app generated by the CLI consists of a top folder, called "My Folder", shown in the sidebar on the left side of the screen. ![](/assets/images/tutorial-tree-dashboard-c6f5344657f5c2e2faa8cc0bcca65de2.png) Click "My Folder" to enter the folder. Now, let's add a new object by clicking the + (create new object) button on the right side of the screen. You'll now see a menu where you can add a new object: ![](/assets/images/tutorial-tree-create-object-8064bb45fa9ce960865664e6449bf393.png) *Create a new object of type "My Entity Type"* Provide a name for the new object and click "Create and open", to create the new object and automatically navigate to the object's editor (it should be empty). From here, you can navigate back to "My Folder" in a few different ways: * By clicking the back button in the top right side of the screen: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAScAAABNCAYAAADkQqLJAAABg2lDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV+/qEjFwQ4iDhlaJwuioo5ahSJUCLVCqw4ml35Bk4YkxcVRcC04+LFYdXBx1tXBVRAEP0AcnZwUXaTE/yWFFjEeHPfj3b3H3TvA36wy1QyOAapmGZlUUsjlV4XwK0IIIoJpxCVm6nOimIbn+LqHj693CZ7lfe7P0acUTAb4BOJZphsW8Qbx1Kalc94njrKypBCfE48adEHiR67LLr9xLjns55lRI5uZJ44SC6UulruYlQ2VeJI4pqga5ftzLiuctzir1Tpr35O/MFLQVpa5TnMYKSxiCSIEyKijgiosJGjVSDGRof2kh3/I8YvkkslVASPHAmpQITl+8D/43a1ZnBh3kyJJIPRi2x9xILwLtBq2/X1s260TIPAMXGkdf60JzHyS3uhosSOgfxu4uO5o8h5wuQMMPumSITlSgKa/WATez+ib8sDALdC75vbW3sfpA5ClrtI3wMEhMFKi7HWPd/d09/bvmXZ/P4k4crCfsJX0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH5gUEDDgb36vGawAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNU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21tbWAYBvHx8YiPj8fDDz8EhUIBADCbzZg5cybUajWeeOIJrFlT5injxImTOH36DBYuXAiWpYwHgiC3bpTExcXhvffeg8PBwWw24csvT8DlckGnq8Vzz5Xg5s2buHOnGwkJifjuu+/wwAMPoKxsNaxWKw4c+MSrrJMnT+LRRx/FggWPw2A4Rb1FEOOIkE4leOutP8XsD9m6dTv1JkGQW0cQBEHiRBAEiVNgZDJZTP6IWK0XQRAiiVNGRmZM/ohYrRdBECKJU17ekzFnpchkMuTlPUk9SRBjjJCf+EsPOCAIIibFiSAIIubcOoIgCBIngiBInAiCIEicCIIgSJwIgvil8j9x/lkVjZQ1mwAAAABJRU5ErkJggg==) * By clicking the menu button in the top left corner of the screen. This will extend (or collapse) the side menu. You can expand "My Folder" to see all containing objects, or click on it: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAvCAYAAAB30kORAAABhGlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV/TSqVUHMwgIhKkOlkQFXHUKhShQqgVWnUwH/2CJg1Jiouj4Fpw8GOx6uDirKuDqyAIfoA4OjkpukiJ/0sKLWI8OO7Hu3uPu3cA16gomhUaBzTdNtPJhJDNrQrhV4TAI4JhDEmKZcyJYgq+4+seAbbexVmW/7k/R4+atxQgIBDPKoZpE28QT2/aBuN9Yl4pSSrxOfGYSRckfmS67PEb46LLHMvkzUx6npgnFoodLHewUjI14inimKrplM9lPVYZbzHWKjWldU/2wmheX1lmOs1BJLGIJYgQIKOGMiqwEadVJ8VCmvYTPv4B1y+SSyZXGQo5FlCFBsn1g/3B726twuSElxRNAF0vjvMxAoR3gWbdcb6PHad5AgSfgSu97a82gJlP0uttLXYE9G4DF9dtTd4DLneA/idDMiVXCtLkCgXg/Yy+KQf03QKRNa+31j5OH4AMdZW6AQ4OgdEiZa/7vLu7s7d/z7T6+wFkC3KhWlFeuQAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAuIwAALiMBeKU/dgAAAA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C++UviQ5Jo0sSK+QvewtzCrFbHmfLmSAKnBrNn9yFefuV55s6bTNj6HWzcuAsjIwNGjvSvMGPFytKcFR9t4ubNOBwc7AicXnoRc3Jy4MWXejN37nJ0lNr4+fnSpKkV6elZ2NhY8oKfD3ezVbwzYzE5uXl4ebkxoWxWQPMWTXhn5vjS9xCfjIWFGSNHDUShUNDG0Z43xvyLkJBQsjLvYmPTmJmzJtZPwGsB6tIP+5wu2vX2AQ9euEYzD76zuwtLPpypmUXRoIEOC96byvpPI9j95SEaNmxAv+d7Ylo2wwXA28eDs2eiK9y21lSGmsHmMr16d+Pu3RzmB60iK+su7Z1bExQ0pUKZ6unp8vb0EDIzsvHs2qHKmGxt1XxeNbO2boyH5zNMmbyAeUFT6jxH/HGp78p8e3VjS/ge/Pr7PnCbVq2bY23dGPcuLg/d1gMmDWfjhp1MnDCP4uJivH268ProV6qvp+a2TJg4hOCFH6NAQQe3dujoKMt1CnqSk5PL/PkryczIplXr5gRMGl5vPfnKPz/0XVlJHSdu3hsX6t2nG1MDX6/yjdbqlvfq3bXW0yQfZx+v3oKuri7jxg/maRR5R02cCga1+Wf/iqJ/yjedH/f6nvpWMAGThuPk5IB4BD14gHHjBxMTfVVzG1FZ5eWWluZPbSA+bbo3kd89J/X99ysoKCTqp3MUFhTi6GgvFfUnb9LqxMBAnzlzJ9VqFoelpTlz5k6SXzwmhKi1ZUvD2Pr51wROG13vz5qednUeorlHpcohbP2OB37xqVfvrowbP1jCXQghnrSALx/00dFXNXPkHRzscHFpI8EuhBBPesALIYR4PMlTNSGEkIAXQgghAS+EEEICXgghhAS8EEIICXghhBAS8EIIIQEvhBBCAl4IIYQEvBBCCAl4IYQQEvBCCCEk4IUQQgJeCCHEk+T/dmwX2+gxmL4AAAAASUVORK5CYII=) Delete the created entity afterwards. ## Defining the GeoPoint (child)[​](https://docs.viktor.ai/docs/tutorials/app-type-tree/.md#defining-the-geopoint-child "Direct link to Defining the GeoPoint (child)") Let's modify `MyEntityType` so that the user can define a `GeoPoint` on a map. Open `app/my_entity_type/controller.py` and replace it with the following code: ``` import viktor as vkt class Parametrization(vkt.Parametrization): geo_point = vkt.GeoPointField("Select point") class Controller(vkt.Controller): parametrization = Parametrization @vkt.MapView("Map") def map_view(self, params, **kwargs): features = [] if params.geo_point: features.append(vkt.MapPoint.from_geo_point(params.geo_point)) return vkt.MapResult(features) ``` In your browser, open "My Folder" and create a few entities of type "My geo-point". Don't forget to select a point on the map for each of them and save (including the entity created at the start of this tutorial, if you did not delete it before). ## Defining the Overview (parent)[​](https://docs.viktor.ai/docs/tutorials/app-type-tree/.md#defining-the-overview-parent "Direct link to Defining the Overview (parent)") To show all the geo-points we just created, let's modify `MyFolder` to iterate over all its children and obtain the point from the params for each of them. Open `app/my_folder/controller.py` and replace it with the following code: ``` import viktor as vkt class Controller(vkt.Controller): label = 'Overview' children = ['MyEntityType'] show_children_as = 'Table' @vkt.MapView("Map") def map_view(self, params, entity_id, **kwargs): features = [] for child in vkt.api_v1.API().get_entity(entity_id).children(): point = child.last_saved_params.geo_point if point: features.append(vkt.MapPoint.from_geo_point(point)) return vkt.MapResult(features) ``` In your browser, open the editor of "My Folder". Within the "Map" view, click the 3 dots and select "Center map", to fit all objects within the view. You should now be able to see all your previously created geo-points. --- # Tutorial - Automatic reporting note Estimated time: 30 minutes<br />Difficulty level: Beginner * [![](/img/illustrations/free-version-banner.svg)](https://www.viktor.ai/start-building-apps) ## Introduction[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#introduction "Direct link to Introduction") Welcome to this tutorial on automatic reporting in VIKTOR with Python! As an engineer or data scientist, generating reports is an essential part of your work. Reporting not only helps you understand the insights from your data but also helps you communicate your findings/results to stakeholders. In this tutorial, we will explore how to automate the process of generating reports in VIKTOR with python. We will cover: 1. [Creating a basic report](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#1-basic-setup) 2. [Adding a table with dynamic rows to the report](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#2-table-with-dynamic-rows) 3. [Adding a table with dynamic columns to the report](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#3-table-with-dynamic-columns) 4. [Including a figure in the report](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#4-adding-a-figure) 5. [Downloading the report](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#5-download-the-word-report) By the end of this tutorial, you will have created a simple VIKTOR application that makes an invoice. See gif below: ![](/assets/images/tutorial_reporting_animation-108813f0e37d9746463a499966c49403.gif) *What the app looks like once you've completed this tutorial* tip You can find the complete code [below](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#6-all-code-together). ## Pre-requisites[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#pre-requisites "Direct link to Pre-requisites") Prerequisites * You have some experience with reading Python code During the tutorial, we added some links to additional information; but don't let them distract you too much. Stay focused on completing the tutorial. After this, you will know everything you need to create an app which includes automatic reporting functionalities. ## 1. Basic setup[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#1-basic-setup "Direct link to 1. Basic setup") In this chapter, we will go through the process of generating a report automatically as fast as possible. In the following chapters, we will add more elements to the report. First, we will create a Word template and then fill this template with data from our app. At the beginning, you may feel that you are not making a lot of progress because we have to set the basis first, but we promise that we will end up adding stuff to your app and report at lighting speed ⚡ Let’s get started! ### Create an empty app[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#create-an-empty-app "Direct link to Create an empty app") Let's create, install and start an empty app. This will be the starting point for the rest of the tutorial. But before we start, make sure to shut down any app that is running (like the demo app) by closing the command-line shell (for example Powershell) or end the process using `Ctrl + C`. Follow these steps to create, install and start an empty app: 1. Open a terminal and run the following command to create the app on the VIKTOR platform and generate the initial code locally: ``` viktor-cli create-app "Reporting tutorial" --init --app-type editor ``` 2. Open the newly created folder in your code editor and run `viktor-cli clean-start` in the terminal to install dependencies and connect the app to the platform. If all went well, your empty app is installed and connected to your development workspace. **Do not close the terminal** as this will break the connection with your app. The terminal in your code editor should show something like this: ``` INFO : Connecting to cloud.viktor.ai... INFO : Connection is established (use Ctrl+C to close) INFO : INFO : Navigate to the link below to see your app in the browser INFO : https://cloud.viktor.ai/workspaces/XXX/app INFO : INFO : App code loaded, waiting for jobs... ``` Re-starting your app * You only need to create an app template and install it once for each new app you want to make. * The app will update automatically once you start adding code in `app.py`, as long as you don't close the terminal or your code editor. * Did you close your code editor? Use `viktor-cli start` to start the app again. No need to install, clear, etc. ### Create your Word template[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#create-your-word-template "Direct link to Create your Word template") To make a report in this tutorial we will use a hypothetical example, we will create an invoice. Depending on your situation you may choose to format this more in terms of an engineering report or consultancy presentation. To start, we will have to make a Word template to fill with information later. We will keep it basic for now and only add the client’s name, company, and date. We will use `tags` enclosed by double curly braces like this `{{company}}` to place information in the Word template. The string inside the double curly braces is known as the identifier, and we use it to place the correct values in the right tags. 1. Open an empty Word file and fill it similarly to the example below. Alternatively, you can download the [pre-made template](https://docs.viktor.ai/files/docs/reporting-tutorial/Template_part1.docx) ![](/img/docs/tutorial-reporting-1.jpg) 2. Now, save your template in a `files` folder. Navigate to your app directory (most likely located somewhere similar to `C:\Users\<username>\viktor-apps\reporting-tutorial`) and create the new folder there. Once you've created the new folder, save the template in it with the filename `Template.docx`. Your app folder should now look something like this: ``` reporting-tutorial ├── files │ └── Template.docx ├── tests ├── app.py ├── CHANGELOG.md ├── README.md ├── requirements.txt └── viktor.config.toml ``` ### App input fields[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#app-input-fields "Direct link to App input fields") The next step is to have some information to fill the template with. In this case, we will add 3 input fields to our app: `client_name`, `company`, and `date`. We will use a [`TextField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_TextField) and [`DateField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_DateField) for this. 1. Open `app.py`, and add the relevant fields to your parametrization. If you like you could accompany the fields with some instructive text. In the end your `app.py` file should look like this: ``` import viktor as vkt class Parametrization(vkt.Parametrization): intro = vkt.Text("# Invoice app 💰 \n This app makes an invoice based on your own Word template") client_name = vkt.TextField("Name of client") company = vkt.TextField("Company name") lb1 = vkt.LineBreak() # This is just to separate fields in the parametrization UI date = vkt.DateField("Date") class Controller(vkt.Controller): parametrization = Parametrization ``` 2. Refresh your app, and you should see the input fields there. ### Filling the template with data[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#filling-the-template-with-data "Direct link to Filling the template with data") We will now fill the word template from the input fields. 1. First, import `Path` from `pathlib` at the beginning of you `app.py` file: ``` from pathlib import Path ``` 2. Now create a method called `generate_word_document` in your controller class. The resulting controller class would look like below: ``` class Controller(vkt.Controller): parametrization = Parametrization def generate_word_document(self, params): # Create emtpy components list to be filled later components = [] # Fill components list with data components.append(vkt.word.WordFileTag("Client_name", params.client_name)) components.append(vkt.word.WordFileTag("company", params.company)) components.append(vkt.word.WordFileTag("date", str(params.date))) # Convert date to string format # Get path to template and render word file template_path = Path(__file__).parent / "files" / "Template.docx" with open(template_path, 'rb') as template: word_file = vkt.word.render_word_file(template, components) return word_file ``` #### How this works[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#how-this-works "Direct link to How this works") 1. **List with information:** Inside `generate_word_document` we made a list `components` with all the information we want to put in the report. The [`WordFileTag`](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/word-file-templater/.md#wordfiletag) function has two arguments, the first argument is the identifier. This is used to find the location in the word template. The second argument is the value that needs to be placed at the location of the identifier in the template 2. **Open and render template**: The last part opens the template and uses the function [`render_word_file`](https://docs.viktor.ai/sdk/api/external/word/.md#_render_word_file) to insert the information from the `components` list into the template. Finally, we need to return the filled template. ### Generate a PDF report[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#generate-a-pdf-report "Direct link to Generate a PDF report") Now that we have a filled template invoice, we can work on visualising it. In VIKTOR it is possible to show a pdf using the [`PDFView`](https://docs.viktor.ai/sdk/api/views/.md#_PDFView). Follow the next steps: 1. Create a `pdf_view` method inside the controller class, after the `generate_word_document` method we just created. 2. Generate the invoice using the `generate_word_document` method we built in the previous section. 3. Convert word to pdf, with the [`convert_word_to_pdf`](https://docs.viktor.ai/sdk/api/utils/.md#_convert_word_to_pdf) function. 4. Return a [`PDFResult`](https://docs.viktor.ai/sdk/api/views/.md#_PDFResult). See code below for the resulting `pdf_view` method: ``` ... class Controller(vkt.Controller): parametrization = Parametrization @vkt.PDFView("PDF viewer", duration_guess=5) def pdf_view(self, params, **kwargs): word_file = self.generate_word_document(params) with word_file.open_binary() as f1: pdf_file = vkt.convert_word_to_pdf(f1) return vkt.PDFResult(file=pdf_file) ``` ### All code so far, just in case.[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#all-code-so-far-just-in-case "Direct link to All code so far, just in case.") Just in case something went wrong, here you can find all code together so far: **Complete code** ``` import viktor as vkt from pathlib import Path class Parametrization(vkt.Parametrization): intro = vkt.Text("# Invoice app 💰 \n This app makes an invoice based on your own Word template") client_name = vkt.TextField("Name of client") company = vkt.TextField("Company name") lb1 = vkt.LineBreak() # This is just to separate fields in the parametrization UI date = vkt.DateField("Date") class Controller(vkt.Controller): parametrization = Parametrization def generate_word_document(self, params): # Create emtpy components list to be filled later components = [] # Fill components list with data components.append(vkt.word.WordFileTag("Client_name", params.client_name)) components.append(vkt.word.WordFileTag("company", params.company)) components.append(vkt.word.WordFileTag("date", str(params.date))) # Convert date to string format # Get path to template and render word file template_path = Path(__file__).parent / "files" / "Template.docx" with open(template_path, 'rb') as template: word_file = vkt.word.render_word_file(template, components) return word_file @vkt.PDFView("PDF viewer", duration_guess=5) def pdf_view(self, params, **kwargs): word_file = generate_word_document(params) with word_file.open_binary() as f1: pdf_file = vkt.convert_word_to_pdf(f1) return vkt.PDFResult(file=pdf_file) ``` Now that we have a basic functional version of our report, let's add some more complicated elements. In the next sections we are going to add: 1. A table, with dynamic rows 2. A table with dynamic columns 3. A figure we're going to make ourselves Finally we'll also include functionality to download the report. ## 2. Table with dynamic rows[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#2-table-with-dynamic-rows "Direct link to 2. Table with dynamic rows") The simple steps to adding a table with dynamic rows into our invoice are: * Update the template * Add input fields for the table * Process the user input * Fill the template with the processed input ### Update the template[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#update-the-template "Direct link to Update the template") The table has a variable amount of rows (dynamic rows), meaning that the number of rows will vary depending on the input. We will do this by writing a for loop inside our template. Follow the steps or just download the [updated template](https://docs.viktor.ai/files/docs/reporting-tutorial/Template_part2.docx) 1. Open your Word template and create a table with the appropriate column headings and layout. 2. Add a row below and paste the following line of code in the first cell to start the for loop: ``` {% tr for r in table1 %} ``` 3. Add another row and, in each column, add the following line of code, where `var` is the key name of the value (desc, qty, price, total): ``` {{r[var]}} ``` 4. Insert a bottom row and add the following line of code to close the for loop: ``` {% tr endfor %} ``` 5. Under this table, lets add the following line to show the total price: ``` ${{total_price}} ``` By following the steps, you added the table to the template, which should make it look like this: ![](/img/docs/tutorial-reporting-template-page1.PNG) ### Add input fields[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#add-input-fields "Direct link to Add input fields") For the table, we will add some input fields. 1. In your `Parametrization` class, under the fields we added before, add: ``` # Table table_price = vkt.Table("Products") table_price.qty = vkt.NumberField("Quantity", suffix="-", min=0) table_price.desc = vkt.TextField("Description", suffix="-") table_price.price = vkt.NumberField("Price", suffix="€", min=0) ``` 2. Refresh your app. You should see a nice table! ### Process user input[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#process-user-input "Direct link to Process user input") In order to enter the table and the final total amount on the invoice, we will create two methods. One to calculate the total price and another to process the data in the table. #### Calculate the total price[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#calculate-the-total-price "Direct link to Calculate the total price") Inside your `Controller` class, under the `PDFview` we made in last section, create this method: ``` @staticmethod def calc_total_price(params): # Get user entry from params product_table = params.table_price # Calculate total price from quantities and unit price quantities = [row["qty"] for row in product_table] prices = [row["price"] for row in product_table] total_price = 0 for qty, price in zip(quantities, prices): total_price += qty * price return total_price ``` This method takes the table and for every entered item in the table, it calculates the total price for that specific item and adds it to the overall total. Which is then returned by the method. #### Processing the table[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#processing-the-table "Direct link to Processing the table") The user input currently in the table does not provide all information for the invoice we have set up in the template. For this table we will also require a total cost per product. Inside your `Controller` class, under the `calc_total_price` method we just made, create this method: ``` def process_table(self, params): product_table = params.table_price for row in product_table: row["total"] = row["qty"] * row["price"] return product_table ``` ### Fill template[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#fill-template "Direct link to Fill template") Remember that we created the method called `generate_word_document` to add the data to the word template? Well, now we will modify that method to add the table data. 1. Just below the method definition, add these two lines like this: ``` def generate_word_document(self, params): #<--- this is just for your reference total_price = self.calc_total_price(params) table = self.process_table(params) ``` 2. Just a few lines under, in the part where we append the data to the components list, add: ``` components.append(vkt.word.WordFileTag("total_price", str(total_price))) # Convert price float to string components.append(vkt.word.WordFileTag("table1", table)) ``` 3. Update your app, fill in the table and check this amazing table inside your invoice! tip If you get stuck, you can always try to have a quick peek at the [complete code](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#6-all-code-together) at the end of this tutorial ## 3. Table with dynamic columns[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#3-table-with-dynamic-columns "Direct link to 3. Table with dynamic columns") In the previous section, we added a table with a fixed column and a variable number of rows. This time we will turn things around and create a table with fixed rows and variable columns because this could apply better to your situation, and we want to show you both options. The steps are the same as before, so let’s jump into it. ### Update the template[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#update-the-template-1 "Direct link to Update the template") Open the template and add a second table to it that looks as follows and don't forget to save. Or just use the [updated template](https://docs.viktor.ai/files/docs/reporting-tutorial/Template_part3.docx) ![](/img/docs/tutorial-reporting-3.jpg) You may notice that, this time, we are creating a for loop in each row that loops through the columns. ### Adjust the data processing[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#adjust-the-data-processing "Direct link to Adjust the data processing") For this second table we also have to calculate the percentage of the total costs every product constitutes. Therefore, we will adjust the `process_table` method we made earlier. It should now look like the following (notice we are employing the `calc_total_price()` method created earlier in the process as well): ``` def process_table(self, params): total_price = self.calc_total_price(params) product_table = params.table_price for row in product_table: row["total"] = row["qty"] * row["price"] row["perc"] = str(round((row["total"] / total_price) * 100, 2)) + "%" return product_table ``` ### Fill template[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#fill-template-1 "Direct link to Fill template") For the sake of time, we will use the same input fields and calculation methods we made before. 1. To add the data to the template, go to `generate_word_document` and add: ``` components.append(vkt.word.WordFileTag("table2", table)) ``` 2. Update your app and see the new table in the report. Wow, that went lightning fast! ## 4. Adding a figure[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#4-adding-a-figure "Direct link to 4. Adding a figure") Now we will add a figure, and we will choose a pie chart because we are engineers and we love charts 😉 ### Generating the figure[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#generating-the-figure "Direct link to Generating the figure") To generate the figure you can use multiple different python libraries. In this tutorial we will not go into depth on this subject. The method below can take in the params as we created them earlier, create a pie-chart of the total division of products in the customer's order, and save that figure to a data object using the `BytesIO` package. 1. At the end of you code, inside the `Controller` class add this code: ``` @staticmethod def create_figure(params): product_table = params.table_price # Create figure fig, ax = plt.subplots(figsize=(16, 8)) products = [row["desc"] for row in product_table] qty = [np.round(row["qty"], 2) for row in product_table] ax.pie(qty, labels=products, autopct="%1.1f%%") ax.set_title("Pie chart total sold products") png_data = BytesIO() fig.savefig(png_data, format='png') plt.close() return png_data ``` 2. Don't forget the imports ``` from io import BytesIO import numpy as np import matplotlib.pyplot as plt ``` ### Update the template[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#update-the-template-2 "Direct link to Update the template") Open your template and place the following tag at the location where you want to see the pie chart. This should complete the template. Again, you can also download the [full template](https://docs.viktor.ai/files/docs/reporting-tutorial/Template.docx) here: ``` {{ figure_sales }} ``` ### Insert Image in report[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#insert-image-in-report "Direct link to Insert Image in report") An image can be inserted using the [`WordFileImage`](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/word-file-templater/.md#wordfileimage) object which requires a binary file handle. The method `create_figure` stores a png image in the `BytesIO` object. This object can be directly placed in the Word document through the `WordFileImage`. 1. You can paste the code below in the `generate_word_document` method underneath the tables and above the actual rendering of the Word file: ``` # Place image figure = self.create_figure(params) word_file_figure = vkt.WordFileImage(figure, "figure_sales", width=500) components.append(word_file_figure) ``` 2. Update your app, and you will see the chart. ## 5. Download the Word report[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#5-download-the-word-report "Direct link to 5. Download the Word report") The last step is to add a download button, the download enables the user to download a file in any format. In this case we will use it to download the report in Word format, just in case you want to add something manually. note The `PDFView` used in the previous chapter already allows the user to download the PDF file from the view directly. The case we're tackling with this download button is the one where the user would require the actual Word format. ### Create a download method[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#create-a-download-method "Direct link to Create a download method") The button we will make in the next step requires a file in the form of a [`DownloadResult`](https://docs.viktor.ai/sdk/api/result/.md#_DownloadResult), so first we will make a simple method. At the end of your `Controller` class add: ``` def download_word_file(self, params, **kwargs): word_file = self.generate_word_document(params) return vkt.DownloadResult(word_file, "Invoice.docx") ``` ### Add a download button.[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#add-a-download-button "Direct link to Add a download button.") A [`DownloadButton`](https://docs.viktor.ai/sdk/api/parametrization/.md#_DownloadButton) is added to the parametrization to allow the user to download the file with a single click. This button requires a `method` argument. This method is the method we just added to the controller class. note Pay attention to the way the method is added to the DownloadButton. This has to be in the format of a `string` so if the method (as in the example below) is called `download_word_file` then it should be added to the DownloadButton as `method="download_word_file"` At the end of your `Parametrization` class add the button: ``` # Downloadbutton download_word_file = vkt.DownloadButton('Download report', method='download_word_file') ``` ## 6. All code together[​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#6-all-code-together "Direct link to 6. All code together") **Complete code** ``` import viktor as vkt import matplotlib.pyplot as plt import numpy as np from io import BytesIO from pathlib import Path class Parametrization(vkt.Parametrization): intro = vkt.Text("# Invoice app 💰 \n This app makes an invoice based on your own Word template") client_name = vkt.TextField("Name of client") company = vkt.TextField("Company name") lb1 = vkt.LineBreak() # This is just to separate fields in the parametrization UI date = vkt.DateField("Date") # Table table_price = vkt.Table("Products") table_price.qty = vkt.NumberField("Quantity", suffix="-", min=0) table_price.desc = vkt.TextField("Description", suffix="-") table_price.price = vkt.NumberField("Price", suffix="€", min=0) # Downloadbutton download_word_file = vkt.DownloadButton('Download report', method='download_word_file') class Controller(vkt.Controller): parametrization = Parametrization def generate_word_document(self, params): total_price = self.calc_total_price(params) table = self.process_table(params) # Create emtpy components list to be filled later components = [] # Fill components list with data components.append(vkt.word.WordFileTag("Client_name", params.client_name)) components.append(vkt.word.WordFileTag("company", params.company)) components.append(vkt.word.WordFileTag("date", str(params.date))) # Convert date to string format components.append(vkt.word.WordFileTag("total_price", str(total_price))) # Convert price float to string components.append(vkt.word.WordFileTag("table1", table)) components.append(vkt.word.WordFileTag("table2", table)) # Place image figure = self.create_figure(params) word_file_figure = vkt.WordFileImage(figure, "figure_sales", width=500) components.append(word_file_figure) # Get path to template and render word file template_path = Path(__file__).parent / "files" / "Template.docx" with open(template_path, 'rb') as template: word_file = vkt.word.render_word_file(template, components) return word_file @vkt.PDFView("PDF viewer", duration_guess=5) def pdf_view(self, params, **kwargs): word_file = self.generate_word_document(params) with word_file.open_binary() as f1: pdf_file = vkt.convert_word_to_pdf(f1) return vkt.PDFResult(file=pdf_file) @staticmethod def calc_total_price(params): # Get user entry from params product_table = params.table_price # Calculate total price from quantities and unit price quantities = [row["qty"] for row in product_table] prices = [row["price"] for row in product_table] total_price = 0 for qty, price in zip(quantities, prices): total_price += qty * price return total_price def process_table(self, params): total_price = self.calc_total_price(params) product_table = params.table_price for row in product_table: row["total"] = row["qty"] * row["price"] row["perc"] = str(round((row["total"] / total_price) * 100, 2)) + "%" return product_table @staticmethod def create_figure(params): product_table = params.table_price # Create figure fig, ax = plt.subplots(figsize=(16, 8)) products = [row["desc"] for row in product_table] qty = [np.round(row["qty"], 2) for row in product_table] ax.pie(qty, labels=products, autopct="%1.1f%%") ax.set_title("Pie chart total sold products") png_data = BytesIO() fig.savefig(png_data, format='png') plt.close() return png_data def download_word_file(self, params, **kwargs): word_file = self.generate_word_document(params) return vkt.DownloadResult(word_file, "Invoice.docx") ``` ## To infinity and beyond\![​](https://docs.viktor.ai/docs/tutorials/automatic-reporting/.md#to-infinity-and-beyond "Direct link to To infinity and beyond!") Well done! You are now able to create an app that takes in user input and processes this automatically into a report which is shown as a `PDFView` and can be downloaded as a Word file! Of course, the journey doesn't end here. Check out some of our other [tutorials](https://docs.viktor.ai/docs/tutorials/.md) or go to the [Create apps](https://docs.viktor.ai/docs/create-apps/.md) where you can see the different options you have to create apps. --- # Tutorial - Create an interactive 3D building info Level: **Beginners**<br />Time: **30 min**<br /> Prerequisites: * You have an account and completed the installation process. No account? Get one [here](https://www.viktor.ai/start-building-apps) * You have some experience with reading Python code * [![](/img/illustrations/free-version-banner.svg)](https://www.viktor.ai/start-building-apps) <br /> ***Not a reader?** feel free to follow this tutorial as a video* ## Introduction[​](https://docs.viktor.ai/docs/tutorials/basic-3d-model/.md#introduction "Direct link to Introduction") Welcome to this tutorial on how to create a web app that takes you from making simple 3D elements, to combining them into a parametric building, using VIKTOR and Python! As an engineer or architect, you may work with changing requirements for a project. In this tutorial we will take an office building as an example. We will explore how to visualize 3D elements and create patterns from our inputs to create an interactive building with VIKTOR and python. Like this we wont need to change any code when we need to change the requirements of the building. 1. [Create and Install the app](https://docs.viktor.ai/docs/tutorials/basic-3d-model/.md#1-create-install-and-start-an-empty-app) 2. [Adding 3D geometry](https://docs.viktor.ai/docs/tutorials/basic-3d-model/.md#2-adding-a-3d-geometry) 3. [Let's make it interactive](https://docs.viktor.ai/docs/tutorials/basic-3d-model/.md#3-lets-make-it-interactive) 4. [Complete Code](https://docs.viktor.ai/docs/tutorials/basic-3d-model/.md#4-complete-app-code) By the end of this tutorial you will be able to make 3D elements and use them in patterns in a VIKTOR app and have a basic understanding of how you can use built-in VIKTOR elements to upgrade your visuals! Try the app we'll be building below: Need help? Are you encountering an error? Take a look at the [**complete app code**](https://docs.viktor.ai/docs/tutorials/basic-3d-model/.md#5-complete-app-code). Also know that you can always ask for help at our [**Community Forum**](https://community.viktor.ai/), where our developers are ready to help with any question related to the installation, coding and more. ## 1. Create, install and start an empty app[​](https://docs.viktor.ai/docs/tutorials/basic-3d-model/.md#1-create-install-and-start-an-empty-app "Direct link to 1. Create, install and start an empty app") Let's create, install and start an empty app. This will be the starting point for the rest of the tutorial. But before we start, make sure to shut down any app that is running (like the demo app) by closing the command-line shell (for example Powershell) or end the process using `Ctrl + C`. Follow these steps to create, install and start an empty app: 1. Open a terminal and run the following command to create the app on the VIKTOR platform and generate the initial code locally: ``` viktor-cli create-app "Parametric building tutorial" --init --app-type editor ``` 2. Open the newly created folder in your code editor and run `viktor-cli clean-start` in the terminal to install dependencies and connect the app to the platform. If all went well, your empty app is installed and connected to your development workspace. **Do not close the terminal** as this will break the connection with your app. The terminal in your code editor should show something like this: ``` INFO : Connecting to cloud.viktor.ai... INFO : Connection is established (use Ctrl+C to close) INFO : INFO : Navigate to the link below to see your app in the browser INFO : https://cloud.viktor.ai/workspaces/XXX/app INFO : INFO : App code loaded, waiting for jobs... ``` Re-starting your app * You only need to create an app template and install it once for each new app you want to make. * The app will update automatically once you start adding code in `app.py`, as long as you don't close the terminal or your code editor. * Did you close your code editor? Use `viktor-cli start` to start the app again. No need to install, clear, etc. **Did you encounter any errors?** * Always make sure to check the spelling of everything you placed in the command-line, a small mistake and the command you are trying to run may not be recognised! * If you are encountering: ``` ERROR: Exiting because of an error: no requirements.txt file PS C:\Users\<username>\viktor-apps> ``` Then you are not in the correct folder! check the command-line and navigate to the 3d-building-tutorial folder. * If you are encountering: ``` Error: App definition is not compatible with the data currently stored in the database. Use the command 'viktor-cli clear' to clear the database. PS C:\Users\<username>\viktor-apps\3d-building-tutorial> ``` That means you have not cleared the database yet! Use the `viktor-cli clear` to clear and then you can use `viktor-cli start` to start the app. No need to install it again! Not seeing any of these errors? Head over to our community! There is a good chance another developer encountered it and solved it too! ## 2. Adding a 3D geometry[​](https://docs.viktor.ai/docs/tutorials/basic-3d-model/.md#2-adding-a-3d-geometry "Direct link to 2. Adding a 3D geometry") Lets jump into our `app.py` file and start working on our VIKTOR application. The first thing we will do is make sure we can see all our progress in the 3D view. For now we will leave the `Parametrization` as is. In the `Controller`, let's change the label to something like "Parametric Building" and add the `GeometryView`. The geometry that we will display is the `SquareBeam`, for now, lets make it a 1-by-1-by-1 block. ``` class Controller(vkt.Controller): parametrization = Parametrization @vkt.GeometryView("3D building", x_axis_to_right=True) def get_geometry(self, params, **kwargs): block = vkt.SquareBeam( length_x=1, length_y=1, length_z=1 ) return vkt.GeometryResult(block) ``` Save your `app.py`, if you closed the terminal enter `viktor-cli start` and go to your cloud environment (e.g. <https://cloud.viktor.ai>) to see your cube. If all went well you should now see a simple cube in the middle of your screen similar to the image below. You can zoom and pan around it with your mouse. If you click the three dots on the top right you can see some options that come standard with VIKTOR's `GeometryView`. ![](/assets/images/tutorial-parametric-cube-ff85e04c59270444e94154022b5eaa5f.png) ## 3. Let's make it interactive[​](https://docs.viktor.ai/docs/tutorials/basic-3d-model/.md#3-lets-make-it-interactive "Direct link to 3. Let's make it interactive") To go from a simple cube to a parametric building we will have to: * make the cube adjustable in size to become a slab (ceiling of a floor) * make windows (to represent the floor) * make a window-slab-window-slab-etc pattern to make a building * duplicate the pattern to make multiple floors ### Parametrize the cube into a slab[​](https://docs.viktor.ai/docs/tutorials/basic-3d-model/.md#parametrize-the-cube-into-a-slab "Direct link to Parametrize the cube into a slab") In order to turn the cube into a slab, we will make the dimension in the vertical axis fixed. That way we have a fixed ceiling/floor thickness. Then we will make the dimensions in the x and y direction variable. Let's start by adding a `NumberField` to the parametrization. You may add a minimum and a default value to make sure you are presented with a model on start up. In this case, a building's dimensions cannot be negative so we choose zero as the minimum and let's say our hypothetical client's lot is currently about 30x30 meters so we will choose that as our default. ``` class Parametrization(vkt.Parametrization): width = vkt.NumberField('Width', min=0, default=30) length = vkt.NumberField('Width', min=0, default=30) ``` If you navigate to your browser again, you will see these two fields appear on the left side of the window but the cube is still the same. To get our cube to turn into a slab, lets change the code. Notice how we change the hard-coded values of `length_x` and `length_y` to `params.length` and `params.width`. ``` class Controller(vkt.Controller): parametrization = Parametrization @vkt.GeometryView("3D building", x_axis_to_right=True) def get_geometry(self, params, **kwargs): block = vkt.SquareBeam( length_x=params.width, #<-- change this length_y=params.length, #<-- change this length_z=1 ) return vkt.GeometryResult(block) ``` If you go back to the browser, you should now see that changing the code results in a change in the size of the block. When you refresh the page, you should see that the default dimensions for the width and length are 30, just like we coded in the parametrization. If all went well it should look something like the image below: ![](/assets/images/tutorial-parametric-slab-6a5e92c4643330d080607e20efba336a.png) ### Make the windows of the floor[​](https://docs.viktor.ai/docs/tutorials/basic-3d-model/.md#make-the-windows-of-the-floor "Direct link to Make the windows of the floor") To make the windows of the floor we will assign materials. Since we already have our slab, lets call the material for that "concrete" and for our windows "glass". We can easily add these materials and their properties to the `get_geometry` method by using the `Color` and `Material` objects. ``` ... class Controller(vkt.Controller): parametrization = Parametrization @vkt.GeometryView("3D building", x_axis_to_right=True) def get_geometry(self, params, **kwargs): #Materials: glass = vkt.Material("Glass", color=vkt.Color(150, 150, 255)) #<-- add this facade = vkt.Material("Concrete") #<-- add this block = vkt.SquareBeam( length_x=params.width, length_y=params.length, length_z=1 ) return vkt.GeometryResult(block) ``` Now we have two materials and a block, but we need to have two blocks, one to represent the concrete facade and the other for the windows. So, we can simply rename the block that we have, duplicate it for the windows and assign the materials. By grouping together the facade and the window we can have a single object that represents an entire floor. Let's also display this in our `GeometryView` to see our floor. ``` ... class Controller(vkt.Controller): parametrization = Parametrization @vkt.GeometryView("3D building", x_axis_to_right=True) def get_geometry(self, params, **kwargs): #Materials: glass = vkt.Material("Glass", color=vkt.Color(150, 150, 255)) facade = vkt.Material("Concrete") floor_glass = vkt.SquareBeam( length_x=params.width, length_y=params.length, length_z=1, material=glass #<-- add this ) floor_facade = vkt.SquareBeam( length_x=params.width, length_y=params.length, length_z=1, material=facade #<-- add this ) floor = vkt.Group([floor_glass, floor_facade]) #<-- add this return vkt.GeometryResult(floor) #<-- Make sure to change this ``` You may have noticed that you still see the slab like before, it does not look like an entire floor including windows. That is because our windows are now inside of the slab. Lets change the values so that we have a bit of overhang and a bit of offset, just like some real buildings have. ``` ... class Controller(vkt.Controller): parametrization = Parametrization @vkt.GeometryView("3D building", x_axis_to_right=True) def get_geometry(self, params, **kwargs): #Materials: glass = vkt.Material("Glass", color=vkt.Color(150, 150, 255)) facade = vkt.Material("Concrete") floor_glass = vkt.SquareBeam( length_x=params.width, length_y=params.length, length_z=2, #<-- change this material=glass ) floor_facade = vkt.SquareBeam( length_x=params.width+1, #<-- change this length_y=params.length+2, #<-- change this length_z=1, material=facade ) floor_facade.translate((0, 0, 1.5)) #<-- add this floor = vkt.Group([floor_glass, floor_facade]) return vkt.GeometryResult(floor) ``` The floor you have made should look something like the image below: ![](/assets/images/tutorial-parametric-floor-9090d83503546c915d3778f79faccd15.png) ### Duplicating a 3D element[​](https://docs.viktor.ai/docs/tutorials/basic-3d-model/.md#duplicating-a-3d-element "Direct link to Duplicating a 3D element") Now you should be able to see a single floor in your `GeometryView`. The next step is to duplicate the floor to a certain amount. For this we will use VIKTOR's `LinearPattern`. Let's make the building 16 floors high and because our floor's thickness is equal to three we will make that the spacing. ``` ... class Controller(vkt.Controller): parametrization = Parametrization @vkt.GeometryView("3D building", x_axis_to_right=True) def get_geometry(self, params, **kwargs): ... floor = vkt.Group([floor_glass, floor_facade]) #<-- Use this line as a reference! building = vkt.LinearPattern(floor, direction=[0, 0, 1], number_of_elements=16, spacing=3) return vkt.GeometryResult(building) ``` If all went well, you should now see a 16 storey building in your browser similar to the image below. You should also be able to change the values of the width and length of this building. ![](/assets/images/tutorial-parametric-flat-1ba4c0a17df487cd9e8ecb65c5a0991a.png) Let's make it a bit more interesting by adding the number of floors to the parametrization and allowing the user to choose a color for their building. For this we add a `ColorField` and another `NumberField`. Since we want the building to have a default of 16, a minimum of 10 and a maximum of 40 floors , let's improve the user experience and make this a slider. ``` ... class Parametrization(vkt.Parametrization): ... number_floors = vkt.NumberField("How many floors", variant='slider', min=10, max=40, default=16) #<-- add this field building_color = vkt.ColorField("Facade Color", default=vkt.Color(221, 221, 221)) #<-- add this field ... class Controller(vkt.Controller): parametrization = Parametrization @vkt.GeometryView("3D building", x_axis_to_right=True) def get_geometry(self, params, **kwargs): ... facade = vkt.Material("Concrete", color=params.building_color) #<-- add color here ... building = vkt.LinearPattern(floor, direction=[0, 0, 1], number_of_elements=params.number_floors, spacing=3) #<-- change to parametric input here return vkt.GeometryResult(building) ``` ### Improve the user's experience[​](https://docs.viktor.ai/docs/tutorials/basic-3d-model/.md#improve-the-users-experience "Direct link to Improve the user's experience") The best applications make it easy for the user to reach their goal. By adding text we can inform the user about the application. We may also choose to add a schematic drawing or image to inform them visually. This can all be done in the Parametrization so let's add a `Text` to our app. ``` ... class Parametrization(vkt.Parametrization): intro_text = vkt.Text( "# 3D Parametric Building App 🏢\n" "In this app, the user can change the dimensions of the building, choose the amount of floors and a color for the facade. The app will generate a 3D building for the user as output." ) ``` The final app should now look like this: ### Well done\![​](https://docs.viktor.ai/docs/tutorials/basic-3d-model/.md#well-done "Direct link to Well done!") If your app now works you have successfully completed this tutorial! You just made some architects shiver with those programming skills there! ## 4. Complete app code[​](https://docs.viktor.ai/docs/tutorials/basic-3d-model/.md#4-complete-app-code "Direct link to 4. Complete app code") Were you able to do everything in this tutorial without error? If not, you can always take a look at the full code: **Complete code** ``` import viktor as vkt class Parametrization(vkt.Parametrization): intro_text = vkt.Text( "# 3D Parametric Building App 🏢\n" "In this app, the user can change the dimensions of the building, choose the amount of floors and a color for " "the facade. The app will generate a 3D building for the user as output." ) width = vkt.NumberField('Width', min=0, default=30) length = vkt.NumberField('Length', min=0, default=30) number_floors = vkt.NumberField("how many floors", variant='slider', min=10, max=40, default=25) building_color = vkt.ColorField("Building Color", default=vkt.Color(221, 221, 221)) class Controller(vkt.Controller): parametrization = Parametrization @vkt.GeometryView("3D building", x_axis_to_right=True) def get_geometry(self, params, **kwargs): #Materials: glass = vkt.Material("Glass", color=vkt.Color(150, 150, 255)) facade = vkt.Material("Concrete", color=params.building_color) floor_glass = vkt.SquareBeam( length_x=params.width, length_y=params.length, length_z=2, material=glass ) floor_facade = vkt.SquareBeam( length_x=params.width+1, length_y=params.length+2, length_z=1, material=facade ) floor_facade.translate((0, 0, 1.5)) floor = vkt.Group([floor_glass, floor_facade]) building = vkt.LinearPattern(floor, direction=[0, 0, 1], number_of_elements=params.number_floors, spacing=3) return vkt.GeometryResult(building) ``` ## Want to learn how VIKTOR works?[​](https://docs.viktor.ai/docs/tutorials/basic-3d-model/.md#want-to-learn-how-viktor-works "Direct link to Want to learn how VIKTOR works?") If you are interested in how VIKTOR works behind the scenes, for example how it processes your input, expand the tabs below! #### How does it work?[​](https://docs.viktor.ai/docs/tutorials/basic-3d-model/.md#how-does-it-work "Direct link to How does it work?") How does the Parametrization work? In the **Parameterization** class you can add input fields that allow the user to provide input to your app, and there are more than 20 [different input fields](https://docs.viktor.ai/docs/create-apps/user-input/.md) you can use, including numbers, text, colors, images and files. Inside the Parametrization class, you can also format the [layout of your app](https://docs.viktor.ai/docs/create-apps/layout-and-styling/.md) by adding sections, tabs, steps and pages. To show your Parametrization in the app, we need to add the line `parametrization = Parametrization` inside the `Controller` class, because it is the controller that determines what is shown and not. How does the Parametrization get saved? So you may be wondering, how do you get the information from the parametrization to my controller? Well, we do this automatically for you. The values of all parameters are stored in a single variable called `params` , which is accessible inside the Controller class. These variables are stored in a `Munch`; this is similar to a dictionary, but works with point denotation. Example: * Let's say we have a variable called `height` as a NumberField in our `Parameterization`. * To use it in a method in the `Controller`, define it as: `def my_method(self, params, **kwargs)` * You can now make calculations inside that method using our height parameter as `params.height`! How does the Controller work? The **Controller** class is the place where you add everything you want to calculate and show. As explained in this tutorial, we show results in a `View` and we always add views in our controller. You can even add several views in a single app by adding them to the controller class... and yes, we have [many Views](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md),for showing graphs, maps, 3D models, reports, images and more. In the Controller, you also do or call your calculation. Remember that the user input given in the parametrization, is accessible inside the Controller class in the variable The `params`. ## What's next[​](https://docs.viktor.ai/docs/tutorials/basic-3d-model/.md#whats-next "Direct link to What's next") Very impressive! You have now learned the basics of the VIKTOR `GeometryView`. In this tutorial, we have only scratched the surface of what you can do using geometries in VIKTOR. So don’t stop your journey there! If you like an extra challenge, here are some ideas: * Can you make the windows opaque? * Can you make the height of the windows/floors parametric as well? Maybe a client is looking for fancy floor-to-ceiling windows with minimal overhang? Or just follow some of our other [tutorials](https://docs.viktor.ai/docs/tutorials/.md) More about geometries You can find more information about how to use the `GeometryView` in the [Geometry guide](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md). It also includes some of the geometry elements that VIKTOR offers out of the box. --- # Tutorial - AutoCAD info Level: **Intermediate**<br />Time: **30–45 min**<br /> Prerequisites: * You have a VIKTOR account and completed the installation process. No account? Get one [here](https://www.viktor.ai/start-building-apps) * You have AutoCAD installed and licensed on a Windows computer. * You can install VIKTOR Desktop on that computer and open a drawing in AutoCAD. * [![](/img/illustrations/free-version-banner.svg)](https://www.viktor.ai/start-building-apps) ## Introduction[​](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#introduction "Direct link to Introduction") Welcome to this tutorial on how to create VIKTOR apps that draw directly in AutoCAD. If you create structural drawings, many details follow the same rules but change from one project to another. Beam dimensions, reinforcement, bay spacing, storey heights, and member sizes may all change. Here you can choose between three App Builder prompts and a step-by-step local development example. Both paths draw in the AutoCAD file already open on your computer. Start with [VIKTOR Desktop and the AutoCAD worker](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#1-set-up-autocad-and-viktor-desktop), then choose a tab in [Choose your approach](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#3-choose-your-approach). The Prompt guide offers three workflows: 1. [Draw a reinforced-concrete beam detail](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#prompt-1-draw-a-reinforced-concrete-beam-detail). 2. [Draw a structural-steel stair detail](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#prompt-2-draw-a-structural-steel-stair-detail). 3. [Create a parametric 3D structural frame](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#prompt-3-create-a-parametric-3d-structural-frame). Prefer writing Python? If you're comfortable with Python and want to build the app yourself, select the **Local development** tab under [Choose your approach](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#3-choose-your-approach). You'll build a simple beam-detail app step by step. Complete the AutoCAD and VIKTOR Desktop setup below first, as it applies to both approaches. ## 1. Set up AutoCAD and VIKTOR Desktop[​](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#1-set-up-autocad-and-viktor-desktop "Direct link to 1. Set up AutoCAD and VIKTOR Desktop") Both approaches use a personal worker to connect a VIKTOR app to AutoCAD on your Windows computer. First, check the [VIKTOR Desktop requirements](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#requirements), then [download and install VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#download-and-install-viktor-desktop) and log in with your VIKTOR account. In VIKTOR Desktop, click **Add**, choose **AutoCAD**, and start the worker. The worker and AutoCAD must run on the same computer and under the same Windows user. Follow the [AutoCAD worker installation steps](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md#install-the-worker) if you need more detail. You do not need to install Python on the worker computer. Select **AutoCAD** in the **Add worker** window: ![AutoCAD highlighted in the VIKTOR Desktop Add worker window](/assets/images/tutorial-autocad-worker-select-66b12cc72647ba547a2a462c01bfebcf.webp) After starting the worker, check that its status is **Running**: ![AutoCAD personal worker with Running status in VIKTOR Desktop](/img/docs/tutorial-autocad-worker-running.webp) Before running either app: 1. Open AutoCAD on the computer where the personal worker is running. 2. Open the drawing you want the app to update. 3. Check that the AutoCAD worker is running in VIKTOR Desktop. 4. Keep AutoCAD free of open dialogs, then trigger the drawing action from the VIKTOR app. note AutoCAD needs a logged-in Windows desktop session. The worker cannot attach to AutoCAD if the application is closed or waiting on a dialog. ## 2. Understand the key concepts[​](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#2-understand-the-key-concepts "Direct link to 2. Understand the key concepts") Although you can get quite far with a clear prompt, it helps to understand how the app reaches AutoCAD: * **Personal worker**: a small program managed through VIKTOR Desktop. It passes drawing operations from the VIKTOR app to AutoCAD on your own computer. * **`vkt.autocad.attach()`**: connects the app to the AutoCAD instance that is already open. It does not start AutoCAD or create a separate drawing. Read more in [Attaching to a running instance](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md#attaching-to-a-running-instance). * **Active drawing**: the drawing currently open in AutoCAD. The generated app adds geometry to this drawing, so start with the correct file and save it yourself when the result is ready. * **AutoCAD ActiveX API**: the set of drawing operations used by the app. It can create lines, polylines, dimensions, blocks, layers, and 3D solids without sending commands to the AutoCAD command line. * **Layers**: named groups that keep concrete, reinforcement, dimensions, annotations, or 3D objects separate. A clear layer prefix makes generated content easier to review, hide, or remove. * **Regeneration**: refreshing the drawing after the app finishes. Regenerating once at the end is faster than refreshing after every object is added. note You can also use [`vkt.autocad.connect()`](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md#calling-the-api-directly-from-your-app) to start a new AutoCAD instance, do the work, and close it when the session ends. This tutorial uses `attach()` to keep the drawing open so you can review and save it yourself. Both methods are **BETA** and require **viktor >= 14.35.0**. ## 3. Choose your approach[​](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#3-choose-your-approach "Direct link to 3. Choose your approach") Use the **Prompt guide** to generate an app with the VIKTOR App Builder, or **Local development** to build a small beam-detail app yourself. The Desktop and worker setup above applies to both tabs. * Prompt guide * Local development ### Explore AutoCAD workflows with prompts[​](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#explore-autocad-workflows-with-prompts "Direct link to Explore AutoCAD workflows with prompts") The following prompts help you turn common AutoCAD drawing tasks into interactive VIKTOR apps. Use the arrow on each prompt to open it in the App Builder, then adapt it to your needs. Once the app is generated, review its inputs and code before running it against your open drawing. ### Prompt 1: Draw a reinforced-concrete beam detail[​](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#prompt-1-draw-a-reinforced-concrete-beam-detail "Direct link to Prompt 1: Draw a reinforced-concrete beam detail") Let's start with a reinforced-concrete beam detail. It is useful when the same drawing standard must be applied to beams with different spans, sections, reinforcement, and clear cover. The app creates an elevation and cross-section from your inputs. ![](/img/illustrations/app-builder-cta-background.svg) ![](/img/illustrations/app-builder-cta-logo.svg)![](/img/illustrations/app-builder-cta-logo-glow.svg) ### Reinforced-concrete beam detail Create a VIKTOR app that draws a 2D reinforced-concrete beam detail in the AutoCAD drawing currently open on my personal worker. Follow the AutoCAD knowledge base guide and use vkt.autocad.attach(). Draw a beam spanning between two columns, including the concrete outline, top and bottom longitudinal bars, regularly spaced stirrups, column links, break symbols, overall dimensions, and leader annotations showing bar diameters, stirrup spacing, and clear cover. Add a labeled cross-section beside the elevation showing the concrete profile, stirrup, and reinforcement positions. Let me configure all dimensions and reinforcement values, use millimetres, organize the elements on separate layers, and regenerate the drawing when finished. Once the App Builder finishes creating the app, check the default beam dimensions and reinforcement values. Open a copy of your AutoCAD drawing, run the action, and confirm that the elevation, cross-section, dimensions, and annotations use the expected scale and layers. Here is the generated app and its beam detail: ![Reinforced-concrete beam detail in AutoCAD beside its VIKTOR App Builder preview](/assets/images/tutorial-autocad-prompt2-beam-588c7738136c8c9e715de576ee15ec51.webp) tip Ask the App Builder to add your office layer names, colors, text style, dimension style, and bar-mark format. This turns the general example into a detail that follows your drawing standard. ### Prompt 2: Draw a structural-steel stair detail[​](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#prompt-2-draw-a-structural-steel-stair-detail "Direct link to Prompt 2: Draw a structural-steel stair detail") The second workflow draws a steel stair in several coordinated views. It is useful when a stair's floor height, width, or riser count changes, but you still need consistent geometry and connection details. ![](/img/illustrations/app-builder-cta-background.svg) ![](/img/illustrations/app-builder-cta-logo.svg)![](/img/illustrations/app-builder-cta-logo-glow.svg) ### Structural-steel stair detail Create a VIKTOR app that draws a complete structural-steel stair detail in the AutoCAD drawing currently open on my personal worker using vkt.autocad.attach(). Generate the stair elevation, plan view, typical tread section, and landing connection detail. Include stringers, treads, risers, landing beams, columns, plates, bolts, weld symbols, dimensions, elevation markers, and member labels. Let me configure floor-to-floor height, stair width, number of risers, tread depth, stringer section, landing dimensions, plate thicknesses, bolt sizes, and drawing origin. Automatically calculate stair geometry from the floor height and selected number of risers. Organize steel, plates, bolts, welds, dimensions, and annotations on separate layers and regenerate the drawing when finished. Once the app is ready, enter the stair dimensions and create the drawing in a test file. Check that the elevation, plan, tread section, and landing connection agree with the inputs. This example shows the generated VIKTOR app beside the AutoCAD drawing: ![Structural-steel stair views in AutoCAD beside the generated VIKTOR app](/assets/images/tutorial-autocad-prompt3-stair-59e7650f42ecaaf7ece070335e636b7d.webp) tip You can extend the prompt with your standard steel sections, connection preferences, and drawing scale. Review the generated plate, bolt, and weld details against your project requirements before using them in a design. ### Prompt 3: Create a parametric 3D structural frame[​](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#prompt-3-create-a-parametric-3d-structural-frame "Direct link to Prompt 3: Create a parametric 3D structural frame") The third workflow creates a 3D structural frame. This is useful for early design studies, when you want to compare bay layouts or member sizes and see the result in AutoCAD without rebuilding every part by hand. ![](/img/illustrations/app-builder-cta-background.svg) ![](/img/illustrations/app-builder-cta-logo.svg)![](/img/illustrations/app-builder-cta-logo-glow.svg) ### Parametric 3D structural frame Create a VIKTOR app that draws a parametric 3D structural frame in the AutoCAD drawing currently open on my personal worker. Follow the AutoCAD knowledge base guide and use vkt.autocad.attach(). Let me configure the number of bays, span, storey height, column size, beam size, and slab dimensions. Create the columns, beams, and slab as 3D solids on separate, user-prefixed layers with distinct colors. Regenerate the drawing when finished and handle attach and AutoCAD execution errors clearly. After the app is generated, choose a layer prefix that does not conflict with the existing drawing. Change the frame inputs, run the drawing action, and inspect the columns, beams, and slab in a 3D AutoCAD view. Here is the generated app beside the frame it drew in AutoCAD: ![Parametric structural frame in AutoCAD beside the generated VIKTOR app](/assets/images/tutorial-autocad-prompt1-frame-87a097ec985effeee458a789b5c75e56.webp) tip Extend the prompt with grid labels, base plates, foundations, or a choice between replacing the previous result and drawing a new option. A replace option is especially useful when you want to compare several frame configurations without leaving old solids behind. ### Create a new VIKTOR app[​](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#create-a-new-viktor-app "Direct link to Create a new VIKTOR app") tip Want to dive straight into the code? Jump to the [complete app.py](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#complete-code). You can come back to the steps below when you're ready to build it yourself. Let's build one small app that draws a reinforced-concrete beam. We will enter a few dimensions in VIKTOR, click a button, and see an elevation and cross-section appear in the AutoCAD drawing that is already open. First, [install the VIKTOR CLI](https://docs.viktor.ai/docs/getting-started/installation/.md) if you have not done so. Then create an editor app from a terminal: ``` viktor-cli create-app "AutoCAD beam detail tutorial" --init --app-type editor ``` Open the new app folder in your code editor. Keep that terminal available, as we will start the app after adding the code. The CLI can run on your development computer; the personal worker runs on the Windows computer with AutoCAD. ### Configure the VIKTOR app[​](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#configure-the-viktor-app "Direct link to Configure the VIKTOR app") Open `viktor.config.toml` and add the AutoCAD worker integration. Keep the `registered_name` that the CLI generated for your app: viktor.config.toml ``` app_type = "editor" python_version = "3.12" registered_name = "<your-generated-registered-name>" worker_integrations = ["autocad"] ``` In `requirements.txt`, use a VIKTOR version that supports `vkt.autocad.attach()`: requirements.txt ``` viktor>=14.35.0,<15 ``` You do not need to install an AutoCAD Python package. The app talks to AutoCAD through the personal worker. ### Add the beam inputs[​](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#add-the-beam-inputs "Direct link to Add the beam inputs") Replace the generated `app.py` with the example below, one step at a time. Start with a title, six simple inputs, and one button: app.py ``` import viktor as vkt class Parametrization(vkt.Parametrization): intro = vkt.Text("# AutoCAD Beam Detail Tutorial") span = vkt.NumberField("Beam span", default=6000, suffix="mm", min=1000) width = vkt.NumberField("Beam width", default=300, suffix="mm", min=100) depth = vkt.NumberField("Beam depth", default=600, suffix="mm", min=100) cover = vkt.NumberField("Concrete cover", default=40, suffix="mm", min=10) bar_diameter = vkt.NumberField("Bar diameter", default=16, suffix="mm", min=6) stirrup_spacing = vkt.NumberField("Stirrup spacing", default=200, suffix="mm", min=50) draw = vkt.ActionButton("Draw beam in AutoCAD", method="draw_beam", longpoll=True) ``` All dimensions are in millimetres. The button calls `draw_beam` when you are ready. It does not draw automatically whenever an input changes. ### Draw the beam detail[​](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#draw-the-beam-detail "Direct link to Draw the beam detail") Add a small helper function below the inputs. AutoCAD expects the coordinates of each corner of a polyline. Setting `Closed` joins the last corner back to the first one. app.py ``` class Parametrization(vkt.Parametrization): ... def rectangle(model_space, x, y, width, height, layer): points = [x, y, x + width, y, x + width, y + height, x, y + height] shape = model_space.AddLightWeightPolyline(points) shape.Closed = True shape.Layer = layer ``` Now add the `Controller` below `rectangle` in the same `app.py`. The `...` placeholders show code you already wrote, so keep your existing `Parametrization` and `rectangle` function. The controller reads the inputs, attaches to the drawing already open in AutoCAD, and creates two layers. Then it draws the elevation and the cross-section. The `try` block gives a useful message if the worker cannot attach or AutoCAD cannot finish the drawing. app.py ``` class Parametrization(vkt.Parametrization): ... def rectangle(model_space, x, y, width, height, layer): ... class Controller(vkt.Controller): parametrization = Parametrization def draw_beam(self, params, **kwargs): span = params.span width = params.width depth = params.depth cover = params.cover bar_radius = params.bar_diameter / 2 spacing = int(params.stirrup_spacing) if 2 * (cover + params.bar_diameter) >= min(width, depth): raise vkt.UserError("Reduce the cover or bar diameter, or increase the beam size.") try: with vkt.autocad.attach(timeout=120) as acad: drawing = acad.ActiveDocument model_space = drawing.ModelSpace for name, color in [ ("VKT-BEAM-CONCRETE", 7), ("VKT-BEAM-REBAR", 1), ]: try: layer = drawing.Layers.Item(name) except vkt.errors.ExecutionError: layer = drawing.Layers.Add(name) layer.Color = color # Beam elevation and two continuous longitudinal bars. rectangle(model_space, 0, 0, span, depth, "VKT-BEAM-CONCRETE") for y in (cover + bar_radius, depth - cover - bar_radius): bar = model_space.AddLine([cover, y, 0], [span - cover, y, 0]) bar.Layer = "VKT-BEAM-REBAR" # Draw one stirrup symbol at each spacing interval. for x in range(spacing, int(span), spacing): stirrup = model_space.AddLine( [x, cover, 0], [x, depth - cover, 0] ) stirrup.Layer = "VKT-BEAM-REBAR" # Add a simple cross-section beside the elevation. section_x = span + 500 rectangle(model_space, section_x, 0, width, depth, "VKT-BEAM-CONCRETE") rectangle( model_space, section_x + cover, cover, width - 2 * cover, depth - 2 * cover, "VKT-BEAM-REBAR" ) for x in (section_x + cover + bar_radius, section_x + width - cover - bar_radius): for y in (cover + bar_radius, depth - cover - bar_radius): bar = model_space.AddCircle([x, y, 0], bar_radius) bar.Layer = "VKT-BEAM-REBAR" drawing.Regen(vkt.autocad.AcRegenType.acAllViewports) except vkt.errors.WorkerSessionAttachError as error: raise vkt.UserError( "Open AutoCAD and a drawing on your personal worker, then try again." ) from error except vkt.errors.ExecutionError as error: raise vkt.UserError("AutoCAD could not draw the beam. Check the open drawing.") from error ``` The same dimensions control both views. `attach()` edits the drawing already on your screen, and `Regen()` refreshes it once after all objects are added. This is a drawing example, not a structural design check. Verify bar spacing, cover, anchorage, and code requirements before using a detail in a project. ### Add labels and a callout[​](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#add-labels-and-a-callout "Direct link to Add labels and a callout") Let's build on the beam and cross-section we just drew. We stay inside the **same** `draw_beam` method. The `...` lines below stand for code you already have. Add the highlighted annotation layer to the layer list. Then add the highlighted labels and callout after the cross-section's `for` loops, just before `drawing.Regen(...)`: app.py ``` class Parametrization(vkt.Parametrization): ... def rectangle(model_space, x, y, width, height, layer): ... class Controller(vkt.Controller): parametrization = Parametrization def draw_beam(self, params, **kwargs): ... try: with vkt.autocad.attach(timeout=120) as acad: ... for name, color in [ ("VKT-BEAM-CONCRETE", 7), ("VKT-BEAM-REBAR", 1), ("VKT-BEAM-ANNOTATIONS", 2), ]: ... # Keep the beam elevation and cross-section code here. ... for label, x in [("BEAM ELEVATION", 0), ("CROSS-SECTION", section_x)]: text = model_space.AddText(label, [x, depth + 180, 0], 80) text.Layer = "VKT-BEAM-ANNOTATIONS" note = model_space.AddMText( [span / 3, depth + 420, 0], 1800, f"Stirrups @ {spacing} mm" ) note.Height = 80 note.Layer = "VKT-BEAM-ANNOTATIONS" leader = model_space.AddLeader( [spacing, depth - cover, 0, span / 3, depth + 420, 0], note, vkt.autocad.AcLeaderType.acLineWithArrow ) leader.Layer = "VKT-BEAM-ANNOTATIONS" drawing.Regen(vkt.autocad.AcRegenType.acAllViewports) ``` The two labels name the views. The callout is an AutoCAD leader attached to text, with its arrow pointing to the first stirrup. If you change the spacing input and draw again, the callout uses the new value. ### Add a native AutoCAD table[​](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#add-a-native-autocad-table "Direct link to Add a native AutoCAD table") Finally, put the beam inputs in a small schedule below the elevation. Keep everything from the previous step. Add the highlighted table layer as the fourth item in the same list, then insert the highlighted table code after `leader.Layer = "VKT-BEAM-ANNOTATIONS"` and before the existing `drawing.Regen(...)`. Again, `...` stands for unchanged code: app.py ``` class Parametrization(vkt.Parametrization): ... def rectangle(model_space, x, y, width, height, layer): ... class Controller(vkt.Controller): parametrization = Parametrization def draw_beam(self, params, **kwargs): ... try: with vkt.autocad.attach(timeout=120) as acad: ... for name, color in [ ("VKT-BEAM-CONCRETE", 7), ("VKT-BEAM-REBAR", 1), ("VKT-BEAM-ANNOTATIONS", 2), ("VKT-BEAM-TABLE", 7), ]: ... # Keep the beam and annotation code here. ... leader.Layer = "VKT-BEAM-ANNOTATIONS" table = model_space.AddTable([0, -250, 0], 7, 2, 160, 900) table.Layer = "VKT-BEAM-TABLE" for row_type in ( vkt.autocad.AcRowType.acTitleRow, vkt.autocad.AcRowType.acHeaderRow, vkt.autocad.AcRowType.acDataRow, ): table.SetTextHeight(row_type, 80) table.SetText(0, 0, "BEAM SCHEDULE") table.SetText(1, 0, "Parameter") table.SetText(1, 1, "Value") for row, (name, value) in enumerate([ ("Span", f"{span:g} mm"), ("Section", f"{width:g} x {depth:g} mm"), ("Cover", f"{cover:g} mm"), ("Bar diameter", f"{params.bar_diameter:g} mm"), ("Stirrup spacing", f"{spacing} mm"), ], start=2): table.SetText(row, 0, name) table.SetText(row, 1, value) drawing.Regen(vkt.autocad.AcRegenType.acAllViewports) ``` `AddTable` creates an editable AutoCAD table, not a collection of drawn lines. Its rows summarize the same inputs that produced the detail. Leave the **one** `drawing.Regen(...)` call at the bottom of the `with` block, after all geometry, labels, and table cells have been added. ### Run the app and check AutoCAD[​](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#run-the-app-and-check-autocad "Direct link to Run the app and check AutoCAD") From the new app folder, run `viktor-cli clean-start` once. It installs the app dependencies and connects your development app to VIKTOR. Keep the terminal open and use the app link printed by the CLI. Later, use `viktor-cli start` to reconnect without reinstalling. Open a copy of a drawing in AutoCAD, check that the personal worker is online in VIKTOR Desktop, and click **Draw beam in AutoCAD**. The detail, labels, callout, and beam schedule appear on four `VKT-BEAM-*` layers. Save the drawing in AutoCAD when you are happy with it. Each click adds another detail; the app does not replace the previous one. The finished app shows the beam inputs beside the elevation, cross-section, callout, and native AutoCAD table: ![Local VIKTOR beam-detail app beside its drawing and beam schedule in AutoCAD](/assets/images/tutorial-autocad-local-beam-b22c10dc2517c45d2f3bf1f929ab270d.webp) If the app cannot attach, make sure AutoCAD is open on the worker machine and no dialog is blocking it. The [AutoCAD integration guide](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md#attaching-to-a-running-instance) explains the attach errors in more detail. ### Complete code[​](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#complete-code "Direct link to Complete code") Here is the final `app.py` with the beam, cross-section, labels, callout, and native table in one place. Open it if you want to compare your code with the finished app. **Complete app.py code** app.py ``` import viktor as vkt class Parametrization(vkt.Parametrization): intro = vkt.Text("# AutoCAD Beam Detail Tutorial") span = vkt.NumberField("Beam span", default=6000, suffix="mm", min=1000) width = vkt.NumberField("Beam width", default=300, suffix="mm", min=100) depth = vkt.NumberField("Beam depth", default=600, suffix="mm", min=100) cover = vkt.NumberField("Concrete cover", default=40, suffix="mm", min=10) bar_diameter = vkt.NumberField("Bar diameter", default=16, suffix="mm", min=6) stirrup_spacing = vkt.NumberField("Stirrup spacing", default=200, suffix="mm", min=50) draw = vkt.ActionButton("Draw beam in AutoCAD", method="draw_beam", longpoll=True) def rectangle(model_space, x, y, width, height, layer): """Draw one closed rectangle in the XY plane.""" points = [x, y, x + width, y, x + width, y + height, x, y + height] shape = model_space.AddLightWeightPolyline(points) shape.Closed = True shape.Layer = layer class Controller(vkt.Controller): parametrization = Parametrization def draw_beam(self, params, **kwargs): span = params.span width = params.width depth = params.depth cover = params.cover bar_radius = params.bar_diameter / 2 spacing = int(params.stirrup_spacing) if 2 * (cover + params.bar_diameter) >= min(width, depth): raise vkt.UserError("Reduce the cover or bar diameter, or increase the beam size.") try: with vkt.autocad.attach(timeout=120) as acad: drawing = acad.ActiveDocument model_space = drawing.ModelSpace for name, color in [ ("VKT-BEAM-CONCRETE", 7), ("VKT-BEAM-REBAR", 1), ("VKT-BEAM-ANNOTATIONS", 2), ("VKT-BEAM-TABLE", 7), ]: try: layer = drawing.Layers.Item(name) except vkt.errors.ExecutionError: layer = drawing.Layers.Add(name) layer.Color = color # Beam elevation and two continuous longitudinal bars. rectangle(model_space, 0, 0, span, depth, "VKT-BEAM-CONCRETE") for y in (cover + bar_radius, depth - cover - bar_radius): bar = model_space.AddLine([cover, y, 0], [span - cover, y, 0]) bar.Layer = "VKT-BEAM-REBAR" # Draw one stirrup symbol at each spacing interval. for x in range(spacing, int(span), spacing): stirrup = model_space.AddLine( [x, cover, 0], [x, depth - cover, 0] ) stirrup.Layer = "VKT-BEAM-REBAR" # Add a simple cross-section beside the elevation. section_x = span + 500 rectangle(model_space, section_x, 0, width, depth, "VKT-BEAM-CONCRETE") rectangle( model_space, section_x + cover, cover, width - 2 * cover, depth - 2 * cover, "VKT-BEAM-REBAR" ) for x in (section_x + cover + bar_radius, section_x + width - cover - bar_radius): for y in (cover + bar_radius, depth - cover - bar_radius): bar = model_space.AddCircle([x, y, 0], bar_radius) bar.Layer = "VKT-BEAM-REBAR" # Label the two views and point a native leader at a stirrup. for label, x in [("BEAM ELEVATION", 0), ("CROSS-SECTION", section_x)]: text = model_space.AddText(label, [x, depth + 180, 0], 80) text.Layer = "VKT-BEAM-ANNOTATIONS" note = model_space.AddMText( [span / 3, depth + 420, 0], 1800, f"Stirrups @ {spacing} mm" ) note.Height = 80 note.Layer = "VKT-BEAM-ANNOTATIONS" leader = model_space.AddLeader( [spacing, depth - cover, 0, span / 3, depth + 420, 0], note, vkt.autocad.AcLeaderType.acLineWithArrow ) leader.Layer = "VKT-BEAM-ANNOTATIONS" # A real AutoCAD table stays editable in the drawing. table = model_space.AddTable([0, -250, 0], 7, 2, 160, 900) table.Layer = "VKT-BEAM-TABLE" for row_type in ( vkt.autocad.AcRowType.acTitleRow, vkt.autocad.AcRowType.acHeaderRow, vkt.autocad.AcRowType.acDataRow, ): table.SetTextHeight(row_type, 80) table.SetText(0, 0, "BEAM SCHEDULE") table.SetText(1, 0, "Parameter") table.SetText(1, 1, "Value") for row, (name, value) in enumerate([ ("Span", f"{span:g} mm"), ("Section", f"{width:g} x {depth:g} mm"), ("Cover", f"{cover:g} mm"), ("Bar diameter", f"{params.bar_diameter:g} mm"), ("Stirrup spacing", f"{spacing} mm"), ], start=2): table.SetText(row, 0, name) table.SetText(row, 1, value) drawing.Regen(vkt.autocad.AcRegenType.acAllViewports) except vkt.errors.WorkerSessionAttachError as error: raise vkt.UserError( "Open AutoCAD and a drawing on your personal worker, then try again." ) from error except vkt.errors.ExecutionError as error: raise vkt.UserError("AutoCAD could not draw the beam. Check the open drawing.") from error ``` ## 4. Important limitations[​](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#4-important-limitations "Direct link to 4. Important limitations") The app edits the live drawing through AutoCAD's ActiveX API. Keep these points in mind: * **The app cannot attach when AutoCAD is closed.** Open AutoCAD and the correct drawing before running the action. * **The drawing changes are real and are not rolled back automatically.** Test the app on a copy of the drawing and use recognizable layer prefixes. * **AutoCAD must remain available.** A modal dialog or an active command can prevent the worker from attaching to the running instance. * **The app cannot use interactive command-line prompts.** Ask for dimensions and choices in the VIKTOR interface instead of relying on AutoCAD selections or prompts. * **Each AutoCAD operation travels through the worker.** Group repeated geometry with polylines, blocks, copies, and arrays, then regenerate once at the end. For the full list of supported behavior and worker errors, continue with the [AutoCAD integration guide](https://docs.viktor.ai/docs/create-apps/software-integrations/autocad/.md). ## To infinity and beyond\![​](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md#to-infinity-and-beyond "Direct link to To infinity and beyond!") Well done! You now have three starting points for creating VIKTOR apps that draw structural details and models in the AutoCAD file open on your computer. Continue by adapting the prompts to your drawing standards, layer conventions, and engineering checks. You can also explore the [Autodesk Forma / ACC tutorial](https://docs.viktor.ai/docs/tutorials/integrate-autodesk-construction-cloud/.md) to work with Revit models stored in Autodesk Construction Cloud, or return to the [tutorial overview](https://docs.viktor.ai/docs/tutorials/.md) for more examples. --- # Tutorial - Autodesk Forma / ACC info Level: **Intermediate**<br />Time: **30 min**<br /> Prerequisites: * You have a VIKTOR account and completed the installation process. No account? Get one [here](https://www.viktor.ai/start-building-apps) * You have access to an Autodesk Construction Cloud project with a Revit model. * Your VIKTOR environment has an Autodesk Platform Services OAuth 2.0 integration available. * The AEC Data Model is active in your ACC account for the prompts that query model data. * [![](/img/illustrations/free-version-banner.svg)](https://www.viktor.ai/start-building-apps) ## Introduction[​](https://docs.viktor.ai/docs/tutorials/integrate-autodesk-construction-cloud/.md#introduction "Direct link to Introduction") Welcome to this tutorial on how to create VIKTOR apps that work with Revit models stored in Autodesk Forma and Autodesk Construction Cloud (ACC). If you work with BIM models, you may need more than a model viewer. You may also want to calculate quantities, compare groups of elements, highlight categories, or check whether model properties meet your project rules. So in this tutorial, we will use four prompts to explore these workflows with the VIKTOR App Builder. Each prompt is a starting point for a different ACC workflow: 1. [Visualize a Revit model in the Autodesk Viewer](https://docs.viktor.ai/docs/tutorials/integrate-autodesk-construction-cloud/.md#prompt-1-visualize-a-revit-model-in-the-autodesk-viewer). 2. [Generate a quantity takeoff from a Revit structural model](https://docs.viktor.ai/docs/tutorials/integrate-autodesk-construction-cloud/.md#prompt-2-generate-a-quantity-takeoff-from-a-revit-structural-model). 3. [Highlight Revit categories with custom colors](https://docs.viktor.ai/docs/tutorials/integrate-autodesk-construction-cloud/.md#prompt-3-highlight-revit-categories-with-custom-colors). 4. [Validate Revit pipe properties](https://docs.viktor.ai/docs/tutorials/integrate-autodesk-construction-cloud/.md#prompt-4-validate-revit-pipe-properties). ## 1. Set up the integration[​](https://docs.viktor.ai/docs/tutorials/integrate-autodesk-construction-cloud/.md#1-set-up-the-integration "Direct link to 1. Set up the integration") Before testing the prompts, configure an Autodesk Platform Services (APS) OAuth 2.0 integration in VIKTOR and connect the same APS application to your ACC account as a custom integration. Follow these sections to complete the setup: * [Create the APS OAuth 2.0 integration](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-platform-services/.md#creating-an-oauth-20-integration-admin). * [Connect the APS application to ACC](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-platform-services/.md#integration-with-autodesk-construction-cloud-acc). * [Review the ACC requirements and available APIs](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-construction-cloud/.md#requirements-and-guidelines-for-using-acc-apis). * [Activate the AEC Data Model](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-construction-cloud/.md#activating-the-aec-data-model) before using the quantity takeoff or property validation prompts. Before submitting a prompt, replace `[YOUR-APS-INTEGRATION-NAME-HERE]` with the exact name of the APS OAuth 2.0 integration available in your VIKTOR environment. ## 2. Understand the key concepts[​](https://docs.viktor.ai/docs/tutorials/integrate-autodesk-construction-cloud/.md#2-understand-the-key-concepts "Direct link to 2. Understand the key concepts") Although you can get quite far in VIKTOR with simple prompts, it helps to understand the main concepts behind these workflows: * **[APS integration](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-platform-services/.md)**: Autodesk Platform Services (APS) is the connection between VIKTOR and Autodesk. The OAuth 2.0 integration lets you sign in securely and gives the app permission to access the ACC projects and models available to you. * **[AEC Data Model API](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-construction-cloud/.md#aec-data-model-api)**: This API lets the app read Revit element data from ACC without opening Revit. It can return names, properties, quantities, and relationships between model elements. * **[APS Viewer](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/autodesk/.md)**: This is the interactive 3D viewer shown inside the VIKTOR app. You can use it to explore the model and highlight elements, while the AEC Data Model API provides the data behind those elements. * **[Category, family, type, and instance](https://help.autodesk.com/cloudhelp/2022/ENU/Revit-Model/files/GUID-6DDC1D52-E847-4835-8F9A-466531E5FD29.htm)**: These describe where an element belongs in Revit. A **category** is a broad group such as Doors. A **family** is a reusable design such as a single door. A **type** is one configured version, such as a 900 × 2100 mm door. An **instance** is one actual door placed in the model. * **[GraphQL](https://graphql.org/learn/)**: GraphQL is the query language used by the AEC Data Model API. The app asks only for the model data it needs, such as all pipe instances and their diameters, and the API returns that data in a structured response. In simple terms, the app uses the APS integration to access the selected model, sends a GraphQL query to retrieve its data, and then shows the result in a viewer, table, or chart. ## 3. Explore ACC workflows with prompts[​](https://docs.viktor.ai/docs/tutorials/integrate-autodesk-construction-cloud/.md#3-explore-acc-workflows-with-prompts "Direct link to 3. Explore ACC workflows with prompts") Click the arrow on a prompt to open it in the VIKTOR App Builder. After the app is generated, connect the APS integration, select a Revit model from ACC, and review the preview. ### Prompt 1: Visualize a Revit model in the Autodesk Viewer[​](https://docs.viktor.ai/docs/tutorials/integrate-autodesk-construction-cloud/.md#prompt-1-visualize-a-revit-model-in-the-autodesk-viewer "Direct link to Prompt 1: Visualize a Revit model in the Autodesk Viewer") Let's start with the simplest workflow. This is useful when you want to review or share an ACC model without downloading the file or opening Revit. The app uses `vkt.AutodeskFileField` to browse the ACC projects available to the signed-in user. After you select a Revit model, it opens in the Autodesk Viewer inside VIKTOR. ![](/img/illustrations/app-builder-cta-background.svg) ![](/img/illustrations/app-builder-cta-logo.svg)![](/img/illustrations/app-builder-cta-logo-glow.svg) ### Revit model viewer Create an app with which I can select a Revit model from Autodesk Forma / ACC and visualize it using the Autodesk Viewer. Use vkt.AutodeskFileField with my existing APS OAuth 2.0 integration "\[YOUR-APS-INTEGRATION-NAME-HERE]" for model selection. Once the App Builder finishes creating the app, connect the APS integration and select a Revit model. Use the viewer controls to orbit, pan, zoom, isolate elements, and inspect the model. ![Generated VIKTOR app displaying a selected Revit model in the Autodesk Viewer](/assets/images/tutorial-acc-prompt1-ab533646b2be343da41dc975f433a046.webp) tip If you want to visualize another Revit view, including a 2D view, add this instruction to the prompt: > Use the APS Viewer SDK to visualize the model and let me select any available Revit view, including 2D views. ### Prompt 2: Generate a quantity takeoff from a Revit structural model[​](https://docs.viktor.ai/docs/tutorials/integrate-autodesk-construction-cloud/.md#prompt-2-generate-a-quantity-takeoff-from-a-revit-structural-model "Direct link to Prompt 2: Generate a quantity takeoff from a Revit structural model") The second workflow combines the Autodesk Viewer with the AEC Data Model API. This is useful for early estimates, model checks, and understanding which elements make up a structural model. The generated app groups model elements and calculates the quantities available for each group, so you can explore the results without exporting the Revit data first. ![](/img/illustrations/app-builder-cta-background.svg) ![](/img/illustrations/app-builder-cta-logo.svg)![](/img/illustrations/app-builder-cta-logo-glow.svg) ### Revit structural quantity takeoff Create a VIKTOR app using my APS OAuth 2.0 integration "\[YOUR-APS-INTEGRATION-NAME-HERE]". Let me select a Revit structural model from ACC and generate a QTO using the AEC Data Model API. Follow the ACC and AEC Data Model patterns in the APS knowledge base. Group the elements by category, family, type, and material, and calculate their count and available quantities such as length, area, volume, and weight. Show only the entities with counts greater than 5. Display the model, a TableView, and a PlotlyView bar plot with the category counts. Select a Revit structural model in the generated app. The model tab lets you inspect the geometry while the QTO table shows the grouped element data and available quantities. ![Generated VIKTOR quantity takeoff app displaying the selected Revit structural model](/assets/images/tutorial-acc-prompt2-img1-6d93af002e1dc20826d76b451d9f3a93.webp) Open the category chart to compare the number of elements in each structural category. Only groups with more than five elements are included in the results. ![Plotly bar chart showing Revit element counts grouped by category](/assets/images/tutorial-acc-prompt2-img2-0ede23a198b8f91bbe16415295d240b6.webp) tip You can extend this app to analyze the families, types, or individual instances within a selected category. You can also export the results to Excel or PDF, compare model versions, or add other charts such as pie charts. ### Prompt 3: Highlight Revit categories with custom colors[​](https://docs.viktor.ai/docs/tutorials/integrate-autodesk-construction-cloud/.md#prompt-3-highlight-revit-categories-with-custom-colors "Direct link to Prompt 3: Highlight Revit categories with custom colors") The third workflow helps you understand a model faster by giving related categories their own colors. This is useful for design reviews and coordination because you can separate structural, architectural, and building-services elements visually. Add one or more highlighting rules, select the categories for each rule, and choose the color that should be applied in the viewer. ![](/img/illustrations/app-builder-cta-background.svg) ![](/img/illustrations/app-builder-cta-logo.svg)![](/img/illustrations/app-builder-cta-logo-glow.svg) ### Revit category highlighter Using my APS OAuth 2.0 integration "\[YOUR-APS-INTEGRATION-NAME-HERE]", create an app where I can select a model from my Autodesk Construction Cloud (ACC) account. Add a multi-select field with common Revit categories such as Walls, Floors, Doors, Windows, Structural Framing, Structural Columns, Mechanical Equipment, Pipes, Ducts, Lighting Fixtures, etc. Use a dynamic array that allows me to add multiple highlighting rules. Each rule should include a multi-select field for one or more Revit categories and a color field. I should be able to add or remove multiple rules and use them to find and highlight the corresponding model elements with the selected colors using the APS Viewer SDK. Select a model, add the rules you need, and assign a color to each group of categories. The Autodesk Viewer updates the model so you can identify the selected categories visually. ![Generated VIKTOR app applying different colors to Revit categories in the Autodesk Viewer](/assets/images/tutorial-acc-prompt3-ad0deee76594b565fd4ca6435fae41f8.webp) tip Use the **View** dropdown in the upper-left corner of the viewer to move between the Revit views available in the model. The selected colors remain visible when you change views, including in supported 2D views. ### Prompt 4: Validate Revit pipe properties[​](https://docs.viktor.ai/docs/tutorials/integrate-autodesk-construction-cloud/.md#prompt-4-validate-revit-pipe-properties "Direct link to Prompt 4: Validate Revit pipe properties") The final workflow turns model data into a repeatable quality check. This is useful when an engineer needs to find elements that do not follow a project requirement without checking every pipe manually. Each rule targets a pipe type, property, operator, and comparison value. Elements that do not satisfy the rule are highlighted in red. ![](/img/illustrations/app-builder-cta-background.svg) ![](/img/illustrations/app-builder-cta-logo.svg)![](/img/illustrations/app-builder-cta-logo-glow.svg) ### Revit pipe validation Create an app using my APS OAuth 2.0 integration "\[YOUR-APS-INTEGRATION-NAME-HERE]" that lets me query data from my Revit model in ACC. Retrieve the distinct pipe types from the Pipes category and use the Element Name parameter as a proxy for the pipe type name. Include a dynamic rule table where I can add one or more validation rules. For each rule, let me select an element name, a property such as Length or Diameter, an inequality operator such as greater than, equal to, or less than, and a comparison value. Evaluate all matching pipe elements and highlight in red any elements in the Autodesk Viewer that do not satisfy the selected rule. Use the APS Viewer SDK. Select a Revit model and add one or more pipe validation rules. The app evaluates the matching elements and highlights every failed check in red, making it easier to find values that need attention. ![Generated VIKTOR app highlighting Revit pipe elements that fail a validation rule](/assets/images/tutorial-acc-prompt4-c0be1ff9edfadcc1bea2852c1cc29cab.webp) tip You can replace these example rules with custom engineering logic that matches your project standards. Keep in mind that the AEC Data Model API does not expose every Revit property or relationship. Connectivity and some mechanical-system properties may not be available, so check which properties the model returns before defining a rule. ## 4. Limitations[​](https://docs.viktor.ai/docs/tutorials/integrate-autodesk-construction-cloud/.md#4-limitations "Direct link to 4. Limitations") The quantity takeoff and pipe validation prompts use the AEC Data Model API. Before building a production workflow, review the [AEC Data Model limitations](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-construction-cloud/.md#aec-data-model-limitations). Keep these points in mind: * The AEC Data Model supports the US, EMEA, and AUS regions. * Linked Revit models are not supported. * Full geometry queries are not available through the AEC Data Model API. The apps use the Autodesk Viewer to display model geometry. * The AEC Data Model works with Revit 2024 and later. ## To infinity and beyond\![​](https://docs.viktor.ai/docs/tutorials/integrate-autodesk-construction-cloud/.md#to-infinity-and-beyond "Direct link to To infinity and beyond!") Well done! You now have four starting points for creating VIKTOR apps that work with Revit models in ACC. You have explored model visualization, quantity takeoffs, category highlighting, and property validation. Finally, the journey doesn't end here. Continue with the [Autodesk Forma Site Design tutorial](https://docs.viktor.ai/docs/tutorials/integrate-forma-site-design/.md) or check out some of our other [tutorials](https://docs.viktor.ai/docs/tutorials/.md). --- # Tutorial - Civil 3D info Level: **Intermediate**<br />Time: **30–45 min**<br /> Prerequisites: * You have a VIKTOR account. No account? Get one [here](https://www.viktor.ai/start-building-apps). * You have Civil 3D installed and licensed on a Windows computer. * You can install VIKTOR Desktop on that computer and open a writable Civil 3D drawing. * [![](/img/illustrations/free-version-banner.svg)](https://www.viktor.ai/start-building-apps) ## Introduction[​](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#introduction "Direct link to Introduction") Welcome to this tutorial on how to create VIKTOR apps that work directly in Civil 3D! Road geometry often changes during a project. Instead of repeating the same drawing operations, you can describe a workflow in the VIKTOR App Builder, adjust a few inputs, and create native Civil 3D objects in your open drawing. In this tutorial, you will explore three workflows: 1. [Create a road alignment and set-out points](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#prompt-1-create-a-road-alignment-and-set-out-points). 2. [Create an existing-ground longitudinal profile](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#prompt-2-create-an-existing-ground-longitudinal-profile). 3. [Create three cross sections](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#prompt-3-create-three-cross-sections). Prefer writing Python? If you're comfortable with Python and want to build the app yourself, select the **Local development** tab under [Choose your approach](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#3-choose-your-approach). You'll build a simple longitudinal-profile app step by step. Complete the Civil 3D and VIKTOR Desktop setup below first, as it applies to both approaches. ## 1. Set up Civil 3D and VIKTOR Desktop[​](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#1-set-up-civil-3d-and-viktor-desktop "Direct link to 1. Set up Civil 3D and VIKTOR Desktop") The apps use a personal worker to connect VIKTOR to Civil 3D on your Windows computer. Check the [VIKTOR Desktop requirements](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#requirements), then [download and install VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#download-and-install-viktor-desktop) and log in with your VIKTOR account. In VIKTOR Desktop, click **Add**, choose **Civil 3D**, and start the worker. Follow the [Civil 3D worker installation steps](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#install-the-worker) for the complete setup. The worker and Civil 3D must run on the same computer, under the same Windows user, in a logged-in desktop session. You do not need to install Python on the worker computer. Select **Civil 3D** in the **Add worker** window: ![Civil 3D highlighted in the VIKTOR Desktop Add worker window](/assets/images/tutorial-civil3d-worker-select-a77193e14aaae38fdfffb6ada4ce1da5.webp) After starting the worker, check that its status is **Running**: ![Civil 3D personal worker with Running status in VIKTOR Desktop](/img/docs/tutorial-civil3d-worker-running.webp) Before running either app: 1. Open Civil 3D and a copy of the drawing you want to work with. 2. Use a metric drawing for these examples and set the worker's **units** to **metric**. 3. Make sure the drawing is writable and **Model Space** is active. 4. Close any dialogs and finish active commands so Civil 3D is idle. 5. Check that the Civil 3D worker is running in VIKTOR Desktop. note These apps change the drawing that is already open. Test on a copy, review the result, and save it yourself in Civil 3D. Closing a connection does not undo drawing changes. ## 2. Understand the key concepts[​](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#2-understand-the-key-concepts "Direct link to 2. Understand the key concepts") Although you can get quite far with a clear prompt, a little context helps you choose the right inputs: * **Personal worker**: the connection between the VIKTOR app and Civil 3D on your computer. The app uses [`vkt.civil3d.attach()`](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#attaching-to-a-running-instance) to reach the instance that is already open. * **Alignment and station**: an alignment describes a route in plan. A station is a distance measured along that route, so you can identify where a point or section belongs. * **COGO points**: Civil 3D survey points with coordinates and descriptions. Set-out points help locate the route on site. **E/N/Z** means easting, northing, and elevation. * **PI, PC, and PT**: the intersection of two tangents, the start of a circular curve, and the end of that curve. * **Surface and profile**: a surface represents terrain. An existing-ground profile shows its elevation along an alignment; a profile view displays that information on a grid. * **Sample lines and cross sections**: sample lines cut across an alignment at selected stations. Sections show the sampled terrain to the left and right, and section views display those cuts in the drawing. * **Styles**: drawing settings that control how Civil 3D objects and labels look. The profile and cross-section apps inspect your drawing so you can choose styles that already exist. note You can also use [`vkt.civil3d.connect()`](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md#calling-the-api-directly-from-your-app) to start a new Civil 3D instance, do the work, and close it when the session ends. This tutorial uses `attach()` to keep the drawing open so you can review and save it yourself. Both methods are **BETA** and require **viktor >= 14.36.0**. ## 3. Choose your approach[​](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#3-choose-your-approach "Direct link to 3. Choose your approach") Use the **Prompt guide** to generate an app with the App Builder, or **Local development** to build a small longitudinal-profile app step by step. Both approaches use the Desktop and worker setup above. * Prompt guide * Local development ### Explore Civil 3D workflows with prompts[​](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#explore-civil-3d-workflows-with-prompts "Direct link to Explore Civil 3D workflows with prompts") Select the arrow to open a prompt in the VIKTOR App Builder. Review the generated app and its preview before running an action that changes your drawing. The screenshots show example results; your app's layout may differ. ### Prompt 1: Create a road alignment and set-out points[​](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#prompt-1-create-a-road-alignment-and-set-out-points "Direct link to Prompt 1: Create a road alignment and set-out points") Let's start with a road alignment. This workflow is useful when you want to explore a route from a few geometric inputs and check its set-out coordinates before adding anything to Civil 3D. Enter the starting coordinates, bearing, and tangent and curve values, then review the alignment preview and point table. ![](/img/illustrations/app-builder-cta-background.svg) ![](/img/illustrations/app-builder-cta-logo.svg)![](/img/illustrations/app-builder-cta-logo-glow.svg) ### Road alignment and set-out points Build a VIKTOR app using only vkt.civil3d.attach() for Civil 3D operations to create a native Civil 3D road alignment and COGO set-out points in the active writable metric drawing. Inputs: start E/N/Z, initial bearing, point prefix, and approximately three PI locations defined by tangent length, deflection angle, and curve radius. Automatically calculate the tangent intersection points, PC/PT locations, circular curves, bearings, and stations. Default output: approximately 12 set-out points. Preview the full alignment geometry and point table before creating anything in Civil 3D. Create native Civil 3D alignment entities using tangent + circular curve + tangent geometry and create native COGO points with ID, E/N/Z, station, type, and description. Include important geometry points such as Start, PI, PC, PT, and End, plus intermediate set-out points distributed by station. Create or reuse the required layer, alignment style, and alignment label style set using documented Civil 3D APIs and stable names. Also create a clearly named visible polyline connecting the set-out points in station order on the alignment layer so the sequence is visible in Model Space. Compute the complete geometry before calling vkt.civil3d.attach(). Use one attach session for creation and one fresh session for verification. Reuse exact matching objects on retry, reject conflicts, never duplicate or delete existing objects, and require an active, writable, idle metric drawing with Model Space active. Verify the alignment entities, COGO points, coordinates, stations, styles, layer, and connecting polyline against the calculated result. Do not use SendCommand, SetVariable, Save, or DownloadButton. Avoid broad scans of Civil 3D layers and drawing elements. Look up only the named objects needed to create, reuse, and verify this alignment and its set-out points. Once the App Builder finishes, adjust the inputs and inspect the curve geometry and point coordinates in VIKTOR. This lets you catch an unexpected bearing or radius before writing to the drawing. ![VIKTOR alignment preview and inputs before creating Civil 3D objects](/assets/images/tutorial-civil3d-prompt1-preview-fd8be33e4888ca03be6c4eab4059b072.webp) When the preview looks right, run the creation action. In Civil 3D, inspect the native alignment, point labels, and polyline connecting the set-out points. Check the app's verification results before saving the drawing. ![Native Civil 3D road alignment and set-out points beside the generated VIKTOR app](/assets/images/tutorial-civil3d-prompt1-alignment-4a5fbc60ea2f12c2bb59b29849ae29fc.webp) tip Ask the App Builder to add an Excel export of the point table or checks for your project's minimum curve radius. Keep the preview separate from the drawing action so you can compare alternatives before creating objects. ### Prepare a drawing for prompts 2 and 3[​](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#prepare-a-drawing-for-prompts-2-and-3 "Direct link to Prepare a drawing for prompts 2 and 3") For the next two prompts, download and open the [sample Civil 3D drawing](https://github.com/viktor-platform/ifc-sample-models/releases/download/CIVIL3D/longitudinal-profile-civil-3d.1.dwg) in Civil 3D. You can also use your own metric drawing with an existing alignment and a terrain surface covering the stations and sampling widths you want to use. It should contain the profile, sample-line, section, view, group-plot, and band-set styles requested by the apps. Work on a copy and inspect the available objects and styles before creating a result. The sample drawing contains a road layout and terrain surface. The following apps read those existing objects; you do not need to run prompt 1 first. ![Sample Civil 3D drawing with road alignments and terrain contours](/assets/images/tutorial-civil3d-sample-drawing-a3013a9460fec7c946c597ef7e0b3f60.webp) ### Prompt 2: Create an existing-ground longitudinal profile[​](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#prompt-2-create-an-existing-ground-longitudinal-profile "Direct link to Prompt 2: Create an existing-ground longitudinal profile") The second workflow shows how the terrain changes along a road. This is useful for reviewing existing ground levels before developing a vertical design. Instead of entering elevations manually, the app samples an existing surface along your chosen alignment and creates a native dynamic profile and profile view. ![](/img/illustrations/app-builder-cta-background.svg) ![](/img/illustrations/app-builder-cta-logo.svg)![](/img/illustrations/app-builder-cta-logo-glow.svg) ### Existing-ground longitudinal profile Create a VIKTOR app that generates an existing-ground longitudinal profile along an alignment in the drawing currently open in Civil 3D. Use vkt.civil3d.attach() and follow the Civil 3D knowledge-base guide. Add an "Inspect open drawing" button that discovers both siteless and Site-based alignments, available surfaces, profile styles, profile-view styles, and band-set styles. Let me select the alignment and surface. Use the alignment's complete station range by default. Then create one native dynamic surface profile and one native profile view in Model Space. Let me configure the profile name, profile-view name, styles, layer, and insertion coordinates. Create the profile and profile view in separate fresh attached sessions, reconnect after each operation to verify it, and safely reuse existing matching objects on retries. Do not use SendCommand, SetVariable, or Save. Show clear inspection, creation, and verification results in the VIKTOR app. Follow the examples in the knowledge base. With the sample drawing or your own model open, click **Inspect open drawing**. Select the alignment and existing-ground surface, then choose the styles, names, layer, and insertion coordinates. Place the profile view in an empty area of Model Space so it does not overlap your plan. ![Civil 3D longitudinal-profile app with alignment, surface, and style selections](/assets/images/tutorial-civil3d-prompt2-inputs-c0fed6a43e17261acf428cc6c5239763.webp) Run the creation action and review the app's verification results. In Civil 3D, locate the profile view and check that its station range and ground elevations match the alignment and surface you selected. ![Native existing-ground profile view in Civil 3D and verification results in VIKTOR](/assets/images/tutorial-civil3d-prompt2-profile-789deff2cd8dccb08c8900a2e8fb7ef8.webp) tip Extend the app to compare existing-ground profiles from different surfaces, or flag steep stretches for review. Ask it to use your office's profile-view and band styles for consistent presentation across projects. ### Prompt 3: Create three cross sections[​](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#prompt-3-create-three-cross-sections "Direct link to Prompt 3: Create three cross sections") The third workflow looks across the road instead of along it. Cross sections help you review terrain on both sides of an alignment at selected locations. Using the same [sample drawing](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#prepare-a-drawing-for-prompts-2-and-3), the app creates three native section views from your station range and sampling widths. ![](/img/illustrations/app-builder-cta-background.svg) ![](/img/illustrations/app-builder-cta-logo.svg)![](/img/illustrations/app-builder-cta-logo-glow.svg) ### Three native cross sections Create a VIKTOR app that generates three native Civil 3D cross sections along an existing road alignment and surface. Follow Civil 3D knowledge-base Worked Example 4 and use vkt.civil3d.attach(). Add an "Inspect open drawing" button to discover alignments, surfaces, and the required sample-line, section, section-view, group-plot, and band-set styles. Store the inventory in a HiddenField and populate all drawing-derived dropdowns through callbacks. Let me choose the alignment and surface, a start and end station, left and right sampling widths, and a naming prefix. Default to three evenly spaced stations within the alignment range. Preview the proposed stations in VIKTOR. Create a sample-line group, sample the selected surface, add three sample lines, and place three native section views in Model Space. Create each missing section view in its own fresh attach session, then reconnect to verify it. Reuse verified objects on retry and report any missing view without duplicating completed work. Require an active, writable, idle drawing with Model Space active. Keep the app on a single input page. Use vkt.Text headings to separate groups of inputs instead of Section, Tab, or Page containers. Click **Inspect open drawing**, select the alignment and surface, and choose the station range and sampling widths. Review the three proposed stations before creating the sections. Make sure the surface extends far enough on both sides of the alignment to cover your sampling widths. After creation, inspect all three section views in Model Space and check their station labels and terrain lines. If the app reports a missing view, retry with the same naming prefix so it can reuse verified objects instead of duplicating completed work. ![Three native Civil 3D cross-section views beside the generated VIKTOR app](/assets/images/tutorial-civil3d-prompt3-sections-d9420415ae87dc5742035f6bf8dc370e.webp) tip Ask the App Builder to let you choose the number of sections or enter specific stations, such as junctions and terrain transitions. You can also request a consistent view spacing and naming convention to make the results easier to review. ### Create a new VIKTOR app[​](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#create-a-new-viktor-app "Direct link to Create a new VIKTOR app") tip Want to dive straight into the code? Jump to the [complete app.py](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#complete-code). You can return to the steps below to see how it works. Let's build one small app that creates an existing-ground longitudinal profile. Enter the names of an alignment and surface, click a button to create the profile, then click another to place its view in Civil 3D. This is a smaller version of prompt 2, not a tool for designing a new road alignment. Here is the app beside the open drawing, before creating the profile. The example uses the **First Street** alignment and **EG** surface: ![Civil 3D sample drawing beside the local-development app with alignment, surface, profile name, and insertion inputs](/assets/images/tutorial-civil3d-local-dev-inputs-1d392fcee0f4e48aae9e4978c7b9c0c4.webp) Use a copy of the [sample drawing](https://github.com/viktor-platform/ifc-sample-models/releases/download/CIVIL3D/longitudinal-profile-civil-3d.1.dwg) and complete the [Desktop and worker setup](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#1-set-up-civil-3d-and-viktor-desktop). This example uses an alignment **outside a Site**, a metric drawing, the existing layer `0`, and the first available profile, profile-view, and band-set styles. Your drawing must contain those styles. The prompt guide covers a more flexible app with automatic discovery and dropdowns. First, [install the VIKTOR CLI](https://docs.viktor.ai/docs/getting-started/installation/.md) if needed. Then create an editor app: ``` viktor-cli create-app "Civil 3D Profile Tutorial" --init --app-type editor --registered-name civil3d-profile-tutorial ``` Open the new app folder in your code editor. The app code can run on your development computer; the personal worker runs on the Windows computer with Civil 3D. ### Configure the VIKTOR app[​](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#configure-the-viktor-app "Direct link to Configure the VIKTOR app") Add the Civil 3D worker integration. Keep your own registered name if you chose a different one: viktor.config.toml ``` app_type = "editor" python_version = "3.12" registered_name = "civil3d-profile-tutorial" worker_integrations = ["civil3d"] ``` Use this SDK version for the example: requirements.txt ``` viktor==14.37.0 ``` No separate Civil 3D Python package is needed. ### 1. Add five simple inputs[​](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#1-add-five-simple-inputs "Direct link to 1. Add five simple inputs") Start `app.py` with three names, two insertion coordinates, and two buttons: app.py ``` import viktor as vkt class Parametrization(vkt.Parametrization): intro = vkt.Text("# Civil 3D Profile Tutorial") alignment = vkt.TextField("Alignment name", default="First Street") surface = vkt.TextField("Surface name", default="EG") profile_name = vkt.TextField("New profile name", default="VKT Tutorial EG") x = vkt.NumberField("View insertion X", default=0, suffix="m") y = vkt.NumberField("View insertion Y", default=0, suffix="m") profile = vkt.SetParamsButton("Create profile", method="create_profile", longpoll=True) view = vkt.SetParamsButton("Create profile view", method="create_view", longpoll=True) status = vkt.HiddenField("Status") result = vkt.OutputField("Last result", value=vkt.Lookup("status")) ``` Copy the exact alignment and surface names from Civil 3D's **Toolspace → Prospector**. The defaults are starting values for the sample model; change them if your drawing uses different names. Give the new profile a unique name. The buttons call methods we will add below. `status` stores the latest result, and the `OutputField` displays it without making it an editable input. ### 2. Connect to the alignment[​](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#2-connect-to-the-alignment "Direct link to 2. Connect to the alignment") Keep the inputs and add these three helpers below them. The `...` placeholders stand for code you already wrote; keep that code rather than replacing it with dots. app.py ``` class Parametrization(vkt.Parametrization): ... def names(collection): return [str(collection.Item(i).Name()) for i in range(collection.Count())] def get_alignment(document, params): if document.ReadOnly() or document.GetVariable("TILEMODE") != 1: raise vkt.UserError("Open a writable drawing and activate the Model tab.") if document.GetVariable("CMDACTIVE") or document.GetVariable("CMDNAMES"): raise vkt.UserError("Finish active commands and leave Civil 3D idle.") if document.GetVariable("MEASUREMENT") != 1: raise vkt.UserError("Use a metric drawing for this tutorial.") if params.alignment not in names(document.AlignmentsSiteless): raise vkt.UserError("Enter the exact name of an alignment outside a Site.") return document.AlignmentsSiteless.Item(params.alignment) def verify(params, drawing, collection_name, object_name): with vkt.civil3d.attach(timeout=600) as civil3d: document = civil3d.ActiveDocument if document.FullName() != drawing: raise vkt.UserError("The active drawing changed. Return to the original drawing.") alignment = get_alignment(document, params) if object_name not in names(getattr(alignment, collection_name)): raise vkt.UserError("The object was not created. Leave Civil 3D idle and retry.") return vkt.SetParamsResult({"status": f"Verified in Civil 3D: {object_name}"}) ``` `names` reads object names from a Civil 3D collection. `get_alignment` checks that the drawing is ready and finds the requested alignment. `verify` reconnects after creation to check that the named object exists. Properties such as `Name()` and `ReadOnly()` are read with parentheses. Civil 3D object handles only belong to the current connection, so every new connection looks up the alignment again. ### 3. Create the ground profile[​](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#3-create-the-ground-profile "Direct link to 3. Create the ground profile") Add the controller below the helpers: app.py ``` class Parametrization(vkt.Parametrization): ... # Keep names, get_alignment, and verify above Controller. class Controller(vkt.Controller): parametrization = Parametrization def create_profile(self, params, **kwargs): with vkt.civil3d.attach(timeout=600) as civil3d: document = civil3d.ActiveDocument drawing = document.FullName() alignment = get_alignment(document, params) if params.profile_name in names(alignment.Profiles): raise vkt.UserError("That profile exists. Create its view or use a new name.") if params.surface not in names(document.Surfaces): raise vkt.UserError("Enter the exact name of an existing surface.") style = document.LandProfileStyles.Item(0).Name() alignment.Profiles.AddFromSurface( params.profile_name, vkt.civil3d.AeccProfileType.aeccExistingGround, style, params.surface, float(alignment.StartingStation()), float(alignment.EndingStation()), "0", ) return verify(params, drawing, "Profiles", params.profile_name) ``` `AddFromSurface` samples the selected surface over the alignment's full station range. The first profile style is `Item(0)`, because collection indices start at zero. The result is a native existing-ground profile—not yet the grid that displays it. The app stops if the profile name already exists. It does not overwrite your drawing. ### 4. Add the profile view[​](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#4-add-the-profile-view "Direct link to 4. Add the profile view") Extend the same controller with `create_view`. Keep the previous method unchanged: app.py ``` class Parametrization(vkt.Parametrization): ... # Keep the helper functions above Controller. class Controller(vkt.Controller): parametrization = Parametrization def create_profile(self, params, **kwargs): ... def create_view(self, params, **kwargs): view_name = f"{params.profile_name} - View" try: with vkt.civil3d.attach(timeout=600) as civil3d: document = civil3d.ActiveDocument drawing = document.FullName() alignment = get_alignment(document, params) if params.profile_name not in names(alignment.Profiles): raise vkt.UserError("Create the profile first with the same name and alignment.") if view_name in names(alignment.ProfileViews): raise vkt.UserError("That profile view already exists. Review it in Civil 3D.") alignment.ProfileViews.Add( view_name, "0", [float(params.x), float(params.y), 0.0], document.ProfileViewStyles.Item(0), document.ProfileViewBandStyleSets.Item(0), ) except vkt.ExecutionError as error: # A lock error can occur after Civil 3D has created the view. if "Lock violation" not in str(error): raise return verify(params, drawing, "ProfileViews", view_name) ``` The view displays the profile on a grid at your X/Y insertion point. Choose an empty area of Model Space. It uses the drawing's first profile-view style and band set; bands add information along the grid. The short `try/except` handles one Civil 3D quirk: a **Lock violation** can occur even after a view was created. For that specific error, we reconnect and check whether it exists. Other errors are not ignored. note Keep the same drawing, alignment, and profile name between the two buttons. Existing names are never replaced or deleted. To try a different surface, use a new profile name. A profile view belongs to an alignment and may display other profiles associated with it. Review the profile visibility settings in Civil 3D. ### 5. Run the app[​](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#5-run-the-app "Direct link to 5. Run the app") From your app folder, run: ``` viktor-cli clean-start ``` Open the development URL printed by the CLI, then: 1. Open the sample drawing in Civil 3D and activate **Model**. 2. Enter the exact alignment and surface names, plus a new profile name. 3. Click **Create profile** and check **Last result**. 4. Enter insertion coordinates and click **Create profile view**. 5. Review the view in Civil 3D and save the drawing yourself. The finished profile view shows the ground elevation along the alignment. **Last result** confirms that the app found the newly created view after reconnecting to Civil 3D: ![Existing-ground longitudinal profile in Civil 3D beside the tutorial app showing a verified profile-view result](/assets/images/tutorial-civil3d-local-dev-profile-9ed60faa52be70353e033ec342fec6f0.webp) Leave Civil 3D idle while each action runs. If an action fails, check for partial results before retrying. If the profile was created but its view was not, keep the same inputs and use **Create profile view**. These checks confirm object creation, not the engineering correctness of the result. tip Once the example works, try adding start and end station inputs or a style selector. Add one feature at a time so the code stays easy to follow. ### Complete code[​](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#complete-code "Direct link to Complete code") Show complete app.py app.py ``` import viktor as vkt class Parametrization(vkt.Parametrization): intro = vkt.Text("# Civil 3D Profile Tutorial") alignment = vkt.TextField("Alignment name", default="First Street") surface = vkt.TextField("Surface name", default="EG") profile_name = vkt.TextField("New profile name", default="VKT Tutorial EG") x = vkt.NumberField("View insertion X", default=0, suffix="m") y = vkt.NumberField("View insertion Y", default=0, suffix="m") profile = vkt.SetParamsButton("Create profile", method="create_profile", longpoll=True) view = vkt.SetParamsButton("Create profile view", method="create_view", longpoll=True) status = vkt.HiddenField("Status") result = vkt.OutputField("Last result", value=vkt.Lookup("status")) def names(collection): return [str(collection.Item(i).Name()) for i in range(collection.Count())] def get_alignment(document, params): if document.ReadOnly() or document.GetVariable("TILEMODE") != 1: raise vkt.UserError("Open a writable drawing and activate the Model tab.") if document.GetVariable("CMDACTIVE") or document.GetVariable("CMDNAMES"): raise vkt.UserError("Finish active commands and leave Civil 3D idle.") if document.GetVariable("MEASUREMENT") != 1: raise vkt.UserError("Use a metric drawing for this tutorial.") if params.alignment not in names(document.AlignmentsSiteless): raise vkt.UserError("Enter the exact name of an alignment outside a Site.") return document.AlignmentsSiteless.Item(params.alignment) def verify(params, drawing, collection_name, object_name): with vkt.civil3d.attach(timeout=600) as civil3d: document = civil3d.ActiveDocument if document.FullName() != drawing: raise vkt.UserError("The active drawing changed. Return to the original drawing.") alignment = get_alignment(document, params) if object_name not in names(getattr(alignment, collection_name)): raise vkt.UserError("The object was not created. Leave Civil 3D idle and retry.") return vkt.SetParamsResult({"status": f"Verified in Civil 3D: {object_name}"}) class Controller(vkt.Controller): parametrization = Parametrization def create_profile(self, params, **kwargs): with vkt.civil3d.attach(timeout=600) as civil3d: document = civil3d.ActiveDocument drawing = document.FullName() alignment = get_alignment(document, params) if params.profile_name in names(alignment.Profiles): raise vkt.UserError("That profile exists. Create its view or use a new name.") if params.surface not in names(document.Surfaces): raise vkt.UserError("Enter the exact name of an existing surface.") style = document.LandProfileStyles.Item(0).Name() alignment.Profiles.AddFromSurface( params.profile_name, vkt.civil3d.AeccProfileType.aeccExistingGround, style, params.surface, float(alignment.StartingStation()), float(alignment.EndingStation()), "0", ) return verify(params, drawing, "Profiles", params.profile_name) def create_view(self, params, **kwargs): view_name = f"{params.profile_name} - View" try: with vkt.civil3d.attach(timeout=600) as civil3d: document = civil3d.ActiveDocument drawing = document.FullName() alignment = get_alignment(document, params) if params.profile_name not in names(alignment.Profiles): raise vkt.UserError("Create the profile first with the same name and alignment.") if view_name in names(alignment.ProfileViews): raise vkt.UserError("That profile view already exists. Review it in Civil 3D.") alignment.ProfileViews.Add( view_name, "0", [float(params.x), float(params.y), 0.0], document.ProfileViewStyles.Item(0), document.ProfileViewBandStyleSets.Item(0), ) except vkt.ExecutionError as error: # A lock error can occur after Civil 3D has created the view. if "Lock violation" not in str(error): raise return verify(params, drawing, "ProfileViews", view_name) ``` ## Limitations of the Civil 3D integration[​](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#limitations-of-the-civil-3d-integration "Direct link to Limitations of the Civil 3D integration") The integration works through Civil 3D's automation interface, so not every action available in the desktop interface is available to the app. See the [Civil 3D integration guide](https://docs.viktor.ai/docs/create-apps/software-integrations/civil3d/.md) for the supported approach and troubleshooting guidance. * Civil 3D must be open in a logged-in Windows session, with the correct drawing active and no blocking dialogs or commands. * These prompts create real drawing objects. A failed operation may still have created an object, which is why the apps reconnect and verify before retrying. * The worker does not allow operations such as `SendCommand`, `SetVariable`, or `Save`. Review and save the drawing yourself in Civil 3D. * Generated geometry is not an engineering design check. Verify coordinates, units, terrain coverage, and project requirements before using the results. ## To infinity and beyond\![​](https://docs.viktor.ai/docs/tutorials/integrate-civil3d/.md#to-infinity-and-beyond "Direct link to To infinity and beyond!") Well done! You now have three starting points for creating road alignments, set-out points, longitudinal profiles, and cross sections from a VIKTOR app. Try adapting the inputs and drawing styles to your own workflow. Continue with the [AutoCAD tutorial](https://docs.viktor.ai/docs/tutorials/integrate-autocad/.md) to explore other drawing tasks, or check out our other [tutorials](https://docs.viktor.ai/docs/tutorials/.md). --- # Tutorial - Integrate Dynamo note Estimated time: 45 minutes<br />Difficulty level: Intermediate * [![](/img/illustrations/free-version-banner.svg)](https://www.viktor.ai/start-building-apps) ## Introduction[​](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#introduction "Direct link to Introduction") Welcome to this tutorial on creating an app that integrates with Dynamo! In this tutorial, we will explore how to render a basic house with Dynamo and visualize it in your app. As a starting point, the user will provide parameters such as the number of houses, width, depth, number of floors, and heights for floors and roofs. These parameters are sent to Dynamo Sandbox using a worker, the program that establishes the connection between VIKTOR and the third-party software, and are used to generate the geometry of the house. The geometry is then converted to a mesh, which is rendered and visualized in VIKTOR. In this tutorial, we will cover the step-by-step process of setting up a VIKTOR app with a Dynamo integration: * [Setup VIKTOR app](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#1-setup-a-viktor-app) * [Create a method to update Dynamo file](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#2-create-a-method-to-update-dynamo-file) * [Create a mocked GeometryView](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#3-create-a-geometryview-with-mocked-ouput-files) * [Create a data processing method](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#4-create-a-data-processing-method) * [Create a Data View with the mocked output files](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#5-create-a-dataview-with-mocked-ouput-files) * [Create a geometry processing method](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#6-create-a-geometryanddataview-with-the-mocked-output-files) * [Add the logic to execute the Dynamo script with a worker](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#7-integrate-dynamo) * [Setting up worker](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#8-setting-up-worker) By the end of this tutorial, you will have created a simple VIKTOR application that generates the geometry of a house and calculates some basic properties. For the final result see the GIF below: ![](/assets/images/tutorial_dynamo_animation-aa15e4df6c7c7b04ae2303f71dda41a7.gif) tip You can find the complete code [below](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#all-code-together) ## Pre-requisites[​](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#pre-requisites "Direct link to Pre-requisites") Prerequisites * You have some experience with reading Python code In the tutorial, we added some links to additional information; but don't let them distract you too much. Stay focused on completing the tutorial. After this, you will know everything you need to create an app which includes an integration with Dynamo (Sandbox). ## 1. Setup a VIKTOR app[​](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#1-setup-a-viktor-app "Direct link to 1. Setup a VIKTOR app") ### Create an empty app[​](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#create-an-empty-app "Direct link to Create an empty app") Let's create, install and start an empty app. This will be the starting point for the rest of the tutorial. But before we start, make sure to shut down any app that is running (like the demo app) by closing the command-line shell (for example Powershell) or end the process using `Ctrl + C`. Follow these steps to create, install and start an empty app: 1. Open a terminal and run the following command to create the app on the VIKTOR platform and generate the initial code locally: ``` viktor-cli create-app "Dynamo tutorial" --init --app-type editor ``` 2. Open the newly created folder in your code editor and run `viktor-cli clean-start` in the terminal to install dependencies and connect the app to the platform. If all went well, your empty app is installed and connected to your development workspace. **Do not close the terminal** as this will break the connection with your app. The terminal in your code editor should show something like this: ``` INFO : Connecting to cloud.viktor.ai... INFO : Connection is established (use Ctrl+C to close) INFO : INFO : Navigate to the link below to see your app in the browser INFO : https://cloud.viktor.ai/workspaces/XXX/app INFO : INFO : App code loaded, waiting for jobs... ``` Re-starting your app * You only need to create an app template and install it once for each new app you want to make. * The app will update automatically once you start adding code in `app.py`, as long as you don't close the terminal or your code editor. * Did you close your code editor? Use `viktor-cli start` to start the app again. No need to install, clear, etc. ### Add input fields[​](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#add-input-fields "Direct link to Add input fields") We will add 6 numeric input fields to our app: `number_of_houses`, `number_of_floors`, `depth`, `width`, `height_floor` and `height_roof`. For these inputs a [`NumberField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_NumberField) will be used. Open `app.py`, and add the relevant fields to the `Parametrization` class. If you like you can accompany the fields with a descriptive text. After adding the fields your `app.py` file should look like this: ``` import viktor as vkt class Parametrization(vkt.Parametrization): intro = vkt.Text("# 3D Dynamo app \n This app parametrically generates and visualises a 3D model of a house using a Dynamo script. \n\n Please fill in the following parameters:") number_of_houses = vkt.NumberField("Number of houses", max=8.0, min=1.0, variant='slider', step=1.0, default=3.0) number_of_floors = vkt.NumberField("Number of floors", max=5.0, min=1.0, variant='slider', step=1.0, default=2.0) depth = vkt.NumberField("Depth", max=10.0, min=5.0, variant='slider', step=1.0, default=8.0, suffix="m") width = vkt.NumberField("Width", max=6.0, min=4.0, variant='slider', step=1.0, default=5.0, suffix="m") height_floor = vkt.NumberField("Height floor", max=3.0, min=2.0, variant='slider', step=0.1, default=2.5, suffix='m') height_roof = vkt.NumberField("Height roof", max=3.0, min=2.0, variant='slider', step=0.1, default=2.5, suffix='m') class Controller(vkt.Controller): parametrization = Parametrization ``` Refresh the development workspace in your browser and the input fields should appear. ## 2. Create a method to update Dynamo file[​](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#2-create-a-method-to-update-dynamo-file "Direct link to 2. Create a method to update Dynamo file") In this section, we will define a function that updates the Dynamo file with the parameters provided by the user. This will be done by defining a `staticmethod` on the `Controller` class, similar to what is described in the [Dynamo](https://docs.viktor.ai/docs/create-apps/software-integrations/dynamo/.md) section of the VIKTOR documentation. Before you continue, download the sample [dynamo file](https://docs.viktor.ai/files/docs/dynamo-tutorial/dynamo_model_sample_app.dyn) and save it the app folder next to `app.py`. The following code will update the nodes of the Dynamo file and generate an input file with the parameters defined in your app: ``` from pathlib import Path import viktor as vkt class Parametrization(vkt.Parametrization): intro = vkt.Text("# 3D Dynamo app \n This app parametrically generates and visualises a 3D model of a house using a Dynamo script. \n\n Please fill in the following parameters:") number_of_houses = vkt.NumberField("Number of houses", max=8.0, min=1.0, variant='slider', step=1.0, default=3.0) number_of_floors = vkt.NumberField("Number of floors", max=5.0, min=1.0, variant='slider', step=1.0, default=2.0) depth = vkt.NumberField("Depth", max=10.0, min=5.0, variant='slider', step=1.0, default=8.0, suffix="m") width = vkt.NumberField("Width", max=6.0, min=4.0, variant='slider', step=1.0, default=5.0, suffix="m") height_floor = vkt.NumberField("Height floor", max=3.0, min=2.0, variant='slider', step=0.1, default=2.5, suffix='m') height_roof = vkt.NumberField("Height roof", max=3.0, min=2.0, variant='slider', step=0.1, default=2.5, suffix='m') class Controller(vkt.Controller): parametrization = Parametrization @staticmethod def update_model(params) -> tuple[vkt.File, vkt.dynamo.DynamoFile]: """This method updates the nodes of the Dynamo file with the parameters from the parametrization class.""" # Create a DynamoFile object using the sample file file_path = Path(__file__).parent / "dynamo_model_sample_app.dyn" dyn_file = vkt.dynamo.DynamoFile(vkt.File.from_path(file_path)) # Update the Dynamo file with parameters from user input dyn_file.update("Number of houses", params.number_of_houses) dyn_file.update("Number of floors", params.number_of_floors) dyn_file.update("Depth", params.depth) dyn_file.update("Width", params.width) dyn_file.update("Height floor", params.height_floor) dyn_file.update("Height roof", params.height_roof) # Generate updated file input_file = dyn_file.generate() return input_file, dyn_file ``` Let us go through the above mentioned logic: 1. Retrieve the input files for the analysis, in this case the `dynamo_model_sample_app.dyn` file, and create a `DynamoFile` object instantiated from the `dynamo_model_sample_app.dyn` file. You can download the sample dynamo model [here](https://docs.viktor.ai/files/docs/dynamo-tutorial/dynamo_model_sample_app.dyn). 2. With the `update` method, the value of input nodes can be updated. 3. When all inputs have been updated as desired, the `generate` method can be used to generate an updated [`File`](https://docs.viktor.ai/sdk/api/core/.md#_File) object. note Don't forget to import `Path` from the `pathlib` module ## 3. Create a GeometryView with mocked output files[​](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#3-create-a-geometryview-with-mocked-output-files "Direct link to 3. Create a GeometryView with mocked output files") In this section we will add a [`GeometryView`](https://docs.viktor.ai/sdk/api/views/.md#_GeometryView) to display the house's geometry. However, for now, we will use a mocked output file. In [section 7](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#7-add-the-worker-logic-to-supply-the-real-output-files) we will create the json file using the Dynamo script. Before you continue, download the mocked output file [here](https://docs.viktor.ai/files/docs/dynamo-tutorial/Mocked_3d_model.json) and save it in your app folder next to `app.py`. To visualize the mocked output add a `GeometryView` method to your `Controller` class, see code below: ``` from pathlib import Path import viktor as vkt class Parametrization(vkt.Parametrization): intro = vkt.Text("# 3D Dynamo app \n This app parametrically generates and visualises a 3D model of a house using a Dynamo script. \n\n Please fill in the following parameters:") number_of_houses = vkt.NumberField("Number of houses", max=8.0, min=1.0, variant='slider', step=1.0, default=3.0) number_of_floors = vkt.NumberField("Number of floors", max=5.0, min=1.0, variant='slider', step=1.0, default=2.0) depth = vkt.NumberField("Depth", max=10.0, min=5.0, variant='slider', step=1.0, default=8.0, suffix="m") width = vkt.NumberField("Width", max=6.0, min=4.0, variant='slider', step=1.0, default=5.0, suffix="m") height_floor = vkt.NumberField("Height floor", max=3.0, min=2.0, variant='slider', step=0.1, default=2.5, suffix='m') height_roof = vkt.NumberField("Height roof", max=3.0, min=2.0, variant='slider', step=0.1, default=2.5, suffix='m') class Controller(vkt.Controller): parametrization = Parametrization @staticmethod def update_model(params) -> tuple[vkt.File, vkt.dynamo.DynamoFile]: """This method updates the nodes of the Dynamo file with the parameters from the parametrization class.""" # Create a DynamoFile object using the sample file file_path = Path(__file__).parent / "dynamo_model_sample_app.dyn" dyn_file = vkt.dynamo.DynamoFile(vkt.File.from_path(file_path)) # Update the Dynamo file with parameters from user input dyn_file.update("Number of houses", params.number_of_houses) dyn_file.update("Number of floors", params.number_of_floors) dyn_file.update("Depth", params.depth) dyn_file.update("Width", params.width) dyn_file.update("Height floor", params.height_floor) dyn_file.update("Height roof", params.height_roof) # Generate updated file input_file = dyn_file.generate() return input_file, dyn_file @vkt.GeometryView("Mocked 3d model", x_axis_to_right=True) def mocked_geometry_view(self, params, **kwargs): # Step 1: Update model input_file, dynamo_file = self.update_model(params) # Step 2: Running analysis file_path = Path(__file__).parent / "Mocked_3d_model.json" threed_file = vkt.File.from_path(file_path) # Step 3: Processing geometry glb_file = vkt.dynamo.convert_geometry_to_glb(threed_file) return vkt.GeometryResult(geometry=glb_file) ``` Let us go through the above mentioned logic: 1. Update the Dynamo file with the `update_model` method(see section 2) 2. For now we are using a mocked file, instead of running the analysis in Dynamo. The mocked file can be downloaded [here](https://docs.viktor.ai/files/docs/dynamo-tutorial/Mocked_3d_model.json). In [section 7](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#7-add-the-worker-logic-to-supply-the-real-output-files) it is explained how to create the json file using the Dynamo script. 3. With the helper function [`convert_geometry_to_glb`](https://docs.viktor.ai/sdk/api/external/dynamo/.md#_convert_geometry_to_glb), you can convert the json file to a GLB file, which can directly be visualized in a `GeometryView`. 4. Refresh your app in the browser, and you should see a 3D model of a house. ## 4. Create a data processing method[​](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#4-create-a-data-processing-method "Direct link to 4. Create a data processing method") In this section, we will define code to extract data from the dynamo files. The dynamo file is used to get the node ID, and the `output.xml` file is used to get the result values. To do this we will add another `staticmethod` on the `Controller` class. See code below: ``` from pathlib import Path import viktor as vkt class Parametrization(vkt.Parametrization): intro = vkt.Text("# 3D Dynamo app \n This app parametrically generates and visualises a 3D model of a house using a Dynamo script. \n\n Please fill in the following parameters:") number_of_houses = vkt.NumberField("Number of houses", max=8.0, min=1.0, variant='slider', step=1.0, default=3.0) number_of_floors = vkt.NumberField("Number of floors", max=5.0, min=1.0, variant='slider', step=1.0, default=2.0) depth = vkt.NumberField("Depth", max=10.0, min=5.0, variant='slider', step=1.0, default=8.0, suffix="m") width = vkt.NumberField("Width", max=6.0, min=4.0, variant='slider', step=1.0, default=5.0, suffix="m") height_floor = vkt.NumberField("Height floor", max=3.0, min=2.0, variant='slider', step=0.1, default=2.5, suffix='m') height_roof = vkt.NumberField("Height roof", max=3.0, min=2.0, variant='slider', step=0.1, default=2.5, suffix='m') class Controller(vkt.Controller): parametrization = Parametrization @staticmethod def update_model(params) -> tuple[vkt.File, vkt.dynamo.DynamoFile]: """This method updates the nodes of the Dynamo file with the parameters from the parametrization class.""" # Create a DynamoFile object using the sample file file_path = Path(__file__).parent / "dynamo_model_sample_app.dyn" dyn_file = vkt.dynamo.DynamoFile(vkt.File.from_path(file_path)) # Update the Dynamo file with parameters from user input dyn_file.update("Number of houses", params.number_of_houses) dyn_file.update("Number of floors", params.number_of_floors) dyn_file.update("Depth", params.depth) dyn_file.update("Width", params.width) dyn_file.update("Height floor", params.height_floor) dyn_file.update("Height roof", params.height_roof) # Generate updated file input_file = dyn_file.generate() return input_file, dyn_file @vkt.GeometryView("Mocked 3d model", x_axis_to_right=True) def mocked_geometry_view(self, params, **kwargs): # Step 1: Update model input_file, dynamo_file = self.update_model(params) # Step 2: Running analysis file_path = Path(__file__).parent / "Mocked_3d_model.json" threed_file = vkt.File.from_path(file_path) # Step 3: Processing geometry glb_file = vkt.dynamo.convert_geometry_to_glb(threed_file) return vkt.GeometryResult(geometry=glb_file) @staticmethod def convert_dynamo_file_to_data_items(input_file: vkt.dynamo.DynamoFile, output_file: vkt.File) -> vkt.DataGroup: """Extracts the output of the Dynamo results by using the input and output files.""" # Collect ids for the computational output from the Dynamo file output_id_floor_area = input_file.get_node_id("(OUTPUT) Floor area per house") output_id_total_cost = input_file.get_node_id("(OUTPUT) Total cost") output_id_mki = input_file.get_node_id("(OUTPUT) MKI") output_id_co2 = input_file.get_node_id("(OUTPUT) CO2") # Collect the numerical results from the output file using the collected ids with output_file.open_binary() as f: floor_area = vkt.dynamo.get_dynamo_result(f, id_=output_id_floor_area) total_cost = vkt.dynamo.get_dynamo_result(f, id_=output_id_total_cost) mki = vkt.dynamo.get_dynamo_result(f, id_=output_id_mki) co2 = vkt.dynamo.get_dynamo_result(f, id_=output_id_co2) # Add values to a DataGroup to visualize them in the app data_group = vkt.DataGroup( vkt.DataItem(label="Floor area", value=round(float(floor_area), 2), suffix="m²"), vkt.DataItem(label="Total cost", value=round(float(total_cost), 2), suffix="€"), vkt.DataItem(label="MKI", value=round(float(mki), 2)), vkt.DataItem(label="CO₂ emission", value=round(float(co2), 2), suffix="ton CO₂"), ) return data_group ``` Let us go through the above mentioned logic: 1. Get the `node_id`, which corresponds to the same node id as the input file. 2. Collect the numerical results. 3. Create a `DataGroup` from the collected numerical results using the [`DataGroup`](https://docs.viktor.ai/sdk/api/views/.md#_DataGroup) and [`DataItem`](https://docs.viktor.ai/sdk/api/views/.md#_DataItem) classes. ## 5. Create a DataView with mocked output files[​](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#5-create-a-dataview-with-mocked-output-files "Direct link to 5. Create a DataView with mocked output files") In this section we will create a [`DataView`](https://docs.viktor.ai/sdk/api/views/.md#_DataView) to display the data. However, for now, we will use a mocked output file. In [section 7](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#7-add-the-worker-logic-to-supply-the-real-output-files) we will generate the xml file using the Dynamo script. Before you continue, download the result file [here](https://docs.viktor.ai/files/docs/dynamo-tutorial/Mocked_data_results.xml) and save it in your app folder next to `app.py`. To visualize the mocked output add a `DataView` method to your `Controller` class, see code below: ``` from pathlib import Path import viktor as vkt class Parametrization(vkt.Parametrization): intro = vkt.Text("# 3D Dynamo app \n This app parametrically generates and visualises a 3D model of a house using a Dynamo script. \n\n Please fill in the following parameters:") number_of_houses = vkt.NumberField("Number of houses", max=8.0, min=1.0, variant='slider', step=1.0, default=3.0) number_of_floors = vkt.NumberField("Number of floors", max=5.0, min=1.0, variant='slider', step=1.0, default=2.0) depth = vkt.NumberField("Depth", max=10.0, min=5.0, variant='slider', step=1.0, default=8.0, suffix="m") width = vkt.NumberField("Width", max=6.0, min=4.0, variant='slider', step=1.0, default=5.0, suffix="m") height_floor = vkt.NumberField("Height floor", max=3.0, min=2.0, variant='slider', step=0.1, default=2.5, suffix='m') height_roof = vkt.NumberField("Height roof", max=3.0, min=2.0, variant='slider', step=0.1, default=2.5, suffix='m') class Controller(vkt.Controller): parametrization = Parametrization @staticmethod def update_model(params) -> tuple[vkt.File, vkt.dynamo.DynamoFile]: """This method updates the nodes of the Dynamo file with the parameters from the parametrization class.""" # Create a DynamoFile object using the sample file file_path = Path(__file__).parent / "dynamo_model_sample_app.dyn" dyn_file = vkt.dynamo.DynamoFile(vkt.File.from_path(file_path)) # Update the Dynamo file with parameters from user input dyn_file.update("Number of houses", params.number_of_houses) dyn_file.update("Number of floors", params.number_of_floors) dyn_file.update("Depth", params.depth) dyn_file.update("Width", params.width) dyn_file.update("Height floor", params.height_floor) dyn_file.update("Height roof", params.height_roof) # Generate updated file input_file = dyn_file.generate() return input_file, dyn_file @vkt.GeometryView("Mocked 3d model", x_axis_to_right=True) def mocked_geometry_view(self, params, **kwargs): # Step 1: Update model input_file, dynamo_file = self.update_model(params) # Step 2: Running analysis file_path = Path(__file__).parent / "Mocked_3d_model.json" threed_file = vkt.File.from_path(file_path) # Step 3: Processing geometry glb_file = vkt.dynamo.convert_geometry_to_glb(threed_file) return vkt.GeometryResult(geometry=glb_file) @staticmethod def convert_dynamo_file_to_data_items(input_file: vkt.dynamo.DynamoFile, output_file: vkt.File) -> vkt.DataGroup: """Extracts the output of the Dynamo results by using the input and output files.""" # Collect ids for the computational output from the Dynamo file output_id_floor_area = input_file.get_node_id("(OUTPUT) Floor area per house") output_id_total_cost = input_file.get_node_id("(OUTPUT) Total cost") output_id_mki = input_file.get_node_id("(OUTPUT) MKI") output_id_co2 = input_file.get_node_id("(OUTPUT) CO2") # Collect the numerical results from the output file using the collected ids with output_file.open_binary() as f: floor_area = vkt.dynamo.get_dynamo_result(f, id_=output_id_floor_area) total_cost = vkt.dynamo.get_dynamo_result(f, id_=output_id_total_cost) mki = vkt.dynamo.get_dynamo_result(f, id_=output_id_mki) co2 = vkt.dynamo.get_dynamo_result(f, id_=output_id_co2) # Add values to a DataGroup to visualize them in the app data_group = vkt.DataGroup( vkt.DataItem(label="Floor area", value=round(float(floor_area), 2), suffix="m²"), vkt.DataItem(label="Total cost", value=round(float(total_cost), 2), suffix="€"), vkt.DataItem(label="MKI", value=round(float(mki), 2)), vkt.DataItem(label="CO₂ emission", value=round(float(co2), 2), suffix="ton CO₂"), ) return data_group @vkt.DataView("Mocked data results") def mocked_data_view(self, params, **kwargs): # Step 1: Update model input_file, dynamo_file = self.update_model(params) # Step 2: Running analysis file_path = Path(__file__).parent / "Mocked_data_results.xml" data_file = vkt.File.from_path(file_path) # Step 3: Process numerical output data_group = self.convert_dynamo_file_to_data_items(dynamo_file, data_file) return vkt.DataResult(data=data_group) ``` Let us go through the above mentioned logic: 1. Update the Dynamo file with the `update_model` method (see [section 1](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#1-setup-a-viktor-app)) 2. For now we are using a mocked file, instead of running the analysis in Dynamo. The mocked file can be downloaded [here](https://docs.viktor.ai/files/docs/dynamo-tutorial/Mocked_data_results.xml). 3. With the static method `convert_dynamo_file_to_data_items`, you can convert the .xml file to a `DataGroup`, which can be directly visualized in a `DataView`. 4. Refresh your app, and you should see a data view with the data. ## 6. Create a GeometryAndDataView with the mocked output files[​](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#6-create-a-geometryanddataview-with-the-mocked-output-files "Direct link to 6. Create a GeometryAndDataView with the mocked output files") In this section we will combine the geometry view and data view in one view using the [`GeometryAndDataView`](https://docs.viktor.ai/sdk/api/views/.md#_GeometryAndDataView) class. We will use the mocked files. To this end, replace the `mocked_data_view` and the `mocked_geometry_view` methods with a single `geometry_and_data_view` method: ``` from pathlib import Path import viktor as vkt class Parametrization(vkt.Parametrization): intro = vkt.Text("# 3D Dynamo app \n This app parametrically generates and visualises a 3D model of a house using a Dynamo script. \n\n Please fill in the following parameters:") number_of_houses = vkt.NumberField("Number of houses", max=8.0, min=1.0, variant='slider', step=1.0, default=3.0) number_of_floors = vkt.NumberField("Number of floors", max=5.0, min=1.0, variant='slider', step=1.0, default=2.0) depth = vkt.NumberField("Depth", max=10.0, min=5.0, variant='slider', step=1.0, default=8.0, suffix="m") width = vkt.NumberField("Width", max=6.0, min=4.0, variant='slider', step=1.0, default=5.0, suffix="m") height_floor = vkt.NumberField("Height floor", max=3.0, min=2.0, variant='slider', step=0.1, default=2.5, suffix='m') height_roof = vkt.NumberField("Height roof", max=3.0, min=2.0, variant='slider', step=0.1, default=2.5, suffix='m') class Controller(vkt.Controller): parametrization = Parametrization @staticmethod def update_model(params) -> tuple[vkt.File, vkt.dynamo.DynamoFile]: """This method updates the nodes of the Dynamo file with the parameters from the parametrization class.""" # Create a DynamoFile object using the sample file file_path = Path(__file__).parent / "dynamo_model_sample_app.dyn" dyn_file = vkt.dynamo.DynamoFile(vkt.File.from_path(file_path)) # Update the Dynamo file with parameters from user input dyn_file.update("Number of houses", params.number_of_houses) dyn_file.update("Number of floors", params.number_of_floors) dyn_file.update("Depth", params.depth) dyn_file.update("Width", params.width) dyn_file.update("Height floor", params.height_floor) dyn_file.update("Height roof", params.height_roof) # Generate updated file input_file = dyn_file.generate() return input_file, dyn_file @staticmethod def convert_dynamo_file_to_data_items(input_file: vkt.dynamo.DynamoFile, output_file: vkt.File) -> vkt.DataGroup: """Extracts the output of the Dynamo results by using the input and output files.""" # Collect ids for the computational output from the Dynamo file output_id_floor_area = input_file.get_node_id("(OUTPUT) Floor area per house") output_id_total_cost = input_file.get_node_id("(OUTPUT) Total cost") output_id_mki = input_file.get_node_id("(OUTPUT) MKI") output_id_co2 = input_file.get_node_id("(OUTPUT) CO2") # Collect the numerical results from the output file using the collected ids with output_file.open_binary() as f: floor_area = vkt.dynamo.get_dynamo_result(f, id_=output_id_floor_area) total_cost = vkt.dynamo.get_dynamo_result(f, id_=output_id_total_cost) mki = vkt.dynamo.get_dynamo_result(f, id_=output_id_mki) co2 = vkt.dynamo.get_dynamo_result(f, id_=output_id_co2) # Add values to a DataGroup to visualize them in the app data_group = vkt.DataGroup( vkt.DataItem(label="Floor area", value=round(float(floor_area), 2), suffix="m²"), vkt.DataItem(label="Total cost", value=round(float(total_cost), 2), suffix="€"), vkt.DataItem(label="MKI", value=round(float(mki), 2)), vkt.DataItem(label="CO₂ emission", value=round(float(co2), 2), suffix="ton CO₂"), ) return data_group @vkt.GeometryAndDataView("Mocked 3d/data", x_axis_to_right=True) def geometry_and_data_view(self, params, **kwargs): """The endpoint that initiates the logic to visualize the geometry and data executed and retrieved from a Dynamo script.""" # Step 1: Update model input_file, dynamo_file = self.update_model(params) # Step 2: Running analysis file_path = Path(__file__).parent / "Mocked_3d_model.json" threed_file = vkt.File.from_path(file_path) file_path = Path(__file__).parent / "Mocked_data_results.xml" data_file = vkt.File.from_path(file_path) # Step 3: Processing geometry glb_file = vkt.dynamo.convert_geometry_to_glb(threed_file) # Step 4: Process numerical output data_group = self.convert_dynamo_file_to_data_items(dynamo_file, data_file) return vkt.GeometryAndDataResult(geometry=glb_file, data=data_group) ``` ## 7. Integrate Dynamo[​](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#7-integrate-dynamo "Direct link to 7. Integrate Dynamo") In this section, we will implement the logic to trigger the Dynamo calculation from your app. We will update step 2 of the `geometry_and_data_view` to run the Dynamo calculation. Please refer to the code snippet below: ``` from pathlib import Path import viktor as vkt class Parametrization(vkt.Parametrization): intro = vkt.Text("# 3D Dynamo app \n This app parametrically generates and visualises a 3D model of a house using a Dynamo script. \n\n Please fill in the following parameters:") number_of_houses = vkt.NumberField("Number of houses", max=8.0, min=1.0, variant='slider', step=1.0, default=3.0) number_of_floors = vkt.NumberField("Number of floors", max=5.0, min=1.0, variant='slider', step=1.0, default=2.0) depth = vkt.NumberField("Depth", max=10.0, min=5.0, variant='slider', step=1.0, default=8.0, suffix="m") width = vkt.NumberField("Width", max=6.0, min=4.0, variant='slider', step=1.0, default=5.0, suffix="m") height_floor = vkt.NumberField("Height floor", max=3.0, min=2.0, variant='slider', step=0.1, default=2.5, suffix='m') height_roof = vkt.NumberField("Height roof", max=3.0, min=2.0, variant='slider', step=0.1, default=2.5, suffix='m') class Controller(vkt.Controller): parametrization = Parametrization @staticmethod def update_model(params) -> tuple[vkt.File, vkt.dynamo.DynamoFile]: """This method updates the nodes of the Dynamo file with the parameters from the parametrization class.""" # Create a DynamoFile object using the sample file file_path = Path(__file__).parent / "dynamo_model_sample_app.dyn" dyn_file = vkt.dynamo.DynamoFile(vkt.File.from_path(file_path)) # Update the Dynamo file with parameters from user input dyn_file.update("Number of houses", params.number_of_houses) dyn_file.update("Number of floors", params.number_of_floors) dyn_file.update("Depth", params.depth) dyn_file.update("Width", params.width) dyn_file.update("Height floor", params.height_floor) dyn_file.update("Height roof", params.height_roof) # Generate updated file input_file = dyn_file.generate() return input_file, dyn_file @staticmethod def convert_dynamo_file_to_data_items(input_file: vkt.dynamo.DynamoFile, output_file: vkt.File) -> vkt.DataGroup: """Extracts the output of the Dynamo results by using the input and output files.""" # Collect ids for the computational output from the Dynamo file output_id_floor_area = input_file.get_node_id("(OUTPUT) Floor area per house") output_id_total_cost = input_file.get_node_id("(OUTPUT) Total cost") output_id_mki = input_file.get_node_id("(OUTPUT) MKI") output_id_co2 = input_file.get_node_id("(OUTPUT) CO2") # Collect the numerical results from the output file using the collected ids with output_file.open_binary() as f: floor_area = vkt.dynamo.get_dynamo_result(f, id_=output_id_floor_area) total_cost = vkt.dynamo.get_dynamo_result(f, id_=output_id_total_cost) mki = vkt.dynamo.get_dynamo_result(f, id_=output_id_mki) co2 = vkt.dynamo.get_dynamo_result(f, id_=output_id_co2) # Add values to a DataGroup to visualize them in the app data_group = vkt.DataGroup( vkt.DataItem(label="Floor area", value=round(float(floor_area), 2), suffix="m²"), vkt.DataItem(label="Total cost", value=round(float(total_cost), 2), suffix="€"), vkt.DataItem(label="MKI", value=round(float(mki), 2)), vkt.DataItem(label="CO₂ emission", value=round(float(co2), 2), suffix="ton CO₂"), ) return data_group @vkt.GeometryAndDataView("Building 3D", duration_guess=5, x_axis_to_right=True) def geometry_and_data_view(self, params, **kwargs): """Run an analysis using Dynamo and visualize the geometry and data""" # Step 1: Update model input_file, dynamo_file = self.update_model(params) # Step 2: Running analysis files = [ ('input.dyn', input_file), ] analysis = vkt.dynamo.DynamoAnalysis(files=files, output_filenames=["output.xml", "geometry.json"]) analysis.execute(timeout=60) # Step 3: Processing geometry geometry_file = analysis.get_output_file('geometry.json', as_file=True) glb_file = vkt.dynamo.convert_geometry_to_glb(geometry_file) # Step 4: Process numerical output output_file = analysis.get_output_file('output.xml', as_file=True) data_group = self.convert_dynamo_file_to_data_items(dynamo_file, output_file) return vkt.GeometryAndDataResult(geometry=glb_file, data=data_group) ``` The steps in `geometry_and_data_view` explained: 1. Update the Dynamo file with the `update_model` method (see section 2) 2. We use the [`DynamoAnalysis`](https://docs.viktor.ai/sdk/api/external/dynamo/.md#_DynamoAnalysis) to run the Dynamo script. The `executable_key` in the example above refers to the "dynamo" command in the configuration file of the worker. For more information on how to configure the worker, refer to next section. 3. Processing the geometry, the .json file can be obtained with the `get_ouput_file` method. With the helper function `convert_geometry_to_glb`, you can convert it to a GLB type file, which can directly be visualized in a `GeometryAndDataView`. 4. Processing geometry, the .xml file can be obtained with the `get_ouput_file`. method. With the static method `convert_dynamo_file_to_data_items`, you can convert the .xml file to a `Datagroup`, which can be directly visualized in `GeometryAndDataView`. ## 8. Setting up a worker[​](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#8-setting-up-a-worker "Direct link to 8. Setting up a worker") A worker is a program that connects your app with third-party software to execute tasks and send results. The worker communicates with the VIKTOR cloud via an encrypted connection. For this integration, we recommend using the **generic worker**. Running a Dynamo script requires passing arguments to the `DynamoWPFCLI` executable (the input and output files, and the path to FormIt or Revit for the geometry export). The dedicated Dynamo worker does not expose these arguments in VIKTOR Desktop, whereas the generic worker lets you define the executables and their arguments yourself in its `config.yaml` file. ### Installation[​](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#installation "Direct link to Installation") <!-- --> Follow these steps to install the worker: * Personal worker * Organization worker A personal worker connects the software that is installed on your own machine, for your own use. Personal workers are installed and managed with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md): 1. [Download and install VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#download-and-install-viktor-desktop) and log in with your VIKTOR account, if you haven't done so already 2. In VIKTOR Desktop, click "Add" and select **Generic** ![](/assets/images/viktor-desktop-add-worker-list-01993b58665874f7b82e3e76d84dd9b9.webp) 3. <!-- --> Define the executables, arguments and paths in the worker's `config.yaml` file, which VIKTOR Desktop exposes when adding the worker <!-- --> 4. Start the worker. You can view its [logs](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#view-logs) inside VIKTOR Desktop, and the editor shows when your worker is online note Personal workers that were installed with the previous per-worker installer keep running, but new personal workers can only be added through [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#migrate-existing-workers-to-viktor-desktop): the per-worker installer download and connection-key flow are no longer available for personal use. An organization worker connects software that runs on a machine managed by your organization, such as a virtual or remote machine, and is shared by the users of the app instance(s) you select. caution You need to be an environment administrator in order to install an organization worker. 1. Navigate to the "Integrations" tab in the Administrator panel 2. Click "Add integration" 3. Follow the steps provided in the modal ![](/assets/images/create-integration-admin-598d0869714267fcb7a220c370dde5df.png) 3.1. Select **Generic** 3.2. Select the app instance(s) the integration should be available to 3.3. Download the worker .msi (Microsoft Installer) and run it on the machine of choice 3.4. Copy the generated **connection key** and paste it when the installer asks for it. In the browser, you can now click Finish and continue in the installer. Connection Key The generated connection key **should be copied immediately** as VIKTOR will not preserve this data for security reasons. 4. <!-- --> After installation, define the executables, arguments and paths in the `config.yaml` file, located in the same directory as the worker <!-- --> 5. Make sure to launch the integration once the installation is finished. If you closed the integration, you can restart it through the desktop shortcut. ### Configuration[​](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#configuration "Direct link to Configuration") To configure the worker, you first need to install FormIt, which can be downloaded from [here](https://formit.autodesk.com/). After it is installed, you can set up the worker to execute the logic when the input files have been sent by the VIKTOR app. The generic worker is configured through its `config.yaml` file. For workers managed with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#add-and-configure-a-worker), this file is exposed when you add the worker. For organization workers (installed with the per-worker installer), the file can be found in the same folder where the worker is installed (`C:\Users\{username}\AppData\Local\Viktor\` for development workers and `C:\Program Files\Viktor\` for production workers). Edit the `config.yaml` file as follows: ``` executables: dynamo: path: 'C:\Program Files\Autodesk\FormIt\DynamoSandbox\DynamoWPFCLI.exe' arguments: - '-o' - 'input.dyn' - '-v' - 'output.xml' - '-gp' - 'C:\Program Files\Autodesk\FormIt' - '-g' - 'geometry.json' maxParallelProcesses: 1 ``` * `path`: Here we define the path of the program to be executed. * `arguments`: Under this key we can list all arguments that can be added to the executable. This works similar to command-line arguments. * `-o` Open the dynamo script(input.dyn) * `-v` Ouput geometry file (name = output.xml) * `-gp` Path to local installation of Autodesk FormIt or Revit * `-g` Ouptut geometry file (name = geometry.json) For more information about the Dynamo CLI see the [Dynamo CLI documentation](https://github.com/DynamoDS/Dynamo/wiki/Dynamo-Command-Line-Interface) note The worker reads the config file once during startup. So when you change the config file, you will need to restart the worker for your changes to take effect. ### Connection[​](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#connection "Direct link to Connection") Once your worker is configured, start it in VIKTOR Desktop. The app shows whether the worker is connected, and its [logs](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#view-logs) can be viewed inside the app. In the top right corner in your VIKTOR environment you should see a green indicator in your worker overview, see the figure below. Organization workers If you installed the worker with the per-worker installer (as used for organization workers), save your `config.yaml` file and start the worker by double-clicking the shortcut on the desktop. If all went well, you will be presented with a window in which the message: "Successfully connected to the server" is displayed. ![](/assets/images/tutorial_dynamo_connection-66da2008601364197682b134e73f0ad2.png) ## All code together[​](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#all-code-together "Direct link to All code together") Now that the worker is successfully connected you can open your development workspace and generate new housing configurations based on the supplied input parameters! ``` from pathlib import Path import viktor as vkt class Parametrization(vkt.Parametrization): intro = vkt.Text("# 3D Dynamo app \n This app parametrically generates and visualises a 3D model of a house using a Dynamo script. \n\n Please fill in the following parameters:") number_of_houses = vkt.NumberField("Number of houses", max=8.0, min=1.0, variant='slider', step=1.0, default=3.0) number_of_floors = vkt.NumberField("Number of floors", max=5.0, min=1.0, variant='slider', step=1.0, default=2.0) depth = vkt.NumberField("Depth", max=10.0, min=5.0, variant='slider', step=1.0, default=8.0, suffix="m") width = vkt.NumberField("Width", max=6.0, min=4.0, variant='slider', step=1.0, default=5.0, suffix="m") height_floor = vkt.NumberField("Height floor", max=3.0, min=2.0, variant='slider', step=0.1, default=2.5, suffix='m') height_roof = vkt.NumberField("Height roof", max=3.0, min=2.0, variant='slider', step=0.1, default=2.5, suffix='m') class Controller(vkt.Controller): parametrization = Parametrization @staticmethod def update_model(params) -> tuple[vkt.File, vkt.dynamo.DynamoFile]: """This method updates the nodes of the Dynamo file with the parameters from the parametrization class.""" # Create a DynamoFile object using the sample file file_path = Path(__file__).parent / "dynamo_model_sample_app.dyn" dyn_file = vkt.dynamo.DynamoFile(vkt.File.from_path(file_path)) # Update the Dynamo file with parameters from user input dyn_file.update("Number of houses", params.number_of_houses) dyn_file.update("Number of floors", params.number_of_floors) dyn_file.update("Depth", params.depth) dyn_file.update("Width", params.width) dyn_file.update("Height floor", params.height_floor) dyn_file.update("Height roof", params.height_roof) # Generate updated file input_file = dyn_file.generate() return input_file, dyn_file @staticmethod def convert_dynamo_file_to_data_items(input_file: vkt.dynamo.DynamoFile, output_file: vkt.File) -> vkt.DataGroup: """Extracts the output of the Dynamo results by using the input and output files.""" # Collect ids for the computational output from the Dynamo file output_id_floor_area = input_file.get_node_id("(OUTPUT) Floor area per house") output_id_total_cost = input_file.get_node_id("(OUTPUT) Total cost") output_id_mki = input_file.get_node_id("(OUTPUT) MKI") output_id_co2 = input_file.get_node_id("(OUTPUT) CO2") # Collect the numerical results from the output file using the collected ids with output_file.open_binary() as f: floor_area = vkt.dynamo.get_dynamo_result(f, id_=output_id_floor_area) total_cost = vkt.dynamo.get_dynamo_result(f, id_=output_id_total_cost) mki = vkt.dynamo.get_dynamo_result(f, id_=output_id_mki) co2 = vkt.dynamo.get_dynamo_result(f, id_=output_id_co2) # Add values to a DataGroup to visualize them in the app data_group = vkt.DataGroup( vkt.DataItem(label="Floor area", value=round(float(floor_area), 2), suffix="m²"), vkt.DataItem(label="Total cost", value=round(float(total_cost), 2), suffix="€"), vkt.DataItem(label="MKI", value=round(float(mki), 2)), vkt.DataItem(label="CO₂ emission", value=round(float(co2), 2), suffix="ton CO₂"), ) return data_group @vkt.GeometryAndDataView("Building 3D", duration_guess=5, x_axis_to_right=True) def geometry_and_data_view(self, params, **kwargs): """Run an analysis using Dynamo and visualize the geometry and data""" # Step 1: Update model input_file, dynamo_file = self.update_model(params) # Step 2: Running analysis files = [('input.dyn', input_file)] analysis = vkt.dynamo.DynamoAnalysis(files=files, output_filenames=["output.xml", "geometry.json"]) analysis.execute(timeout=60) # Step 3: Processing geometry geometry_file = analysis.get_output_file('geometry.json', as_file=True) glb_file = vkt.dynamo.convert_geometry_to_glb(geometry_file) # Step 4: Process numerical output output_file = analysis.get_output_file('output.xml', as_file=True) data_group = self.convert_dynamo_file_to_data_items(dynamo_file, output_file) return vkt.GeometryAndDataResult(geometry=glb_file, data=data_group) ``` ## To infinity and beyond[​](https://docs.viktor.ai/docs/tutorials/integrate-dynamo/.md#to-infinity-and-beyond "Direct link to To infinity and beyond") Nice! You are now able to create an app that can integrate with Dynamo (Sandbox) using the generic worker! Of course, the journey doesn't end here. Check out some of our other [tutorials](https://docs.viktor.ai/docs/tutorials/.md) or try to replace Dynamo script from this tutorial with one of your own! --- # Tutorial - Integrate ETABS and SAP2000 note Estimated time: 55 minutes<br /><!-- -->Difficulty level: Intermediate * [![](/img/illustrations/free-version-banner.svg)](https://www.viktor.ai/start-building-apps) ## Introduction[​](https://docs.viktor.ai/docs/tutorials/integrate-etabs-sap2000/.md#introduction "Direct link to Introduction") ETABS and SAP2000 are two of the most commonly used software tools for structural engineering. They offer a range of features for modeling and design, along with a robust API that automates various workflows. In this tutorial, you will learn how to create a VIKTOR web app that integrates these tools behind the scenes. Although this tutorial is written specifically for ETABS, it can easily be modified to use [SAP2000](https://docs.viktor.ai/docs/tutorials/integrate-etabs-sap2000/.md#what-about-sap2000). Here are the main sections we will cover: 1. [Create a new VIKTOR app.](https://docs.viktor.ai/docs/tutorials/integrate-etabs-sap2000/.md#create-a-new-viktor-app) 2. [Create a simple parametric model.](https://docs.viktor.ai/docs/tutorials/integrate-etabs-sap2000/.md#lets-create-the-3d-model) 3. [Calculate the reaction loads of your model.](https://docs.viktor.ai/docs/tutorials/integrate-etabs-sap2000/.md#hands-on-the-etabs-api) 4. [Display the reaction loads in your VIKTOR app.](https://docs.viktor.ai/docs/tutorials/integrate-etabs-sap2000/.md#lets-integrate-the-worker-in-our-viktor-app) Here is a sneak peek at how the app will look: ![model](/assets/images/tutorial_etabs_sap_webapp-68ba25a66b118e6c43e67f53242b615b.png) ## Prerequisites and downloads[​](https://docs.viktor.ai/docs/tutorials/integrate-etabs-sap2000/.md#prerequisites-and-downloads "Direct link to Prerequisites and downloads") Prerequisites * You have [installed VIKTOR](https://docs.viktor.ai/docs/getting-started/installation/) * You have some experience with reading Python code * You have some experience with ETABS/SAP2000 Before using the ETABS API in Python, ensure you have `pywin32` and `comtypes` installed in your *Python environment*. If they are not installed, you can add them using pip. Open Windows Powershell and run the following command: ``` pip install pywin32 comtypes ``` ## Create a new VIKTOR app[​](https://docs.viktor.ai/docs/tutorials/integrate-etabs-sap2000/.md#create-a-new-viktor-app "Direct link to Create a new VIKTOR app") Let's create, install and start an empty app. This will be the starting point for the rest of the tutorial. But before we start, make sure to shut down any app that is running (like the demo app) by closing the command-line shell (for example Powershell) or end the process using `Ctrl + C`. Follow these steps to create, install and start an empty app: 1. Open a terminal and run the following command to create the app on the VIKTOR platform and generate the initial code locally: ``` viktor-cli create-app "ETABS SAP2000 tutorial" --init --app-type editor ``` 2. Open the newly created folder in your code editor and run `viktor-cli clean-start` in the terminal to install dependencies and connect the app to the platform. If all went well, your empty app is installed and connected to your development workspace. **Do not close the terminal** as this will break the connection with your app. The terminal in your code editor should show something like this: ``` INFO : Connecting to cloud.viktor.ai... INFO : Connection is established (use Ctrl+C to close) INFO : INFO : Navigate to the link below to see your app in the browser INFO : https://cloud.viktor.ai/workspaces/XXX/app INFO : INFO : App code loaded, waiting for jobs... ``` Re-starting your app * You only need to create an app template and install it once for each new app you want to make. * The app will update automatically once you start adding code in `app.py`, as long as you don't close the terminal or your code editor. * Did you close your code editor? Use `viktor-cli start` to start the app again. No need to install, clear, etc. ## Let's define a simple structure[​](https://docs.viktor.ai/docs/tutorials/integrate-etabs-sap2000/.md#lets-define-a-simple-structure "Direct link to Let's define a simple structure") To generate a simple moment frame, we use a parametric approach by defining the frame's `length` and `height` as variables. The function **create\_frame\_data** creates the frame’s topology using **nodes** and **lines** to represent its geometry. This approach allows us to generate different configurations by adjusting the `length` and `height` values. Additionally, the geometry is saved to a `json` file each time the function is executed. In the next sections, we will show how this function is used within the `Controller` class, triggered when new inputs are defined in the `Parametrization` class. Take a moment to review the following code snippet before continuing with the tutorial. ``` import viktor as vkt import json def create_frame_data(length, height): nodes = { 1:{"node_id": 1, "x": 0, "y": 0, "z": 0}, 2:{"node_id": 2, "x": 0, "y": length, "z": 0}, 3:{"node_id": 3, "x": 0, "y": 0, "z": height}, 4:{"node_id": 4, "x": 0, "y": length, "z": height}, 5:{"node_id": 5, "x": length, "y": 0, "z": 0}, 6:{"node_id": 6, "x": length, "y": length, "z": 0}, 7:{"node_id": 7, "x": length, "y": 0, "z": height}, 8:{"node_id": 8, "x": length, "y": length, "z": height}, } lines = { 1:{"line_id": 1, "node_i": 1, "node_j": 3}, 2:{"line_id": 2, "node_i": 2, "node_j": 4}, 3:{"line_id": 3, "node_i": 3, "node_j": 4}, 4:{"line_id": 4, "node_i": 6, "node_j": 8}, 5:{"line_id": 5, "node_i": 5, "node_j": 7}, 6:{"line_id": 6, "node_i": 3, "node_j": 7}, 7:{"line_id": 7, "node_i": 4, "node_j": 8}, 8:{"line_id": 8, "node_i": 7, "node_j": 8}, } return nodes, lines class Parametrization(vkt.Parametrization): pass class Controller(vkt.Controller): parametrization = Parametrization ``` ## Let's create the 3D model[​](https://docs.viktor.ai/docs/tutorials/integrate-etabs-sap2000/.md#lets-create-the-3d-model "Direct link to Let's create the 3D model") Now that we have a function to generate the topology of our structure, it's time to define the inputs in our `Parametrization` class and implement the logic to create a 3D model of the frame in a `GeometryView`. You can refer to the [documentation](https://docs.viktor.ai/sdk/api/geometry/) for more details on how to work with 3D geometry in VIKTOR. The resulting code of your app is shown below: ``` import json import viktor as vkt def create_frame_data(length, height): nodes = { 1:{"node_id": 1, "x": 0, "y": 0, "z": 0}, 2:{"node_id": 2, "x": 0, "y": length, "z": 0}, 3:{"node_id": 3, "x": 0, "y": 0, "z": height}, 4:{"node_id": 4, "x": 0, "y": length, "z": height}, 5:{"node_id": 5, "x": length, "y": 0, "z": 0}, 6:{"node_id": 6, "x": length, "y": length, "z": 0}, 7:{"node_id": 7, "x": length, "y": 0, "z": height}, 8:{"node_id": 8, "x": length, "y": length, "z": height}, } lines = { 1:{"line_id": 1, "node_i": 1, "node_j": 3}, 2:{"line_id": 2, "node_i": 2, "node_j": 4}, 3:{"line_id": 3, "node_i": 3, "node_j": 4}, 4:{"line_id": 4, "node_i": 6, "node_j": 8}, 5:{"line_id": 5, "node_i": 5, "node_j": 7}, 6:{"line_id": 6, "node_i": 3, "node_j": 7}, 7:{"line_id": 7, "node_i": 4, "node_j": 8}, 8:{"line_id": 8, "node_i": 7, "node_j": 8}, } return nodes, lines class Parametrization(vkt.Parametrization): intro = vkt.Text(""" # ETABS Base Reaction App Please fill in the following parameters: """ ) frame_length = vkt.NumberField("Frame Length", min=100, default=4000, suffix="mm") frame_height = vkt.NumberField("Frame Height", min=100, default=4000, suffix="mm") class Controller(vkt.Controller): parametrization = Parametrization @vkt.GeometryView("3D Model", duration_guess=1, x_axis_to_right=True) def create_render(self, params, **kwargs): nodes, lines = create_frame_data(length=params.frame_length, height=params.frame_height) sections_group = [] for line_id, dict_vals in lines.items(): node_id_i = dict_vals["node_i"] node_id_j = dict_vals["node_j"] node_i = nodes[node_id_i] node_j = nodes[node_id_j] point_i = vkt.Point(node_i["x"], node_i["y"], node_i["z"]) point_j = vkt.Point(node_j["x"], node_j["y"], node_j["z"]) line_k = vkt.Line(point_i, point_j) section_k = vkt.RectangularExtrusion(300, 300, line_k, identifier=str(line_id)) sections_group.append(section_k) return vkt.GeometryResult(geometry=sections_group) ``` Great! Now, you can change the dimensions of your frame, and the model will render with the updated geometry. You should see an app like this in your browser: ![model](/assets/images/tutorial_etabs_sap_geo_view-4950796446a8136418a0ad3b6e298f49.png) However, since you're here to learn how to integrate ETABS or SAP2000, let's move on and start using the CSI API! ## Hands on the ETABS API[​](https://docs.viktor.ai/docs/tutorials/integrate-etabs-sap2000/.md#hands-on-the-etabs-api "Direct link to Hands on the ETABS API") Let's create a new Python file called `run_etabs_model.py` in the same directory and add a `create_etabs_model` function. This function contains the logic to create our ETABS model using Python. The first step is to initialize the program with `comtypes`. Copy the snippet below, and make sure to update the `program_path` to match your ETABS version. You can run this code in **your Python environment**, and it will open a blank ETABS model. note If ETABS is running on a remote server, the `program_path` needs to match the ETABS location on the server where the worker is running. ``` import comtypes.client import pythoncom import json from pathlib import Path def create_etabs_model(): # Initialize ETABS model program_path=r"C:\Program Files\Computers and Structures\ETABS 22\ETABS.exe" pythoncom.CoInitialize() try: helper = comtypes.client.CreateObject("ETABSv1.Helper") helper = helper.QueryInterface(comtypes.gen.ETABSv1.cHelper) EtabsEngine = helper.CreateObject(program_path) EtabsEngine.ApplicationStart() EtabsObject = EtabsEngine.SapModel EtabsObject.InitializeNewModel(9) # Set units to mm EtabsObject.File.NewBlank() finally: pythoncom.CoUninitialize() if __name__ == "__main__": create_etabs_model() ``` ## Create the structure in ETABS[​](https://docs.viktor.ai/docs/tutorials/integrate-etabs-sap2000/.md#create-the-structure-in-etabs "Direct link to Create the structure in ETABS") Next, let's extend the `create_etabs_model` function to add joints, members, and rigid supports. We'll load the nodes and lines geometry from the `inputs.json` file, then create the nodes and members in ETABS, followed by defining the material properties for the frame. Here's how all this looks in code: ``` def create_etabs_model(): # Initialize ETABS model program_path=r"C:\Program Files\Computers and Structures\ETABS 22\ETABS.exe" pythoncom.CoInitialize() try: helper = comtypes.client.CreateObject("ETABSv1.Helper") helper = helper.QueryInterface(comtypes.gen.ETABSv1.cHelper) EtabsEngine = helper.CreateObject(program_path) EtabsEngine.ApplicationStart() EtabsObject = EtabsEngine.SapModel EtabsObject.InitializeNewModel(9) # Set units to mm EtabsObject.File.NewBlank() finally: pythoncom.CoUninitialize() # Create joints input_json = Path.cwd() / "inputs.json" #only works when running python from the working directory! with open(input_json) as jsonfile: data = json.load(jsonfile) nodes, lines = data[:] # Create nodes for node_id, node in nodes.items(): ret, _ = EtabsObject.PointObj.AddCartesian( node["x"], node["y"], node["z"], " ", str(node_id)) ) # Create members MATERIAL_CONCRETE = 2 ret = EtabsObject.PropMaterial.SetMaterial("CONC", MATERIAL_CONCRETE) ret = EtabsObject.PropMaterial.SetMPIsotropic("CONC", 30000, 0.2, 0.0000055) section_name = "300x300 RC" ret = EtabsObject.PropFrame.SetRectangle(section_name, "CONC", 300, 300) for line_id, line in lines.items(): point_i = line["node_i"] point_j = line["node_j"] ret, _ = EtabsObject.FrameObj.AddByPoint( str(point_i), str(point_j), str(line_id), section_name, "Global" ) # Add rigid supports list_nodes = [1, 2, 5, 6] for node_id in list_nodes: ret = EtabsObject.PointObj.SetRestraint(str(node_id), [1, 1, 1, 1, 1, 1]) EtabsObject.View.RefreshView(0, False) if __name__ == "__main__": create_etabs_model() ``` ## Run the model[​](https://docs.viktor.ai/docs/tutorials/integrate-etabs-sap2000/.md#run-the-model "Direct link to Run the model") Now you can save the model and run the analysis. By default, ETABS creates a load case called `Dead`, which includes only the self-weight of the structure. After the analysis, we can extract the reaction loads and save the results in a `.json` file to be used later in our VIKTOR app. ``` def create_etabs_model(): # Initialize ETABS model program_path=r"C:\Program Files\Computers and Structures\ETABS 22\ETABS.exe" pythoncom.CoInitialize() try: helper = comtypes.client.CreateObject("ETABSv1.Helper") helper = helper.QueryInterface(comtypes.gen.ETABSv1.cHelper) EtabsEngine = helper.CreateObject(program_path) EtabsEngine.ApplicationStart() EtabsObject = EtabsEngine.SapModel EtabsObject.InitializeNewModel(9) # Set units to mm EtabsObject.File.NewBlank() finally: pythoncom.CoUninitialize() # Create joints input_json = Path.cwd() / "inputs.json" #only works when running python from the working directory! with open(input_json) as jsonfile: data = json.load(jsonfile) nodes, lines = data[:] # Create nodes for node_id, node in nodes.items(): ret, _ = EtabsObject.PointObj.AddCartesian( node["x"], node["y"], node["z"], " ", str(node_id)) ) # Create members MATERIAL_CONCRETE = 2 ret = EtabsObject.PropMaterial.SetMaterial("CONC", MATERIAL_CONCRETE) ret = EtabsObject.PropMaterial.SetMPIsotropic("CONC", 30000, 0.2, 0.0000055) section_name = "300x300 RC" ret = EtabsObject.PropFrame.SetRectangle(section_name, "CONC", 300, 300) for line_id, line in lines.items(): point_i = line["node_i"] point_j = line["node_j"] ret, _ = EtabsObject.FrameObj.AddByPoint( str(point_i), str(point_j), str(line_id), section_name, "Global" ) # Add rigid supports list_nodes = [1, 2, 5, 6] for node_id in list_nodes: ret = EtabsObject.PointObj.SetRestraint(str(node_id), [1, 1, 1, 1, 1, 1]) EtabsObject.View.RefreshView(0, False) # Create the model and run the analysis file_path = Path.cwd() / "etabsmodel.edb" EtabsObject.File.Save(str(file_path)) EtabsObject.Analyze.RunAnalysis() # Get the reaction loads load_case = "Dead" ret = EtabsObject.Results.Setup.DeselectAllCasesAndCombosForOutput() reactions_list = list() ret = EtabsObject.Results.Setup.SetCaseSelectedForOutput(load_case) for node in list_nodes: *_, U1, U2, U3, R1, R2, R3, ret = EtabsObject.Results.JointReact( str(node), 0, 0 ) reaction = { "Node": str(node), "LoadCase": load_case, "U1": U1[0], "U2": U2[0], "U3": U3[0], "R1": R1[0], "R2": R2[0], "R3": R3[0], } reactions_list.append(reaction) # Save the output in a JSON output = Path.cwd() / "output.json" with open(output, "w") as jsonfile: json.dump(reactions_list, jsonfile) ret = EtabsEngine.ApplicationExit(False) return ret if __name__ == "__main__": create_etabs_model() ``` After running your `run_etabs_model.py` in your Python environment, you should end up with a model like the following: ![model](/assets/images/tutorial_etabs_model-b155492f041afdb2f65244333898ec2c.png) ## How to connect your VIKTOR app with the CSI API?[​](https://docs.viktor.ai/docs/tutorials/integrate-etabs-sap2000/.md#how-to-connect-your-viktor-app-with-the-csi-api "Direct link to How to connect your VIKTOR app with the CSI API?") The connection between VIKTOR and SAP2000 or ETABS is managed by a “worker.” A worker is a program that connects the VIKTOR platform to third-party software running outside the platform. You can install the worker on your local machine to test the integration by following this [tutorial](https://docs.viktor.ai/docs/create-apps/software-integrations/etabs-and-sap2000/.md). ## Let's integrate the worker in our VIKTOR app[​](https://docs.viktor.ai/docs/tutorials/integrate-etabs-sap2000/.md#lets-integrate-the-worker-in-our-viktor-app "Direct link to Let's integrate the worker in our VIKTOR app") In the `Controller` of our VIKTOR app, we need to set up the communication with the worker. To call the worker, we use the `ETABSAnalysis` class, which allows us to send inputs (files and objects) to the worker. In this example, we will send the `inputs.json` and `run_etabs_model.py` to be executed in the environment set up for the worker. This environment can be on your own computer or a remote server. When `run_etabs_model.py` is executed, it will generate the `output.json` file, and the worker will handle transferring this file from the server environment to our VIKTOR app. Here's how it looks in the code: ``` import json from io import BytesIO from pathlib import Path import viktor as vkt def create_frame_data(length, height): nodes = { 1:{"node_id": 1, "x": 0, "y": 0, "z": 0}, 2:{"node_id": 2, "x": 0, "y": length, "z": 0}, 3:{"node_id": 3, "x": 0, "y": 0, "z": height}, 4:{"node_id": 4, "x": 0, "y": length, "z": height}, 5:{"node_id": 5, "x": length, "y": 0, "z": 0}, 6:{"node_id": 6, "x": length, "y": length, "z": 0}, 7:{"node_id": 7, "x": length, "y": 0, "z": height}, 8:{"node_id": 8, "x": length, "y": length, "z": height}, } lines = { 1:{"line_id": 1, "node_i": 1, "node_j": 3}, 2:{"line_id": 2, "node_i": 2, "node_j": 4}, 3:{"line_id": 3, "node_i": 3, "node_j": 4}, 4:{"line_id": 4, "node_i": 6, "node_j": 8}, 5:{"line_id": 5, "node_i": 5, "node_j": 7}, 6:{"line_id": 6, "node_i": 3, "node_j": 7}, 7:{"line_id": 7, "node_i": 4, "node_j": 8}, 8:{"line_id": 8, "node_i": 7, "node_j": 8}, } return nodes, lines class Parametrization(vkt.Parametrization): intro = vkt.Text( "# ETABS Base Reaction App" "\n\n Please fill in the following parameters:" ) frame_length = vkt.NumberField("Frame Length", min=100, default=4000, suffix="mm") frame_height = vkt.NumberField("Frame Height", min=100, default=4000, suffix="mm") class Controller(vkt.Controller): parametrization = Parametrization @vkt.GeometryView("3D Model", duration_guess=1, x_axis_to_right=True) def create_render(self, params, **kwargs): nodes, lines = create_frame_data(length=params.frame_length, height=params.frame_height) sections_group = [] for line_id, dict_vals in lines.items(): node_id_i = dict_vals["node_i"] node_id_j = dict_vals["node_j"] node_i = nodes[node_id_i] node_j = nodes[node_id_j] point_i = vkt.Point(node_i["x"], node_i["y"], node_i["z"]) point_j = vkt.Point(node_j["x"], node_j["y"], node_j["z"]) line_k = vkt.Line(point_i, point_j) section_k = vkt.RectangularExtrusion(300, 300, line_k, identifier=str(line_id)) sections_group.append(section_k) return vkt.GeometryResult(geometry=sections_group) def run_etabs(self, params, **kwargs): nodes, lines = create_frame_data(length=params.frame_length, height= params.frame_height) input_json = json.dumps([nodes, lines]) script_path = Path(__file__).parent / "run_etabs_model.py" files = [("inputs.json", BytesIO(bytes(input_json, 'utf8')))] etabs_analysis = vkt.etabs.ETABSAnalysis( script=vkt.File.from_path(script_path), files=files, output_filenames=["output.json"] ) etabs_analysis.execute(timeout=300) output_file = etabs_analysis.get_output_file("output.json", as_file=True) ``` And of course, we would like to see the results in a nice table, so we will decorate the previous function with a `TableView` and post-process the results from the `output.json` file, as shown below: ``` import json from io import BytesIO from pathlib import Path import viktor as vkt def create_frame_data(length, height): nodes = { 1:{"node_id": 1, "x": 0, "y": 0, "z": 0}, 2:{"node_id": 2, "x": 0, "y": length, "z": 0}, 3:{"node_id": 3, "x": 0, "y": 0, "z": height}, 4:{"node_id": 4, "x": 0, "y": length, "z": height}, 5:{"node_id": 5, "x": length, "y": 0, "z": 0}, 6:{"node_id": 6, "x": length, "y": length, "z": 0}, 7:{"node_id": 7, "x": length, "y": 0, "z": height}, 8:{"node_id": 8, "x": length, "y": length, "z": height}, } lines = { 1:{"line_id": 1, "node_i": 1, "node_j": 3}, 2:{"line_id": 2, "node_i": 2, "node_j": 4}, 3:{"line_id": 3, "node_i": 3, "node_j": 4}, 4:{"line_id": 4, "node_i": 6, "node_j": 8}, 5:{"line_id": 5, "node_i": 5, "node_j": 7}, 6:{"line_id": 6, "node_i": 3, "node_j": 7}, 7:{"line_id": 7, "node_i": 4, "node_j": 8}, 8:{"line_id": 8, "node_i": 7, "node_j": 8}, } return nodes, lines class Parametrization(vkt.Parametrization): intro = vkt.Text( "# ETABS Base Reaction App" "\n\n Please fill in the following parameters:" ) frame_length = vkt.NumberField("Frame Length", min=100, default=4000, suffix="mm") frame_height = vkt.NumberField("Frame Height", min=100, default=4000, suffix="mm") class Controller(vkt.Controller): parametrization = Parametrization @vkt.GeometryView("3D Model", duration_guess=1, x_axis_to_right=True) def create_render(self, params, **kwargs): nodes, lines = create_frame_data(length=params.frame_length, height=params.frame_height) sections_group = [] for line_id, dict_vals in lines.items(): node_id_i = dict_vals["node_i"] node_id_j = dict_vals["node_j"] node_i = nodes[node_id_i] node_j = nodes[node_id_j] point_i = vkt.Point(node_i["x"], node_i["y"], node_i["z"]) point_j = vkt.Point(node_j["x"], node_j["y"], node_j["z"]) line_k = vkt.Line(point_i, point_j) section_k = vkt.RectangularExtrusion(300, 300, line_k, identifier=str(line_id)) sections_group.append(section_k) return vkt.GeometryResult(geometry=sections_group) @vkt.TableView("Base Reactions",duration_guess=10, update_label="Run ETABS analysis") def run_etabs(self, params, **kwargs): nodes, lines = create_frame_data(length=params.frame_length, height= params.frame_height) input_json = json.dumps([nodes, lines]) script_path = Path(__file__).parent / "run_etabs_model.py" files = [("inputs.json", BytesIO(bytes(input_json, 'utf8')))] etabs_analysis = vkt.etabs.ETABSAnalysis( script=vkt.File.from_path(script_path), files=files, output_filenames=["output.json"] ) etabs_analysis.execute(timeout=300) output_file = etabs_analysis.get_output_file("output.json", as_file=True) reactions = json.loads(output_file.getvalue()) data = [] for reaction in reactions: data.append([ reaction.get("Node", 0), reaction.get("LoadCase", "Dead"), round(reaction.get("U1", 0), 0), round(reaction.get("U2", 0), 0), round(reaction.get("U3", 0), 0) ]) return vkt.TableResult( data, row_headers=["Sup 1","Sup 2","Sup 3","Sup 4"], column_headers=["Node", "Load Case","U1[N]", "U2[N]", "U3[N]"], ) ``` Now you're ready to test your app. Make sure your worker is running, then try generating the model. After the analysis, your app should look like this: ![model](/assets/images/tutorial_etabs_sap_table_view-5c40ce41eb266cceb24ec740412e544a.JPG) ## What about SAP2000?[​](https://docs.viktor.ai/docs/tutorials/integrate-etabs-sap2000/.md#what-about-sap2000 "Direct link to What about SAP2000?") You can integrate SAP2000 in the same way we did for ETABS. All you need to do is change the program path and the helper, as shown below. ``` import pythoncom import comtypes.client def initialize_sap2000( program_path=r"C:\Program Files\Computers and Structures\SAP2000 25\SAP2000.exe", ): pythoncom.CoInitialize() try: helper = comtypes.client.CreateObject("SAP2000v1.Helper") helper = helper.QueryInterface(comtypes.gen.SAP2000v1.cHelper) SapEngine = helper.CreateObject(program_path) SapEngine.ApplicationStart() SapObject = SapEngine.SapModel SapObject.InitializeNewModel() SapObject.File.NewBlank() return SapObject, SapEngine finally: pythoncom.CoUninitialize() ``` ## Your turn to build[​](https://docs.viktor.ai/docs/tutorials/integrate-etabs-sap2000/.md#your-turn-to-build "Direct link to Your turn to build") You now have everything you need to start building powerful applications that integrate ETABS and SAP2000 into your VIKTOR apps. But the journey doesn’t end here, you can explore our other [tutorials](https://docs.viktor.ai/docs/tutorials/.md) or try integrating your own ETABS or SAP2000 model. --- # Tutorial - Autodesk Forma Site Design info Level: **Intermediate**<br />Time: **30 min**<br /> Prerequisites: * You have a VIKTOR account and completed the installation process. No account? Get one [here](https://www.viktor.ai/start-building-apps) * You have access to an Autodesk Forma Site Design project. * Your VIKTOR environment has an OAuth 2.0 integration available for Autodesk Forma Site Design. * [![](/img/illustrations/free-version-banner.svg)](https://www.viktor.ai/start-building-apps) ## Introduction[​](https://docs.viktor.ai/docs/tutorials/integrate-forma-site-design/.md#introduction "Direct link to Introduction") Welcome to this tutorial on how to create VIKTOR apps that connect to Autodesk Forma Site Design through Autodesk Platform Services (APS), VIKTOR, and Python. As an engineer or architect, you may work with changing requirements throughout a project. In this tutorial, we use three example workflows to explore how VIKTOR can help you read Forma data, generate geometry, visualize results, and publish new design outcomes without changing the app's source code for every variation. Instead of starting with a single finished application, we will use prompts as the starting point for each workflow. Each prompt describes a different way to combine VIKTOR with Forma Site Design: 1. [Create a parametric tower and publish it to the Forma Library](https://docs.viktor.ai/docs/tutorials/integrate-forma-site-design/.md#prompt-1-create-a-parametric-tower-and-publish-it-to-the-forma-library). 2. [Analyze terrain for drainage and ponding risks](https://docs.viktor.ai/docs/tutorials/integrate-forma-site-design/.md#prompt-2-analyze-terrain-for-drainage-and-ponding-risks). 3. [Place a building on terrain and publish it to a derived proposal](https://docs.viktor.ai/docs/tutorials/integrate-forma-site-design/.md#prompt-3-place-a-building-on-terrain-and-publish-it-to-a-derived-proposal). ## 1. Set up the integration[​](https://docs.viktor.ai/docs/tutorials/integrate-forma-site-design/.md#1-set-up-the-integration "Direct link to 1. Set up the integration") Before testing the prompts, configure the APS application, VIKTOR OAuth 2.0 integration, ACC custom integration, and Forma extension service account. The same APS client ID must be connected across these services, and the Forma extension must be installed in every project the app needs to access. For the complete setup procedure, including the required permissions, regions, project access, and OAuth 2.0 integration configuration, follow the [Autodesk Forma Site Design integration guide](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-forma-site-design/.md). In particular, review these sections: * [Before you begin](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-forma-site-design/.md#before-you-begin): confirm the required VIKTOR, APS, ACC, and Forma access. * [Create the APS application and VIKTOR integration](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-forma-site-design/.md#1-create-the-aps-application-and-viktor-integration). * [Add the APS client ID to the ACC account](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-forma-site-design/.md#2-add-the-aps-client-id-to-the-acc-account). * [Create and install the Forma extension](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-forma-site-design/.md#3-create-and-install-the-forma-extension). ## 2. Understand the key concepts[​](https://docs.viktor.ai/docs/tutorials/integrate-forma-site-design/.md#2-understand-the-key-concepts "Direct link to 2. Understand the key concepts") Most Forma workflows created with the VIKTOR App Builder start with the same project context: a Forma **project ID** and a selected **proposal or project revision**. You can find these values in the URL of the open Forma Site Design project: * **Project ID**: the value after `/designmodel/`, such as `pro_gsbvy6xpyt` in the example below. * **Proposal or revision ID**: the identifier that follows the project ID. The exact field label depends on the generated app. When the app asks you to select a revision, choose the proposal or revision you want it to read or extend. Copy the relevant values into the generated app when prompted. The examples below may ask for the project ID and region first, then load the available proposals dynamically so you can select the right proposal or revision. ![Autodesk Forma Site Design URL showing the project ID and proposal ID](/assets/images/forma-site-tutorial-key-concepts-757ef823038bb161745a9c74cfafe8e0.png) ## 3. Explore Forma Site Design workflows with prompts[​](https://docs.viktor.ai/docs/tutorials/integrate-forma-site-design/.md#3-explore-forma-site-design-workflows-with-prompts "Direct link to 3. Explore Forma Site Design workflows with prompts") The following prompts are starting points for three different Forma workflows. Click the arrow to open a prompt in the VIKTOR App Builder. Review the generated app and test its preview before using an action that writes to Forma. ### Prompt 1: Create a parametric tower and publish it to the Forma Library[​](https://docs.viktor.ai/docs/tutorials/integrate-forma-site-design/.md#prompt-1-create-a-parametric-tower-and-publish-it-to-the-forma-library "Direct link to Prompt 1: Create a parametric tower and publish it to the Forma Library") Let's start by creating a parametric tower. This is useful in the early stages of a project, when you want to explore different building options without rebuilding the model by hand. Before you submit the prompt, replace `[YOUR-FORMA-SITE-INTEGRATION-NAME-HERE]` with the name of the OAuth 2.0 integration configured in your VIKTOR environment. Then open the prompt in the App Builder, review the generated app, and test the preview before publishing the GLB to your Forma Library. ![](/img/illustrations/app-builder-cta-background.svg) ![](/img/illustrations/app-builder-cta-logo.svg)![](/img/illustrations/app-builder-cta-logo-glow.svg) ### Parametric twisting tower Create a parametric 30-story twisting tower with a 40 × 30 m base, 4 m floor height, 1% taper per floor, and 2° rotation per floor. Preview it vertically, export it as a Forma-compatible GLB with the correct Y-up axis conversion, and publish it to the current project's Forma Library. Use my OAuth integration "\[YOUR-FORMA-SITE-INTEGRATION-NAME-HERE]". Once the App Builder finishes creating the app, open the preview and enter the Forma project ID. You can then change the tower parameters, such as the number of stories, base dimensions, floor height, taper, and rotation. When the model looks right, publish it to the Forma Library. ![Generated VIKTOR app with project ID, tower parameters, preview, and Forma publishing controls](/assets/images/tutorial-forma-site-prompt1-img1-bb5e9a22e81afe16d21e8767345174ba.png) Next, open the Forma Site Design project and go to the Library. Select the parametric twisting tower and place it into the proposal you want to update. This lets you reuse the generated model in Forma after testing different parameters in the VIKTOR app. ![Autodesk Forma Site Design Library with the parametric twisting tower ready to place in a proposal](/assets/images/tutorial-forma-site-prompt1-img2-8a5ee4abb361a34a83bf7be5c7805a5b.png) ### Prompt 2: Analyze terrain for drainage and ponding risks[​](https://docs.viktor.ai/docs/tutorials/integrate-forma-site-design/.md#prompt-2-analyze-terrain-for-drainage-and-ponding-risks "Direct link to Prompt 2: Analyze terrain for drainage and ponding risks") The second workflow looks at the terrain before you make a design decision. It is useful when you want to find possible low points and drainage risks during early site planning. Enter the Forma project ID and region, select a proposal from the proposals loaded by the app, and review the heatmap and summary table before publishing a new proposal. ![](/img/illustrations/app-builder-cta-background.svg) ![](/img/illustrations/app-builder-cta-logo.svg)![](/img/illustrations/app-builder-cta-logo-glow.svg) ### Drainage and ponding risk analysis Create a VIKTOR app for Forma Site Design using my OAuth integration "\[YOUR-FORMA-SITE-INTEGRATION-NAME-HERE]". I want to screen a site's terrain for possible drainage and ponding risks. Ask me for the Forma project ID and region, dynamically load its proposals, and let me select one. Sample the terrain, identify local low points, and display a simple drainage-risk heatmap in a GeometryView with a summary table. Add an ActionButton that publishes the colored heatmap to a new Forma proposal without modifying the selected source proposal. Once the App Builder finishes creating the app, enter the Forma project ID and select a proposal in the Proposal Selection field. Review the drainage-risk heatmap and summary table, then use the publish action when the result looks right. ![Generated VIKTOR drainage app with project ID, proposal selection, heatmap, and publish controls](/assets/images/tutorial-forma-site-prompt2-img1-959136efd444faf0af780e2da478a40a.png) After the heatmap is published, return to the Forma Site Design project and refresh the page. The new proposal should appear in the proposals list with the colored heatmap ready for review. ![Refreshed Autodesk Forma Site Design proposal showing the published drainage-risk heatmap](/assets/images/tutorial-forma-site-prompt2-img2-9a437c32328a4de92f5b4cd5170642be.png) tip This prompt asks the generated app to create a new proposal so the selected source proposal stays unchanged. You can also update the prompt to modify an existing proposal instead, but do that only when you intend to change that proposal. ### Prompt 3: Place a building on terrain and publish it to a derived proposal[​](https://docs.viktor.ai/docs/tutorials/integrate-forma-site-design/.md#prompt-3-place-a-building-on-terrain-and-publish-it-to-a-derived-proposal "Direct link to Prompt 3: Place a building on terrain and publish it to a derived proposal") The third workflow helps you test a simple building on real Forma terrain. Change the building dimensions, rotation, and position in the generated app, then use the GeometryView to check the result. When the placement looks right, publish it to a new derived proposal so the selected source proposal stays unchanged. ![](/img/illustrations/app-builder-cta-background.svg) ![](/img/illustrations/app-builder-cta-logo.svg)![](/img/illustrations/app-builder-cta-logo-glow.svg) ### Terrain-aware building placement Create a VIKTOR app for Forma Site Design using my OAuth integration "\[YOUR-FORMA-SITE-INTEGRATION-NAME-HERE]". I want to enter a Forma project ID and region, select a proposal dynamically, download its terrain, and define one simple rectangular building with width, depth, height, rotation, and X/Y position inputs. Preview the terrain and generated building in a VIKTOR GeometryView. Add an ActionButton that creates the building as native Forma Basic Geometry and attaches it to a new derived proposal, resolving the latest proposal revision immediately before the write. Do not write to Forma during App Builder validation. Once the App Builder finishes creating the app, enter the Forma project ID and region, then select the proposal you want to use. Change the building dimensions, height, rotation, and X/Y position to test different site options. Add a name for the new proposal, review the GeometryView, and create the building in Forma when the result looks right. ![Generated VIKTOR building placement app with project, proposal, building, and publishing inputs](/assets/images/tutorial-forma-site-prompt3-img1-054f880c4899e25b6e888e8982176c35.png) After the action finishes, return to Forma Site Design and refresh the project. Open the new proposal and check that the building was added to the selected terrain without changing the source proposal. ![Autodesk Forma Site Design proposal showing the published building on the terrain](/assets/images/tutorial-forma-site-prompt3-img2-8875818f823d1f6a97abac167bb3ca6d.png) ## 4. Limitations of the VIKTOR Forma Site Design integration[​](https://docs.viktor.ai/docs/tutorials/integrate-forma-site-design/.md#4-limitations-of-the-viktor-forma-site-design-integration "Direct link to 4. Limitations of the VIKTOR Forma Site Design integration") In this tutorial, VIKTOR communicates with Forma through its **HTTP APIs**, also commonly called **REST APIs**. You can think of these APIs as a background connection: the VIKTOR app can ask Forma to read or save supported project, proposal, terrain, geometry, and Library data. The VIKTOR integration does not control the live Forma workspace. For an overview, see Forma's [HTTP API extension type](https://aps.autodesk.com/en/docs/forma/v1/overview/extension-types/#http-api-s). Here are some limitations of the integration: * **The VIKTOR integration does not control the live canvas.** It cannot see what the user has selected, move the camera, or read the current scene state. * **The VIKTOR integration does not start Forma's drawing tools.** It cannot ask the user to draw a point, line, polygon, or extrusion directly in the Forma scene. * **The VIKTOR integration cannot always download the full geometry of existing elements.** If the workflow needs geometry from the model currently loaded in Forma, the server-side integration may not provide it. Persistent changes still require supported API operations and the appropriate edit permissions. ## To infinity and beyond\![​](https://docs.viktor.ai/docs/tutorials/integrate-forma-site-design/.md#to-infinity-and-beyond "Direct link to To infinity and beyond!") Well done! You now have three starting points for creating VIKTOR apps that connect to Autodesk Forma Site Design. You have explored how to generate parametric geometry, analyze terrain, preview results in VIKTOR, and publish new outcomes to Forma. Finally, the journey doesn't end here. Check out some of our other [tutorials](https://docs.viktor.ai/docs/tutorials/.md) or explore the [VIKTOR documentation](https://docs.viktor.ai/docs/welcome/.md) to learn more about building apps with VIKTOR. --- # Tutorial - Integrate Rhino/Grasshopper note Estimated time: 45 minutes<br />Difficulty level: Intermediate * [![](/img/illustrations/free-version-banner.svg)](https://www.viktor.ai/start-building-apps) <br /> ***Not a reader?** feel free to follow this tutorial as a video* <br /> ## Introduction[​](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper/.md#introduction "Direct link to Introduction") Welcome to this tutorial on integrating Grasshopper with VIKTOR! In this tutorial, you will learn how to create a VIKTOR web app with a Grasshopper model running behind it by the following steps: 1. [Setup integration with Grasshopper](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper/.md#1-setup-integration-with-grasshopper) 2. [Build the VIKTOR app](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper/.md#2-build-the-viktor-app) 3. [Use your own Grasshopper model](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper/.md#3-use-your-own-grasshopper-model) By the end of this tutorial, you will have created a simple VIKTOR application that creates a geometry and data view of a simple box, see the image below: ![](/assets/images/tutorial_grasshopper_results-f939ef1c75b54353570a700e93960869.png) So, let's get started and learn how to create a VIKTOR app based on a Grasshopper model! ## Pre-requisites and downloads[​](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper/.md#pre-requisites-and-downloads "Direct link to Pre-requisites and downloads") Prerequisites * You have [installed VIKTOR](https://docs.viktor.ai/docs/getting-started/installation/.md) on your computer * You have some experience with reading Python code * You have some experience with Rhino/Grasshopper Required Downloads * [sample\_box\_grasshopper.gh](https://docs.viktor.ai/files/docs/grasshopper-tutorial/sample_box_grasshopper.gh) SDK version This code requires support for the GrasshopperAnalysis, which is available since SDK **v14.8.0**. Make sure use this SDK version or higher in your `requirements.txt` file. ## Explanation of setup[​](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper/.md#explanation-of-setup "Direct link to Explanation of setup") Before diving into the steps, let's explain how the integration will work. See the following diagram: ![](/assets/images/tutorial-grasshopper-integration-8c1af77e8d8dc7ea248d5be4162a43d4.png) The following will happen: 1. The user fills in input parameters in the **VIKTOR UI** 2. In **VIKTOR app.py** these input parameters will be sent together with a Grasshopper script (*sample\_box\_grasshopper.gh*) to the [worker](https://docs.viktor.ai/docs/manage-apps/software-integrations/.md). 3. The **Grasshopper worker** will run **Rhino/Grasshopper** (on your local machine), based on the Grasshopper script (*sample\_box\_grasshopper.gh*) and the input parameters. 4. The Grasshopper model generates output data, which is sent back by the **worker**. 5. In **VIKTOR app.py**, the output data is converted into a 3dm geometry file, which will be visualized in the **VIKTOR UI**. Now let's setup everything to get this running! We will go through the diagram from right to left. Rhino 8 - plug-ins & .NET In order to install some older plug-ins, you may have had to set your .NET such that it is running in .NET Framework. If you did, please change it back to the default setting (.NET Core) for the integration to work using the `SetDotNetRuntime` in the Rhino command line. ## 1. Setup integration with Grasshopper[​](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper/.md#1-setup-integration-with-grasshopper "Direct link to 1. Setup integration with Grasshopper") A worker (integration) is a program that connects a VIKTOR app with third-party software to execute tasks and send back results. In this case, the worker will start Rhino/Grasshopper with the input data and send the resulting output data back. Before we setup the worker, we must first install the Hops plugin for Grasshopper. ### Install Hops plugin[​](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper/.md#install-hops-plugin "Direct link to Install Hops plugin") Hops is a plugin for Grasshopper, which will be used to make it possible to call the Grasshopper script externally, using a local Rhino Compute server. Follow these steps to install Hops: 1. Install Hops via the Package Manager in Rhino (type `PackageManager` on the Rhino command line and search for "Hops") ![](/assets/images/tutorial_grasshopper_packagemanager-2761170ce4873aef374134a6b32e1cee.png) 2. Make sure Rhino Compute will be launched at start up. In Grasshopper, go to `File -> Preferences` and check the following settings: ![](/assets/images/tutorial_grasshopper_settings-385bbda5010d974c567821d2016996c2.png) We recommend to uncheck *Hide Rhino.Compute Console Window*, because you can then easily see if Rhino Compute is running and debug when necessary. The full documentation of Hops can be found in the [Rhino documentation](https://developer.rhino3d.com/guides/compute/hops-component/). ### Install Grasshopper worker[​](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper/.md#install-grasshopper-worker "Direct link to Install Grasshopper worker") Follow these steps to install the worker: * Personal worker * Organization worker A personal worker connects the Grasshopper installation on your own machine, for your own use. Personal workers are installed and managed with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md): 1. [Download and install VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#download-and-install-viktor-desktop) and log in with your VIKTOR account, if you haven't done so already 2. In VIKTOR Desktop, click "Add" and select **Grasshopper** 3. Configure the worker where needed and start it note Grasshopper workers that were installed with the previous per-worker installer keep running, but new personal workers can only be added through [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#migrate-existing-workers-to-viktor-desktop). An organization worker connects a Grasshopper installation on a machine managed by your organization, such as a virtual or remote machine, and is shared by the users of the app instance(s) you select. caution You need to be an environment administrator in order to install an organization worker. 1. Navigate to the "Integrations" tab in the Administrator panel 2. Click "Add integration" 3. Follow the steps provided in the modal ![](/assets/images/create-integration-admin-598d0869714267fcb7a220c370dde5df.png) 3.1. Select **Grasshopper** 3.2. Select the app instance(s) the integration should be available to 3.3. Download the worker .msi (Microsoft Installer) and run it on the machine of choice 3.4. Copy the generated **connection key** and paste it when the installer asks for it Connection Key The generated connection key **should be copied immediately** as VIKTOR will not preserve this data for security reasons. localhost port By default, the local RhinoCompute server runs on `http://localhost:6500/`, so this has been preselected in the worker setup. If you have configured RhinoCompute to a different port, please update this accordingly when configuring the worker. Once the worker is enabled in VIKTOR Desktop, the app shows whether it is connected. If you installed the worker with the per-worker installer (as used for organization workers), the worker starts up automatically after installation and you will be presented with the worker terminal in which the message: **"Successfully connected to the server"** is displayed. In the top right corner in your viktor environment you should see a green indicator in your integrations overview, see the figure below. ![](/assets/images/tutorial_dynamo_connection-66da2008601364197682b134e73f0ad2.png) Nice work! The integration is ready to use, let's test the VIKTOR app. ### (optional) Check out Grasshopper model[​](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper/.md#optional-check-out-grasshopper-model "Direct link to (optional) Check out Grasshopper model") Before we start building the app, you might be curious to know what kind of Grasshopper model we will be integrating. If you want to check out the Grasshopper model, open the Grasshopper file (`sample_box_grasshopper.gh`) with the Grasshopper plugin and this should lead to the following view: ![](/assets/images/tutorial_grasshopper_open_models-f6514c40bb49e4a054b85193ccc58281.png) Let's take some time to check out what is happening in the Grasshopper script: ![](/assets/images/tutorial_grasshopper_script-4ccb11f965a8f7f97e55b0026c389671.png) 1. Three Hops input parameters (`width`, `length` and `height`) are defined based on the `Get Number` component of [Hops](https://developer.rhino3d.com/guides/compute/hops-component/#create-a-hops-function). 2. A simple box is created based on the width, length and height, which is subsequently meshed. 3. The mesh is baked into Rhino using the `Context Bake` component of Hops. If you change the input parameters, you will see that a box is drawn in Rhino. With this setup, we are ready to run this Grasshopper file from a Python script. ## 2. Build the VIKTOR app[​](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper/.md#2-build-the-viktor-app "Direct link to 2. Build the VIKTOR app") ### Create an empty app[​](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper/.md#create-an-empty-app "Direct link to Create an empty app") Let's create, install and start an empty app. This will be the starting point for the rest of the tutorial. But before we start, make sure to shut down any app that is running (like the demo app) by closing the command-line shell (for example Powershell) or end the process using `Ctrl + C`. Follow these steps to create, install and start an empty app: 1. Open a terminal and run the following command to create the app on the VIKTOR platform and generate the initial code locally: ``` viktor-cli create-app "Grasshopper tutorial" --init --app-type editor ``` 2. Open the newly created folder in your code editor and run `viktor-cli clean-start` in the terminal to install dependencies and connect the app to the platform. If all went well, your empty app is installed and connected to your development workspace. **Do not close the terminal** as this will break the connection with your app. The terminal in your code editor should show something like this: ``` INFO : Connecting to cloud.viktor.ai... INFO : Connection is established (use Ctrl+C to close) INFO : INFO : Navigate to the link below to see your app in the browser INFO : https://cloud.viktor.ai/workspaces/XXX/app INFO : INFO : App code loaded, waiting for jobs... ``` Re-starting your app * You only need to create an app template and install it once for each new app you want to make. * The app will update automatically once you start adding code in `app.py`, as long as you don't close the terminal or your code editor. * Did you close your code editor? Use `viktor-cli start` to start the app again. No need to install, clear, etc. ### Add input fields[​](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper/.md#add-input-fields "Direct link to Add input fields") We will add 3 input fields to our app: `width`, `length` and `height` using the `NumberField`. 1. Open `app.py`, import viktor and add the relevant fields to your parametrization. In the end your `app.py` file should look like this: ``` import viktor as vkt class Parametrization(vkt.Parametrization): intro = vkt.Text("## Grasshopper app \n This app parametrically generates and visualises a 3D model of a box using a Grasshopper script. \n\n Please fill in the following parameters:") # Input fields width = vkt.NumberField('Width', default=5) length = vkt.NumberField('Length', default=6) height = vkt.NumberField('Height', default=7) class Controller(vkt.Controller): parametrization = Parametrization ``` 2. Refresh your app in the browser, and you should see the input fields appear. ### Install additional dependencies[​](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper/.md#install-additional-dependencies "Direct link to Install additional dependencies") In the next step we will need the `rhino3dm` package. To be able to use this, we have to add it as dependency in the [requirements.txt](https://docs.viktor.ai/docs/create-apps/development-tools-and-tips/use-python-packages/.md) file so that the contents look like this: ``` viktor==14.37.0 rhino3dm ``` If your terminal is still running, close the connection using Ctrl+C. Install the rhino3dm dependency: ``` viktor-cli install ``` And start your app: ``` viktor-cli start ``` ### Add the Python code to run Grasshopper[​](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper/.md#add-the-python-code-to-run-grasshopper "Direct link to Add the Python code to run Grasshopper") Now the app code can be extended to integrate the Grasshopper script. First, place the `sample_box_grasshopper.gh` file in the 'my-grasshopper-app' folder. Then change the code in `app.py` to the code below: ``` import viktor as vkt import json import rhino3dm from pathlib import Path class Parametrization(vkt.Parametrization): intro = vkt.Text("## Grasshopper app \n This app parametrically generates and visualizes a 3D model of a box using a Grasshopper script. \n\n Please fill in the following parameters:") # Input fields width = vkt.NumberField('Width', default=5) length = vkt.NumberField('Length', default=6) height = vkt.NumberField('Height', default=7) class Controller(vkt.Controller): parametrization = Parametrization @vkt.GeometryView("Geometry", duration_guess=10, x_axis_to_right=True, update_label='Run Grasshopper') def run_grasshopper(self, params, **kwargs): grasshopper_script_path = Path(__file__).parent / "sample_box_grasshopper.gh" script = vkt.File.from_path(grasshopper_script_path) input_parameters = dict(params) # Run the Grasshopper analysis and obtain the output data analysis = vkt.grasshopper.GrasshopperAnalysis(script=script, input_parameters=input_parameters) analysis.execute(timeout=30) output = analysis.get_output() # Convert output data to mesh file3dm = rhino3dm.File3dm() obj = rhino3dm.CommonObject.Decode(json.loads(output["values"][0]["InnerTree"]['{0}'][0]["data"])) file3dm.Objects.Add(obj) # Write to geometry_file geometry_file = vkt.File() file3dm.Write(geometry_file.source, version=7) return vkt.GeometryResult(geometry=geometry_file, geometry_type="3dm") ``` If you now refresh your app, you should see the following: ![](/assets/images/tutorial_grasshopper_editor-20d58c5b3dbefe0586082dba915e7e26.png) Now press the **Run Grasshopper** button (be sure that the worker, Rhino and Grasshopper are running). You should see that Rhino Compute is run by the worker which will result in the following: ![](/assets/images/tutorial_grasshopper_results-f939ef1c75b54353570a700e93960869.png) Congratulations, you now have made a VIKTOR app with a Grasshopper model running behind it! ## 3. Use your own Grasshopper model[​](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper/.md#3-use-your-own-grasshopper-model "Direct link to 3. Use your own Grasshopper model") If you would like to integrate your own Grasshopper model in VIKTOR, you can adapt the app you just created. Take the following steps: ### Extend your Grasshopper model[​](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper/.md#extend-your-grasshopper-model "Direct link to Extend your Grasshopper model") As explained in [this section](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper/.md#optional-check-out-grasshopper-model), some specific things need to be defined in the Grasshopper model to make the integration work. 1. **Connect your specific input parameters by Hops components.** In order to update the parameters via Rhino Compute, create [Hops Get Components](https://developer.rhino3d.com/guides/compute/hops-component/#defining-inputs) for the parameters you want to update. As you can see highlighted in the image below, the names need to be *exactly* the same for the integration to work. ![](/assets/images/tutorial-grasshopper-use-your-own-779724c0ab9dd558dcdd80172bb4fb97.png) 2. **Mesh your final geometry.** In order for Rhino Compute to successfully export your geometry you need to mesh it because Rhino Compute can only export a mesh. If you don't, your geometry will not appear in the environment. 3. **Add the Context Bake component.** The Grasshopper node [Context Bake](https://developer.rhino3d.com/guides/compute/hops-component/#defining-outputs) is needed to bake the model. Flatten your inputs It is recommended to flatten the inputs in your grasshopper script, especially for simpler/smaller scripts. For larger grasshopper scripts, this may still be true, but it may be more efficient to use the Tree structure as input. Want to find out more? Check out the thread on the [community](https://community.viktor.ai/t/snippet-wednesday-grasshopper-tree-inputs/1572). ### Adjust the VIKTOR app code[​](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper/.md#adjust-the-viktor-app-code "Direct link to Adjust the VIKTOR app code") In the VIKTOR app code **adjust the parametrization** to match with your required input parameters. The rest of the code should not require any changes to work. ## To infinity and beyond[​](https://docs.viktor.ai/docs/tutorials/integrate-grasshopper/.md#to-infinity-and-beyond "Direct link to To infinity and beyond") Great work! You are now able to create an app that can integrate with an external installation of Grasshopper through a Grasshopper Worker! Of course, the journey doesn't end here. Check out some of our other [tutorials](https://docs.viktor.ai/docs/tutorials/.md) or go to the [next section](https://docs.viktor.ai/docs/create-apps/.md) or try to connect your own Grasshopper script to your VIKTOR app! --- # Tutorial - AutoCAD Plant 3D info Level: **Intermediate**<br />Time: **30–45 min**<br /> Prerequisites: * A VIKTOR account with access to the App Builder, or the VIKTOR CLI for local development. * Access to an ACC project with published Plant 3D data and a viewable DWG. * An Autodesk Platform Services OAuth 2.0 integration available in your VIKTOR environment. Beta The Plant 3D integration is in Beta. Validate the generated tables, quantities and viewer highlights against your source model before using the results in a project. ## Introduction[​](https://docs.viktor.ai/docs/tutorials/integrate-plant3d/.md#introduction "Direct link to Introduction") In this tutorial, you will build apps that use published Plant 3D data from ACC / Forma to review equipment, color valves in a drawing, prepare a quantity takeoff and explore asset relationships. You will use four prompts in the App Builder, each creating a separate app with guided inputs, tables, charts and a drawing viewer. If you prefer to write Python, open the **Local development** tab to build a 3D equipment overview app step by step with the VIKTOR CLI. The complete code is included. ## 1. Set up the integration[​](https://docs.viktor.ai/docs/tutorials/integrate-plant3d/.md#1-set-up-the-integration "Direct link to 1. Set up the integration") First, you will set up the connection your apps will use to access Plant data in ACC / Forma. Follow the [APS OAuth integration setup](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-platform-services/.md#creating-an-oauth-20-integration-admin), then [connect the same APS application to ACC](https://docs.viktor.ai/docs/create-apps/software-integrations/autodesk-platform-services/.md#integration-with-autodesk-construction-cloud-acc). Next, check that your Plant project has been published to the AEC Data Model. Your apps will query these published data sets. Uploading a standalone DWG does not create a Plant data set. If you need to publish your project, follow Autodesk's [Query AutoCAD Plant 3D Project Data](https://aps.autodesk.com/en/docs/aecdatamodel/v1/tutorials/plant3d/query_plant3d_data) instructions. Existing projects Existing projects may not be processed automatically by the AEC Data Model. Publish the Plant project again, or publish an updated version, to trigger processing. Once processing is complete, [check for the published data sets in the next section](https://docs.viktor.ai/docs/tutorials/integrate-plant3d/.md#2-understand-the-two-plant-data-sets). ## 2. Understand the two Plant data sets[​](https://docs.viktor.ai/docs/tutorials/integrate-plant3d/.md#2-understand-the-two-plant-data-sets "Direct link to 2. Understand the two Plant data sets") Plant 3D publishes two main data sets to the **AEC Data Model**. Each data set is represented by an **element group** with its own **element group ID**. The app uses that ID to query its records. | Data set | What it contains | | ---------------------- | ----------------------------------------------------------------------------------------------------------- | | **P\&ID Data Set** | Process and instrumentation records, such as equipment, lines, valves, instruments and their relationships. | | **3D Piping Data Set** | 3D model records, such as pipes, fittings, valves and equipment, with their published properties. | The published data sets appear as separate entries in the ACC / Forma Files tool. A **P\&ID Data Set** looks like this: ![P\&ID Data Set entry alongside a folder in ACC / Forma](/assets/images/tutorial-plant3d-acc-pid-dataset-e8b7117bd099b917039020b519a83cb5.webp) A **3D Piping Data Set** appears alongside the published 3D drawings and folders: ![3D Piping Data Set entry alongside DWG files and folders in ACC / Forma](/assets/images/tutorial-plant3d-acc-piping-dataset-56ac0fd8d0cc1650e6bcd966988a8996.webp) Keep the default data-set names The App Builder assumes the data sets use their default names: **P\&ID Data Set** and **3D Piping Data Set**. Do not rename these entries. ## 3. Work with selections and scope[​](https://docs.viktor.ai/docs/tutorials/integrate-plant3d/.md#3-work-with-selections-and-scope "Direct link to 3. Work with selections and scope") The App Builder generates the inputs and code to read records through the **AEC Data Model API** and display the DWG with the **APS Viewer SDK**. In the apps you will build: 1. Select a DWG from the Plant project's published folders using `AutodeskFileField`. 2. The App Builder uses the file's project and folder context to find the Plant publication root and discover its P\&ID and 3D Piping data sets. 3. Choose which data set to query from a dropdown. 4. Open the viewer to display the same selected DWG. In the generated app, the DWG and data-set selections have different purposes: | You select | The app uses it to | | ------------------------------ | ------------------------------------------------------------------------------------------------------------------- | | **A DWG file in ACC / Forma** | Find the Plant publication from its project and folder context, and display that drawing in the APS viewer. | | **A published Plant data set** | Read the equipment, pipes, valves or relationships needed for the report. These records can cover several drawings. | ### 3.1. Set the report scope[​](https://docs.viktor.ai/docs/tutorials/integrate-plant3d/.md#31-set-the-report-scope "Direct link to 3.1. Set the report scope") The App Builder will use the scope specified in your prompt to determine which records the app retrieves: * **Drawing scope:** records linked to one DWG (prompt 2). * **Data-set scope:** matching records in one complete selected data set (prompts 1, 3 and 4). * **Project scope:** records across several selected data sets in a project. We recommend starting with drawing or data-set scope so you can verify the results more easily before expanding to several data sets (project scope). ## 4. Choose your approach[​](https://docs.viktor.ai/docs/tutorials/integrate-plant3d/.md#4-choose-your-approach "Direct link to 4. Choose your approach") * Prompt guide * Local development To build your first app, click the arrow on a prompt to open it in the App Builder. Before submitting the prompt, replace `[YOUR-APS-INTEGRATION-NAME-HERE]` with the exact name of your configured integration. Connect that integration in the generated app, then follow its input and button instructions. ### Prompt 1: Review equipment across one P\&ID data set[​](https://docs.viktor.ai/docs/tutorials/integrate-plant3d/.md#prompt-1-review-equipment-across-one-pid-data-set "Direct link to Prompt 1: Review equipment across one P\&ID data set") The first app creates an equipment inventory for one published P\&ID data set. The App Builder uses the prompt to generate the app's inputs, API queries and result views. The app queries the AEC Data Model API for Equipment and its child classes in the selected data set. You do not need to write the query yourself. Use the table to review asset IDs and Tags, and the bar chart to compare counts by concrete class: the specific equipment type, such as a pump or vessel. ![](/img/illustrations/app-builder-cta-background.svg) ![](/img/illustrations/app-builder-cta-logo.svg)![](/img/illustrations/app-builder-cta-logo-glow.svg) ### Plant 3D P\&ID equipment overview Create a Plant 3D P\&ID equipment overview app using the Plant 3D guide in the knowledge base. Let me select an ACC 2D P\&ID DWG file with AutodeskFileField, click "Find data sets" to discover published P\&ID Data Sets, and select one. Query only Equipment class and its subclasses through the AEC Data Model API, requesting IDs, Tag, and concrete class. Display equipment records in a VIKTOR TableView and show counts by concrete class in a Plotly bar chart. Add an APS Viewer using the APS Viewer SDK to display the selected 2D DWG. Use exactly one AutodeskFileField for both the drawing viewer and data-set discovery. Keep the equipment report scoped to the complete selected P\&ID data set. Add short vkt.Text instructions beside each input and button explaining what to select, what each button does, and the order of use. Clearly label the report scope and the drawing shown in the viewer. Use integration name "\[YOUR-APS-INTEGRATION-NAME-HERE]". When the app is ready, select a published 2D P\&ID DWG and open the viewer first. The viewer can display the drawing before you load a data set. Its colors come from the DWG; prompt 2 adds colors based on queried properties in a 3D drawing. ![Equipment overview app with ACC inputs and the selected P\&ID drawing in the APS viewer](/assets/images/tutorial-plant3d-equipment-viewer-a2e413db1c3d836842a6300c32ba4480.webp) Click **Find data sets**, choose a **P\&ID Data Set**, then load the equipment. Open the table to inspect Tags and classes across the selected data set. Open the chart to compare the equipment counts by concrete class. It uses the same records as the table. ![Equipment overview app with ACC inputs beside the equipment count chart](/assets/images/tutorial-plant3d-equipment-counts-95e23a9f99f233f08d10ae12b6aaa735.webp) The report covers the selected data set even when the viewer shows only one of its drawings. To request a drawing-only equipment report, replace the scope instruction with: **“Retrieve only equipment linked to the selected DWG.”** ### Prompt 2: Color valves in one drawing[​](https://docs.viktor.ai/docs/tutorials/integrate-plant3d/.md#prompt-2-color-valves-in-one-drawing "Direct link to Prompt 2: Color valves in one drawing") Build a valve review app for one 3D Plant drawing. Review valve properties in a table, compare counts by body type in a pie chart, and locate the valves by color in the APS viewer. The table, pie chart and viewer use the same valves linked to the selected DWG. Each body type has one color, shared by the chart and viewer legend. ![](/img/illustrations/app-builder-cta-background.svg) ![](/img/illustrations/app-builder-cta-logo.svg)![](/img/illustrations/app-builder-cta-logo-glow.svg) ### Plant 3D valve overview Create a Plant 3D valve overview using the Plant 3D guide in the App Builder and my APS OAuth 2.0 integration "\[YOUR-APS-INTEGRATION-NAME-HERE]". Let me select an ACC DWG with AutodeskFileField, click Find data sets and select its 3D Piping Data Set. Use the AEC Data Model API to retrieve only valves linked to that drawing and their PnP ID, Tag, Spec and published Valve Body Type. Show a VIKTOR table and a Plotly count pie chart grouped by body type. Add a viewer using the APS Viewer SDK and color the drawing’s valves with the same color map as the chart. Resolve published property IDs and verified source-to-viewer mappings. Label missing body types “Not specified” and report unmapped valves. Never replace empty drawing results with the full data set. Add short vkt.Text instructions for every input and button, including the order of use and drawing scope. When the app is ready, select the DWG and data set, then retrieve the valves. If the generated app has separate viewer setup buttons, load the available 3D views, select the display and property views, then load the viewer map. This connects the report records to the objects that can be colored. ![Plant 3D drawing with valves colored by body type in the APS Viewer SDK](/assets/images/tutorial-plant3d-valve-colors-1cc9525ee5feae86575f2254567ddca1.webp) Open the pie chart to compare valve body types in the selected drawing. ![Valve body type pie chart with colors shared by the drawing viewer](/assets/images/tutorial-plant3d-valve-chart-9e7a77ba84ee009f4bdbfc9d438aa9cd.webp) If you find “Not specified” in the results, the property is missing. If you find “Unmapped”, the report record could not be matched to a viewer object. Keep these records visible in the table even when they cannot receive a viewer color. ### Prompt 3: Prepare a data-set quantity takeoff[​](https://docs.viktor.ai/docs/tutorials/integrate-plant3d/.md#prompt-3-prepare-a-data-set-quantity-takeoff "Direct link to Prompt 3: Prepare a data-set quantity takeoff") The next example creates a quantity takeoff app for a 3D Piping Data Set. Use it to total pipe lengths by their assigned piping specification (**Spec**) and nominal pipe size (**nominal diameter**), and count fittings and valves by concrete class. Review the quantities in VIKTOR tables and Plotly charts. The report covers the complete selected data set, while the viewer displays one DWG. ![](/img/illustrations/app-builder-cta-background.svg) ![](/img/illustrations/app-builder-cta-logo.svg)![](/img/illustrations/app-builder-cta-logo-glow.svg) ### Plant 3D quantity takeoff Create a Plant 3D quantity takeoff app using the Plant 3D guide in the knowledge base. Use my "\[YOUR-APS-INTEGRATION-NAME-HERE]" integration. Let me select an ACC DWG with AutodeskFileField, click Find data sets and select one 3D Piping Data Set. Query pipes, fittings and valves through the AEC Data Model API with only the properties needed for the report. Show pipe lengths grouped by Spec and nominal diameter, and component counts by concrete class, in VIKTOR tables and Plotly charts. Add a viewer using the APS Viewer SDK for the selected DWG. Keep the report scoped to the complete selected data set, independently of the viewer drawing. Use published Length units, count each source asset once and keep missing or invalid values visible alongside valid totals. Add short vkt.Text instructions for every input and button, including the order of use and report scope. When the app is ready, select a data set and generate the report. Inspect the contributing records and their published units before using the totals. A missing length does not remove a pipe from the record count, and an invalid value must not hide valid subtotals. ![Plant 3D quantity takeoff app with independent DWG viewer and data-set report controls](/assets/images/tutorial-plant3d-qto-viewer-951ebd78e4f6fd1d58036aaa25b6e7cf.webp) Open the pipe-length chart to compare specifications and sizes. Component counts are a separate quantity; they are not added to pipe lengths. ![VIKTOR QTO app showing its data-set inputs beside the pipe-length chart](/assets/images/tutorial-plant3d-qto-lengths-d3fec683ec776ed9fd942a7805260d61.webp) The component chart covers the selected data set. Its valve count can therefore differ from the drawing-only count in prompt 2. ![VIKTOR QTO app showing its data-set inputs beside the fitting and valve count chart](/assets/images/tutorial-plant3d-qto-components-15746ec64684b26f928c31ee49455fe7.webp) ### Prompt 4: Explore asset relationships across a data set[​](https://docs.viktor.ai/docs/tutorials/integrate-plant3d/.md#prompt-4-explore-asset-relationships-across-a-data-set "Direct link to Prompt 4: Explore asset relationships across a data set") The final example creates an asset relationship explorer for a Plant 3D data set. Find an asset by its Tag, review related objects and their roles in a VIKTOR table, and see the connections in a Plotly diagram. Use the APS viewer to inspect the selected DWG. The table and diagram use relationships from the selected data set. Choose how far to follow them with the depth input: one **hop** follows one relationship link, while four hops can reach objects through up to four links. ![](/img/illustrations/app-builder-cta-background.svg) ![](/img/illustrations/app-builder-cta-logo.svg)![](/img/illustrations/app-builder-cta-logo-glow.svg) ### Plant 3D asset relationship explorer Create a Plant 3D asset relationship explorer using the Plant 3D guide in the knowledge base and integration "\[YOUR-APS-INTEGRATION-NAME-HERE]". Let me select an ACC DWG with AutodeskFileField, click Find data sets and select a published Plant 3D data set. Let me enter an asset Tag and select the matching asset if several share that Tag. Add a relationship depth input from 1 to 5 hops, defaulting to 4, and expand from each newly found peer within the same data set. Use only verified published relationship classes and endpoint roles. Avoid repeated expansion of visited assets and duplicate edges. Show both endpoints in a VIKTOR TableView with their PnP IDs, Tags, classes, roles, relationship type and hop depth. Show the selected asset and its related objects in a Plotly diagram with distinct symbols by asset class, colors by relationship type, labelled connections and source properties on hover. Keep unresolved endpoints visible and do not infer flow direction or physical routing. Set a node limit and clearly report when results are limited. Add an independent DWG viewer using the APS Viewer SDK. Add short vkt.Text instructions for each input and button, and explain that relationships cover the selected data set while the viewer displays the selected drawing. When the app is ready, select the DWG and data set, enter an asset Tag, then find and select the matching asset. Open the DWG viewer to inspect the drawing. ![Plant 3D relationship app with inputs beside the independent APS drawing viewer](/assets/images/tutorial-plant3d-relationships-viewer-23c3c87342365b48a6a9bdf184adf80b.webp) Choose how many relationship links to follow and how many objects to show, then explore the results. The table lists the related objects and their roles. Use the graph to see how they connect, and hover over an object to view its properties. ![Plant 3D relationship app with asset selection, depth controls and a Plotly graph](/assets/images/tutorial-plant3d-relationships-graph-7228a924326f7ff07fd95ba72f78e8b5.webp) A higher depth does not guarantee more results: expansion stops when there are no new peers or the node limit is reached. The graph shows published relationships, not pipe routing or flow direction. ### Create a new VIKTOR app[​](https://docs.viktor.ai/docs/tutorials/integrate-plant3d/.md#create-a-new-viktor-app "Direct link to Create a new VIKTOR app") tip Want to start with the finished app? Jump to the [complete app.py](https://docs.viktor.ai/docs/tutorials/integrate-plant3d/.md#complete-code). The phases below build that same file step by step. Let's build a 3D version of the equipment app from prompt 1. This example uses a **3D Piping Data Set** instead of a P\&ID Data Set. Select a 3D Plant DWG for the viewer, discover the project's published data sets, then choose a 3D Piping Data Set. Load its equipment into a table and a class-count chart. The report covers the selected data set; the viewer displays the selected 3D drawing. Keep all Python code in one `app.py`. In later blocks, `...` marks code from an earlier phase. Keep that code instead of replacing it with dots. Highlighted lines show what you add. [Install the VIKTOR CLI](https://docs.viktor.ai/docs/getting-started/installation/.md) if needed, then create an editor app: ``` viktor-cli create-app "Plant 3D Equipment Tutorial" --init --app-type editor --registered-name plant3d-equipment-tutorial ``` Open the new app folder in your code editor. ### Configure the app and dependencies[​](https://docs.viktor.ai/docs/tutorials/integrate-plant3d/.md#configure-the-app-and-dependencies "Direct link to Configure the app and dependencies") Keep your registered name if you chose a different one. Replace the integration placeholder with the exact OAuth integration name configured in your VIKTOR environment: viktor.config.toml ``` app_type = "editor" python_version = "3.12" registered_name = "plant3d-equipment-tutorial" oauth2_integrations = ["[YOUR-APS-INTEGRATION-NAME-HERE]"] ``` Add these packages to `requirements.txt`: requirements.txt ``` viktor==14.37.0 requests==2.32.5 plotly>=5.24,<7 aps-viewer-sdk==0.1.4 ``` VIKTOR provides the inputs, buttons and result views. Requests reads the Autodesk APIs, Plotly creates the chart, and the APS Viewer SDK displays the DWG. ### 1. Add the inputs and app structure[​](https://docs.viktor.ai/docs/tutorials/integrate-plant3d/.md#1-add-the-inputs-and-app-structure "Direct link to 1. Add the inputs and app structure") Start `app.py` with the imports, selection helpers and inputs below. Replace `OAUTH2_INTEGRATION` with the same integration name used in the configuration. The file picker selects a DWG. **Find data sets** fills a separate dropdown, and **Load equipment** retrieves the report. Hidden fields keep discovered choices and report rows between button clicks. The buttons will call the Controller methods added in the next phases. app.py ``` import json from collections import Counter from collections.abc import Iterator from datetime import datetime, timezone from typing import Any from urllib.parse import quote import plotly.graph_objects as go import requests import viktor as vkt from aps_viewer_sdk import APSViewer OAUTH2_INTEGRATION = "[YOUR-APS-INTEGRATION-NAME-HERE]" NO_DATASET = "__choose_dataset__" def selection_key(params: Any) -> list[str]: selected = params.plant_drawing return [selected.project_id, selected.urn, params.plant_dataset or ""] if selected else [] def dataset_choices(params: Any, **kwargs: Any) -> list[Any]: discovery = json.loads(params.datasets_json or "{}") selected = params.plant_drawing key = [selected.project_id, selected.urn] if selected else [] options = discovery.get("groups", []) if discovery.get("drawing") == key else [] choices = [vkt.OptionListElement(NO_DATASET, label="Choose a data set")] choices += [vkt.OptionListElement(item["id"], label=item["label"]) for item in options] if params.plant_dataset and params.plant_dataset not in {item.value for item in choices}: choices.append(vkt.OptionListElement(params.plant_dataset, label="Saved selection: click Find data sets")) return choices class Parametrization(vkt.Parametrization): intro = vkt.Text("# Plant 3D equipment overview\nReview equipment across one published 3D Piping Data Set. The drawing viewer is independent.") drawing_help = vkt.Text("**1. Select a drawing.** Browse to a published Plant DWG in ACC. This file supplies the project context and the viewer.") plant_drawing = vkt.AutodeskFileField("ACC DWG", oauth2_integration=OAUTH2_INTEGRATION) discover_help = vkt.Text("**2. Find data sets.** Discover the 3D Piping Data Sets published for this Plant project.") find = vkt.SetParamsButton("Find data sets", method="find_datasets", longpoll=True) dataset_help = vkt.Text("**3. Select one data set.** Equipment records and class counts cover this complete data set, not only the selected drawing.") plant_dataset = vkt.OptionField("3D Piping Data Set", options=dataset_choices, default=NO_DATASET) load_help = vkt.Text("**4. Load equipment.** Read equipment IDs, Tags and concrete classes, then open the table or chart. Load again after changing a source selection.") load = vkt.SetParamsButton("Load equipment", method="load_equipment", longpoll=True) viewer_help = vkt.Text("**Drawing viewer.** Open Selected drawing after choosing a DWG. The viewer works without loading equipment; it does not restrict the report.") status_text = vkt.HiddenField("Status") status = vkt.OutputField("Report status", value=vkt.Lookup("status_text")) datasets_json = vkt.HiddenField("Data set choices") report_json = vkt.HiddenField("Equipment report") class Controller(vkt.Controller): parametrization = Parametrization ``` ### 2. Connect to the Autodesk APIs[​](https://docs.viktor.ai/docs/tutorials/integrate-plant3d/.md#2-connect-to-the-autodesk-apis "Direct link to 2. Connect to the Autodesk APIs") Add these constants and functions above `selection_key()`. `gql()` sends a request to the AEC Data Model API. `pages()` follows each returned cursor so the app reads all matching records. app.py ``` ... AEC_GRAPHQL_URL = "https://developer.api.autodesk.com/aec/graphql" PUBLICATION_FOLDERS = {"pid_dwg", "plant_3d_models"} DATASET_NAMES = {"3D Piping Data Set"} HUBS_QUERY = 'query PlantHubs($pagination: PaginationInput) { hubs(pagination: $pagination) { pagination { cursor } results { id } } }' PROJECTS_QUERY = 'query PlantProjects($hubId: ID!, $pagination: PaginationInput) { projects(hubId: $hubId, pagination: $pagination) { pagination { cursor } results { id alternativeIdentifiers { dataManagementAPIProjectId } } } }' FOLDERS_QUERY = 'query PlantFolders($projectId: ID!, $folderId: ID!, $pagination: PaginationInput) { foldersByFolder(projectId: $projectId, folderId: $folderId, pagination: $pagination) { pagination { cursor } results { id name } } }' GROUPS_QUERY = 'query PlantDatasetGroups( $projectId: ID!, $folderId: ID!, $filter: ElementGroupFilterInput, $pagination: PaginationInput ) { elementGroupsByFolder( projectId: $projectId, folderId: $folderId, filter: $filter, pagination: $pagination ) { pagination { cursor } results { id name alternativeIdentifiers { fileUrn fileVersionUrn } } } }' DEFINITIONS_QUERY = 'query PlantDefinitions($groupId: ID!, $pagination: PaginationInput) { propertyDefinitionsByElementGroup( elementGroupId: $groupId, pagination: $pagination ) { pagination { cursor } results { id name specification units { name } } } }' ELEMENTS_QUERY = 'query PlantElements( $groupId: ID!, $filter: ElementFilterInput, $pagination: PaginationInput, $propertyFilter: PropertyFilterInput ) { elementsByElementGroup( elementGroupId: $groupId, filter: $filter, pagination: $pagination ) { pagination { cursor } results { id name alternativeIdentifiers { externalElementId } properties(filter: $propertyFilter, pagination: {limit: 100}) { pagination { cursor } results { name value displayValue definition { id name specification units { name } } } } } } }' PROPERTIES_QUERY = 'query PlantProperties( $elementId: ID!, $propertyFilter: PropertyFilterInput, $pagination: PaginationInput ) { elementAtTip(elementId: $elementId) { properties(filter: $propertyFilter, pagination: $pagination) { pagination { cursor } results { name value displayValue definition { id name specification units { name } } } } } }' def gql( query: str, token: str, region: str, variables: dict[str, Any] ) -> dict[str, Any]: response = requests.post( AEC_GRAPHQL_URL, headers={ "Authorization": f"Bearer {token}", "Content-Type": "application/json", "Region": region, }, json={"query": query, "variables": variables}, timeout=60, ) response.raise_for_status() body = response.json() if body.get("errors"): messages = [error.get("message", "Unknown error") for error in body["errors"]] raise RuntimeError("AEC query failed: " + "; ".join(messages)) data = body.get("data") if not isinstance(data, dict): raise RuntimeError("AEC query returned no data object.") return data def pages( query: str, path: tuple[str, ...], token: str, region: str, variables: dict[str, Any], limit: int = 25, cursor: str | None = None, ) -> Iterator[dict[str, Any]]: seen = {cursor} if cursor else set() while True: pagination: dict[str, Any] = {"limit": limit} if cursor: pagination["cursor"] = cursor block = gql(query, token, region, {**variables, "pagination": pagination}) for key in path: block = block[key] if not isinstance(block, dict) or not isinstance(block.get("results"), list): raise RuntimeError("AEC query returned no result page.") yield from block["results"] cursor = block["pagination"]["cursor"] if not cursor: return if cursor in seen: raise RuntimeError("AEC query returned a repeated cursor.") seen.add(cursor) ``` ### 3. Find the published data sets[​](https://docs.viktor.ai/docs/tutorials/integrate-plant3d/.md#3-find-the-published-data-sets "Direct link to 3. Find the published data sets") Add these module functions above `selection_key()`. They locate the selected DWG's Plant project and find its published 3D Piping Data Sets. This discovery reads publication metadata; it does not load the project's equipment records. app.py ``` ... def dm_get(path: str, token: str) -> dict[str, Any]: response = requests.get( "https://developer.api.autodesk.com/data/v1/" + path, headers={"Authorization": f"Bearer {token}"}, timeout=60, ) response.raise_for_status() return response.json() def parent_id(resource: dict[str, Any]) -> str | None: parent = resource.get("relationships", {}).get("parent", {}).get("data") return parent.get("id") if isinstance(parent, dict) else None def plant_root(selected: Any, token: str) -> str: prefix = f"projects/{quote(selected.project_id, safe='')}/" item = dm_get(prefix + "items/" + quote(selected.urn, safe=""), token)["data"] folder_id = parent_id(item) seen: set[str] = set() while folder_id and len(seen) < 12: if folder_id in seen: raise vkt.UserError("The drawing folder path contains a cycle.") seen.add(folder_id) folder = dm_get(prefix + "folders/" + quote(folder_id, safe=""), token)["data"] parent = parent_id(folder) if folder["attributes"]["name"].casefold() in PUBLICATION_FOLDERS: if not parent: break return parent folder_id = parent raise vkt.UserError( "Select a published DWG below PID_DWG or Plant_3D_Models. " "This app cannot locate a Plant project for this file." ) def aec_project_id(token: str, region: str, dm_project_id: str) -> str: for hub in pages(HUBS_QUERY, ("hubs",), token, region, {}, limit=20): for project in pages( PROJECTS_QUERY, ("projects",), token, region, {"hubId": hub["id"]}, limit=20, ): alternative = project.get("alternativeIdentifiers") or {} if alternative.get("dataManagementAPIProjectId") == dm_project_id: return project["id"] raise vkt.UserError("The selected ACC project is not available in AEC Data Model.") def discover_datasets(params: Any, token: str) -> tuple[str, list[dict[str, Any]]]: selected = params.plant_drawing if not selected: raise vkt.UserError("Select a Plant drawing first.") version = selected.get_latest_version(token) if not str(version.attributes.get("displayName", "")).lower().endswith(".dwg"): raise vkt.UserError("Select a Plant DWG file.") region = selected.get_region(token) root_id = plant_root(selected, token) project_id = aec_project_id(token, region, selected.project_id) groups: dict[str, dict[str, Any]] = {} for folder in pages( FOLDERS_QUERY, ("foldersByFolder",), token, region, {"projectId": project_id, "folderId": root_id}, ): if folder["name"].casefold() not in PUBLICATION_FOLDERS: continue for group in pages( GROUPS_QUERY, ("elementGroupsByFolder",), token, region, {"projectId": project_id, "folderId": folder["id"], "filter": {"searchType": "ALL"}}, ): if group["name"] in DATASET_NAMES: groups[group["id"]] = {**group, "folderName": folder["name"]} if not groups: raise vkt.UserError("No published Plant data set was found for this drawing's project.") return region, list(groups.values()) ``` Now add `find_datasets()` inside the existing Controller. It saves the choices for the dropdown and clears the previous report when discovery runs again: app.py ``` class Parametrization(vkt.Parametrization): ... class Controller(vkt.Controller): parametrization = Parametrization ... def find_datasets(self, params: Any, **kwargs: Any) -> Any: token = vkt.external.OAuth2Integration(OAUTH2_INTEGRATION).get_access_token() region, groups = discover_datasets(params, token) drawing = params.plant_drawing choices = [{"id": group["id"], "label": f"{group['folderName']} / {group['name']}"} for group in groups] return vkt.SetParamsResult({ "datasets_json": json.dumps({"drawing": [drawing.project_id, drawing.urn], "region": region, "groups": choices}), "plant_dataset": NO_DATASET, "report_json": "{}", "status_text": "Select a 3D Piping Data Set, then click Load equipment.", }) ``` ### 4. Load equipment from the selected data set[​](https://docs.viktor.ai/docs/tutorials/integrate-plant3d/.md#4-load-equipment-from-the-selected-data-set "Direct link to 4. Load equipment from the selected data set") Add these module functions above `selection_key()`. The first reads the published property dictionary. The second retrieves matching elements and follows both element and property pages. app.py ``` ... def definitions(token: str, region: str, group_id: str) -> list[dict[str, Any]]: return list(pages( DEFINITIONS_QUERY, ("propertyDefinitionsByElementGroup",), token, region, {"groupId": group_id}, limit=100, )) def elements( token: str, region: str, group_id: str, rsql: str | None = None, verified_display_names: list[str] | None = None, page_size: int = 25, ) -> list[dict[str, Any]]: property_filter = {"names": verified_display_names} if verified_display_names is not None else None variables = { "groupId": group_id, "filter": {"query": rsql} if rsql else None, "propertyFilter": property_filter, } output: dict[str, dict[str, Any]] = {} for element in pages( ELEMENTS_QUERY, ("elementsByElementGroup",), token, region, variables, limit=page_size, ): block = element["properties"] properties = list(block["results"]) cursor = block["pagination"]["cursor"] if cursor: properties.extend(pages( PROPERTIES_QUERY, ("elementAtTip", "properties"), token, region, {"elementId": element["id"], "propertyFilter": property_filter}, limit=100, cursor=cursor, )) if not properties: raise RuntimeError( "An element has no extracted properties. Check the property filter and publication." ) element["properties"] = {"results": properties} if element["id"] in output and output[element["id"]] != element: raise RuntimeError("An element changed during extraction. Run the scan again.") output[element["id"]] = element return list(output.values()) ``` Add the following property and identity helpers below them. They read values by their full property ID, identify the concrete class and count each logical equipment asset once. app.py ``` ... def property_id(key: str) -> str: return f"autodesk.plant3d.parameter:{key}-1.0.0" def literal(value: str) -> str: return "'" + value.replace("\\", "\\\\").replace("'", "\\'") + "'" def selector(key: str) -> str: return "property.id." + property_id(key) def class_filter(class_token: str) -> str: return f"{selector('tableNames')}=contains={literal(class_token)}" def property_record(element: dict[str, Any], definition_id: str) -> dict[str, Any] | None: matches = [ prop for prop in element["properties"]["results"] if prop["definition"]["id"] == definition_id ] if len(matches) > 1: raise ValueError(f"Ambiguous property {definition_id} on {element['id']}.") return matches[0] if matches else None def raw(element: dict[str, Any], key: str) -> Any: prop = property_record(element, property_id(key)) return prop["value"] if prop else None def missing_value(value: Any) -> bool: return value is None or (isinstance(value, str) and value.strip().lower() in {"", "null"}) def class_name(element: dict[str, Any]) -> str | None: value = raw(element, "pnpClassName") if not missing_value(value): return str(value).strip() chain = raw(element, "tableNames") if isinstance(chain, str) and not missing_value(chain): return next((part.strip() for part in chain.split(",") if part.strip()), None) value = raw(element, "className") return None if missing_value(value) else str(value).strip() def plant_id(value: Any) -> str | None: if isinstance(value, bool): return None if isinstance(value, int): return str(value) if value > 0 else None if isinstance(value, str) and value.isascii() and value.isdigit() and int(value) > 0: return str(int(value)) return None def unique_assets(rows: list[dict[str, Any]]) -> dict[str, dict[str, Any]]: result: dict[str, dict[str, Any]] = {} for row in rows: key = plant_id(raw(row, "pnpId")) if key is None: raise ValueError(f"Missing or invalid pnpId on {row['id']}.") if key in result and result[key]["id"] != row["id"]: raise ValueError(f"More than one element has pnpId {key} in this group.") result[key] = row return result ``` The equipment query uses `Table Names` with `=contains=` because that property contains an object's class inheritance chain. This includes Equipment and its child classes. Add `load_equipment()` inside Controller. It requests the identity, class and Tag properties, then saves the rows for the table and chart: app.py ``` class Parametrization(vkt.Parametrization): ... class Controller(vkt.Controller): parametrization = Parametrization ... def load_equipment(self, params: Any, **kwargs: Any) -> Any: drawing = params.plant_drawing discovery = json.loads(params.datasets_json or "{}") key = [drawing.project_id, drawing.urn] if drawing else [] if not key or discovery.get("drawing") != key: raise vkt.UserError("Select a DWG and click Find data sets.") group = next((item for item in discovery.get("groups", []) if item["id"] == params.plant_dataset), None) if group is None: raise vkt.UserError("Select a discovered 3D Piping Data Set.") token = vkt.external.OAuth2Integration(OAUTH2_INTEGRATION).get_access_token() dictionary = definitions(token, discovery["region"], group["id"]) required = {property_id(key) for key in ("pnpId", "pnpClassName", "tableNames")} if required - {item["id"] for item in dictionary}: raise vkt.UserError("The data set is missing Plant identity or class definitions.") wanted = required | {property_id("tag"), property_id("className")} names = sorted({item["name"] for item in dictionary if item["id"] in wanted}) source = elements(token, discovery["region"], group["id"], class_filter("Equipment"), names, page_size=500) rows = [{"id": row["id"], "pnp_id": raw(row, "pnpId"), "tag": raw(row, "tag"), "class": class_name(row)} for row in unique_assets(source).values()] missing = " Tag is not published." if property_id("tag") not in {item["id"] for item in dictionary} else "" report = {"selection": selection_key(params), "label": group["label"], "rows": rows, "loaded_at": datetime.now(timezone.utc).isoformat(), "note": missing} return vkt.SetParamsResult({"report_json": json.dumps(report), "status_text": f"Data set scope: {group['label']} | {len(rows)} equipment records.{missing}"}) ``` ### 5. Add the equipment table and chart[​](https://docs.viktor.ai/docs/tutorials/integrate-plant3d/.md#5-add-the-equipment-table-and-chart "Direct link to 5. Add the equipment table and chart") Add these methods inside the same Controller. `loaded()` checks that the saved report matches the current selections. Both views use those same saved rows, so switching tabs does not repeat the Autodesk query. app.py ``` class Parametrization(vkt.Parametrization): ... class Controller(vkt.Controller): parametrization = Parametrization ... def loaded(self, params: Any) -> dict[str, Any]: report = json.loads(params.report_json or "{}") if report and report.get("selection") != selection_key(params): raise vkt.UserError("Source selection changed. Find data sets and load equipment again.") return report @vkt.TableView("Equipment records - data set", duration_guess=1) def equipment_table(self, params: Any, **kwargs: Any) -> Any: report = self.loaded(params) rows = [[row["id"], row["pnp_id"], row["tag"], row["class"]] for row in report.get("rows", [])] if not rows: message = "No equipment found in the selected data set." if report else "Select a data set and click Load equipment." rows = [[None, None, None, message]] return vkt.TableResult(rows, column_headers=["AEC ID", "PnP ID", "Tag", "Concrete class"]) @vkt.PlotlyView("Equipment counts - data set", duration_guess=1) def equipment_chart(self, params: Any, **kwargs: Any) -> Any: report = self.loaded(params) counts = Counter(row["class"] or "Not specified" for row in report.get("rows", [])) labels = sorted(counts, key=lambda label: (-counts[label], label)) figure = go.Figure(go.Bar(x=labels, y=[counts[label] for label in labels], text=[counts[label] for label in labels], textposition="outside", marker_color="#007bc2")) figure.update_layout(title="Equipment count by concrete class", template="plotly_white", xaxis_title="Concrete class", yaxis_title="Equipment count", yaxis={"dtick": 1}) if not report: figure.add_annotation(text="Select a data set and click Load equipment.", showarrow=False, x=0.5, y=0.5, xref="paper", yref="paper") elif not counts: figure.add_annotation(text="No equipment found in the selected data set.", showarrow=False, x=0.5, y=0.5, xref="paper", yref="paper") return vkt.PlotlyResult(figure.to_json()) ``` ### 6. Add the independent drawing viewer[​](https://docs.viktor.ai/docs/tutorials/integrate-plant3d/.md#6-add-the-independent-drawing-viewer "Direct link to 6. Add the independent drawing viewer") Add this WebView method inside Controller. It only needs the selected DWG and a current access token. It can display the model before data-set discovery or equipment loading. app.py ``` class Parametrization(vkt.Parametrization): ... class Controller(vkt.Controller): parametrization = Parametrization ... @vkt.WebView("Selected drawing - independent", duration_guess=20) def drawing(self, params: Any, **kwargs: Any) -> Any: selected = params.plant_drawing if not selected: return vkt.WebResult(html="<p>Select an ACC DWG to open the drawing viewer.</p>") token = vkt.external.OAuth2Integration(OAUTH2_INTEGRATION).get_access_token() version = selected.get_latest_version(token) if not str(version.attributes.get("displayName", "")).lower().endswith(".dwg"): raise vkt.UserError("Select a DWG file.") viewer = APSViewer(urn=version.urn, token=token, region=selected.get_region(token), views_selector=True) return vkt.WebResult(html=viewer.write()) ``` This viewer uses the DWG's source colors. Prompt 2 adds the record-to-viewer mapping needed to apply colors from queried properties. ### 7. Run the app[​](https://docs.viktor.ai/docs/tutorials/integrate-plant3d/.md#7-run-the-app "Direct link to 7. Run the app") After adding all the code, run this command from your app folder: ``` viktor-cli clean-start ``` Open the development URL printed by the CLI, then: 1. Connect your configured Autodesk integration. 2. Select a published Plant DWG in ACC. 3. Open **Selected drawing** and choose **3D View** to inspect the model first. 4. Click **Find data sets** and select one **3D Piping Data Set**. 5. Click **Load equipment**, then open the equipment table and chart. ![Plant 3D model displayed by the CLI example before reviewing the equipment report](/assets/images/tutorial-plant3d-local-model-9eb6e5c705e72d97d45c3e0c24137c53.webp) ![CLI equipment overview showing the selected data set and live equipment records](/assets/images/tutorial-plant3d-local-equipment-e88d642a973303237ed804640848f5da.webp) ![CLI chart showing the equipment count for each concrete class](/assets/images/tutorial-plant3d-local-counts-5de8031b680e9c316d0244568ef2378b.webp) After changing a source selection, find the data sets and load the equipment again. Empty equipment results remain valid results; they do not trigger a broader project scan. ### Complete code[​](https://docs.viktor.ai/docs/tutorials/integrate-plant3d/.md#complete-code "Direct link to Complete code") Show complete app.py app.py ``` import json from collections import Counter from collections.abc import Iterator from datetime import datetime, timezone from typing import Any from urllib.parse import quote import plotly.graph_objects as go import requests import viktor as vkt from aps_viewer_sdk import APSViewer OAUTH2_INTEGRATION = "[YOUR-APS-INTEGRATION-NAME-HERE]" NO_DATASET = "__choose_dataset__" AEC_GRAPHQL_URL = "https://developer.api.autodesk.com/aec/graphql" PUBLICATION_FOLDERS = {"pid_dwg", "plant_3d_models"} DATASET_NAMES = {"3D Piping Data Set"} HUBS_QUERY = 'query PlantHubs($pagination: PaginationInput) { hubs(pagination: $pagination) { pagination { cursor } results { id } } }' PROJECTS_QUERY = 'query PlantProjects($hubId: ID!, $pagination: PaginationInput) { projects(hubId: $hubId, pagination: $pagination) { pagination { cursor } results { id alternativeIdentifiers { dataManagementAPIProjectId } } } }' FOLDERS_QUERY = 'query PlantFolders($projectId: ID!, $folderId: ID!, $pagination: PaginationInput) { foldersByFolder(projectId: $projectId, folderId: $folderId, pagination: $pagination) { pagination { cursor } results { id name } } }' GROUPS_QUERY = 'query PlantDatasetGroups( $projectId: ID!, $folderId: ID!, $filter: ElementGroupFilterInput, $pagination: PaginationInput ) { elementGroupsByFolder( projectId: $projectId, folderId: $folderId, filter: $filter, pagination: $pagination ) { pagination { cursor } results { id name alternativeIdentifiers { fileUrn fileVersionUrn } } } }' DEFINITIONS_QUERY = 'query PlantDefinitions($groupId: ID!, $pagination: PaginationInput) { propertyDefinitionsByElementGroup( elementGroupId: $groupId, pagination: $pagination ) { pagination { cursor } results { id name specification units { name } } } }' ELEMENTS_QUERY = 'query PlantElements( $groupId: ID!, $filter: ElementFilterInput, $pagination: PaginationInput, $propertyFilter: PropertyFilterInput ) { elementsByElementGroup( elementGroupId: $groupId, filter: $filter, pagination: $pagination ) { pagination { cursor } results { id name alternativeIdentifiers { externalElementId } properties(filter: $propertyFilter, pagination: {limit: 100}) { pagination { cursor } results { name value displayValue definition { id name specification units { name } } } } } } }' PROPERTIES_QUERY = 'query PlantProperties( $elementId: ID!, $propertyFilter: PropertyFilterInput, $pagination: PaginationInput ) { elementAtTip(elementId: $elementId) { properties(filter: $propertyFilter, pagination: $pagination) { pagination { cursor } results { name value displayValue definition { id name specification units { name } } } } } }' def gql( query: str, token: str, region: str, variables: dict[str, Any] ) -> dict[str, Any]: response = requests.post( AEC_GRAPHQL_URL, headers={ "Authorization": f"Bearer {token}", "Content-Type": "application/json", "Region": region, }, json={"query": query, "variables": variables}, timeout=60, ) response.raise_for_status() body = response.json() if body.get("errors"): messages = [error.get("message", "Unknown error") for error in body["errors"]] raise RuntimeError("AEC query failed: " + "; ".join(messages)) data = body.get("data") if not isinstance(data, dict): raise RuntimeError("AEC query returned no data object.") return data def pages( query: str, path: tuple[str, ...], token: str, region: str, variables: dict[str, Any], limit: int = 25, cursor: str | None = None, ) -> Iterator[dict[str, Any]]: seen = {cursor} if cursor else set() while True: pagination: dict[str, Any] = {"limit": limit} if cursor: pagination["cursor"] = cursor block = gql(query, token, region, {**variables, "pagination": pagination}) for key in path: block = block[key] if not isinstance(block, dict) or not isinstance(block.get("results"), list): raise RuntimeError("AEC query returned no result page.") yield from block["results"] cursor = block["pagination"]["cursor"] if not cursor: return if cursor in seen: raise RuntimeError("AEC query returned a repeated cursor.") seen.add(cursor) def dm_get(path: str, token: str) -> dict[str, Any]: response = requests.get( "https://developer.api.autodesk.com/data/v1/" + path, headers={"Authorization": f"Bearer {token}"}, timeout=60, ) response.raise_for_status() return response.json() def parent_id(resource: dict[str, Any]) -> str | None: parent = resource.get("relationships", {}).get("parent", {}).get("data") return parent.get("id") if isinstance(parent, dict) else None def plant_root(selected: Any, token: str) -> str: prefix = f"projects/{quote(selected.project_id, safe='')}/" item = dm_get(prefix + "items/" + quote(selected.urn, safe=""), token)["data"] folder_id = parent_id(item) seen: set[str] = set() while folder_id and len(seen) < 12: if folder_id in seen: raise vkt.UserError("The drawing folder path contains a cycle.") seen.add(folder_id) folder = dm_get(prefix + "folders/" + quote(folder_id, safe=""), token)["data"] parent = parent_id(folder) if folder["attributes"]["name"].casefold() in PUBLICATION_FOLDERS: if not parent: break return parent folder_id = parent raise vkt.UserError( "Select a published DWG below PID_DWG or Plant_3D_Models. " "This app cannot locate a Plant project for this file." ) def aec_project_id(token: str, region: str, dm_project_id: str) -> str: for hub in pages(HUBS_QUERY, ("hubs",), token, region, {}, limit=20): for project in pages( PROJECTS_QUERY, ("projects",), token, region, {"hubId": hub["id"]}, limit=20, ): alternative = project.get("alternativeIdentifiers") or {} if alternative.get("dataManagementAPIProjectId") == dm_project_id: return project["id"] raise vkt.UserError("The selected ACC project is not available in AEC Data Model.") def discover_datasets(params: Any, token: str) -> tuple[str, list[dict[str, Any]]]: selected = params.plant_drawing if not selected: raise vkt.UserError("Select a Plant drawing first.") version = selected.get_latest_version(token) if not str(version.attributes.get("displayName", "")).lower().endswith(".dwg"): raise vkt.UserError("Select a Plant DWG file.") region = selected.get_region(token) root_id = plant_root(selected, token) project_id = aec_project_id(token, region, selected.project_id) groups: dict[str, dict[str, Any]] = {} for folder in pages( FOLDERS_QUERY, ("foldersByFolder",), token, region, {"projectId": project_id, "folderId": root_id}, ): if folder["name"].casefold() not in PUBLICATION_FOLDERS: continue for group in pages( GROUPS_QUERY, ("elementGroupsByFolder",), token, region, {"projectId": project_id, "folderId": folder["id"], "filter": {"searchType": "ALL"}}, ): if group["name"] in DATASET_NAMES: groups[group["id"]] = {**group, "folderName": folder["name"]} if not groups: raise vkt.UserError("No published Plant data set was found for this drawing's project.") return region, list(groups.values()) def definitions(token: str, region: str, group_id: str) -> list[dict[str, Any]]: return list(pages( DEFINITIONS_QUERY, ("propertyDefinitionsByElementGroup",), token, region, {"groupId": group_id}, limit=100, )) def elements( token: str, region: str, group_id: str, rsql: str | None = None, verified_display_names: list[str] | None = None, page_size: int = 25, ) -> list[dict[str, Any]]: property_filter = {"names": verified_display_names} if verified_display_names is not None else None variables = { "groupId": group_id, "filter": {"query": rsql} if rsql else None, "propertyFilter": property_filter, } output: dict[str, dict[str, Any]] = {} for element in pages( ELEMENTS_QUERY, ("elementsByElementGroup",), token, region, variables, limit=page_size, ): block = element["properties"] properties = list(block["results"]) cursor = block["pagination"]["cursor"] if cursor: properties.extend(pages( PROPERTIES_QUERY, ("elementAtTip", "properties"), token, region, {"elementId": element["id"], "propertyFilter": property_filter}, limit=100, cursor=cursor, )) if not properties: raise RuntimeError( "An element has no extracted properties. Check the property filter and publication." ) element["properties"] = {"results": properties} if element["id"] in output and output[element["id"]] != element: raise RuntimeError("An element changed during extraction. Run the scan again.") output[element["id"]] = element return list(output.values()) def property_id(key: str) -> str: return f"autodesk.plant3d.parameter:{key}-1.0.0" def literal(value: str) -> str: return "'" + value.replace("\\", "\\\\").replace("'", "\\'") + "'" def selector(key: str) -> str: return "property.id." + property_id(key) def class_filter(class_token: str) -> str: return f"{selector('tableNames')}=contains={literal(class_token)}" def property_record(element: dict[str, Any], definition_id: str) -> dict[str, Any] | None: matches = [ prop for prop in element["properties"]["results"] if prop["definition"]["id"] == definition_id ] if len(matches) > 1: raise ValueError(f"Ambiguous property {definition_id} on {element['id']}.") return matches[0] if matches else None def raw(element: dict[str, Any], key: str) -> Any: prop = property_record(element, property_id(key)) return prop["value"] if prop else None def missing_value(value: Any) -> bool: return value is None or (isinstance(value, str) and value.strip().lower() in {"", "null"}) def class_name(element: dict[str, Any]) -> str | None: value = raw(element, "pnpClassName") if not missing_value(value): return str(value).strip() chain = raw(element, "tableNames") if isinstance(chain, str) and not missing_value(chain): return next((part.strip() for part in chain.split(",") if part.strip()), None) value = raw(element, "className") return None if missing_value(value) else str(value).strip() def plant_id(value: Any) -> str | None: if isinstance(value, bool): return None if isinstance(value, int): return str(value) if value > 0 else None if isinstance(value, str) and value.isascii() and value.isdigit() and int(value) > 0: return str(int(value)) return None def unique_assets(rows: list[dict[str, Any]]) -> dict[str, dict[str, Any]]: result: dict[str, dict[str, Any]] = {} for row in rows: key = plant_id(raw(row, "pnpId")) if key is None: raise ValueError(f"Missing or invalid pnpId on {row['id']}.") if key in result and result[key]["id"] != row["id"]: raise ValueError(f"More than one element has pnpId {key} in this group.") result[key] = row return result def selection_key(params: Any) -> list[str]: selected = params.plant_drawing return [selected.project_id, selected.urn, params.plant_dataset or ""] if selected else [] def dataset_choices(params: Any, **kwargs: Any) -> list[Any]: discovery = json.loads(params.datasets_json or "{}") selected = params.plant_drawing key = [selected.project_id, selected.urn] if selected else [] options = discovery.get("groups", []) if discovery.get("drawing") == key else [] choices = [vkt.OptionListElement(NO_DATASET, label="Choose a data set")] choices += [vkt.OptionListElement(item["id"], label=item["label"]) for item in options] if params.plant_dataset and params.plant_dataset not in {item.value for item in choices}: choices.append(vkt.OptionListElement(params.plant_dataset, label="Saved selection: click Find data sets")) return choices class Parametrization(vkt.Parametrization): intro = vkt.Text("# Plant 3D equipment overview\nReview equipment across one published 3D Piping Data Set. The drawing viewer is independent.") drawing_help = vkt.Text("**1. Select a drawing.** Browse to a published Plant DWG in ACC. This file supplies the project context and the viewer.") plant_drawing = vkt.AutodeskFileField("ACC DWG", oauth2_integration=OAUTH2_INTEGRATION) discover_help = vkt.Text("**2. Find data sets.** Discover the 3D Piping Data Sets published for this Plant project.") find = vkt.SetParamsButton("Find data sets", method="find_datasets", longpoll=True) dataset_help = vkt.Text("**3. Select one data set.** Equipment records and class counts cover this complete data set, not only the selected drawing.") plant_dataset = vkt.OptionField("3D Piping Data Set", options=dataset_choices, default=NO_DATASET) load_help = vkt.Text("**4. Load equipment.** Read equipment IDs, Tags and concrete classes, then open the table or chart. Load again after changing a source selection.") load = vkt.SetParamsButton("Load equipment", method="load_equipment", longpoll=True) viewer_help = vkt.Text("**Drawing viewer.** Open Selected drawing after choosing a DWG. The viewer works without loading equipment; it does not restrict the report.") status_text = vkt.HiddenField("Status") status = vkt.OutputField("Report status", value=vkt.Lookup("status_text")) datasets_json = vkt.HiddenField("Data set choices") report_json = vkt.HiddenField("Equipment report") class Controller(vkt.Controller): parametrization = Parametrization def find_datasets(self, params: Any, **kwargs: Any) -> Any: token = vkt.external.OAuth2Integration(OAUTH2_INTEGRATION).get_access_token() region, groups = discover_datasets(params, token) drawing = params.plant_drawing choices = [{"id": group["id"], "label": f"{group['folderName']} / {group['name']}"} for group in groups] return vkt.SetParamsResult({ "datasets_json": json.dumps({"drawing": [drawing.project_id, drawing.urn], "region": region, "groups": choices}), "plant_dataset": NO_DATASET, "report_json": "{}", "status_text": "Select a 3D Piping Data Set, then click Load equipment.", }) def load_equipment(self, params: Any, **kwargs: Any) -> Any: drawing = params.plant_drawing discovery = json.loads(params.datasets_json or "{}") key = [drawing.project_id, drawing.urn] if drawing else [] if not key or discovery.get("drawing") != key: raise vkt.UserError("Select a DWG and click Find data sets.") group = next((item for item in discovery.get("groups", []) if item["id"] == params.plant_dataset), None) if group is None: raise vkt.UserError("Select a discovered 3D Piping Data Set.") token = vkt.external.OAuth2Integration(OAUTH2_INTEGRATION).get_access_token() dictionary = definitions(token, discovery["region"], group["id"]) required = {property_id(key) for key in ("pnpId", "pnpClassName", "tableNames")} if required - {item["id"] for item in dictionary}: raise vkt.UserError("The data set is missing Plant identity or class definitions.") wanted = required | {property_id("tag"), property_id("className")} names = sorted({item["name"] for item in dictionary if item["id"] in wanted}) source = elements(token, discovery["region"], group["id"], class_filter("Equipment"), names, page_size=500) rows = [{"id": row["id"], "pnp_id": raw(row, "pnpId"), "tag": raw(row, "tag"), "class": class_name(row)} for row in unique_assets(source).values()] missing = " Tag is not published." if property_id("tag") not in {item["id"] for item in dictionary} else "" report = {"selection": selection_key(params), "label": group["label"], "rows": rows, "loaded_at": datetime.now(timezone.utc).isoformat(), "note": missing} return vkt.SetParamsResult({"report_json": json.dumps(report), "status_text": f"Data set scope: {group['label']} | {len(rows)} equipment records.{missing}"}) def loaded(self, params: Any) -> dict[str, Any]: report = json.loads(params.report_json or "{}") if report and report.get("selection") != selection_key(params): raise vkt.UserError("Source selection changed. Find data sets and load equipment again.") return report @vkt.TableView("Equipment records - data set", duration_guess=1) def equipment_table(self, params: Any, **kwargs: Any) -> Any: report = self.loaded(params) rows = [[row["id"], row["pnp_id"], row["tag"], row["class"]] for row in report.get("rows", [])] if not rows: message = "No equipment found in the selected data set." if report else "Select a data set and click Load equipment." rows = [[None, None, None, message]] return vkt.TableResult(rows, column_headers=["AEC ID", "PnP ID", "Tag", "Concrete class"]) @vkt.PlotlyView("Equipment counts - data set", duration_guess=1) def equipment_chart(self, params: Any, **kwargs: Any) -> Any: report = self.loaded(params) counts = Counter(row["class"] or "Not specified" for row in report.get("rows", [])) labels = sorted(counts, key=lambda label: (-counts[label], label)) figure = go.Figure(go.Bar(x=labels, y=[counts[label] for label in labels], text=[counts[label] for label in labels], textposition="outside", marker_color="#007bc2")) figure.update_layout(title="Equipment count by concrete class", template="plotly_white", xaxis_title="Concrete class", yaxis_title="Equipment count", yaxis={"dtick": 1}) if not report: figure.add_annotation(text="Select a data set and click Load equipment.", showarrow=False, x=0.5, y=0.5, xref="paper", yref="paper") elif not counts: figure.add_annotation(text="No equipment found in the selected data set.", showarrow=False, x=0.5, y=0.5, xref="paper", yref="paper") return vkt.PlotlyResult(figure.to_json()) @vkt.WebView("Selected drawing - independent", duration_guess=20) def drawing(self, params: Any, **kwargs: Any) -> Any: selected = params.plant_drawing if not selected: return vkt.WebResult(html="<p>Select an ACC DWG to open the drawing viewer.</p>") token = vkt.external.OAuth2Integration(OAUTH2_INTEGRATION).get_access_token() version = selected.get_latest_version(token) if not str(version.attributes.get("displayName", "")).lower().endswith(".dwg"): raise vkt.UserError("Select a DWG file.") viewer = APSViewer(urn=version.urn, token=token, region=selected.get_region(token), views_selector=True) return vkt.WebResult(html=viewer.write()) ``` ## Next steps[​](https://docs.viktor.ai/docs/tutorials/integrate-plant3d/.md#next-steps "Direct link to Next steps") Use these apps as a starting point for your own Plant 3D tasks. Ask the App Builder to review different assets or properties, change how results are grouped, or color objects by another property. Make one change at a time and check the results. Specify which drawings or data sets the report should cover. Continue with the [Autodesk Forma / ACC tutorial](https://docs.viktor.ai/docs/tutorials/integrate-autodesk-construction-cloud/.md) or explore the other [VIKTOR tutorials](https://docs.viktor.ai/docs/tutorials/.md). --- # Tutorial - Creating and analyzing a SCIA model note Estimated time: 60 minutes * [![](/img/illustrations/free-version-banner.svg)](https://www.viktor.ai/start-building-apps) ## Introduction[​](https://docs.viktor.ai/docs/tutorials/integrate-scia/.md#introduction "Direct link to Introduction") This tutorial explains how a SCIA model can be created within VIKTOR, which can be used for analysis using an external coupling. The SCIA model that we will be constructing consists of a foundation slab with piles. * The starting app for this tutorial can be downloaded [here](https://docs.viktor.ai/files/docs/scia-tutorial.zip). * The end result can be downloaded [here](https://docs.viktor.ai/files/docs/scia-tutorial-complete.zip). Before you can use the starting app, you first need to register it on the VIKTOR platform. Open a terminal and run: ``` viktor-cli create-app "SCIA tutorial" ``` Note the registered name printed by the command. Extract the downloaded starting app zip and open `viktor.config.toml` and add the `registered_name` with the name of the app ('scia-tutorial'). From within the app folder, install and start the app: ``` viktor-cli clean-start ``` In the browser, click the "Example" entity to open its editor and verify the app is installed and running as expected. ## Folder structure[​](https://docs.viktor.ai/docs/tutorials/integrate-scia/.md#folder-structure "Direct link to Folder structure") The app has the following folder structure: ``` scia-tutorial ├── app.py ├── model.esa ├── requirements.txt └── viktor.config.toml ``` caution The example template SCIA file (model.esa) in this tutorial has been made in SCIA 19.0. The file cannot be opened nor run with versions < 19.0 (and is not guaranteed to work for > 19.0). If you are using a version of SCIA other than 19.0, a template file must be created for (and the worker must run) this specific version. This can be done with the following procedure: 1. Open a new project in your SCIA version of choice 2. Make sure that the material that will be used is present in the materials library 3. Setup the XML I/O document to export the desired results (see the [SCIA documentation](https://help.scia.net/19.0/en/pod/optimiser/xml_documents.htm)) 4. Save the empty file as *model.esa* 5. Replace the existing esa file with the just created one in the foundation folder Open `app.py` and have a look at the code that we have set up for you. Note that the code already creates an empty SCIA model and some basic class structure. We will extend the code and add specific SCIA objects, step-by-step, throughout this tutorial. ## Creating the corner nodes[​](https://docs.viktor.ai/docs/tutorials/integrate-scia/.md#creating-the-corner-nodes "Direct link to Creating the corner nodes") If we assume that one of the corner points is located in the origin, the other three corner point locations can easily be calculated using `width_x` and `width_y`. Open `app.py` and add the following code `create_scia_model`: ``` def create_scia_model(self, params) -> vkt.scia.SciaModel: model = vkt.scia.SciaModel() ''' STRUCTURE ''' # create nodes at the slab corners width_x = params.geometry.slab.width_x * 1e-03 width_y = params.geometry.slab.width_y * 1e-03 n1 = model.create_node('n1', 0, 0, 0) # origin n2 = model.create_node('n2', 0, width_y, 0) n3 = model.create_node('n3', width_x, width_y, 0) n4 = model.create_node('n4', width_x, 0, 0) return model ``` note The corner nodes are defined in **clockwise direction**, since this order will be used later to create a 3D extrusion object. While setting up a SCIA model in VIKTOR, the 3D visualization is a very helpful feature to verify that the written logic does indeed create the model as desired. Therefore, we will extend `create_visualization_geometries` to get and show the just created nodes. This can easily be done by calling the `nodes` attribute of the `SciaModel`: ``` def create_visualization_geometries(self, params, scia_model): geometries = [] for node in scia_model.nodes: node_obj = vkt.Sphere(vkt.Point(node.x, node.y, node.z), params.geometry.slab.width_y * 1e-05) node_obj.material = vkt.Material('node', color=vkt.Color(0, 255, 0)) geometries.append(node_obj) return geometries ``` ![](/assets/images/tutorial-scia-corner-nodes-aa27cbc2e597e3ac841a98d22426bed7.png) *Corner nodes* ## Creating the piles[​](https://docs.viktor.ai/docs/tutorials/integrate-scia/.md#creating-the-piles "Direct link to Creating the piles") For the purpose of this tutorial, some parameters like the number of piles and the distance between the piles and the edge are fixed. The locations of these piles however, depend on the dimensions of the slab: ``` ... import numpy as np import itertools def create_scia_model(self, params) -> vkt.scia.Model: ... # create the pile nodes number_of_piles_x = 4 number_of_piles_y = 3 pile_edge_distance = 0.3 pile_length = params.geometry.piles.length start_x = pile_edge_distance end_x = width_x - pile_edge_distance x = np.linspace(start_x, end_x, number_of_piles_x) start_y = pile_edge_distance end_y = width_y - pile_edge_distance y = np.linspace(start_y, end_y, number_of_piles_y) pile_positions = np.array(list(itertools.product(x, y))) pile_top_nodes = [] pile_bottom_nodes = [] for pile_id, (pile_x, pile_y) in enumerate(pile_positions, 1): n_top = model.create_node(f'K:p{pile_id}_t', pile_x, pile_y, 0) n_bottom = model.create_node(f'K:p{pile_id}_b', pile_x, pile_y, -pile_length) pile_top_nodes.append(n_top) pile_bottom_nodes.append(n_bottom) return model ``` Since we already loop through all the nodes in the `create_visualization_geometries` method (`for node in scia_model.nodes:`), the nodes located at the pile ends will automatically be visualized when the app is (automatically) restarted. ![](/assets/images/tutorial-scia-pile-nodes-8d45b27becf6ff6961f675c1caa507f1.png) *Pile nodes* The top and bottom nodes of the piles can now be used along with the pile diameter defined in the `Parametrization` to create a circular cross-section and beam elements. The cross-section in turn needs a `SciaMaterial` as input, which **needs to be defined in the .esa model** that is used. note The `Material` from the SCIA package is imported with a different name to prevent conflicts with the `Material` import from `viktor.geometry`. ``` def create_scia_model(self, params) -> vkt.scia.Model: ... # create pile beams pile_diameter = params.geometry.piles.diameter * 1e-03 material = vkt.scia.Material(0, 'C30/37') cross_section = model.create_circular_cross_section('concrete_pile', material, pile_diameter) pile_beams = [] for pile_id, (n_top, n_bottom) in enumerate(zip(pile_top_nodes, pile_bottom_nodes), 1): pile_beam = model.create_beam(n_top, n_bottom, cross_section) pile_beams.append(pile_beam) return model ``` For the visualization of the piles, a [`CircularExtrusion`](https://docs.viktor.ai/sdk/api/geometry/.md#_CircularExtrusion) is used. This object needs a diameter and [`Line`](https://docs.viktor.ai/sdk/api/geometry/.md#_Line) object which specifies the direction of the beam in terms of a start and end [`Point`](https://docs.viktor.ai/sdk/api/geometry/.md#_Point). ``` def create_visualization_geometries(self, params, scia_model): ... # pile beams pile_diameter = params.geometry.piles.diameter * 1e-03 for beam in scia_model.beams: point_top = vkt.Point(beam.begin_node.x, beam.begin_node.y, beam.begin_node.z) point_bottom = vkt.Point(beam.end_node.x, beam.end_node.y, beam.end_node.z) beam_obj = vkt.CircularExtrusion(pile_diameter, vkt.Line(point_top, point_bottom)) beam_obj.material = vkt.Material('beam', roughness=1, opacity=0.3) geometries.append(beam_obj) ... ``` ![](/assets/images/tutorial-scia-pile-beams-163ef02495b591ed82aa6b1f7993fdf6.png) *Pile beams* ## Creating the slab[​](https://docs.viktor.ai/docs/tutorials/integrate-scia/.md#creating-the-slab "Direct link to Creating the slab") The corner nodes that were created earlier can be used to create the concrete slab object. Extend the `create_scia_model` method with the following lines: ``` def create_scia_model(self, params) -> vkt.scia.Model: ... # create the concrete slab material = vkt.scia.Material(0, 'concrete_slab') thickness = params.geometry.slab.thickness * 1e-03 corner_nodes = [n1, n2, n3, n4] slab = model.create_plane(corner_nodes, thickness, name='foundation slab', material=material) return model ``` Again we can verify the position and dimensions of the created slab by means of visualization: ``` def create_visualization_geometries(self, params, scia_model): ... corner_points = [ vkt.Point(scia_model.nodes[0].x, scia_model.nodes[0].y, scia_model.nodes[0].z), vkt.Point(scia_model.nodes[1].x, scia_model.nodes[1].y, scia_model.nodes[1].z), vkt.Point(scia_model.nodes[2].x, scia_model.nodes[2].y, scia_model.nodes[2].z), vkt.Point(scia_model.nodes[3].x, scia_model.nodes[3].y, scia_model.nodes[3].z), vkt.Point(scia_model.nodes[0].x, scia_model.nodes[0].y, scia_model.nodes[0].z) ] thickness = params.geometry.slab.thickness * 1e-03 slab_obj = vkt.Extrusion(corner_points, vkt.Line(vkt.Point(0, 0, -thickness/2), vkt.Point(0, 0, thickness/2))) slab_obj.material = vkt.Material('slab', roughness=1, opacity=0.3) geometries.append(slab_obj) ... ``` ![](/assets/images/tutorial-scia-slab-7378714b202faede4692660c7b3a0bce.png) *Slab* ## Creating the supports[​](https://docs.viktor.ai/docs/tutorials/integrate-scia/.md#creating-the-supports "Direct link to Creating the supports") Since the foundation will be completely underground, the following supports have to be attached: 1. Point supports ([`PointSupport`](https://docs.viktor.ai/sdk/api/external/scia/.md#_PointSupport)) at the bottom of each pile: ``` def create_scia_model(self, params) -> vkt.scia.Model: ... ''' SUPPORTS ''' # create pile point supports freedom_v = ( vkt.scia.PointSupport.Freedom.FREE, vkt.scia.PointSupport.Freedom.FREE, vkt.scia.PointSupport.Freedom.FLEXIBLE, vkt.scia.PointSupport.Freedom.FREE, vkt.scia.PointSupport.Freedom.FREE, vkt.scia.PointSupport.Freedom.FREE ) kv = 400 * 1e06 stiffness_v = (0, 0, kv, 0, 0, 0) for pile_id, pile_beam in enumerate(pile_beams, 1): n_bottom = pile_beam.end_node model.create_point_support(f'Sn:p{pile_id}', n_bottom, vkt.scia.PointSupport.Type.STANDARD, freedom_v, stiffness_v, vkt.scia.PointSupport.CSys.GLOBAL) return model ``` 2. Line supports ([`LineSupport`](https://docs.viktor.ai/sdk/api/external/scia/.md#_LineSupport)) on the piles: ``` def create_scia_model(self, params) -> vkt.scia.Model: ... # create pile line supports kh = 10 * 1e06 for pile_id, pile_beam in enumerate(pile_beams, 1): model.create_line_support_on_beam(pile_beam, x=vkt.scia.LineSupport.Freedom.FLEXIBLE, stiffness_x = kh, y=vkt.scia.LineSupport.Freedom.FLEXIBLE, stiffness_y = kh, z=vkt.scia.LineSupport.Freedom.FREE, rx=vkt.scia.LineSupport.Freedom.FREE, ry=vkt.scia.LineSupport.Freedom.FREE, rz=vkt.scia.LineSupport.Freedom.FREE, c_sys=vkt.scia.LineSupport.CSys.GLOBAL) return model ``` 3. Line supports ([`LineSupport`](https://docs.viktor.ai/sdk/api/external/scia/.md#_LineSupport)) on the slab edges: ``` def create_scia_model(self, params) -> vkt.scia.Model: ... # create the slab supports stiffness_x = 50 * 1e06 stiffness_y = 50 * 1e06 for edge in (1, 3): model.create_line_support_on_plane((slab, edge), x=vkt.scia.LineSupport.Freedom.FLEXIBLE, stiffness_x=stiffness_x, y=vkt.scia.LineSupport.Freedom.FREE, z=vkt.scia.LineSupport.Freedom.FREE, rx=vkt.scia.LineSupport.Freedom.FREE, ry=vkt.scia.LineSupport.Freedom.FREE, rz=vkt.scia.LineSupport.Freedom.FREE) for edge in (2, 4): model.create_line_support_on_plane((slab, edge), x=vkt.scia.LineSupport.Freedom.FREE, y=vkt.scia.LineSupport.Freedom.FLEXIBLE, stiffness_y=stiffness_y, z=vkt.scia.LineSupport.Freedom.FREE, rx=vkt.scia.LineSupport.Freedom.FREE, ry=vkt.scia.LineSupport.Freedom.FREE, rz=vkt.scia.LineSupport.Freedom.FREE) return model ``` ## Creating the load combinations[​](https://docs.viktor.ai/docs/tutorials/integrate-scia/.md#creating-the-load-combinations "Direct link to Creating the load combinations") Adding a load combination to the SCIA model is done in three steps, similarly as in the SCIA interface: 1. Create a load group ([`LoadGroup`](https://docs.viktor.ai/sdk/api/external/scia/.md#_LoadGroup)) 2. Create a load case ([`LoadCase`](https://docs.viktor.ai/sdk/api/external/scia/.md#_LoadCase)) 3. Create a load combination ([`LoadCombination`](https://docs.viktor.ai/sdk/api/external/scia/.md#_LoadCombination)) ``` def create_scia_model(self, params) -> vkt.scia.Model: ... ''' SETS ''' # create the load group lg = model.create_load_group('LG1', vkt.scia.LoadGroup.LoadOption.VARIABLE, vkt.scia.LoadGroup.RelationOption.STANDARD, vkt.scia.LoadGroup.LoadTypeOption.CAT_G) # create the load case lc = model.create_variable_load_case('LC1', 'first load case', lg, vkt.scia.LoadCase.VariableLoadType.STATIC, vkt.scia.LoadCase.Specification.STANDARD, vkt.scia.LoadCase.Duration.SHORT) # create the load combination load_cases = { lc: 1 } model.create_load_combination('C1', vkt.scia.LoadCombination.Type.ENVELOPE_SERVICEABILITY, load_cases) return model ``` ## Creating the load(s)[​](https://docs.viktor.ai/docs/tutorials/integrate-scia/.md#creating-the-loads "Direct link to Creating the load(s)") The last component of a complete SCIA model is the actual load that is applied on the structure. In this example, a simple uniform surface load is placed on the slab: ``` def create_scia_model(self, params) -> vkt.scia.Model: ... ''' LOADS ''' # create the load force = params.loads.input.uniform_load * 1e03 force *= -1 # in negative Z-direction model.create_surface_load('SF:1', lc, slab, vkt.scia.SurfaceLoad.Direction.Z, vkt.scia.SurfaceLoad.Type.FORCE, force, vkt.scia.SurfaceLoad.CSys.GLOBAL, vkt.scia.SurfaceLoad.Location.LENGTH) return model ``` ## Downloading the SCIA model[​](https://docs.viktor.ai/docs/tutorials/integrate-scia/.md#downloading-the-scia-model "Direct link to Downloading the SCIA model") It is always helpful to generate the XML representation of the SCIA model and to manually load this input in the SCIA interface. This will help in verifying that, for example, all the loads are defined correctly in terms of placement and magnitude. In the app we will add a feature to download the necessary files. In order to be able to view the created model in the SCIA interface, the following three files are needed: 1. Empty SCIA model (`*.esa`) 2. Definition file (`*.def`) 3. Input file (`*.xml`) Now let's fill the download methods that we defined earlier in `Foundation`: ``` from pathlib import Path ... class Foundation(vkt.Controller): ... def download_scia_input_esa(self, params, **kwargs): scia_input_esa = self.get_scia_input_esa() return vkt.DownloadResult(scia_input_esa, 'model.esa') def download_scia_input_xml(self, params, **kwargs): scia_model = self.create_scia_model(params) input_xml, _ = scia_model.generate_xml_input() return vkt.DownloadResult(input_xml, 'test.xml') def download_scia_input_def(self, params, **kwargs): m = vkt.scia.Model() _, input_def = m.generate_xml_input() return vkt.DownloadResult(input_def, 'viktor.xml.def') def get_scia_input_esa(self) -> vkt.File: return vkt.File.from_path(Path(__file__).parent / 'model.esa') ``` note pathlib's `Path` object is VIKTOR's [recommended](https://docs.viktor.ai/docs/create-apps/managing-files/.md) way of defining a path. You can now download the files from within VIKTOR. ## Viewing the model in SCIA[​](https://docs.viktor.ai/docs/tutorials/integrate-scia/.md#viewing-the-model-in-scia "Direct link to Viewing the model in SCIA") caution SCIA 19.0 is required if using the example file. When the files are obtained, the empty .esa model can be opened in SCIA. This model will now be updated with the created input .xml file. In SCIA Engineer: 1. Click on `File` -> `Update` -> `XML file` 2. Select the `test.xml` file note It is important that the .xml and the .def files are located in the same directory, and the filename of the .def should not be changed. If this name is changed, make sure to also change the reference to this .def file in the input .xml file. The updated SCIA model should look like this: ![](/assets/images/tutorial-scia-model-scia-f6fcf3b5aa1afa7cb0f343a93097bb4f.png) *SCIA model generated by VIKTOR* ## Set up integration with SCIA[​](https://docs.viktor.ai/docs/tutorials/integrate-scia/.md#set-up-integration-with-scia "Direct link to Set up integration with SCIA") ### Install SCIA worker[​](https://docs.viktor.ai/docs/tutorials/integrate-scia/.md#install-scia-worker "Direct link to Install SCIA worker") Follow these steps to install the worker: * Personal worker * Organization worker A personal worker connects the SCIA installation on your own machine, for your own use. Personal workers are installed and managed with [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md): 1. [Download and install VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#download-and-install-viktor-desktop) and log in with your VIKTOR account, if you haven't done so already 2. In VIKTOR Desktop, click "Add" and select **SCIA** 3. Start the worker. You can view its logs inside VIKTOR Desktop, and the editor shows when your worker is online note SCIA workers that were installed with the previous per-worker installer keep running, but new personal workers can only be added through [VIKTOR Desktop](https://docs.viktor.ai/docs/create-apps/software-integrations/viktor-desktop/.md#migrate-existing-workers-to-viktor-desktop). An organization worker connects a SCIA installation on a machine managed by your organization, such as a virtual or remote machine, and is shared by the users of the app instance(s) you select. caution You need to be an environment administrator in order to install an organization worker. 1. Navigate to the "Integrations" tab in the Administrator panel 2. Click "Add integration" 3. Follow the steps provided in the modal ![](/assets/images/create-integration-admin-598d0869714267fcb7a220c370dde5df.png) 3.1. Select **SCIA** 3.2. Select the app instance(s) the integration should be available to 3.3. Download the worker .msi (Microsoft Installer) and run it on the machine of choice 3.4. Copy the generated **connection key** and paste it when the installer asks for it Connection Key The generated connection key **should be copied immediately** as VIKTOR will not preserve this data for security reasons. ### Add the Python code to run SCIA[​](https://docs.viktor.ai/docs/tutorials/integrate-scia/.md#add-the-python-code-to-run-scia "Direct link to Add the Python code to run SCIA") The three files that are used for the verification above, can now be used as input for the external analysis. note An I/O document has to be defined in the `.esa` file, which has to be named "output". If not defined, the worker will not be able to write this expected document and fails to execute. In this example, the empty `model.esa` has the following structure of the I/O document: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANEAAADiCAYAAADQ1CLsAAAO40lEQVR4nO2d3Y8b1RmH52+KpVz4D9iLolZU0Kq12u5KZEdVW1T1yhcVcquiBEjoeoGuCLSpCSxf2zQkIBeWhKzzgVSxXejSgCIjpA3NCpXdZDeBfADR2wt77JnxfPodj2fGzyP9FNszPnPO+jxzzhl7FENCWF//j6y0zsXOBx+sy927d8OKB8g9RtgOx157Q1Y/uOibf/37oqytfyRr6x/J68tn5eRbnbz06nHZ2tpKow0AYyVUondWzsvtO1/L7Tt3fPK13LpzR265Xjt15qxcuXIljTYAjJVQic6euyCX2v+VR4+ckcca78jBo6fl0OIpefzlZfn440/l2tVtuXx5Qy5f3pCr21vy7IlVefbEarBETVOMcl3ajpcMKdfbItIU0zDEMJueb23Xy2IYZam3pbuv9diPppiGKd6lpUjT9G2TNE0xDKOXcnCDUqb7eWS2fuMnVKLW2fNyqb0pP597XX7x5An51dPH5ddHjslvnn9V1tc/kavbXwxIdOTNf4aORE3TkF6fatel3JOqI0a57CWH9YFmSaIodWhL3bM90hXIvq0t9XLUjhrl2FEIKse9Lfgkl32S+pv1CZVo+fSKXGpvykNHl+WXh4/JT596TioLz0jlmT91JNrqSrTRkej5c+fl5ffOhE/nbOI4hOo20jTLgx2paYphmrY/Qk4katel7NnpOsIMbGrXpRypzuOQKE79ssg4JDp1Ri61N+X+g0fkO48+Kd+t1+XehUNy37OPeo5Ef//wH3Li49cjrYna9c6I4zyrWY10d37rbN5USNTdv256TE2625p1Kfttc5yNrbrYpjoBU1Bvh/w6o33kinPsUbTB62/skr/dP55huE8KnX2d2/zqYntsa4PZtKbxHtNJx7HDPudon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KkAhACRIBKEEiACVIBKAEiQCUIBGAEiQCUIJEAEqQCEAJEgEoQSIAJUgEoASJAJQgEYASJAJQgkQASpAIQAkSAShBIgAlSASgBIkAlCARgBIkAlCCRABKkAhACRIBKEEiACWxJCKEeCeSRPaNhJDBIBEhyiARIcogESHKIBEhyiARIcoMLdGxY8cyn6CGj7tu2vqT7EQl0cbGRmYTRaJx11FTf5KdIFFGg0T5CRJlNEiUnyBRRoNE+cloJWrVpGSUpNZyvVaqSSvjErVqFSkZhhiGIUapJJVGK7W6I1G+koJEhhj2jpcDiVq1khilmjQs+VsNqRglqTWQiIxDolJNapWSVBp5kagltZJr9Ez5BIBE+UoqErXsnc/1uFKypkyVTsdt1aRkVKSxsSEbGw2peD4eoURBogTU3apXq1bqvGaUpFJr9d430E4kKkzSkWhjQxrWaNR7zXXG93q9URHDMFzvy4JELamVjM46yRKn0nCK3jsZ+LUTiYqS1CTa2GhIxT4qWeslRzqdrVHpiNOolKRWq0mp0pCNRkVK1pl93BK593HJZZRKUqk1pNUbWb3biUTFSIoSdc7YpUrFJpHP9KxRkVKt1pGuK1+tZltXjVKiKGsiX4ms5w2pVUpiGBVpBLUTiQqRVCXqTHesq3XdKZFt3eAYtQyjN/I0KiXHumO0EkW5Ohc0nbMEtGQMaicSFSEpS9TvoC2rc3ouuK1O2h+ZOp00HYk69bR9T2R4fE/kuFhgH2377+tNP33biURFCL9YyGiQKD9BoowGifITJMpokCg/QaKMBonyEyTKaJAoP+H28Axn3J2DjFgiQkgnSESIMkhEiDJIRIgySESIMkhEiDKBEo27coTkIX4S/R8Ajup0SqIVqwAAAABJRU5ErkJggg==) *I/O document of the esa model* Let's create a second view, which is a combination of geometry and data (results). Set the duration of this view to 60 seconds, which indicates that it concerns a long-running job with a manual update button. This button will be connected to the SCIA analysis: ``` class Foundation(vkt.Controller): ... @vkt.GeometryAndDataView("SCIA result", duration_guess=60, x_axis_to_right=True) def run_scia(self, params, **kwargs): scia_model = self.create_scia_model(params) # create input files input_xml, input_def = scia_model.generate_xml_input() input_esa = self.get_scia_input_esa() # analyze SCIA model scia_analysis = vkt.scia.SciaAnalysis(input_xml, input_def, input_esa) scia_analysis.execute(300) # timeout after 5 minutes data_result = vkt.DataGroup() geometries = self.create_visualization_geometries(params, scia_model) return vkt.GeometryAndDataResult(geometries, data_result) ``` After execution, the result can easily be called and parsed as desired. The "Reactions" results (defined in the I/O document) of the load combination C1 can be parsed from the analysis result using the provided output parser as is shown in the snippet below: ``` class Foundation(vkt.Controller): ... @vkt.GeometryAndDataView(...) def run_scia(self, params, **kwargs): scia_model = self.create_scia_model(params) # create input files input_xml, input_def = scia_model.generate_xml_input() input_esa = self.get_scia_input_esa() # analyze SCIA model scia_analysis = vkt.scia.SciaAnalysis(input_xml, input_def, input_esa) scia_analysis.execute(300) # timeout after 5 minutes scia_result = scia_analysis.get_xml_output_file() # parse analysis result result = vkt.scia.OutputFileParser.get_result(scia_result, "Reactions", parent='Combinations - C1') reactions = result['Nodal reactions'] max_rz = float(max(reactions['R_z'])) data_result = vkt.DataGroup( vkt.DataItem('SCIA results', ' ', subgroup=vkt.DataGroup( vkt.DataItem('Maximum pile reaction', max_rz, suffix='N', number_of_decimals=2) )) ) geometries = self.create_visualization_geometries(params, scia_model) return vkt.GeometryAndDataResult(geometries, data_result) ``` The pile reactions as seen from within the SCIA interface show a maximum of 3.3 kN (depending on your load input): ![](/assets/images/tutorial-scia-result-scia-7d2138b3714b62600ff4f2f835e94e55.png) *SCIA analysis result in SCIA* From the result obtained in VIKTOR we can validate that we indeed obtained the maximum reaction force of this load combination: ![](/assets/images/tutorial-scia-result-viktor-7af1b7a23a2bd6502dcd3a81985435bf.png) *SCIA analysis result obtained in VIKTOR* --- # Tutorial - Integrate STAAD.Pro note Estimated time: 55 minutes<br />Difficulty level: Intermediate * [![](/img/illustrations/free-version-banner.svg)](https://www.viktor.ai/start-building-apps) ## Introduction[​](https://docs.viktor.ai/docs/tutorials/integrate-staadpro/.md#introduction "Direct link to Introduction") STAAD.Pro is one of the most widely used software tools for structural engineering. It offers a range of features for modeling and design, along with a robust API called OpenSTAAD that enables you to automate a workflow. In this tutorial, you will learn how to create a VIKTOR web app that integrates STAAD.Pro behind the scenes. Here are the main sections we will cover: 1. [Build a VIKTOR app.](https://docs.viktor.ai/docs/tutorials/integrate-staadpro/.md#create-a-new-viktor-app) 2. [Create a simple parametric model.](https://docs.viktor.ai/docs/tutorials/integrate-staadpro/.md#lets-create-our-3d-model) 3. [Calculate the member end forces of your model.](https://docs.viktor.ai/docs/tutorials/integrate-staadpro/.md#working-with-openstaad-in-python) 4. [Display the member end forces in your VIKTOR app.](https://docs.viktor.ai/docs/tutorials/integrate-staadpro/.md#lets-integrate-the-worker-in-our-viktor-app) Here is a sneak peek at how the app will look: ![model](/assets/images/tutorial_staadpro_webapp-fbf4f50595a69b7340f34e6f86c18ebf.png) ### Prerequisites and downloads[​](https://docs.viktor.ai/docs/tutorials/integrate-staadpro/.md#prerequisites-and-downloads "Direct link to Prerequisites and downloads") PREREQUISITES You have [installed VIKTOR](https://docs.viktor.ai/docs/getting-started/installation/.md) on your computer<br /><!-- -->You have some experience with reading Python code<br /><!-- -->You have some experience with STAAD.Pro Before using the OpenSTAAD API in Python, ensure you have the official Bentley [`openstaadpy`](https://github.com/BentleySystems/openstaadpy) package installed in your *main Python development environment*. If it is not installed, you can add it using pip: ``` pip install git+https://github.com/BentleySystems/openstaadpy.git ``` ## Create a new VIKTOR app[​](https://docs.viktor.ai/docs/tutorials/integrate-staadpro/.md#create-a-new-viktor-app "Direct link to Create a new VIKTOR app") Let's create, install and start an empty app. This will be the starting point for the rest of the tutorial. But before we start, make sure to shut down any app that is running (like the demo app) by closing the command-line shell (for example Powershell) or end the process using `Ctrl + C`. Follow these steps to create, install and start an empty app: 1. Open a terminal and run the following command to create the app on the VIKTOR platform and generate the initial code locally: ``` viktor-cli create-app sample-staad-integration --init --app-type editor ``` 2. Open the newly created folder in your code editor and run `viktor-cli clean-start` in the terminal to install dependencies and connect the app to the platform. If all went well, your empty app is installed and connected to your development workspace. **Do not close the terminal** as this will break the connection with your app. The terminal in your code editor should show something like this: ``` INFO : Connecting to cloud.viktor.ai... INFO : Connection is established (use Ctrl+C to close) INFO : INFO : Navigate to the link below to see your app in the browser INFO : https://cloud.viktor.ai/workspaces/XXX/app INFO : INFO : App code loaded, waiting for jobs... ``` RE-STARTING YOUR APP You only need to create an app template and install it once for each new app you want to make. as long as you don't close the terminal or your code editor, the app will update automatically once you save code in `app.py`. Did you close your code editor? Use `viktor-cli start` to start the app again. No need to install, clear, etc. ### Configure the VIKTOR app[​](https://docs.viktor.ai/docs/tutorials/integrate-staadpro/.md#configure-the-viktor-app "Direct link to Configure the VIKTOR app") Before we start building the app logic, let's configure the `viktor.config.toml` file to declare the Python worker integration. Open the `viktor.config.toml` file in your project and make sure it includes the following configuration: ``` app_type = "editor" python_version = "3.13" registered_name = "sample-staad-integration" worker_integrations = [ "python", ] ``` The `worker_integrations` key tells VIKTOR that this app will use a Python worker to execute external scripts. This is essential for running STAAD.Pro analysis through the worker environment. ### Let's define a simple frame[​](https://docs.viktor.ai/docs/tutorials/integrate-staadpro/.md#lets-define-a-simple-frame "Direct link to Let's define a simple frame") To create a basic steel structure, we use a parametric method by setting the frame's `length` and `height` as adjustable variables. The `create_frame_data` function defines the frame's topology through **nodes** and **lines** to represent its geometry. By modifying the `length` and `height`, we can produce various configurations of the frame. In the following sections, we will demonstrate how this function integrates with the `Controller` class, activated when new inputs are provided by the `Parametrization` class. You can extend your `app.py` to look something like this: ``` import viktor as vkt import json def create_frame_data(length, height, cross_section="IPE400"): nodes = { 1: {"node_id": 1, "x": 0, "z": 0, "y": 0}, 2: {"node_id": 2, "x": 0, "z": length, "y": 0}, 3: {"node_id": 3, "x": 0, "z": 0, "y": height}, 4: {"node_id": 4, "x": 0, "z": length, "y": height}, 5: {"node_id": 5, "x": length, "z": 0, "y": 0}, 6: {"node_id": 6, "x": length, "z": length, "y": 0}, 7: {"node_id": 7, "x": length, "z": 0, "y": height}, 8: {"node_id": 8, "x": length, "z": length, "y": height}, } lines = { 1: {"line_id": 1, "node_i": 1, "node_j": 3}, 2: {"line_id": 2, "node_i": 2, "node_j": 4}, 3: {"line_id": 3, "node_i": 3, "node_j": 4}, 4: {"line_id": 4, "node_i": 6, "node_j": 8}, 5: {"line_id": 5, "node_i": 5, "node_j": 7}, 6: {"line_id": 6, "node_i": 3, "node_j": 7}, 7: {"line_id": 7, "node_i": 4, "node_j": 8}, 8: {"line_id": 8, "node_i": 7, "node_j": 8}, 9: {"line_id": 9, "node_i": 1, "node_j": 4}, 10: {"line_id": 10, "node_i": 5, "node_j": 8}, } return nodes, lines, cross_section class Parametrization(vkt.Parametrization): pass class Controller(vkt.Controller): parametrization = Parametrization ``` ## Let's create our 3D model[​](https://docs.viktor.ai/docs/tutorials/integrate-staadpro/.md#lets-create-our-3d-model "Direct link to Let's create our 3D model") VIKTOR makes it easy to create various types of input fields for your application logic. You can use text fields, number fields, option fields, and many more to gather information from the user. You can find all available input components in the [VIKTOR documentation](https://docs.viktor.ai/docs/create-apps/user-input/.md). This range of components lets you build clear and structured user interfaces without complex coding. The inputs defined in your `Parametrization` class are automatically available in the `params` object. You can retrieve a field's value, such as `frame_length`, by calling `params.frame_length`. This way, the parameter definitions stay decoupled from the rest of your logic, and you can easily access or modify the user input throughout your code. Now that we have our input fields, components, and our function to create the structure's topology, the next step is to build a 3D model of the frame, as shown in the code below. For this, we also use a convenient component called `GeometryView`. You can find more information about working with 3D geometry in VIKTOR in the [documentation](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md). ``` import viktor as vkt import json from io import BytesIO from pathlib import Path from viktor.geometry import Point, Line, RectangularExtrusion def create_frame_data(length, height, cross_section="IPE400"): ... class Parametrization(vkt.Parametrization): intro = vkt.Text("# STAAD.Pro - Member End Forces App") inputs_title = vkt.Text("""## Frame Geometry Fill in the following parameters to create the steel structure:""" ) frame_length = vkt.NumberField("Frame Length", min=0.3, default=8, suffix="m") frame_height = vkt.NumberField("Frame Height", min=1, default=6, suffix="m") line_break = vkt.LineBreak() section_title = vkt.Text("""## Frame Cross-Section Select a cross section for the frame elements:""" ) cross_sect = vkt.OptionField( "Cross-Section", options=["IPE400", "IPE200"], default="IPE400" ) class Controller(vkt.Controller): parametrization = Parametrization @vkt.GeometryView("3D Model", duration_guess=1, x_axis_to_right=True) def create_render(self, params, **kwargs): nodes, lines, _ = create_frame_data( length=params.frame_length, height=params.frame_height, cross_section=params.cross_sect, ) sections_group = [] for line_id, line_data in lines.items(): node_i = nodes[line_data["node_i"]] node_j = nodes[line_data["node_j"]] point_i = vkt.Point(node_i["x"], node_i["z"], node_i["y"]) point_j = vkt.Point(node_j["x"], node_j["z"], node_j["y"]) line = vkt.Line(point_i, point_j) section_size = float(params.cross_sect[3:]) / 1000 section = vkt.RectangularExtrusion( section_size, section_size, line, identifier=str(line_id) ) sections_group.append(section) return vkt.GeometryResult(geometry=sections_group) ``` Great! You can now modify the frame's dimensions and select a different cross-section, and the model will update to reflect the new geometry. Your browser should display an app that looks like this: ![model](/assets/images/tutorial_staadpro_geo_view-c64ec6e04cd7383c8437995f52db6202.png) Since you're here to learn how to integrate STAAD.Pro, let's move on and start using the OpenSTAAD API! ## Working with OpenSTAAD in Python[​](https://docs.viktor.ai/docs/tutorials/integrate-staadpro/.md#working-with-openstaad-in-python "Direct link to Working with OpenSTAAD in Python") Let's create a new Python file called `run_staad_model.py` in the same directory and add the `run_staad` function. This function contains the logic to create our STAAD.Pro model using Python. The first step is to initialize the program with `subprocess` and then connect to STAAD.Pro using the official Bentley [`openstaadpy`](https://github.com/BentleySystems/openstaadpy) package. Copy the snippet below, and make sure to update the `staad_path` to match your STAAD.Pro version. You can run this code in **your Python environment**, and it will launch STAAD.Pro and connect you to the OpenSTAAD API. info If STAAD.Pro is running on a remote server, the `staad_path` needs to match the STAAD.Pro location on the server where the worker is running. For older STAAD.Pro versions (<2025), use the COM-based workflow with `pywin32` and `comtypes` instead of `openstaadpy`. You can find a complete guide [here](https://www.viktor.ai/blog/186/how-to-use-python-to-automate-staad-pro). ``` import json import subprocess import time from datetime import datetime from pathlib import Path from openstaadpy import os_analytical def run_staad() -> None: # Replace with your version and file path. staad_path = Path(r"C:\Program Files\Bentley\Engineering\STAAD.Pro 2025\STAAD\Bentley.Staad.exe") if not staad_path.is_file(): raise FileNotFoundError(f"STAAD.Pro executable was not found at: {staad_path}") # Launch STAAD.Pro staad_process = subprocess.Popen([str(staad_path)]) print(f"Launching STAAD.Pro from: {staad_path}") time.sleep(30) # Connect to OpenSTAAD using openstaadpy staad = os_analytical.connect() staad.SetSilentMode(True) ``` ### Create the structure in STAAD.Pro[​](https://docs.viktor.ai/docs/tutorials/integrate-staadpro/.md#create-the-structure-in-staadpro "Direct link to Create the structure in STAAD.Pro") Next, let's extend the `run_staad` function to add nodes, beams, and supports. We'll load the nodes and lines geometry from the `inputs.json` file, then create the nodes and beams in STAAD.Pro, followed by defining the material properties and the cross-section for the frame. Here's how all this looks in code: ``` def run_staad() -> None: # Define constants for units and settings length_unit_meter = 4 force_unit_kilonewton = 5 section_table_european = 7 # Launch STAAD.Pro and connect as before... # Load input data input_path = Path.cwd() / "inputs.json" with input_path.open(encoding="utf-8") as json_file: nodes, lines, section_name = json.load(json_file) # Convert node and line IDs to integers nodes = {int(node_id): values for node_id, values in nodes.items()} lines = {int(line_id): values for line_id, values in lines.items()} # Create a new STAAD file timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") std_file_path = Path.cwd() / f"Structure_{timestamp}.std" staad.NewSTAADFile(str(std_file_path), length_unit_meter, force_unit_kilonewton) time.sleep(8) # Get geometry, property, support, and load objects geometry = staad.Geometry prop = staad.Property support = staad.Support load = staad.Load # Create nodes for node_id, coordinates in nodes.items(): geometry.CreateNode( int(node_id), float(coordinates["x"]), float(coordinates["y"]), float(coordinates["z"]) ) # Create beams for line_id, line_data in lines.items(): geometry.CreateBeam( int(line_id), int(line_data["node_i"]), int(line_data["node_j"]) ) # Create beam property from section table property_id = prop.CreateBeamPropertyFromTable( section_table_european, section_name, 0, 0.0, 0.0 ) member_ids = list(lines.keys()) # Assign material and property to all members raw_property = prop._property raw_property.SetMaterialName("STEEL") for member_id in member_ids: raw_property.AssignBeamProperty(int(member_id), property_id) raw_property.AssignMaterialToMember("STEEL", int(member_id)) # Create supports fixed_support_id = support.CreateSupportFixed() for node_id in [1, 2, 5, 6]: support._support.AssignSupportToNode(int(node_id), fixed_support_id) ``` ### Run the analysis[​](https://docs.viktor.ai/docs/tutorials/integrate-staadpro/.md#run-the-analysis "Direct link to Run the analysis") Now you can save the model and run the analysis. By default, we will create a load case that includes only the self-weight of the structure. After the analysis, we can extract the member end forces and save the results in a `.json` file to be used later in our VIKTOR app. ``` def run_staad(): # Previous code... # Define constants self_weight_direction_global_y = 2 results_local = 0 start_end = 0 final_end = 1 # Create load case and add self-weight load_case = load.CreateNewPrimaryLoad("Self Weight") load.SetLoadActive(load_case) load.AddSelfWeightInXYZ(self_weight_direction_global_y, -1.0) # Update structure before analysis staad.UpdateStructure() time.sleep(2) # Run analysis staad.Command.PerformAnalysis(6) time.sleep(2) # Save model staad.SaveModel(True) time.sleep(2) # Start analysis staad.Analyze() # Wait for analysis to complete with timeout analysis_deadline = time.time() + 300 while staad.IsAnalyzing(): if time.time() > analysis_deadline: raise TimeoutError("STAAD.Pro analysis did not finish within the timeout.") print("...Analyzing") time.sleep(2) time.sleep(3) # Check analysis status analysis_status = staad.GetAnalysisStatus() print(f"Analysis status: {analysis_status}") if analysis_status["ReturnValue"] not in [2, 3]: raise RuntimeError(f"STAAD.Pro analysis did not complete successfully: {analysis_status}") time.sleep(3) # Extract results output = staad.Output # GetMemberEndForces returns FX, FY, FZ, MX, MY, and MZ (in order) end_forces = [ output.GetMemberEndForces(int(line_id), final_end, int(load_case), results_local) for line_id in lines ] end_headers = [f"Beam:{lines[line_id]['line_id']}/Node:{lines[line_id]['node_j']}" for line_id in lines] # Retrieve start forces and headers start_forces = [ output.GetMemberEndForces(int(line_id), start_end, int(load_case), results_local) for line_id in lines ] start_headers = [f"Beam:{lines[line_id]['line_id']}/Node:{lines[line_id]['node_i']}" for line_id in lines] # Combine forces and headers forces = end_forces + start_forces headers = end_headers + start_headers # Save to JSON file output_path = Path.cwd() / "output.json" with output_path.open("w", encoding="utf-8") as json_file: json.dump({"forces": forces, "headers": headers}, json_file) # Clean up staad.Quit() staad_process.terminate() # Run the function if __name__ == "__main__":     run_staad() ``` After running your `run_staad_model.py` in your Python environment, you should end up with a model like the following: ![model](/assets/images/tutorial_staadpro_model-9866e954f88e893e2024414c34e61ff8.png) ## Let's Integrate the worker in our VIKTOR app[​](https://docs.viktor.ai/docs/tutorials/integrate-staadpro/.md#lets-integrate-the-worker-in-our-viktor-app "Direct link to Let's Integrate the worker in our VIKTOR app") A worker is a simple program that lets you connect the app you have in the cloud to a server on which in this case STAAD.Pro and Python can run to execute scripts and analyses on models. Once we have a worker set up, we can connect our app! If you do not have access to a server with STAAD.Pro on it, do not worry, you can replicate this process on your local machine for the development of your applications. Don't have the worker installed yet? The connection between VIKTOR and STAAD.Pro is managed by the generic worker. You can install the worker on your local machine to test the integration by following **[this guide](https://docs.viktor.ai/docs/create-apps/software-integrations/staadpro/.md)**. ### Set up the worker environment[​](https://docs.viktor.ai/docs/tutorials/integrate-staadpro/.md#set-up-the-worker-environment "Direct link to Set up the worker environment") Before running the worker, make sure that the Python environment on your worker machine (local or remote) has the necessary dependencies installed. Install the `openstaadpy` package in your worker environment: ``` pip install git+https://github.com/BentleySystems/openstaadpy.git ``` ### Integrate the worker in the Controller[​](https://docs.viktor.ai/docs/tutorials/integrate-staadpro/.md#integrate-the-worker-in-the-controller "Direct link to Integrate the worker in the Controller") In the `Controller` of our VIKTOR app, we need to set up the communication with the worker. To call the worker, we use the `PythonAnalysis` class, which allows us to send inputs (files and objects) to the worker. In this example, we will send the `inputs.json` and `run_staad_model.py` to be executed in the Python environment set up for the worker. This environment can be on your own computer or a remote server. When `run_staad_model.py` is executed, it will generate the `output.json` file, and the worker will handle transferring this file from the server environment to our VIKTOR app. Here's how it looks in the code: ``` import json from io import BytesIO from pathlib import Path from viktor.core import File from viktor.external.python import PythonAnalysis class Controller(vkt.Controller): # Previous code... @vkt.TableView("Member End Forces", duration_guess=10, update_label="Run STAAD.Pro Analysis") def run_staad(self, params, **kwargs): nodes, lines, cross_section = create_frame_data( length=params.frame_length, height=params.frame_height, cross_section=params.cross_sect, ) input_json = json.dumps([nodes, lines, cross_section]) script_path = Path(__file__).parent / "run_staad_model.py" staad_analysis = PythonAnalysis( script=File.from_path(script_path), files=[("inputs.json", BytesIO(input_json.encode("utf-8")))], output_filenames=["output.json"], ) staad_analysis.execute(timeout=300) output_file = staad_analysis.get_output_file("output.json") output_raw = output_file.getvalue() if isinstance(output_raw, bytes): output_raw = output_raw.decode("utf-8") output = json.loads(output_raw) forces = [[round(force, 2) for force in row] for row in output["forces"]] return vkt.TableResult( forces, row_headers=output["headers"], column_headers=[ "FX [kN]", "FY [kN]", "FZ [kN]", "MX [kN m]", "MY [kN m]", "MZ [kN m]", ], ) ``` Now you're ready to test your app. Make sure your worker is running, then try generating the model. After the analysis, your app should look like this: ![model](/assets/images/tutorial_staadpro_table_view-a621ff75c915f9658940322899e9dc12.jpg) ## Would you like to see the complete code?[​](https://docs.viktor.ai/docs/tutorials/integrate-staadpro/.md#would-you-like-to-see-the-complete-code "Direct link to Would you like to see the complete code?") We have a convenient GitHub repository with the [STAAD.Pro integration app](https://github.com/viktor-platform/sample-staad-integration/tree/main). If you have a version of STAAD.Pro installed on your computer, you can try out the proof-of-concept app to get an idea of how such an app works and behaves. ## Your turn to build[​](https://docs.viktor.ai/docs/tutorials/integrate-staadpro/.md#your-turn-to-build "Direct link to Your turn to build") You now have everything you need to start building applications that integrate STAAD.Pro into your VIKTOR apps. You can also: * Explore how to [create and analyze transmission towers in STAAD.Pro](https://www.viktor.ai/blog/188/create-and-analyze-transmission-towers-easily-in-staad-pro) ([GitHub repo](https://github.com/viktor-platform/staad-transmission-tower)) * Learn how to [automate baseplate analysis in STAAD.Pro with Python](https://www.viktor.ai/blog/191/how-to-automate-baseplate-analysis-in-staad-pro-with-python) ([GitHub repo](https://github.com/viktor-platform/STAAD-baseplate)) * Explore other [integration tutorials](https://docs.viktor.ai/docs/tutorials/.md#intermediate-level) to learn how to connect more structural or geotechnical software to your apps --- # Tutorial - Create an interactive map info Level: **Beginners**<br />Time: **20 min**<br /> Prerequisites: * You have an account and completed the installation process. No account? Get one [here](https://www.viktor.ai/start-building-apps) * You have some experience with reading Python code * [![](/img/illustrations/free-version-banner.svg)](https://www.viktor.ai/start-building-apps) <br /> ***Not a reader?** feel free to follow this tutorial as a video* ## Introduction[​](https://docs.viktor.ai/docs/tutorials/interactive-maps/.md#introduction "Direct link to Introduction") Welcome to this tutorial on how to create a web app that displays data on map, using VIKTOR and Python! As an engineer or data scientist, you may work with geo-located data. Visualizing this on a map is probably the best way to make this data insightful! In this tutorial, we will explore how to visualize points, lines, and polygons in a map with VIKTOR and python. We will also see how you can make this map interactive and ask users to provide a location. We will cover: 1. [Create an empty app template](https://docs.viktor.ai/docs/tutorials/interactive-maps/.md#2-create-install-and-start-an-empty-app) 2. [Adding a map](https://docs.viktor.ai/docs/tutorials/interactive-maps/.md#3-adding-a-map) 3. [Showing data on the map](https://docs.viktor.ai/docs/tutorials/interactive-maps/.md#4-showing-data-on-the-map) 4. [Let's make it interactive!](https://docs.viktor.ai/docs/tutorials/interactive-maps/.md#5-lets-make-it-interactive) 5. [Using custom markers and colors](https://docs.viktor.ai/docs/tutorials/interactive-maps/.md#6-but-wait-there-is-more) By the end of this tutorial you will be able to place points, lines and polygons in a VIKTOR app and have a basic understanding of how you can use maps to enhance your visuals! It will look similar to the gif below: Need help? Are you encountering an error? Take a look at the [**complete app code**](https://docs.viktor.ai/docs/tutorials/interactive-maps/.md#complete-app-code). Also know that you can always ask for help at our [**Community Forum**](https://community.viktor.ai/), where our developers are ready to help with any question related to the installation, coding and more. ## 1. Create, install and start an empty app[​](https://docs.viktor.ai/docs/tutorials/interactive-maps/.md#1-create-install-and-start-an-empty-app "Direct link to 1. Create, install and start an empty app") Let's create, install and start an empty app. This will be the starting point for the rest of the tutorial. But before we start, make sure to shut down any app that is running (like the demo app) by closing the command-line shell (for example Powershell) or end the process using `Ctrl + C`. Follow these steps to create, install and start an empty app: 1. Open a terminal and run the following command to create the app on the VIKTOR platform and generate the initial code locally: ``` viktor-cli create-app "Map tutorial" --init --app-type editor ``` 2. Open the newly created folder in your code editor and run `viktor-cli clean-start` in the terminal to install dependencies and connect the app to the platform. If all went well, your empty app is installed and connected to your development workspace. **Do not close the terminal** as this will break the connection with your app. The terminal in your code editor should show something like this: ``` INFO : Connecting to cloud.viktor.ai... INFO : Connection is established (use Ctrl+C to close) INFO : INFO : Navigate to the link below to see your app in the browser INFO : https://cloud.viktor.ai/workspaces/XXX/app INFO : INFO : App code loaded, waiting for jobs... ``` Re-starting your app * You only need to create an app template and install it once for each new app you want to make. * The app will update automatically once you start adding code in `app.py`, as long as you don't close the terminal or your code editor. * Did you close your code editor? Use `viktor-cli start` to start the app again. No need to install, clear, etc. Did you encounter any errors? * Always make sure to check the spelling of everything you placed in the command-line, a small mistake and the command you are trying to run may not be recognised! * If you are encountering: ``` ERROR: Exiting because of an error: no requirements.txt file PS C:\Users\<username>\viktor-apps> ``` Then you are not in the correct folder! check the command-line and navigate to the map-tutorial folder. * If you are encountering: ``` Error: App definition is not compatible with the data currently stored in the database. Use the command 'viktor-cli clear' to clear the database. PS C:\Users\<username>\viktor-apps\map-tutorial> ``` That means you have not cleared the database yet! Use the `viktor-cli clear` to clear and then you can use `viktor-cli start` to start the app. No need to install it again! Not seeing any of these errors? Head over to our community! There is a good chance another developer encountered it and solved it too! ## 2. Adding a map[​](https://docs.viktor.ai/docs/tutorials/interactive-maps/.md#2-adding-a-map "Direct link to 2. Adding a map") The app we will be making during this tutorial will display flight paths for air traffic. It will also include functionality for visualizing a no-flight zone. To begin, we will add the map to our app using a [`MapView`](https://docs.viktor.ai/sdk/api/views/.md#_MapView). Remember that we always add views in the `Controller` class. We will also create a list called `features`, containing everything we want to show on the map. The list is empty for now, but we will fill it in the following steps. 1. Open `app.py` and make sure your code looks like this. Notice that all the required import statements are already included. This will save us some back-and-forth along the way. If you like you can use the searchbar on the top-right of this page to get some more information on those features: ``` import viktor as vkt class Parametrization(vkt.Parametrization): pass class Controller(vkt.Controller): parametrization = Parametrization @vkt.MapView('Flight Analysis') def generate_map(self, params, **kwargs): features = [] return vkt.MapResult(features) ``` 2. Go to your cloud environment (e.g. [cloud.viktor.ai](https://cloud.viktor.ai/workspaces)) and open the development card. Great! You will be able to see the map. ![](/assets/images/tutorial-map-1-empty-map-c08e09fadb31c4549c2ec2bb1024676b.png) ## 3. Showing data on the map[​](https://docs.viktor.ai/docs/tutorials/interactive-maps/.md#3-showing-data-on-the-map "Direct link to 3. Showing data on the map") We will draw a polygon on the map to mark the no-fly zone using [`MapPolygon`](https://docs.viktor.ai/sdk/api/views/.md#_MapPolygon). To create this polygon, we must first define its corner using [`MapPoints`](https://docs.viktor.ai/sdk/api/views/.md#_MapPoint). 1. Go to `app.py` and modify the code under the `MapView` so it looks like this: ``` @vkt.MapView('Flight Analysis') def generate_map(self, params, **kwargs): features = [] # Draw no-fly zone no_fly_zone = vkt.MapPolygon([ vkt.MapPoint(54.814614, -26.785331), vkt.MapPoint(54.610949, -15.190123), vkt.MapPoint(50.824269, -15.429211), vkt.MapPoint(50.864828, -26.741683)], ) features.append(no_fly_zone) return vkt.MapResult(features) ``` 2. Go to your app in the browser and refresh the page. Awesome! You should now be able to see the no-fly zone we just made ![](/assets/images/tutorial-map-2-polygon-39607e2fa3b1e1fce894f6b9fda03fff.png) ## 4. Let's make it interactive\![​](https://docs.viktor.ai/docs/tutorials/interactive-maps/.md#4-lets-make-it-interactive "Direct link to 4. Let's make it interactive!") In this part of the tutorial, we will add some interactivity. We will define a flight path by letting the user choose the departing and arriving airport by clicking on the map! We will do this using [`GeoPointField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_GeoPointField). We just want to let you know that there is also [`GeoPolylineField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_GeoPolylineField) and [`GeoPolygonField`](https://docs.viktor.ai/sdk/api/parametrization/.md#_GeoPolygonField) that you can use in your app. Also, we will add a [`Text`](https://docs.viktor.ai/sdk/api/parametrization/.md#_Text) description that helps the users understand what they need to do. 1. Under your `Parametrization` class add these fields, and don’t forget to delete `pass`: ``` ... class Parametrization(vkt.Parametrization): intro = vkt.Text(""" # ✈️ Flight Analysis App! In this app, you can analyze a flight path and whether it passes through a no-fly zone. **Select two points** corresponding to the airports of departure and arrival. """) dep_airport = vkt.GeoPointField('Departing Airport') arr_airport = vkt.GeoPointField('Arriving Airport') ``` 2. Refresh the app and take a look. You will notice the new `GeoFields` and the description. Give them a try. 3. Maybe you already noticed this, but the markers disappear after clicking the map. To solve the problem, let’s add the points to our `features` list in the `MapView` list. Note that we will add an `if-statement` before adding them so the app does not give an error when the user hasn't clicked on the map yet (e.g. `params.dep_airport = None`) Under the line `features.append(no_fly_zone)` add: ``` ... features.append(no_fly_zone) # <--- this line is for your reference if params.dep_airport: dep_point = vkt.MapPoint.from_geo_point(params.dep_airport) features.append(dep_point) if params.arr_airport: arr_point = vkt.MapPoint.from_geo_point(params.arr_airport) features.append(arr_point) ``` 4. Since we are looking to analyze the flight, we also need to add a flight path. Let’s connect the dots 😉. Under the lines we just added, add: ``` if params.dep_airport and params.arr_airport: flight_path = vkt.MapLine(dep_point, arr_point) features.append(flight_path) ``` 5. Refresh your app and take a look. Fantastic, you have now made an app to add flight paths to a map and see whether they enter a no-fly zone. You have done a great job! 🥳 ![](/assets/images/tutorial-map-3-geofields-4c2cc29b28ba2a9202f676c7f757ea9a.png) ## 5. But wait... there is more\![​](https://docs.viktor.ai/docs/tutorials/interactive-maps/.md#5-but-wait-there-is-more "Direct link to 5. But wait... there is more!") We made a beautiful app together, but let’s make it even better by adding some color, custom pins, and descriptive labels. Pins & Colors Here you can find a list of all [pins](https://docs.viktor.ai/sdk/api/views/.md#_MapPoint) and [colors](https://docs.viktor.ai/sdk/api/core/.md#_Color). 1. Let’s make it clear that it is a no-fly zone by making it red and adding a description that the user will see when clicking on the map. Do this by adding these lines of code where you define the `no_fly_zone`: ``` no_fly_zone = vkt.MapPolygon([ vkt.MapPoint(54.814614, -26.785331), vkt.MapPoint(54.610949, -15.190123), vkt.MapPoint(50.824269, -15.429211), vkt.MapPoint(50.864828, -26.741683)], color=vkt.Color.red(), # <--- add this line title="No-fly zone", # <--- add this line description="⛔ This is a no-fly zone. Stay out of this zone!" # <--- add this line ) ``` 2. We will make airport pins blue and change their icon. Find where we define `dep_point` and `arr_point` and modify the code like this: ``` dep_point = vkt.MapPoint.from_geo_point(params.dep_airport, icon='triangle', color=vkt.Color.blue()) ``` ``` arr_point = vkt.MapPoint.from_geo_point(params.arr_airport, icon='triangle-down', color=vkt.Color.blue()) ``` 3. Refresh your app and play with it. Congratulations! You made a wonderful interactive map and even personalized it by using custom icons and colors. You have done a great job and can be proud of yourself! 😎 By now, your app should look like this: ![](/assets/images/tutorial-map-4-custom-1e01e32c48c20adf950b9225f553d3e1.png) ## Complete app code[​](https://docs.viktor.ai/docs/tutorials/interactive-maps/.md#complete-app-code "Direct link to Complete app code") Were you able to do everything in this tutorial without error? If not, you can always take a look at the full code: **Complete code** ``` import viktor as vkt class Parametrization(vkt.Parametrization): intro = vkt.Text(""" # ✈️ Flight Analysis App! In this app, you can analyze a flight path and whether it passes through a no-fly zone. **Select two points** corresponding to the airports of departure and arrival. """) dep_airport = vkt.GeoPointField('Departing Airport') arr_airport = vkt.GeoPointField('Arriving Airport') class Controller(vkt.Controller): parametrization = Parametrization @vkt.MapView('Flight Analysis') def generate_map(self, params, **kwargs): features = [] # Draw no-fly zone no_fly_zone = vkt.MapPolygon([ vkt.MapPoint(54.814614, -26.785331), vkt.MapPoint(54.610949, -15.190123), vkt.MapPoint(50.824269, -15.429211), vkt.MapPoint(50.864828, -26.741683)], color=vkt.Color.red(), title="No-fly zone", description="⛔ This is a no-fly zone. Stay out of this zone!" ) features.append(no_fly_zone) # Draw airports if params.dep_airport: dep_point = vkt.MapPoint.from_geo_point(params.dep_airport, icon='triangle', color=vkt.Color.blue()) features.append(dep_point) if params.arr_airport: arr_point = vkt.MapPoint.from_geo_point(params.arr_airport, icon='triangle-down', color=vkt.Color.blue()) features.append(arr_point) # Draw flight path if params.dep_airport and params.arr_airport: flight_path = vkt.MapLine(dep_point, arr_point) features.append(flight_path) return vkt.MapResult(features) ``` ## Want to learn how VIKTOR works?[​](https://docs.viktor.ai/docs/tutorials/interactive-maps/.md#want-to-learn-how-viktor-works "Direct link to Want to learn how VIKTOR works?") If you are interested in how VIKTOR works behind the scenes, for example how it processes your input, expand the tabs below! #### How does it work?[​](https://docs.viktor.ai/docs/tutorials/interactive-maps/.md#how-does-it-work "Direct link to How does it work?") How does the Parametrization work? In the **Parameterization** class you can add input fields that allow the user to provide input to your app, and there are more than 20 [different input fields](https://docs.viktor.ai/docs/create-apps/user-input/.md) you can use, including numbers, text, colors, images and files. Inside the Parametrization class, you can also format the [layout of your app](https://docs.viktor.ai/docs/create-apps/layout-and-styling/.md) by adding sections, tabs, steps and pages. To show your Parametrization in the app, we need to add the line `parametrization = Parametrization` inside the `Controller` class, because it is the controller that determines what is shown and not. How does the Parametrization get saved? So you may be wondering, how do you get the information from the parametrization to my controller? Well, we do this automatically for you. The values of all parameters are stored in a single variable called `params` , which is accessible inside the Controller class. These variables are stored in a `Munch`; this is similar to a dictionary, but work with point denotation. Example: * Let's say we have a variable called `height` as a NumberField in our `Parameterization`. * To use it in a method in the `Controller`, define it as: `def my_method(self, params, **kwargs)` * You can now make calculations inside that method using our height parameter as `params.height`! How does the Controller work? The **Controller** class is the place where you add everything you want to calculate and show. As explained in this tutorial, we show results in a `View` and we always add views in our controller. You can even add several views in a single app by adding them to the controller class... and yes, we have [many Views](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md),for showing graphs, maps, 3D models, reports, images and more. In the Controller, you also do or call your calculation. Remember that the user input given in the parametrization, is accessible inside the Controller class in the variable The `params`. ## What's next[​](https://docs.viktor.ai/docs/tutorials/interactive-maps/.md#whats-next "Direct link to What's next") Very impressive! You have now learned the basics of the VIKTOR `MapView`. In this tutorial, we have only scratched the surface of what you can do using maps. So don’t stop your journey there! If you like an extra challenge, here are some ideas: * Make the no-fly zone interactive using a `GeoPolygonField` * Make the flight path red when it crosses the no-fly zone and green when it doesn’t * Create a flight path that passes several points using a `GeoPolylineField` * Calculate the distance of the flight path and show it on the map Or just follow some of our other [tutorials](https://docs.viktor.ai/docs/tutorials/.md) More about maps You can find more information about how to use maps in the [maps guide](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/map/.md). Also check more about [input fields for maps](https://docs.viktor.ai/docs/create-apps/user-input/map-features/.md) --- # Tutorial - 3D models info Level: **Intermediate**<br />Time: **30 min**<br /> Prerequisites: * You have an account and completed the installation process. No account? Get one [here](https://www.viktor.ai/start-building-apps) * You have some experience with reading Python code * [![](/img/illustrations/free-version-banner.svg)](https://www.viktor.ai/start-building-apps) ## Introduction[​](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#introduction "Direct link to Introduction") As a designer or engineer, creating 3D models is an essential part of your work. 3D models can help you visualize and communicate complex concepts in a way that is easy to understand. In this tutorial, we will explore how to create 3D models in VIKTOR using Python. By the end of this tutorial, you will have the skills and knowledge needed to create your own 3D models in VIKTOR using Python. We will start with simple shapes and gradually work our way up to more complex models. Whether you are a beginner or an experienced designer, this tutorial will provide you with a solid foundation in 3D modeling with VIKTOR. This tutorial consists of six different sections: 1. [Create an empty app](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#1-create-install-and-start-an-empty-app) 2. [Set up the basis](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#2-set-up-the-basis) 3. [Drawing the bridge deck](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#3-drawing-the-bridge-deck) 4. [Adding supports](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#4-adding-supports) 5. [The finishing touches](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#5-the-finishing-touches) 6. [The complete app code](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#complete-app-code) To give you an idea of what you will be creating, here's a GIF of the application you will me making throughout this tutorial: ![](/assets/images/tutorial_three_d_animation-746869b19b332fe75b85339dacdbcb1a.webp) *What the app looks like once you complete this tutorial* Need help? Are you encountering an error? Take a look at the [**complete app code**](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#complete-app-code). Also know that you can always ask for help at our [**Community Forum**](https://community.viktor.ai/), where our developers are ready to help with any question related to the installation, coding and more. ## 1. Create, install and start an empty app[​](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#1-create-install-and-start-an-empty-app "Direct link to 1. Create, install and start an empty app") Let's create, install and start an empty app. This will be the starting point for the rest of the tutorial. But before we start, make sure to shut down any app that is running (like the demo app) by closing the command-line shell (for example Powershell) or end the process using `Ctrl + C`. Follow these steps to create, install and start an empty app: 1. Open a terminal and run the following command to create the app on the VIKTOR platform and generate the initial code locally: ``` viktor-cli create-app "Model tutorial" --init --app-type editor ``` 2. Open the newly created folder in your code editor and run `viktor-cli clean-start` in the terminal to install dependencies and connect the app to the platform. If all went well, your empty app is installed and connected to your development workspace. **Do not close the terminal** as this will break the connection with your app. The terminal in your code editor should show something like this: ``` INFO : Connecting to cloud.viktor.ai... INFO : Connection is established (use Ctrl+C to close) INFO : INFO : Navigate to the link below to see your app in the browser INFO : https://cloud.viktor.ai/workspaces/XXX/app INFO : INFO : App code loaded, waiting for jobs... ``` Re-starting your app * You only need to create an app template and install it once for each new app you want to make. * The app will update automatically once you start adding code in `app.py`, as long as you don't close the terminal or your code editor. * Did you close your code editor? Use `viktor-cli start` to start the app again. No need to install, clear, etc. Did you encounter any errors? * Always make sure to check the spelling of everything you placed in the command-line, a small mistake and the command you are trying to run may not be recognised! * If you are encountering: ``` ERROR: Exiting because of an error: no requirements.txt file PS C:\Users\<username>\viktor-apps> ``` Then you are not in the correct folder! check the command-line and navigate to the 3D-model-tutorial folder. * If you are encountering: ``` Error: App definition is not compatible with the data currently stored in the database. Use the command 'viktor-cli clear' to clear the database. PS C:\Users\<username>\viktor-apps\3D-model-tutorial> ``` That means you have not cleared the database yet! Use the `viktor-cli clear` to clear and then you can use `viktor-cli start` to start the app. No need to install it again! Not seeing any of these errors? Head over to our community! There is a good chance another developer encountered it and solved it too! ## 2. Set up the basis[​](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#2-set-up-the-basis "Direct link to 2. Set up the basis") In this tutorial we will make a 3D model. In this example case you will be modelling a bridge including a simplified version of the river running underneath it, the sloped embankment on the side of the river and the supports underneath the bridge. 🌉 Let's start easy and create a simple bridge deck and a river running underneath it, and some input fields to change the dimensions. ### Input fields[​](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#input-fields "Direct link to Input fields") We will add 4 inputfields to define the dimensions of our bridge, our app: `length`, `width`, `height` and `deck_thickness`. We will use a [`Numberfield`](https://docs.viktor.ai/sdk/api/parametrization/.md#_NumberField), for each. 1. Open `app.py`, and add the relevant fields to your parametrization. It is always good to give people some context using [`Text`](https://docs.viktor.ai/docs/create-apps/inform-end-user/text-blocks/.md) elements. Don't forget to import the necessary fields. In the end your `app.py` file should look like this: ``` import viktor as vkt class Parametrization(vkt.Parametrization): intro = vkt.Text("# 3D model app 🌉\n This app parametrically generates and visualises a 3D model of a bridge") txt_deck = vkt.Text('### Deck layout ') # texts can be used for explanation in the user-interface length = vkt.NumberField("Deck length", min=6, default=100, suffix='m') width = vkt.NumberField("Deck width", min=2, default=20, suffix='m') deck_thickness = vkt.NumberField("Deck thickness", min=0.5, default=1, suffix='m') height = vkt.NumberField("Bridge height", min=2, default=10, suffix='m') class Controller(vkt.Controller): parametrization = Parametrization ``` 2. Refresh your app, and you should see the input fields there. ### Basic set up & the river[​](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#basic-set-up--the-river "Direct link to Basic set up & the river") We don’t need a bridge if there is no river. So, let’s start with making the river step by step and set up the basis for the next parts, so we can explain some concepts. 1. We want to show a 3D model, so we will create a [`GeometryView`](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/threed-model/.md) inside your `controller` like this: ``` class Controller(vkt.Controller): parametrization = Parametrization @vkt.GeometryView("3D", x_axis_to_right=True) def visualize_bridge(self, params, **kwargs): return vkt.GeometryResult(geometry_group) ``` 2. Inside `visualize_bridge`, we'll create a empty [`Group`](https://docs.viktor.ai/sdk/api/geometry/.md#_Group) to store all elements we want to show: ``` # Create an empty group to hold all the geometry geometry_group = vkt.Group([]) ``` 3. Now we'll define the measurements of the river and bridge's surroundings. We don’t want to make new input field for that, so we will just use the bridge measurements for this. Inside `visualize_bridge`: ``` # Measurements environment env_width = params.length env_thick = params.deck_thickness # Thickness of water and embankment water_width = params.length - 2 * params.height # Assuming embankment at 45 deg ``` 4. Then, create a [`Material`](https://docs.viktor.ai/sdk/api/geometry/.md#_Material) so we can make the water blue, and let's make it a bit transparent. Inside `visualize_bridge`: ``` # Create materials mat_water = vkt.Material('Water', color=vkt.Color.blue(), opacity=0.7) ``` 5. Next, create the water by drawing a box is using [`SquareBeam`](https://docs.viktor.ai/sdk/api/geometry/.md#_SquareBeam) and add it to the `Group` we made before. Inside `visualize_bridge` add: ``` # Draw water water = vkt.SquareBeam(water_width, env_width, env_thick, material=mat_water) ``` 6. The last step is return the geometry, so it is visualized: ``` geometry_group.add([water]) ``` 7. Update your app, and you will see the river ### All code until now[​](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#all-code-until-now "Direct link to All code until now") Click here to see **all code until now** ``` import viktor as vkt class Parametrization(vkt.Parametrization): intro = vkt.Text("# 3D model app 🌉\n This app parametrically generates and visualises a 3D model of a bridge") txt_deck = vkt.Text('### Deck layout ') # texts can be used for explanation in the user-interface length = vkt.NumberField("Deck length", min=6, default=100, suffix='m') width = vkt.NumberField("Deck width", min=2, default=20, suffix='m') deck_thickness = vkt.NumberField("Deck thickness", min=0.5, default=1, suffix='m') height = vkt.NumberField("Bridge height", min=2, default=10, suffix='m') class Controller(vkt.Controller): parametrization = Parametrization @vkt.GeometryView("3D", x_axis_to_right=True) def visualize_bridge(self, params, **kwargs): # Create an empty group to hold all the geometry geometry_group = vkt.Group([]) # Measurements environment env_width = params.length env_thick = params.deck_thickness # Thickness of water and embankment water_width = params.length - 2 * params.height # Assuming embankment at 45 deg # Create materials mat_water = vkt.Material('Water', color=vkt.Color.blue(), opacity=0.7) # Draw water water = vkt.SquareBeam(water_width, env_width, env_thick, material=mat_water) geometry_group.add([water]) return vkt.GeometryResult(geometry_group) ``` ## 3. Drawing the bridge deck[​](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#3-drawing-the-bridge-deck "Direct link to 3. Drawing the bridge deck") Now that we have the basis for drawing our 3D models, and a beautiful river 😉, we can quickly create the bridge: ### Adding the deck[​](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#adding-the-deck "Direct link to Adding the deck") We'll create the bridge inside the `GeometryView`, like we did before. 1. Create the deck, using the `SquareBeam` function as well, and give the deck a width, length and thickness. ``` deck = vkt.SquareBeam(params.length, params.width, params.deck_thickness) ``` 2. `SquareBeam` creates a box with its centre at the origin (0, 0, 0). In order to move the deck to the correct position let's use [`translate`](https://docs.viktor.ai/sdk/api/geometry/.md#_TransformableObject) ``` deck.translate((0, 0, params.height)) ``` 3. Now we will create the deck top, you can interpret this top as the asphalt layer of the bridge. But first, let's define a new material. This time we'll define the `Color` using RGB values: ``` mat_deck_top = vkt.Material('Deck top', color=vkt.Color(60, 60, 60)) ``` 4. Again, use `SquareBeam` and `translate` it in the z-direction: ``` deck_top = vkt.SquareBeam(params.length, params.width, params.deck_thickness / 4, material=mat_deck_top) deck_top.translate((0, 0, params.height + 5/8*params.deck_thickness)) ``` 5. Add the created elements to the geometry `Group` so they get visualized: ``` geometry_group.add([deck, deck_top]) ``` 6. Refresh your application, you should see the water and the bridge in 3D view. ## 5. Adding supports[​](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#5-adding-supports "Direct link to 5. Adding supports") That's a really beautiful bridge, but something feels wrong, it looks like the bridge is flying, so we are now going to generate some supports for it, parametrically of course. ### The plan[​](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#the-plan "Direct link to The plan") Before going into the code, let's discuss the plan. We will make a V-shaped support and place it on several locations according to a 'grid', as shown here: ![](/assets/images/tutorial-three-d-supports-aacfa2b654a79d0f9b75c1206ef8de34.png) ### Input fields[​](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#input-fields-1 "Direct link to Input fields") With that said, let's jump into the code. 1. We will add 2 input fields to our app: `support_amount`, `support_piles_amount`. These inputs will define how many supports we want. Inside the `parametrization` class add the following three lines of code: ``` txt_support = vkt.Text('### Support layout', flex=100) support_amount = vkt.NumberField("Number of supports", default=2, min=1) support_piles_amount = vkt.NumberField("Number of piles per support", min=2, default=3) ``` 2. Refresh your app and you should see the new input fields. ### Create one support[​](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#create-one-support "Direct link to Create one support") Next let's make the bridge supports. The supports each consist of two columns in a V-formation placed on a support box. As before, we will draw the different element inside the `GeometryView` 1. Inside your `GeometryView` before the `return`, we will define the pile diameter and the grid size. Note that we did not create an input field to define the diameter (but feel free), so we will make it equal to ½ of the deck thickness: ``` pile_diameter = params.deck_thickness / 2 grid_size_x = water_width / params.support_amount grid_size_y = (params.width - pile_diameter) / (params.support_piles_amount - 1) ``` 2. Draw one column and use [`mirror_object`](https://docs.viktor.ai/sdk/api/geometry/.md#_mirror_object) to get the V-shape. We draw the column by extruding a circle along a line using [`CircularExtrusion`](https://docs.viktor.ai/sdk/api/geometry/.md#_CircularExtrusion): ``` # Draw columns top_point = vkt.Point(-grid_size_x/2, 0, params.height) bottom_point = vkt.Point(0, 0, 0) column_line = vkt.Line(top_point, bottom_point) column_1 = vkt.CircularExtrusion(pile_diameter, column_line) column_2 = vkt.geometry.mirror_object(column_1, vkt.Point(0, 0, 0), (1, 0, 0)) ``` 3. Let's now add the box at the base to complete our support: ``` # Draw base column_base = vkt.SquareBeam(3 * pile_diameter, pile_diameter, 2*pile_diameter) ``` 4. For the next step, it is convenient to put the 3 elements we just made in a new `Group`: ``` support = vkt.Group([column_1, column_2, column_base]) ``` 5. Let's see our progress by temporarily adding the `support` to our `geometry_group` and updating your app: ``` geometry_group.add([support]) ``` 6. Before continuing, eliminate the line of code we added in the last step. ### Repeating the supports[​](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#repeating-the-supports "Direct link to Repeating the supports") We will now use the support we draw in the last section and repeat it according to our grid. As before, we will continue to work inside our `GeometryView`. Improve the speed of your app When we hear repeating, our Python minds immediately think in a for loop. But in VIKTOR, we do **not use a for loop** for making repetitive geometries. This will make you app unnecessary slow. For this `Pattern`, `LinearPattern`, and `BidirectionalPattern` are better suited. This can reduce the loading time from minutes to seconds in larger models. 1. First, place the `support` in the corner of the grid using `translate`: ``` support.translate((-water_width/2 + grid_size_x/2, -params.width/2 + pile_diameter/2, 0)) ``` 2. Now, we will copy the support using [`BidirectionalPattern`](https://docs.viktor.ai/sdk/api/geometry/.md#_BidirectionalPattern). While this may seem like a difficult function at first, the implementation is surprisingly easy: ``` all_supports = vkt.BidirectionalPattern( base_object=support, direction_1=[1, 0, 0], direction_2=[0, 1, 0], number_of_elements_1=params.support_amount, number_of_elements_2=params.support_piles_amount, spacing_1=grid_size_x, spacing_2=grid_size_y ) ``` 3. Let's add `all_supports` to `geometry_group` so we visualize them ``` # Adding geometry group to geometry result geometry_group.add(all_supports) ``` 4. Refresh your app, and look how amazing your bridge is looking! ### All code until now[​](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#all-code-until-now-1 "Direct link to All code until now") Click here to see **all code until now** ``` import viktor as vkt class Parametrization(vkt.Parametrization): intro = vkt.Text("# 3D model app 🌉\n This app parametrically generates and visualises a 3D model of a bridge") txt_deck = vkt.Text('### Deck layout ') # texts can be used for explanation in the user-interface length = vkt.NumberField("Deck length", min=6, default=100, suffix='m') width = vkt.NumberField("Deck width", min=2, default=20, suffix='m') deck_thickness = vkt.NumberField("Deck thickness", min=0.5, default=1, suffix='m') height = vkt.NumberField("Bridge height", min=2, default=10, suffix='m') txt_support = vkt.Text('### Support layout', flex=100) support_amount = vkt.NumberField("Number of supports", default=2, min=1) support_piles_amount = vkt.NumberField("Number of piles per support", min=2, default=3) class Controller(vkt.Controller): parametrization = Parametrization @vkt.GeometryView("3D", x_axis_to_right=True) def visualize_bridge(self, params, **kwargs): # Create an empty group to hold all the geometry geometry_group = vkt.Group([]) # =============================== # Draw Environment # =============================== # Measurements environment env_width = params.length env_thick = params.deck_thickness # Thickness of water and embankment water_width = params.length - 2 * params.height # Assuming embankment at 45 deg # Create materials mat_water = vkt.Material('Water', color=vkt.Color.blue(), opacity=0.7) mat_deck_top = vkt.Material('Deck top', color=vkt.Color(60, 60, 60)) # Draw water water = vkt.SquareBeam(water_width, env_width, env_thick, material=mat_water) geometry_group.add([water]) # =============================== # Create Bridge # =============================== # Draw deck deck = vkt.SquareBeam(params.length, params.width, params.deck_thickness) deck.translate((0, 0, params.height)) deck_top = vkt.SquareBeam(params.length, params.width, params.deck_thickness / 4, material=mat_deck_top) deck_top.translate((0, 0, params.height + 5/8*params.deck_thickness)) geometry_group.add([deck, deck_top]) # Define grid pile_diameter = params.deck_thickness / 2 grid_size_x = water_width / params.support_amount grid_size_y = (params.width - pile_diameter) / (params.support_piles_amount - 1) # Draw columns top_point = vkt.Point(-grid_size_x/2, 0, params.height) bottom_point = vkt.Point(0, 0, 0) column_line = vkt.Line(top_point, bottom_point) column_1 = vkt.CircularExtrusion(pile_diameter, column_line) column_2 = vkt.geometry.mirror_object(column_1, vkt.Point(0, 0, 0), (1, 0, 0)) # Draw base column_base = vkt.SquareBeam(3 * pile_diameter, pile_diameter, 2*pile_diameter) # Pattern supports support = vkt.Group([column_1, column_2, column_base]) support.translate((-water_width/2 + grid_size_x/2, -params.width/2 + pile_diameter/2, 0)) all_supports = vkt.BidirectionalPattern( base_object=support, direction_1=[1, 0, 0], direction_2=[0, 1, 0], number_of_elements_1=params.support_amount, number_of_elements_2=params.support_piles_amount, spacing_1=grid_size_x, spacing_2=grid_size_y ) # Adding geometry group to geometry result geometry_group.add(all_supports) return vkt.GeometryResult(geometry_group) ``` ## 5. The finishing touches[​](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#5-the-finishing-touches "Direct link to 5. The finishing touches") You already made an amazing parametric bridge and learned the basics of creating 3D models in VIKTOR. In this chapter we just want to show you some little extras that can be useful during your app development journey. ### Drawing the embankment[​](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#drawing-the-embankment "Direct link to Drawing the embankment") We already learned that you can move things using `translate`. This is because everything you draw is a [`TransformableObject`](https://docs.viktor.ai/sdk/api/geometry/.md#_TransformableObject). Besides `translate` you can also use other transformations, like [`rotate`](https://docs.viktor.ai/sdk/api/geometry/.md#TransformableObject.rotate), [`mirror`](https://docs.viktor.ai/sdk/api/geometry/.md#TransformableObject.mirror) and [`scale`](https://docs.viktor.ai/sdk/api/geometry/.md#TransformableObject.scale). Let’s give this a try drawing the embankments. 1. In your `GeometryView`, let's add a new `Material`: ``` mat_grass = vkt.Material('Grass', color=vkt.Color.green()) ``` 2. Then, we will create, `rotate`, and `translate` the embankment, and make a copy of it : ``` # Draw embankment (assuming embankment at 45 deg) embankment_1 = vkt.SquareBeam(1.4 * params.height, env_width, env_thick, material=mat_grass) embankment_1.rotate(-math.pi / 4, direction=[0, 1, 0]) embankment_1.translate(((water_width+params.height)/2, 0, params.height/2)) embankment_2 = vkt.geometry.mirror_object(embankment_1, vkt.Point(0, 0, 0), (1, 0, 0)) ``` 3. As allways, add the objects to `geometry_group`: ``` geometry_group.add([embankment_1, embankment_2]) ``` 4. Don't forget to import: ``` import math ``` 5. Reload you app and see what happened ### A colorful bridge[​](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#a-colorful-bridge "Direct link to A colorful bridge") Until now, we did not give the bridge a color, which by is shown grey by default. We already learned that you can make a `Material` and give it a `Color`, but did you know that we can ask the user to give it a color too? To demonstrate this, let’s: 1. Create an ColorField: ``` bridge_color = vkt.ColorField('Bridge Color', default=vkt.Color(200, 200, 200)) ``` 2. Create a material ``` mat_bridge = vkt.Material('Bridge', color=params.bridge_color) ``` 3. Assign this material to any (or all) of `deck`, `column_1` and `column_base`. By adding `material=mat_bridge` to the `SquareBeam` and `CircularExtrusion` functions that generate these elements. 4. Reload and play with you app ## Complete app code[​](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#complete-app-code "Direct link to Complete app code") Were you able to do everything in this tutorial without error? If not, you can always look at the full code: **Complete code** ``` import viktor as vkt import math class Parametrization(vkt.Parametrization): intro = vkt.Text("# 3D model app 🌉\n This app parametrically generates and visualises a 3D model of a bridge") txt_deck = vkt.Text('### Deck layout ') # texts can be used for explanation in the user-interface length = vkt.NumberField("Deck length", min=6, default=100, suffix='m') width = vkt.NumberField("Deck width", min=2, default=20, suffix='m') deck_thickness = vkt.NumberField("Deck thickness", min=0.5, default=1, suffix='m') height = vkt.NumberField("Bridge height", min=2, default=10, suffix='m') txt_support = vkt.Text('### Support layout', flex=100) support_amount = vkt.NumberField("Number of supports", default=2, min=1) support_piles_amount = vkt.NumberField("Number of piles per support", min=2, default=3) bridge_color = vkt.ColorField('Bridge Color', default=vkt.Color(200, 200, 200)) class Controller(vkt.Controller): parametrization = Parametrization @vkt.GeometryView("3D", x_axis_to_right=True) def visualize_bridge(self, params, **kwargs): # Create an empty group to hold all the geometry geometry_group = vkt.Group([]) # Measurements environment env_width = params.length env_thick = params.deck_thickness # Thickness of water and embankment water_width = params.length - 2 * params.height # Assuming embankment at 45 deg # Create materials mat_water = vkt.Material('Water', color=vkt.Color.blue(), opacity=0.7) mat_deck_top = vkt.Material('Deck top', color=vkt.Color(60, 60, 60)) mat_grass = vkt.Material('Grass', color=vkt.Color.green()) mat_bridge = vkt.Material('Bridge', color=params.bridge_color) # =============================== # Draw environment # =============================== # Draw water water = vkt.SquareBeam(water_width, env_width, env_thick, material=mat_water) geometry_group.add([water]) # Draw embankment (at 45 deg) embankment_1 = vkt.SquareBeam(1.4 * params.height, env_width, env_thick, material=mat_grass) embankment_1.rotate(-math.pi / 4, direction=[0, 1, 0]) embankment_1.translate(((water_width+params.height)/2, 0, params.height/2)) embankment_2 = vkt.geometry.mirror_object(embankment_1, vkt.Point(0, 0, 0), (1, 0, 0)) # Add created geometries to geometry group geometry_group.add([embankment_1, embankment_2]) # =============================== # Create Bridge # =============================== # Draw deck deck = vkt.SquareBeam(params.length, params.width, params.deck_thickness, material=mat_bridge) deck.translate((0, 0, params.height)) deck_top = vkt.SquareBeam(params.length, params.width, params.deck_thickness / 4, material=mat_deck_top) deck_top.translate((0, 0, params.height + 5/8*params.deck_thickness)) geometry_group.add([deck, deck_top]) # Define grid pile_diameter = params.deck_thickness / 2 grid_size_x = water_width / params.support_amount grid_size_y = (params.width - pile_diameter) / (params.support_piles_amount - 1) # Draw columns top_point = vkt.Point(-grid_size_x/2, 0, params.height) bottom_point = vkt.Point(0, 0, 0) column_line = vkt.Line(top_point, bottom_point) column_1 = vkt.CircularExtrusion(pile_diameter, column_line, material=mat_bridge) column_2 = vkt.geometry.mirror_object(column_1, vkt.Point(0, 0, 0), (1, 0, 0)) # Draw base column_base = vkt.SquareBeam(3 * pile_diameter, pile_diameter, 2*pile_diameter, material=mat_bridge) support = vkt.Group([column_1, column_2, column_base]) support.translate((-water_width/2 + grid_size_x/2, -params.width/2 + pile_diameter/2, 0)) all_supports = vkt.BidirectionalPattern( base_object=support, direction_1=[1, 0, 0], direction_2=[0, 1, 0], number_of_elements_1=params.support_amount, number_of_elements_2=params.support_piles_amount, spacing_1=grid_size_x, spacing_2=grid_size_y ) # Adding geometry group to geometry result geometry_group.add(all_supports) return vkt.GeometryResult(geometry_group) ``` ## Want to learn how VIKTOR works?[​](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#want-to-learn-how-viktor-works "Direct link to Want to learn how VIKTOR works?") If you are interested in how VIKTOR works behind the scenes, for example how it processes your input, expand the tabs below! #### How does it work?[​](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#how-does-it-work "Direct link to How does it work?") How does the Parametrization work? In the **Parameterization** class you can add input fields that allow the user to provide input to your app, and there are more than 20 [different input fields](https://docs.viktor.ai/docs/create-apps/user-input/.md) you can use, including numbers, text, colors, images and files. Inside the Parametrization class, you can also format the [layout of your app](https://docs.viktor.ai/docs/create-apps/layout-and-styling/.md) by adding sections, tabs, steps and pages. To show your Parametrization in the app, we need to add the line `parametrization = Parametrization` inside the `Controller` class, because it is the controller that determines what is shown and not. How does the Parametrization get saved? So you may be wondering, how do you get the information from the parametrization to my controller? Well, we do this automatically for you. The values of all parameters are stored in a single variable called `params` , which is accessible inside the Controller class. These variables are stored in a `Munch`; this is similar to a dictionary, but work with point denotation. Example: * Let's say we have a variable called `height` as a NumberField in our `Parameterization`. * To use it in a method in the `Controller`, define it as: `def my_method(self, params, **kwargs)` * You can now make calculations inside that method using our height parameter as `params.height`! How does the Controller work? The **Controller** class is the place where you add everything you want to calculate and show. As explained in this tutorial, we show results in a `View` and we always add views in our controller. You can even add several views in a single app by adding them to the controller class... and yes, we have [many Views](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md),for showing graphs, maps, 3D models, reports, images and more. In the Controller, you also do or call your calculation. Remember that the user input given in the parametrization, is accessible inside the Controller class in the variable The `params`. ## To infinity and beyond\![​](https://docs.viktor.ai/docs/tutorials/intermediate-3d-model/.md#to-infinity-and-beyond "Direct link to To infinity and beyond!") Well done! You are now able to create an app that can parametrically design a 3D model which includes rectangular as well as circular extrusions with mirror, rotate and pattern possibilities! Obviously there is way more to discover about VIKTOR and its 3D modelling capabilities. Check those out in [our documentation](https://docs.viktor.ai/sdk/api/geometry/.md) Finally, the journey doesn't end here. Check out some of our other [tutorials](https://docs.viktor.ai/docs/tutorials/.md) or go to the [next section](https://docs.viktor.ai/docs/create-apps/.md) where you can see the different paths you can follow in your journey to learn more about VIKTOR. --- # Tutorial - Data Analysis with Plotly and Pandas info Level: **Beginners**<br />Time: **20 min**<br /> Prerequisites: * You have an account and completed the installation process. No account? Get one [here](https://www.viktor.ai/start-building-apps) * You have some experience with reading Python code * [![](/img/illustrations/free-version-banner.svg)](https://www.viktor.ai/start-building-apps) <br /> ***Not a reader?** feel free to follow this tutorial as a video* ## Introduction[​](https://docs.viktor.ai/docs/tutorials/plots-and-data/.md#introduction "Direct link to Introduction") In this tutorial we’ll make a VIKTOR app to process, visualize and summarize data from a `.csv`. We’ll do this by using two well-known Python libraries: Pandas and Plotly. Visualizing data is one of the best ways to find trends and patterns. By plotting or grouping the data, we can quickly find these trends and make better business decisions! It is also an excellent way to present results to stakeholders like your manager or another business unit. In this tutorial you will learn how to: 1. [Create an empty app template](https://docs.viktor.ai/docs/tutorials/plots-and-data/.md#1-create-install-and-start-an-empty-app) 2. [Extract the data from a .csv](https://docs.viktor.ai/docs/tutorials/plots-and-data/.md#2-extract-data-from-csv) 3. [Add input fields](https://docs.viktor.ai/docs/tutorials/plots-and-data/.md#3-add-input-fields) 4. [Plot the data using Plotly](https://docs.viktor.ai/docs/tutorials/plots-and-data/.md#4-plot-the-data) 5. [Add a data summary](https://docs.viktor.ai/docs/tutorials/plots-and-data/.md#5-add-a-data-summary) By the end of this tutorial you will be able to create a colorful chart that can be used for analysis and saved for reports to help explain data. You will understand how to automate the process in VIKTOR and it will look similar to the gif below: Need help? Are you encountering an error? Take a look at the [**complete app code**](https://docs.viktor.ai/docs/tutorials/plots-and-data/.md#complete-code). Also know that you can always ask for help at our [**Community Forum**](https://community.viktor.ai/), where our developers are ready to help with any question related to the installation, coding and more. ## 1. Create, install and start an empty app[​](https://docs.viktor.ai/docs/tutorials/plots-and-data/.md#1-create-install-and-start-an-empty-app "Direct link to 1. Create, install and start an empty app") Let's create, install and start an empty app. This will be the starting point for the rest of the tutorial. But before we start, make sure to shut down any app that is running (like the demo app) by closing the command-line shell (for example Powershell) or end the process using `Ctrl + C`. Follow these steps to create, install and start an empty app: 1. Open a terminal and run the following command to create the app on the VIKTOR platform and generate the initial code locally: ``` viktor-cli create-app "Graph tutorial" --init --app-type editor ``` 2. Open the newly created folder in your code editor and run `viktor-cli clean-start` in the terminal to install dependencies and connect the app to the platform. If all went well, your empty app is installed and connected to your development workspace. The terminal in your code editor should show something like this: ``` INFO : Connecting to cloud.viktor.ai... INFO : Connection is established (use Ctrl+C to close) INFO : INFO : Navigate to the link below to see your app in the browser INFO : https://cloud.viktor.ai/workspaces/XXX/app INFO : INFO : App code loaded, waiting for jobs... ``` 4. We want to use Pandas and Plotly in this app. Open `requirements.txt` and add `plotly` and `pandas` under your `viktor` version (don't change that line): ``` viktor==X.X.X <-- Don't modify this line plotly pandas ``` Now disconnect your app by closing the connection using Ctrl+C to be able to install these new dependencies. You do this by entering the following command: ``` viktor-cli install ``` And reconnecting the app by entering the command: ``` viktor-cli start ``` Re-starting your app * You only need to create an app template and install it once for each new app you want to make. * The app will update automatically once you start adding code in `app.py`, as long as you don't close the terminal or your code editor. * Did you close your code editor? Use `viktor-cli start` to start the app again. No need to install, clear, etc. Did you encounter any errors? * Always make sure to check the spelling of everything you placed in the command-line, a small mistake and the command you are trying to run may not be recognised! * If you are encountering: ``` ERROR: Exiting because of an error: no requirements.txt file PS C:\Users\<username>\viktor-apps> ``` Then you are not in the correct folder! check the command-line and navigate to the data-analysis-tutorial folder. * If you are encountering: ``` Error: App definition is not compatible with the data currently stored in the database. Use the command 'viktor-cli clear' to clear the database. PS C:\Users\<username>\viktor-apps\data-analysis-tutorial> ``` That means you have not cleared the database yet! Use the `viktor-cli clear` to clear and then you can use `viktor-cli start` to start the app. No need to install it again! Not seeing any of these errors? Head over to our community! There is a good chance another developer encountered it and solved it too! ## 2. Extract data from .csv[​](https://docs.viktor.ai/docs/tutorials/plots-and-data/.md#2-extract-data-from-csv "Direct link to 2. Extract data from .csv") For this tutorial, we will dive into a dataset that contains the car sales data of a showroom. The CEO has asked you to create a tool so that they can compare which type of cars were sold. He did not specify what he wanted to compare so we will make this tool so that we compare any two properties of the sold cars as well as give some additional data/information that might be interesting. 1. Download the dataset [here](https://docs.viktor.ai/files/docs/graph-tutorial/car-sales.csv). 2. Make sure the file name is `car-sales.csv` 3. Add the file to your app folder (`data-analysis-tutorial`) 4. We'll create the function `extract_data` to access the data using Pandas, and add all the necessary imports so that we don't need to do this later. Open `app.py` and make sure the first part of the code looks like this: ``` import viktor as vkt import pandas as pd import plotly.graph_objects as go from pathlib import Path def extract_data(): parent_folder = Path(__file__).parent file_path = parent_folder/"car-sales.csv" data = pd.read_csv(file_path, sep=';') return data class Parametrization(vkt.Parametrization): # <--- this line is for your reference ``` ## 3. Add Input fields[​](https://docs.viktor.ai/docs/tutorials/plots-and-data/.md#3-add-input-fields "Direct link to 3. Add Input fields") We want the CEO to interact with the app. For this, we will add two [`OptionFields`](https://docs.viktor.ai/sdk/api/parametrization/.md#_OptionField). One to determine the variable on the X-axis and the other for the Y-axis. Also, we will make sure that the showed options correspond to the columns of the data set. Remember, we always add input fields in the `Parametrization` class. 1. In the `app.py` file make sure the code in the `Parametrization` class looks like this: ``` ... class Parametrization(vkt.Parametrization): introduction = vkt.Text( """ # 📊 Data Analysis App! In this app you can summarise data and visualise it in a PlotlyView. The app will summarise some data in the DataView and allow the user to choose a column to analyse to create the Plotly chart. """ ) # Add some input field for the user main_column = vkt.OptionField('Choose main property', options=extract_data().columns.values.tolist()) count_column = vkt.OptionField('Choose property to analyse', options=extract_data().columns.values.tolist()) class Controller(vkt.Controller): # <--- this line is for your reference ``` 2. Go to your cloud environment (e.g. [cloud.viktor.ai](https://cloud.viktor.ai/workspaces)) and open the development card. Great! You will be able to see your input fields. ![](/assets/images/tutorial-data-1-params-66c67690b9d95dba4562c3fe43c2aa71.png) *How the app should look after the parametrization* ## 4. Plot the data[​](https://docs.viktor.ai/docs/tutorials/plots-and-data/.md#4-plot-the-data "Direct link to 4. Plot the data") Now, we'll make a bar chart to show the data. We will create the plot using Plotly, which is a well known plotting library. In VIKTOR, we show Plotly graphs in a [`PlotlyView`](https://docs.viktor.ai/sdk/api/views/.md#_PlotlyView). We'll use the function `extract_data` to extract the data form the .csv, and Pandas to process it. Remember, we allways add views in our `Controller` class. 1. In `app.py`, find the `Controller` class and make it look like this: ``` class Controller(vkt.Controller): parametrization = Parametrization @vkt.PlotlyView('Bar chart') def generate_plotly_view(self, params, **kwargs): # Extract and edit data to make it easy to plot data = extract_data() edited_data = data.groupby(params.main_column)[params.count_column].value_counts().unstack().fillna(0) # Make the bar chart fig = go.Figure() for column in edited_data.columns: fig.add_trace(go.Bar(x=edited_data.index, y=edited_data[column], name=column)) # Edit the bar chart fig.update_layout(barmode='stack',xaxis_title=params.main_column,yaxis_title='Amount Sold') return vkt.PlotlyResult(fig) ``` 2. Refresh your app. Nice! You should now see a beautiful stacked bar chart of the data after you fill in the inputs. What you will also notice is that when you hover the mouse over one of the bars, Plotly will tell you the exact amount of cars with those two properties! ![](/assets/images/tutorial-data-2-plotly-691487a4378e6a85e7504f95b5b7ca29.webp) *The app is almost finished! It should look similar to this* ## 5. Add a data summary[​](https://docs.viktor.ai/docs/tutorials/plots-and-data/.md#5-add-a-data-summary "Direct link to 5. Add a data summary") Fantastic, we have a fully functioning app 🎉. But that doesn't mean we cannot make it better. Let's now add a summary with the most important data next to our graph. We'll show the total number of cars sold and the selected column's best-performing and least-performing property. Thanks to Pandas, we can easily compute the totals per column and find the highest and lowest value with just a single line per value. For this, we need to modify the `generate_plotly_view` method. Here are the required steps. The code is below. 1. Replace the `@PlotlyView` in your code for a [`@PlotlyAndDataView`](https://docs.viktor.ai/sdk/api/views/.md#_PlotlyAndDataView), so we can also display data next to the plot. 2. Create a [`DataGroup`](https://docs.viktor.ai/sdk/api/views/.md#_DataGroup) with the [`DataItems`](https://docs.viktor.ai/sdk/api/views/.md#_DataItem) we want to display. 3. Make sure you return a [`PlotlyAndDataResult`](https://docs.viktor.ai/sdk/api/views/.md#_PlotlyAndDataResult) with the plot and the `Datagroup` Here is the code for your reference: ``` ... class Controller(vkt.Controller): parametrization = Parametrization @vkt.PlotlyAndDataView('Bar chart') # <--- Change the PlotlyView to PlotlyAndDataView def generate_plotly_view(self, params, **kwargs): # Extract and edit data to make it easy to plot data = extract_data() edited_data = data.groupby(params.main_column)[params.count_column].value_counts().unstack().fillna(0) # Make the bar chart fig = go.Figure() for column in edited_data.columns: fig.add_trace(go.Bar(x=edited_data.index, y=edited_data[column], name=column)) # Edit the bar chart fig.update_layout(barmode='stack', xaxis_title=params.main_column, yaxis_title='Amount Sold') # Create a summary with the data # <--- add this line summary = vkt.DataGroup( # <--- add this line vkt.DataItem("Total Sold" , len(data)), # <--- add this line vkt.DataItem("Most Occurring", edited_data.sum().idxmax()), # <--- add this line vkt.DataItem("Least Occurring", edited_data.sum().idxmin()), # <--- add this line ) return vkt.PlotlyAndDataResult(fig, summary) # <--- Modify this line (PlotlyResult to PlotlyAndDataResult) ``` Refresh your app. You can now see the data on the right of the chart, and you can hide it using the arrow so you can focus on the bar chart! Now select the 'Make' as main property and 'body-style' to analyse and try to find the best selling convertible and best selling car! You should find that the Alfa-Romero Convertible is the best selling Convertible and that the Toyota Hatchbacks are the overall best selling automobile! Can you also find the amount of cars with a diesel powered turbo engine? Which type of engine and fuel combination are your best seller? By now, your app should look like this: ![](/assets/images/tutorial-data-0-intro-c7d4bbfc529426cec1d19505e294769b.webp) *The app should now look like this* ## Complete code[​](https://docs.viktor.ai/docs/tutorials/plots-and-data/.md#complete-code "Direct link to Complete code") Were you able to do everything in this tutorial without error? If not, you can always look at the full code: **Complete code** ``` import viktor as vkt import pandas as pd import plotly.graph_objects as go from pathlib import Path def extract_data(): parent_folder = Path(__file__).parent file_path = parent_folder / "car-sales.csv" data = pd.read_csv(file_path, sep=';') return data class Parametrization(vkt.Parametrization): introduction = vkt.Text( """ # 📊 Data Analysis App! In this app you can summarise data and visualise it in a PlotlyView. The app will summarise some data in the DataView and allow the user to choose a column to analyse to create the Plotly chart. """ ) # Add some input field for the user main_column = vkt.OptionField('Choose main property', options=extract_data().columns.values.tolist()) count_column = vkt.OptionField('Choose property to analyse', options=extract_data().columns.values.tolist()) class Controller(vkt.Controller): parametrization = Parametrization @vkt.PlotlyAndDataView('Bar chart') def generate_plotly_view(self, params, **kwargs): # Extract and edit data to make it easy to plot data = extract_data() edited_data = data.groupby(params.main_column)[params.count_column].value_counts().unstack().fillna(0) # Make the bar chart fig = go.Figure() for column in edited_data.columns: fig.add_trace(go.Bar(x=edited_data.index, y=edited_data[column], name=column)) # Edit the bar chart fig.update_layout(barmode='stack', xaxis_title=params.main_column, yaxis_title='Amount Sold') # Create a summary with the data summary = vkt.DataGroup( vkt.DataItem("Total Sold" , len(data)), vkt.DataItem("Most Occurring", edited_data.sum().idxmax()), vkt.DataItem("Least Occurring", edited_data.sum().idxmin()), ) return vkt.PlotlyAndDataResult(fig, summary) ``` ## Want to learn how VIKTOR works?[​](https://docs.viktor.ai/docs/tutorials/plots-and-data/.md#want-to-learn-how-viktor-works "Direct link to Want to learn how VIKTOR works?") If you are interested in how VIKTOR works behind the scenes, for example how it processes your input, expand the tabs below! #### How does it work?[​](https://docs.viktor.ai/docs/tutorials/plots-and-data/.md#how-does-it-work "Direct link to How does it work?") How does the Parametrization work? In the **Parameterization** class you can add input fields that allow the user to provide input to your app, and there are more than 20 [different input fields](https://docs.viktor.ai/docs/create-apps/user-input/.md) you can use, including numbers, text, colors, images and files. Inside the Parametrization class, you can also format the [layout of your app](https://docs.viktor.ai/docs/create-apps/layout-and-styling/.md) by adding sections, tabs, steps and pages. To show your Parametrization in the app, we need to add the line `parametrization = Parametrization` inside the `Controller` class, because it is the controller that determines what is shown and not. How does the Parametrization get saved? So you may be wondering, how do you get the information from the parametrization to my controller? Well, we do this automatically for you. The values of all parameters are stored in a single variable called `params` , which is accessible inside the Controller class. These variables are stored in a `Munch`; this is similar to a dictionary, but work with point denotation. Example: * Let's say we have a variable called `height` as a NumberField in our `Parameterization`. * To use it in a method in the `Controller`, define it as: `def my_method(self, params, **kwargs)` * You can now make calculations inside that method using our height parameter as `params.height`! How does the Controller work? The **Controller** class is the place where you add everything you want to calculate and show. As explained in this tutorial, we show results in a `View` and we always add views in our controller. You can even add several views in a single app by adding them to the controller class... and yes, we have [many Views](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md),for showing graphs, maps, 3D models, reports, images and more. In the Controller, you also do or call your calculation. Remember that the user input given in the parametrization, is accessible inside the Controller class in the variable The `params`. ## What's next?[​](https://docs.viktor.ai/docs/tutorials/plots-and-data/.md#whats-next "Direct link to What's next?") Very Impressive! you have mastered the basics on how you can use VIKTOR for data analysis. In this tutorial, we have only scratched the surface of what you can do with data so don't stop there! If you like an extra challenge, here are some ideas you can add: * Try analysing another dataset's columns, perhaps by uploading a set using the [`Filefield`](https://docs.viktor.ai/sdk/api/parametrization/.md#_FileField) * extend the `DataGroup` to have an average and standard deviation of the property * Try to add another chart such as a hierarchy or pie chart suing a second `PlotlyView` * Display several charts on a single view using [subplots](https://plotly.com/python/subplots/) Or just follow some of our other [tutorials](https://docs.viktor.ai/docs/tutorials/.md) More about plotting You can find more information about how to make plots in the [plotting guide](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/plots-charts-graphs/.md). Also check more about the possibilities of the [DataView](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/data-and-tables/.md) --- # Tutorial - Post-process ETABS data info Level: **Beginners**<br />Time: **20 min**<br /> Prerequisites: * You have an account and completed the installation process. No account? Get one [here](https://www.viktor.ai/start-building-apps) * You have some experience with reading Python code * [![](/img/illustrations/free-version-banner.svg)](https://www.viktor.ai/start-building-apps) In this tutorial, you will build a VIKTOR app to process and visualize outputs from ETABS. You'll see how to export these outputs from ETABS into a file, upload them into VIKTOR and post-process reaction loads for various load combinations. Along the way, you will work with Plotly and Pandas, using the flexible tools and building blocks that VIKTOR offers. Here is what we'll cover: 1. [Creating an app to take in a file](https://docs.viktor.ai/docs/tutorials/process-etabs-data/.md#1-basic-setup) 2. [Processing the uploaded `.xlsx` file exported from ETABS](https://docs.viktor.ai/docs/tutorials/process-etabs-data/.md#2-process-the-xlsx-file) 3. [Adding processed data into a field so that the user can select from the results](https://docs.viktor.ai/docs/tutorials/process-etabs-data/.md#3-allow-user-selection-of-load-combinations) 4. [Visualizing results based on those selections](https://docs.viktor.ai/docs/tutorials/process-etabs-data/.md#4-visualize-reaction-loads-with-plotly) By the end of this tutorial, you will be able to generate a heatmap of the reaction loads for your structure by selecting specific load cases. This will allow you to gain valuable insights from your results and easily share them with your clients and team. Additionally, you will learn how to automate this process using VIKTOR. The final result will look like the figure below: ![](/assets/images/tutorial_post_processing_etabs_app_complete-8865fcdf600b903fee9186bf9b9728f7.png) ## 1. Basic setup[​](https://docs.viktor.ai/docs/tutorials/process-etabs-data/.md#1-basic-setup "Direct link to 1. Basic setup") ### Create an empty app[​](https://docs.viktor.ai/docs/tutorials/process-etabs-data/.md#create-an-empty-app "Direct link to Create an empty app") Let's create, install and start an empty app. This will be the starting point for the rest of the tutorial. But before we start, make sure to shut down any app that is running (like the demo app) by closing the command-line shell (for example Powershell) or end the process using `Ctrl + C`. Follow these steps to create, install and start an empty app: 1. Open a terminal and run the following command to create the app on the VIKTOR platform and generate the initial code locally: ``` viktor-cli create-app "Data tutorial" --init --app-type editor ``` 2. Open the newly created folder in your code editor and run `viktor-cli clean-start` in the terminal to install dependencies and connect the app to the platform. If all went well, your empty app is installed and connected to your development workspace. The terminal in your code editor should show something like this: ``` INFO : Connecting to cloud.viktor.ai... INFO : Connection is established (use Ctrl+C to close) INFO : INFO : Navigate to the link below to see your app in the browser INFO : https://cloud.viktor.ai/workspaces/XXX/app INFO : INFO : App code loaded, waiting for jobs... ``` Re-starting your app * You only need to create an app template and install it once for each new app you want to make. * The app will update automatically once you start adding code in `app.py`, as long as you don't close the terminal or your code editor. * Did you close your code editor? Use `viktor-cli start` to start the app again. No need to install, clear, etc. ### Adding useful Python packages[​](https://docs.viktor.ai/docs/tutorials/process-etabs-data/.md#adding-useful-python-packages "Direct link to Adding useful Python packages") We want to use the Python packages Pandas, Openpyxl, and Plotly in this app. Open `requirements.txt` and add `plotly`, `openpyxl` and `pandas` under your `viktor` version (don't change that line): ``` viktor==X.X.X <-- Don't modify this line plotly pandas openpyxl ``` Next, close the connection to your app in the terminal (if the app has been connected automatically). You can do this by using Ctrl+C. Open a new terminal and install the new dependencies (like `plotly` and `pandas`) in your Python environment by running this terminal: ``` viktor-cli install ``` And after that connect your app to the VIKTOR platform again: ``` viktor-cli start ``` **Keep the terminal open**, as closing it will disconnect your app. ### Adding input fields[​](https://docs.viktor.ai/docs/tutorials/process-etabs-data/.md#adding-input-fields "Direct link to Adding input fields") Let's add some text and input fields for the user to upload their file into. We will include a `FileField` to upload our `.xlsx` file and an `OptionField` to select a load combination from our Excel file. Feel free to copy and paste the **highlighted** lines of code in `app.py`, save the file and refresh the app in the browser. You should now see the input fields you just added to the code. ``` import viktor as vkt class Parametrization(vkt.Parametrization): intro = vkt.Text(""" # ETABS reaction heatmap This app allows you to inspect results from an uploaded ETABS output file. Export your ETABS model results to an .xlsx file and upload it below. After uploading your Excel file, select the load combination you want to visualize. Ensure the file includes the tables: - **Joint Reactions** - **Objects and Elements - Joints** """) xlsx_file = vkt.FileField("Upload ETABS exported .xlsx") lb = vkt.LineBreak() selected_load_combo = vkt.OptionField("Select available load combos", options=[]) class Controller(vkt.Controller): parametrization = Parametrization ``` The result should look like the image below. Now that the inputs are sorted, we will continue with processing the ETABS data. ![app](/assets/images/tutorial_post_processing_etabs_app_components-25b066b5d91373002aa25c6aab1b5a45.png) ## 2. Process the XLSX file[​](https://docs.viktor.ai/docs/tutorials/process-etabs-data/.md#2-process-the-xlsx-file "Direct link to 2. Process the XLSX file") ### Sample ETABS exported `.xlsx` file[​](https://docs.viktor.ai/docs/tutorials/process-etabs-data/.md#sample-etabs-exported-xlsx-file "Direct link to sample-etabs-exported-xlsx-file") For this tutorial, you can use this sample [Excel file](https://docs.viktor.ai/files/docs/simple-etabs-data-tutorial/etabs_tutorial.xlsx) but don't worry; at the end of this tutorial, we will guide you on how to export this data from ETABS and create your own file. ### Processing the uploaded xlsx file[​](https://docs.viktor.ai/docs/tutorials/process-etabs-data/.md#processing-the-uploaded-xlsx-file "Direct link to Processing the uploaded xlsx file") The next step is to process the data from the uploaded Excel file. It's a good idea to do this processing in a separate function, that we'll name `process_etabs_file`. This function will extract the unique load combinations (which will be used later in our `OptionField`) and the joint reactions. The goal is to combine this data with the joint coordinates to create a DataFrame that can be used to plot the heatmap in the Plotly view. Below is the logic in the code, along with a breakdown. Add the highlighted lines of code to `app.py` and save the file.   ``` import viktor as vkt import pandas as pd def process_etabs_file(uploaded_file): # Read the file into a dataframe sheet_names = ["Joint Reactions", "Objects and Elements - Joints"] with uploaded_file.open_binary() as fr: dataframes = pd.read_excel(fr, sheet_name=sheet_names, skiprows=1) # Process the 'Joint Reactions' dataframe loads_df = dataframes["Joint Reactions"].dropna(subset=["Unique Name", "Output Case"]).copy() # Process the 'Objects and Elements - Joints' dataframe cords = dataframes["Objects and Elements - Joints"].dropna( subset=["Element Name", "Object Name", "Global X", "Global Y", "Global Z"] ).copy() cords = cords.rename(columns={"Object Name": "Unique Name"}) # Get unique load case names as a list unique_output_cases = loads_df["Output Case"].unique().tolist() # Merge loads and cords dataframe merged_df = pd.merge(loads_df, cords, on="Unique Name", how="inner") return unique_output_cases, merged_df.reset_index(drop=True) class Parametrization(vkt.Parametrization): intro = vkt.Text(""" # ETABS reaction heatmap This app allows you to inspect results from an uploaded ETABS output file. Export your ETABS model results to an .xlsx file and upload it below. After uploading your Excel file, select the load combination you want to visualize. Ensure the file includes the tables: - **Joint Reactions** - **Objects and Elements - Joints** """) xlsx_file = vkt.FileField("Upload ETABS exported .xlsx") lb = vkt.LineBreak() selected_load_combo = vkt.OptionField("Select available load combos", options=[]) class Controller(vkt.Controller): parametrization = Parametrization ``` ### How this works[​](https://docs.viktor.ai/docs/tutorials/process-etabs-data/.md#how-this-works "Direct link to How this works") 1. In the top of the file we import Pandas, which we'll use to load the file content into dataframes 2. The function reads the excel file and extract the necessary sheets: **Joint Reactions** and **Objects and Elements - Joints**. 3. Then we filter for and remove the rows that we want based on the required data, keeping columns `Global X`, `Global Y`, and `Global Z`. 4. Finally, merge the processed **Joint Reactions** data with the joint coordinates using the `Unique Name` column as the key. This merged DataFrame includes all the necessary information to plot a heatmap. 5. This functions returns two things at once, the unique load combinations and the merged dataframe. ## 3. Allow user selection of load combinations[​](https://docs.viktor.ai/docs/tutorials/process-etabs-data/.md#3-allow-user-selection-of-load-combinations "Direct link to 3. Allow user selection of load combinations") With the function to process the uploaded file done, we can now use that processed data in the `Parametrization`. We will allow users to select a load combination from the unique load combinations. To get the unique load combinations into the `OptionField`, we can use a callback function. Let's call it `get_load_combos`. It will get the unique load combinations from `read_file` and update our `OptionField` to display a dropdown with the correct options. Add the highlighted lines of code to `app.py` and don't forget to reference the `get_load_combos` in the `selected_load_combo` field. ``` import viktor as vkt import pandas as pd def process_etabs_file(uploaded_file): # Read the file into a dataframe sheet_names = ["Joint Reactions", "Objects and Elements - Joints"] with uploaded_file.open_binary() as fr: dataframes = pd.read_excel(fr, sheet_name=sheet_names, skiprows=1) # Process the 'Joint Reactions' dataframe loads_df = dataframes["Joint Reactions"].dropna(subset=["Unique Name", "Output Case"]).copy() # Process the 'Objects and Elements - Joints' dataframe cords = dataframes["Objects and Elements - Joints"].dropna( subset=["Element Name", "Object Name", "Global X", "Global Y", "Global Z"] ).copy() cords = cords.rename(columns={"Object Name": "Unique Name"}) # Get unique load case names as a list unique_output_cases = loads_df["Output Case"].unique().tolist() # Merge loads and cords dataframe merged_df = pd.merge(loads_df, cords, on="Unique Name", how="inner") return unique_output_cases, merged_df.reset_index(drop=True) def get_load_combos(params, **kwargs): if params.xlsx_file: load_combos, _ = process_etabs_file(params.xlsx_file) # Only use the first returned item, the load_combos return load_combos return [] class Parametrization(vkt.Parametrization): intro = vkt.Text(""" # ETABS reaction heatmap This app allows you to inspect results from an uploaded ETABS output file. Export your ETABS model results to an .xlsx file and upload it below. After uploading your Excel file, select the load combination you want to visualize. Ensure the file includes the tables: - **Joint Reactions** - **Objects and Elements - Joints** """) xlsx_file = vkt.FileField("Upload ETABS exported .xlsx") lb = vkt.LineBreak() selected_load_combo = vkt.OptionField("Select available load combos", options=get_load_combos) class Controller(vkt.Controller): parametrization = Parametrization ``` By replacing the `options=[]` with a reference to the callback function (`options=get_load_combos`) we fill the field with the processed load combos from the file (if there is a file uploaded). ## 4. Visualize reaction loads with Plotly[​](https://docs.viktor.ai/docs/tutorials/process-etabs-data/.md#4-visualize-reaction-loads-with-plotly "Direct link to 4. Visualize reaction loads with Plotly") Once the user selected a load combination, we filter the data to focus on the selected load combination. Then we use Plotly to generate an interactive heat map. To visualize a Plotly figure in a VIKTOR app we can add a `PloltyView` method to the `Controller`. We will add a scatter plot to represent each joint from the ETABS data, with its color indicating the magnitude of the reaction load (FZ) in kN. This visualization allows you to clearly observe how loads are distributed across the base floor, making it easier to analyze and interpret the results. Copy the **highlighted** piece of code and add it to `app.py`. Don't forget importing ploty on line 3! ``` import viktor as vkt import pandas as pd import plotly.graph_objects as go def process_etabs_file(uploaded_file): # Read the file into a dataframe sheet_names = ["Joint Reactions", "Objects and Elements - Joints"] with uploaded_file.open_binary() as fr: dataframes = pd.read_excel(fr, sheet_name=sheet_names, skiprows=1) # Process the 'Joint Reactions' dataframe loads_df = dataframes["Joint Reactions"].dropna(subset=["Unique Name", "Output Case"]).copy() # Process the 'Objects and Elements - Joints' dataframe cords = dataframes["Objects and Elements - Joints"].dropna( subset=["Element Name", "Object Name", "Global X", "Global Y", "Global Z"] ).copy() cords = cords.rename(columns={"Object Name": "Unique Name"}) # Get unique load case names as a list unique_output_cases = loads_df["Output Case"].unique().tolist() # Merge loads and cords dataframe merged_df = pd.merge(loads_df, cords, on="Unique Name", how="inner") return unique_output_cases, merged_df.reset_index(drop=True) def get_load_combos(params, **kwargs): if params.xlsx_file: load_combos, _ = process_etabs_file(params.xlsx_file) # Only use the first returned item, the load_combos return load_combos return [] class Parametrization(vkt.Parametrization): intro = vkt.Text(""" # ETABS reaction heatmap This app allows you to inspect results from an uploaded ETABS output file. Export your ETABS model results to an .xlsx file and upload it below. After uploading your Excel file, select the load combination you want to visualize. Ensure the file includes the tables: - **Joint Reactions** - **Objects and Elements - Joints** """) xlsx_file = vkt.FileField("Upload ETABS exported .xlsx") lb = vkt.LineBreak() selected_load_combo = vkt.OptionField("Select available load combos", options=get_load_combos) class Controller(vkt.Controller): parametrization = Parametrization @vkt.PlotlyView("Heatmap") def plot_heat_map(params,**kwargs): if params.selected_load_combo: _, merged_df = process_etabs_file(params.xlsx_file) # Filter the dataframe based on the selected load combination filtered_df = merged_df[merged_df["Output Case"] == params.selected_load_combo] FZ_min, FZ_max = filtered_df["FZ"].min(), filtered_df["FZ"].max() # Create plotly scatter plot fig = go.Figure( data=go.Scatter( x=filtered_df["Global X"], y=filtered_df["Global Y"], mode='markers+text', marker=dict( size=16, color=filtered_df["FZ"], colorscale=[ [0, "green"], [0.5, "yellow"], [1, "red"] ], colorbar=dict(title="FZ (kN)"), cmin=FZ_min, cmax=FZ_max ), text=[f"{fz:.1f}" for fz in filtered_df["FZ"]], textposition="top right" ) ) # Style the plot fig.update_layout( title=f"Heatmap for Output Case: {params.selected_load_combo}", xaxis_title="X (m)", yaxis_title="Y (m)", plot_bgcolor='rgba(0,0,0,0)', ) fig.update_xaxes( linecolor='LightGrey', tickvals=filtered_df["Global X"], ticktext=[f"{x / 1000:.3f}" for x in filtered_df["Global X"]], ) fig.update_yaxes( linecolor='LightGrey', tickvals=filtered_df["Global Y"], ticktext=[f"{y / 1000:.3f}" for y in filtered_df["Global Y"]], ) return vkt.PlotlyResult(fig) else: return vkt.PlotlyResult({}) ``` ### This code explained[​](https://docs.viktor.ai/docs/tutorials/process-etabs-data/.md#this-code-explained "Direct link to This code explained") 1. At the top of the file, we import Plotly, which we'll use to create the plot 2. At the top of the function, we use `process_etabs_file` again, but this time we only use the second returned item, the merged dataframe. 3. The dataframe is filtered, based on the selected option in `params.selected_load_combo`. We also find the lowest and highest values for FZ. 4. Using Plotly, we create a scatter plot based on the filtered dataframe. Using the lowest and highest values for F the colors are determined for each point. 5. Finally, we apply some styling to the figure, like adding a title, setting linecolors and text for the tickmarks ### The resulting app[​](https://docs.viktor.ai/docs/tutorials/process-etabs-data/.md#the-resulting-app "Direct link to The resulting app") Refresh your app in the browser. You will now see the empty graph appear on the right side of the screen. You can now upload the Excel sheet with ETABS loads in the upload field. After that select one of the load combinations, and a heatmap will display the magnitudes, color-coded, along with the joint locations. You can try any combination and test it with any ETABS model. Our final app will look like this: ![app](/assets/images/tutorial_post_processing_etabs_app_complete-8865fcdf600b903fee9186bf9b9728f7.png) ## Complete code[​](https://docs.viktor.ai/docs/tutorials/process-etabs-data/.md#complete-code "Direct link to Complete code") Were you able to do everything in this tutorial without error? If not, you can always look at the full code: ``` import viktor as vkt import pandas as pd import plotly.graph_objects as go def process_etabs_file(uploaded_file): # Read the file into a dataframe sheet_names = ["Joint Reactions", "Objects and Elements - Joints"] with uploaded_file.open_binary() as fr: dataframes = pd.read_excel(fr, sheet_name=sheet_names, skiprows=1) # Process the 'Joint Reactions' dataframe loads_df = dataframes["Joint Reactions"].dropna(subset=["Unique Name", "Output Case"]).copy() # Process the 'Objects and Elements - Joints' dataframe cords = dataframes["Objects and Elements - Joints"].dropna( subset=["Element Name", "Object Name", "Global X", "Global Y", "Global Z"] ).copy() cords = cords.rename(columns={"Object Name": "Unique Name"}) # Get unique load case names as a list unique_output_cases = loads_df["Output Case"].unique().tolist() # Merge loads and cords dataframe merged_df = pd.merge(loads_df, cords, on="Unique Name", how="inner") return unique_output_cases, merged_df.reset_index(drop=True) def get_load_combos(params, **kwargs): if params.xlsx_file: load_combos, _ = process_etabs_file(params.xlsx_file) return load_combos return [] class Parametrization(vkt.Parametrization): intro = vkt.Text(""" # ETABS reaction heatmap This app allows you to inspect results from an uploaded ETABS output file. Export your ETABS model results to an .xlsx file and upload it below. After uploading your Excel file, select the load combination you want to visualize. Ensure the file includes the tables: - **Joint Reactions** - **Objects and Elements - Joints** """) xlsx_file = vkt.FileField("Upload ETABS exported .xlsx") lb = vkt.LineBreak() selected_load_combo = vkt.OptionField("Select available load combos", options=get_load_combos) class Controller(vkt.Controller): parametrization = Parametrization @vkt.PlotlyView("Heatmap") def plot_heat_map(params,**kwargs): if params.selected_load_combo: _, merged_df = process_etabs_file(params.xlsx_file) # Filter the dataframe based on the selected load combination filtered_df = merged_df[merged_df["Output Case"] == params.selected_load_combo] FZ_min, FZ_max = filtered_df["FZ"].min(), filtered_df["FZ"].max() # Create plotly scatter plot fig = go.Figure( data=go.Scatter( x=filtered_df["Global X"], y=filtered_df["Global Y"], mode='markers+text', marker=dict( size=16, color=filtered_df["FZ"], colorscale=[ [0, "green"], [0.5, "yellow"], [1, "red"] ], colorbar=dict(title="FZ (kN)"), cmin=FZ_min, cmax=FZ_max ), text=[f"{fz:.1f}" for fz in filtered_df["FZ"]], textposition="top right" ) ) # Style the plot fig.update_layout( title=f"Heatmap for Output Case: {params.selected_load_combo}", xaxis_title="X (m)", yaxis_title="Y (m)", plot_bgcolor='rgba(0,0,0,0)', ) fig.update_xaxes( linecolor='LightGrey', tickvals=filtered_df["Global X"], ticktext=[f"{x / 1000:.3f}" for x in filtered_df["Global X"]], ) fig.update_yaxes( linecolor='LightGrey', tickvals=filtered_df["Global Y"], ticktext=[f"{y / 1000:.3f}" for y in filtered_df["Global Y"]], ) return vkt.PlotlyResult(fig) else: return vkt.PlotlyResult({}) ``` ## Export your own results from ETABS[​](https://docs.viktor.ai/docs/tutorials/process-etabs-data/.md#export-your-own-results-from-etabs "Direct link to Export your own results from ETABS") If you want to try this app with your own data, first run your analysis and then export the reaction loads from your ETABS model. Navigate to `File menu > Export > ETABS Tables to Excel` within ETABS, and select the **Joint Reactions** and **Objects and Elements - Joints** tables, as shown in the figure below: ![app](/assets/images/tutorial_post_processing_etabs_app_etabs_export_tables-3b6491b6ff487ff248154828d98bb520.png) warning Ensure that your exported Excel file contains these specific sheets. Without them, the app won’t be able to read and process the data correctly. Set the model units to international system units. The model expects the loads in kN and in millimeters (mm). ## What's next?[​](https://docs.viktor.ai/docs/tutorials/process-etabs-data/.md#whats-next "Direct link to What's next?") In this tutorial, you learned how to post-process results exported from ETABS. Your next goal could be to implement automation using the CSI API from your VIKTOR app. To achieve this, the best place to start is the following [tutorial](https://docs.viktor.ai/docs/tutorials/integrate-etabs-sap2000/.md). If you want to explore more use cases where VIKTOR shines, feel free to check out our other [tutorials](https://docs.viktor.ai/docs/tutorials/.md)! --- # Tutorial - Post-process STAAD.Pro data note Level: **Beginners**<br />Time: **20 min** Prerequisites: * You have an account and completed the installation process. No account? Get one [here](https://www.viktor.ai/start-building-apps) * You have some experience with reading Python code * [![](/img/illustrations/free-version-banner.svg)](https://www.viktor.ai/start-building-apps) In this tutorial, you will build a VIKTOR app to process and visualize outputs from STAAD.PRO. You’ll learn how to export these outputs from STAAD.PRO into a VIKTOR web app and post-process design ratios for various cross-sections. Filtering, grouping, and visualizing these design ratio outputs is not possible directly in STAAD.PRO, and there is no native way to export these results directly to Excel. This tutorial will guide you through overcoming these limitations while exploring the powerful tools and building blocks that VIKTOR and Pandas provide. Here is what we'll cover: * [Create an app with an input block to receive STAAD.PRO data](https://docs.viktor.ai/docs/tutorials/process-staad-data/.md#1-basic-setup) * [Create the structure of our app with steps](https://docs.viktor.ai/docs/tutorials/process-staad-data/.md#2-creating-the-structure-of-our-app) * [Process the STAAD.PRO data](https://docs.viktor.ai/docs/tutorials/process-staad-data/.md#3-process-the-staadpro-data) * [Allow user selection, grouping, and filtering of cross-sections](https://docs.viktor.ai/docs/tutorials/process-staad-data/.md#4-allow-user-selection-of-cross-sections) * [Visualize results based on those selections](https://docs.viktor.ai/docs/tutorials/process-staad-data/.md#5-visualize-design-ratios-with-viktor) By the end of this tutorial, you will be able to generate a table with a heatmap displaying design ratios for your structure by filtering or grouping specific cross-sections. You will also have the opportunity to test this using your own data by following the steps outlined in the final section of the tutorial. This will help you gain valuable insights from your results and effectively share them with your clients and team. ![final app](/assets/images/tutorial_staad_final_app-e10427c0885f46673be9d053028a774c.gif) ## 1. Basic setup[​](https://docs.viktor.ai/docs/tutorials/process-staad-data/.md#1-basic-setup "Direct link to 1. Basic setup") Let’s create, install, and start a blank app template. We’ll use this blank template as the base for our design ratios app. Before we begin, ensure that any running app (like the demo app) is stopped. You can do this by closing the command-line shell (e.g., PowerShell) or by canceling the process with `Ctrl + C`. 1. Open a terminal and run the following command to create the app on the VIKTOR platform and generate the initial code locally: ``` viktor-cli create-app "STAAD data tutorial" --init --app-type editor ``` 2. Open the newly created folder in your code editor and run `viktor-cli clean-start` in the terminal to install dependencies and connect the app to the platform. If all went well, your empty app is installed and connected to your development workspace. **Do not close the terminal** as this will break the connection with your app. The terminal in your code editor should show something like this: ``` INFO : Connecting to cloud.viktor.ai... INFO : Connection is established: INFO : INFO : https://cloud.viktor.ai/workspaces/XXX/app <--- navigate here to find your app INFO : INFO : The connection can be closed using Ctrl+C INFO : App is ready ``` RE-STARTING YOUR APP You only need to create an app template and install it once for each new app you want to make. The app will update automatically once you start adding code in `app.py`, as long as you don't close the terminal or your code editor. Did you close your code editor? Use `viktor-cli start` to start the app again. No need to install, clear, etc. ### Adding useful Python packages[​](https://docs.viktor.ai/docs/tutorials/process-staad-data/.md#adding-useful-python-packages "Direct link to Adding useful Python packages") We want to use Pandas and VIKTOR as our only dependencies in this app. Open `requirements.txt` and add `pandas` under your `viktor` version (do not change that line): ``` viktor==X.X.X # Don’t modify this line pandas ``` Next, close the connection to your app in the terminal (if the app has been connected automatically). You can do this by using `Ctrl+C`. Open a new terminal and install the new dependencies (like `pandas`) in your Python environment by running this command: ``` viktor-cli install ``` And after that, connect your app to the VIKTOR platform again: ``` viktor-cli start ``` **Keep the terminal open**, as closing it will disconnect your app. ## 2. Creating the structure of our app[​](https://docs.viktor.ai/docs/tutorials/process-staad-data/.md#2-creating-the-structure-of-our-app "Direct link to 2. Creating the structure of our app") In this step, we will create the structure of our app by organizing it into steps using `vkt.Step`. This will help us separate the application into inputs and outputs. In the first step, we input the data coming from STAAD.PRO with the `vkt.Table`, and in the second step, we filter and group the results with a `TableView`. Later, we will add a `TableView` and the logic for the filtering and grouping components on step 2. Feel free to copy and paste the highlighted lines of code into `app.py`, save the file, and refresh the app in the browser. You should now see the input fields you just added to the code. ``` import viktor as vkt class Parametrization(vkt.Parametrization): step_1 = vkt.Step("Step 1 - Input Your Data!") step_1.intro = vkt.Text(""" # STAAD Design Ratio Analyzer This app allows you to visualize a heat map from your STAAD.PRO model results. You can filter and group them based on cross sections and visualize how they are distributed.""") step_1.table_input = vkt.Text(""" ## 1.0 Create the Input Table! Paste the design ratio data from your STAAD.PRO model!""") step_1.table = vkt.Table("### Beam Design Analysis") step_1.table.col_beam = vkt.TextField("Beam") step_1.table.col_analysis_property = vkt.TextField("Analysis Property") step_1.table.col_design_property = vkt.TextField("Design Property") step_1.table.col_actual_ratio = vkt.NumberField("Actual Ratio") step_1.table.col_allowable_ratio = vkt.NumberField("Allowable Ratio") step_1.table.col_normalized_ratio = vkt.NumberField("Normalized Ratio") step_1.table.col_clause = vkt.TextField("Clause") step_1.table.col_load_case = vkt.TextField("L/C") step_1.table.col_ax = vkt.TextField("Ax in²") step_1.table.col_iz = vkt.TextField("Iz in⁴") step_1.table.col_iy = vkt.TextField("Iy in⁴") step_1.table.col_ix = vkt.TextField("Ix in⁴") step_2 = vkt.Step("Step 2 - Post-Processing") step_2.process = vkt.Text(""" ## 2.0 Filter and Group Group or filter by a specific cross section. Use the options below to customize your view. If you want to list all cross-sections after selecting one, you can select the "All" option! """) step_2.group = vkt.BooleanField("### Group by Cross-Section") step_2.ln_break = vkt.LineBreak() step_2.cross_section = vkt.OptionField( "### Filter by Cross-Section", options=["Empty Options"] ) class Controller(vkt.Controller): parametrization = Parametrization() ``` ### How this works[​](https://docs.viktor.ai/docs/tutorials/process-staad-data/.md#how-this-works "Direct link to How this works") * We organized our app into two steps using `vkt.Step`: * **Step 1** is for inputting data. We added introductory text using `vkt.Text` and created a table called `step_1.table` using `vkt.Table`. This table replicates the columns from the design ratio table in STAAD.PRO. * **Step 2** is for post-processing. This step includes the following features: <!-- --> * **Filtering**: <!-- --> * We use **`vkt.OptionField`** to show a list of cross-sections that the user can select. * Only design ratios of the selected cross-section will be displayed. * **Grouping**: <!-- --> * We use **`vkt.BooleanField`** to let the user group the design ratios by cross-section. * When grouping is enabled, the app displays only the **maximum design ratio** for each cross-section. * The `Controller` class sets `parametrization = Parametrization()` to link our parametrization to the controller. The result should look like the image below. Now that the inputs are ready, we will move on to process the STAAD.PRO data. ![Create app](/assets/images/tutorial_staad_inputs-2ec740c44624517352aaede9776dba57.JPG) ## 3. Process the STAAD.PRO data[​](https://docs.viktor.ai/docs/tutorials/process-staad-data/.md#3-process-the-staadpro-data "Direct link to 3. Process the STAAD.PRO data") ### Sample STAAD.PRO design ratio data[​](https://docs.viktor.ai/docs/tutorials/process-staad-data/.md#sample-staadpro-design-ratio-data "Direct link to Sample STAAD.PRO design ratio data") For this tutorial, you can use this in [TXT format](https://docs.viktor.ai/files/docs/simple-staadpro-tutorial/sample_data.txt), which you can copy and paste into our `vkt.Table`. However, you can use your **own** design ratio data from STAAD.PRO. At the end of this tutorial, we will guide you on how to get this data from STAAD.PRO. info The last section of this tutorial shows how to get this data from STAAD.PRO. For now, you can use the sample `.TXT` file to complete and test the app! ### Processing the STAAD.PRO data[​](https://docs.viktor.ai/docs/tutorials/process-staad-data/.md#processing-the-staadpro-data "Direct link to Processing the STAAD.PRO data") The next step is to process the data from the `vkt.Table`. It's a good idea to do this processing in a separate function, which we'll name `generate_dataframe`. This function will convert the table data into a **Pandas DataFrame** and rename the columns for easier access. Below is the logic in the code, along with a breakdown. Add the highlighted lines of code to `app.py` and save the file. ``` import viktor as vkt import pandas as pd def generate_dataframe(table_data): df = pd.DataFrame([dict(item) for item in table_data]) df.rename( columns={ "col_beam": "Beam", "col_analysis_property": "Analysis Property", "col_design_property": "Design Property", "col_actual_ratio": "Actual Ratio", "col_allowable_ratio": "Allowable Ratio", "col_normalized_ratio": "Normalized Ratio (Actual/Allowable)", "col_clause": "Clause", "col_load_case": "L/C", "col_ax": "Ax in²", "col_iz": "Iz in⁴", "col_iy": "Iy in⁴", "col_ix": "Ix in⁴", }, inplace=True, ) return df class Parametrization(vkt.Parametrization): step_1 = vkt.Step("Step 1 - Input Your Data!") step_1.intro = vkt.Text(""" # STAAD Design Ratio Analyzer This app allows you to visualize a heat map from your STAAD.PRO model results. You can filter and group them based on cross sections and visualize how they are distributed.""") step_1.table_input = vkt.Text(""" ## 1.0 Create the Input Table! Paste the design ratio data from your STAAD.PRO model!""") step_1.table = vkt.Table("### Beam Design Analysis") step_1.table.col_beam = vkt.TextField("Beam") step_1.table.col_analysis_property = vkt.TextField("Analysis Property") step_1.table.col_design_property = vkt.TextField("Design Property") step_1.table.col_actual_ratio = vkt.NumberField("Actual Ratio") step_1.table.col_allowable_ratio = vkt.NumberField("Allowable Ratio") step_1.table.col_normalized_ratio = vkt.NumberField("Normalized Ratio") step_1.table.col_clause = vkt.TextField("Clause") step_1.table.col_load_case = vkt.TextField("L/C") step_1.table.col_ax = vkt.TextField("Ax in²") step_1.table.col_iz = vkt.TextField("Iz in⁴") step_1.table.col_iy = vkt.TextField("Iy in⁴") step_1.table.col_ix = vkt.TextField("Ix in⁴") step_2 = vkt.Step("Step 2 - Post-Processing") step_2.process = vkt.Text(""" ## 2.0 Filter and Group Group or filter by a specific cross section. Use the options below to customize your view. If you want to list all cross-sections after selecting one, you can select the "All" option! """) step_2.group = vkt.BooleanField("### Group by Cross-Section") step_2.ln_break = vkt.LineBreak() step_2.cross_section = vkt.OptionField( "### Filter by Cross-Section", options=["Empty Options"] ) class Controller(vkt.Controller): parametrization = Parametrization() ``` ### How this works[​](https://docs.viktor.ai/docs/tutorials/process-staad-data/.md#how-this-works-1 "Direct link to How this works") * At the top of the file, we import `pandas`, which we'll use to manipulate the data. * The function `generate_dataframe` converts the table data from the `Parametrization` into a `DataFrame` and renames the columns to more readable names. * This function returns the `DataFrame`, which will be used later to process and visualize the data. ## 4. Allow user selection of cross-sections[​](https://docs.viktor.ai/docs/tutorials/process-staad-data/.md#4-allow-user-selection-of-cross-sections "Direct link to 4. Allow user selection of cross-sections") Now that we have implemented the `generate_dataframe` function, we can use the resulting DataFrame to create a list of cross sections. To do this, we can get the unique cross-section names from the "Design Property" column and convert them into a list. This list will be used in our `OptionField`. You can update the code as shown in the code snippet below! ``` import viktor as vkt import pandas as pd def generate_dataframe(table_data): df = pd.DataFrame([dict(item) for item in table_data]) df.rename( columns={ "col_beam": "Beam", "col_analysis_property": "Analysis Property", "col_design_property": "Design Property", "col_actual_ratio": "Actual Ratio", "col_allowable_ratio": "Allowable Ratio", "col_normalized_ratio": "Normalized Ratio (Actual/Allowable)", "col_clause": "Clause", "col_load_case": "L/C", "col_ax": "Ax in²", "col_iz": "Iz in⁴", "col_iy": "Iy in⁴", "col_ix": "Ix in⁴", }, inplace=True, ) return df def get_cross_sections(params, **kwargs): if params.step_1.table: df = generate_dataframe(params.step_1.table) secs = df["Design Property"].unique().tolist() secs.append("All") return secs return ["No data available! Please add table input."] class Parametrization(vkt.Parametrization): step_1 = vkt.Step("Step 1 - Input Your Data!") step_1.intro = vkt.Text(""" # STAAD Design Ratio Analyzer This app allows you to visualize a heat map from your STAAD.PRO model results. You can filter and group them based on cross sections and visualize how they are distributed.""") step_1.table_input = vkt.Text(""" ## 1.0 Create the Input Table! Paste the design ratio data from your STAAD.PRO model!""") step_1.table = vkt.Table("### Beam Design Analysis") step_1.table.col_beam = vkt.TextField("Beam") step_1.table.col_analysis_property = vkt.TextField("Analysis Property") step_1.table.col_design_property = vkt.TextField("Design Property") step_1.table.col_actual_ratio = vkt.NumberField("Actual Ratio") step_1.table.col_allowable_ratio = vkt.NumberField("Allowable Ratio") step_1.table.col_normalized_ratio = vkt.NumberField("Normalized Ratio") step_1.table.col_clause = vkt.TextField("Clause") step_1.table.col_load_case = vkt.TextField("L/C") step_1.table.col_ax = vkt.TextField("Ax in²") step_1.table.col_iz = vkt.TextField("Iz in⁴") step_1.table.col_iy = vkt.TextField("Iy in⁴") step_1.table.col_ix = vkt.TextField("Ix in⁴") step_2 = vkt.Step("Step 2 - Post-Processing") step_2.process = vkt.Text(""" ## 2.0 Filter and Group Group or filter by a specific cross section. Use the options below to customize your view. If you want to list all cross-sections after selecting one, you can select the "All" option! """) step_2.group = vkt.BooleanField("### Group by Cross-Section") step_2.ln_break = vkt.LineBreak() step_2.cross_section = vkt.OptionField( "### Filter by Cross-Section", options=get_cross_sections ) class Controller(vkt.Controller): parametrization = Parametrization() ``` ### How this works[​](https://docs.viktor.ai/docs/tutorials/process-staad-data/.md#how-this-works-2 "Direct link to How this works") * The `get_cross_sections` function reads the DataFrame and extracts the unique values from the 'Design Property' column. * These unique cross-sections are returned as a list to be used as options in the `cross_section` `OptionField`. We also append "All" to the list to allow viewing all cross sections. * By setting `options=get_cross_sections` in the `OptionField`, we fill the field with the cross sections from the data (if there is data input). ## 5. Visualize design ratios with VIKTOR[​](https://docs.viktor.ai/docs/tutorials/process-staad-data/.md#5-visualize-design-ratios-with-viktor "Direct link to 5. Visualize design ratios with VIKTOR") After the user inputs data into the `vkt.Table`, we want to create clear visualizations and add functionality to the `vkt.BooleanField` and `vkt.OptionField` for grouping and filtering. To do this, we will add a `TableView` that shows the design ratios in a table, sorted and colored based on their values. The logic for this will be implemented in the `table_design_ratios` method inside the `Controller` class. In addition, we will use a complementary function called `get_cell_color` to assign a color based on the design ratio values. This will allow us to create a heatmap within the table. Copy the highlighted piece of code and add it to `app.py`. ``` import viktor as vkt import pandas as pd def generate_dataframe(table_data): df = pd.DataFrame([dict(item) for item in table_data]) df.rename( columns={ "col_beam": "Beam", "col_analysis_property": "Analysis Property", "col_design_property": "Design Property", "col_actual_ratio": "Actual Ratio", "col_allowable_ratio": "Allowable Ratio", "col_normalized_ratio": "Normalized Ratio (Actual/Allowable)", "col_clause": "Clause", "col_load_case": "L/C", "col_ax": "Ax in²", "col_iz": "Iz in⁴", "col_iy": "Iy in⁴", "col_ix": "Ix in⁴", }, inplace=True, ) return df def get_cross_sections(params, **kwargs): if params.step_1.table: df = generate_dataframe(params.step_1.table) secs = df["Design Property"].unique().tolist() secs.append("All") return secs return ["No data available! Please add table input."] class Parametrization(vkt.Parametrization): step_1 = vkt.Step("Step 1 - Input Your Data!") step_1.intro = vkt.Text(""" # STAAD Design Ratio Analyzer This app allows you to visualize a heat map from your STAAD.PRO model results. You can filter and group them based on cross sections and visualize how they are distributed.""") step_1.table_input = vkt.Text(""" ## 1.0 Create the Input Table! Paste the design ratio data from your STAAD.PRO model!""") step_1.table = vkt.Table("### Beam Design Analysis") step_1.table.col_beam = vkt.TextField("Beam") step_1.table.col_analysis_property = vkt.TextField("Analysis Property") step_1.table.col_design_property = vkt.TextField("Design Property") step_1.table.col_actual_ratio = vkt.NumberField("Actual Ratio") step_1.table.col_allowable_ratio = vkt.NumberField("Allowable Ratio") step_1.table.col_normalized_ratio = vkt.NumberField("Normalized Ratio") step_1.table.col_clause = vkt.TextField("Clause") step_1.table.col_load_case = vkt.TextField("L/C") step_1.table.col_ax = vkt.TextField("Ax in²") step_1.table.col_iz = vkt.TextField("Iz in⁴") step_1.table.col_iy = vkt.TextField("Iy in⁴") step_1.table.col_ix = vkt.TextField("Ix in⁴") step_2 = vkt.Step("Step 2 - Post-Processing", views=["table_design_ratios"]) step_2.process = vkt.Text(""" ## 2.0 Filter and Group Group or filter by a specific cross section. Use the options below to customize your view. If you want to list all cross-sections after selecting one, you can select the "All" option! """) step_2.group = vkt.BooleanField("### Group by Cross-Section") step_2.ln_break = vkt.LineBreak() step_2.cross_section = vkt.OptionField( "### Filter by Cross-Section", options=get_cross_sections ) class Controller(vkt.Controller): parametrization = Parametrization() @vkt.TableView(label="Design Ratios by Cross Section") def table_design_ratios(self, params, **kwargs): if not params.step_1.table or len(params.step_1.table) == 0: return vkt.TableResult([["No data available! Please add table input."]]) df = generate_dataframe(params.step_1.table) # Group or filter the data based on user selection if params.step_2.group: # For each cross section, get the row with the maximum normalized ratio df = df.loc[ df.groupby("Design Property")[ "Normalized Ratio (Actual/Allowable)" ].idxmax() ].reset_index(drop=True) if params.step_2.cross_section and params.step_2.cross_section != "All": df = df[df["Design Property"] == params.step_2.cross_section] # Drop unnecessary columns df.drop( ["Ax in²", "Iz in⁴", "Iy in⁴", "Ix in⁴", "Analysis Property", "Clause"], axis=1, inplace=True, ) # Sort the DataFrame by Normalized Ratio in descending order df.sort_values( by="Normalized Ratio (Actual/Allowable)", ascending=False, inplace=True ) # Create table data with color-coded cells data = [] for _, row in df.iterrows(): ratio = row["Normalized Ratio (Actual/Allowable)"] color = self.get_cell_color(ratio) row_data = row.tolist() row_data[4] = vkt.TableCell(ratio, background_color=color) data.append(row_data) return vkt.TableResult( data, column_headers=df.columns.tolist(), enable_sorting_and_filtering=True ) def get_cell_color(self, ratio): if ratio >= 1: return vkt.Color(210, 0, 0) # Red elif ratio >= 0.85: return vkt.Color(255, 165, 0) # Orange else: return vkt.Color(0, 210, 0) # Green ``` ### How this works[​](https://docs.viktor.ai/docs/tutorials/process-staad-data/.md#how-this-works-3 "Direct link to How this works") * We added the `table_design_ratios` method decorated with `@vkt.TableView`, which returns a `TableResult` to be displayed in the app. * We specified `views=["table_design_ratios"]` in `step_2`, so the `TableView` will appear in Step 2. * We check if there's data available; if not, we return a message indicating that to the user. * Depending on the user's selection of `group` and `cross_section`, we group or filter the DataFrame. * If `group` is selected, we group the data by "Design Property" and keep the row with the maximum "Normalized Ratio (Actual/Allowable)" for each group. * If a `cross_section` is selected and it's not "All", we filter the DataFrame to only include that cross-section. * We drop unnecessary columns to keep the table clean. * We sort the DataFrame by "Normalized Ratio (Actual/Allowable)" in descending order. * For each row, we create a `TableCell` for the "Normalized Ratio" column, setting the background color based on the value using the `get_cell_color` function. * The `get_cell_color` function determines the color based on the ratio value: * Ratios >= 1 are colored red (overutilized) * Ratios >= 0.85 and < 1 are colored orange (approaching maximum capacity) * Ratios < 0.85 are colored green (underutilized) ## The resulting app[​](https://docs.viktor.ai/docs/tutorials/process-staad-data/.md#the-resulting-app "Direct link to The resulting app") Refresh your app in the browser. You will now see the table view appear in Step 2 of your app. For testing, feel free to copy the rows of the TXT file from [section 3](https://docs.viktor.ai/docs/tutorials/process-staad-data/.md#3-process-the-staadpro-data), then create a new row in the table. Click the top-left checkbox, press `Ctrl + V`, and you will see your rows being populated. After that, you can choose to group or filter the results by cross-section and analyze them. ![Create app](/assets/images/tutorial_staad_results-0f6e600ff88100222b0198da3c9ed8e7.gif) note Ensure that there are no empty rows in the `vkt.Table`; otherwise, the app will complain. You can right-click on an empty row and delete it. You can use the **"Group by Cross-Section"** toggle to view the maximum design ratios for each cross-section. Alternatively, you can use the **"Filter by Cross-Section"** dropdown to focus on a specific cross-section and see how its design ratios are distributed. This provides flexibility in analyzing the data based on your needs. ## Complete code[​](https://docs.viktor.ai/docs/tutorials/process-staad-data/.md#complete-code "Direct link to Complete code") Were you able to do everything in this tutorial without error? If not, you can always look at the full code: ``` import viktor as vkt import pandas as pd def generate_dataframe(table_data): df = pd.DataFrame([dict(item) for item in table_data]) df.rename( columns={ "col_beam": "Beam", "col_analysis_property": "Analysis Property", "col_design_property": "Design Property", "col_actual_ratio": "Actual Ratio", "col_allowable_ratio": "Allowable Ratio", "col_normalized_ratio": "Normalized Ratio (Actual/Allowable)", "col_clause": "Clause", "col_load_case": "L/C", "col_ax": "Ax in²", "col_iz": "Iz in⁴", "col_iy": "Iy in⁴", "col_ix": "Ix in⁴", }, inplace=True, ) return df def get_cross_sections(params, **kwargs): if params.step_1.table: df = generate_dataframe(params.step_1.table) secs = df["Design Property"].unique().tolist() secs.append("All") return secs return ["No data available! Please add table input."] class Parametrization(vkt.Parametrization): step_1 = vkt.Step("Step 1 - Input Your Data!") step_1.intro = vkt.Text(""" # STAAD Design Ratio Analyzer This app allows you to visualize a heat map from your STAAD.PRO model results. You can filter and group them based on cross sections and visualize how they are distributed.""") step_1.table_input = vkt.Text(""" ## 1.0 Create the Input Table! Paste the design ratio data from your STAAD.PRO model!""") step_1.table = vkt.Table("### Beam Design Analysis") step_1.table.col_beam = vkt.TextField("Beam") step_1.table.col_analysis_property = vkt.TextField("Analysis Property") step_1.table.col_design_property = vkt.TextField("Design Property") step_1.table.col_actual_ratio = vkt.NumberField("Actual Ratio") step_1.table.col_allowable_ratio = vkt.NumberField("Allowable Ratio") step_1.table.col_normalized_ratio = vkt.NumberField("Normalized Ratio") step_1.table.col_clause = vkt.TextField("Clause") step_1.table.col_load_case = vkt.TextField("L/C") step_1.table.col_ax = vkt.TextField("Ax in²") step_1.table.col_iz = vkt.TextField("Iz in⁴") step_1.table.col_iy = vkt.TextField("Iy in⁴") step_1.table.col_ix = vkt.TextField("Ix in⁴") step_2 = vkt.Step("Step 2 - Post-Processing", views=["table_design_ratios"]) step_2.process = vkt.Text(""" ## 2.0 Filter and Group Group or filter by a specific cross section. Use the options below to customize your view. If you want to list all cross-sections after selecting one, you can select the "All" option! """) step_2.group = vkt.BooleanField("### Group by Cross-Section") step_2.ln_break = vkt.LineBreak() step_2.cross_section = vkt.OptionField( "### Filter by Cross-Section", options=get_cross_sections ) class Controller(vkt.Controller): parametrization = Parametrization() @vkt.TableView(label="Design Ratios by Cross Section") def table_design_ratios(self, params, **kwargs): if not params.step_1.table or len(params.step_1.table) == 0: return vkt.TableResult([["No data available! Please add table input."]]) df = generate_dataframe(params.step_1.table) # Group or filter the data based on user selection if params.step_2.group: # For each cross section, get the row with the maximum normalized ratio df = df.loc[ df.groupby("Design Property")[ "Normalized Ratio (Actual/Allowable)" ].idxmax() ].reset_index(drop=True) if params.step_2.cross_section and params.step_2.cross_section != "All": df = df[df["Design Property"] == params.step_2.cross_section] # Drop unnecessary columns df.drop( ["Ax in²", "Iz in⁴", "Iy in⁴", "Ix in⁴", "Analysis Property", "Clause"], axis=1, inplace=True, ) # Sort the DataFrame by Normalized Ratio in descending order df.sort_values( by="Normalized Ratio (Actual/Allowable)", ascending=False, inplace=True ) # Create table data with color-coded cells data = [] for _, row in df.iterrows(): ratio = row["Normalized Ratio (Actual/Allowable)"] color = self.get_cell_color(ratio) row_data = row.tolist() row_data[4] = vkt.TableCell(ratio, background_color=color) data.append(row_data) return vkt.TableResult( data, column_headers=df.columns.tolist(), enable_sorting_and_filtering=True ) def get_cell_color(self, ratio): if ratio >= 1: return vkt.Color(210, 0, 0) # Red elif ratio >= 0.85: return vkt.Color(255, 165, 0) # Orange else: return vkt.Color(0, 210, 0) # Green ``` ## Export your own results from STAAD.PRO[​](https://docs.viktor.ai/docs/tutorials/process-staad-data/.md#export-your-own-results-from-staadpro "Direct link to Export your own results from STAAD.PRO") To export the design ratios from your STAAD.PRO app, first run your analysis and design check. Then, right-click > **Tables** > **Design Results**, and simply copy and paste the data into the `vkt.Table` component in the app. Make sure there are no empty rows, and you are all set! You can see how this process works in the animation below. ![Export data](/assets/images/tutorial_staad_export_data-8f9f32e80c1c5b5dc30824c460ca92c8.gif) ## What's next?[​](https://docs.viktor.ai/docs/tutorials/process-staad-data/.md#whats-next "Direct link to What's next?") In this tutorial, you learned how to post-process results exported from STAAD.PRO. Your next goal could be to implement automation using the STAAD.PRO API from your VIKTOR app. To achieve this, the best place to start is the following [tutorial](https://docs.viktor.ai/docs/tutorials/integrate-staadpro/.md). --- # How to convert a Python Project to a VIKTOR app info Level: **Beginners**<br />Time: **30 min**<br /> Prerequisites: * You have some experience with reading Python code * You have completed the installation and onboarding process of the VIKTOR platform * You have a Python project or script that you would like to convert to a VIKTOR app ***Not a reader?** feel free to follow this tutorial as a video* ## Introduction[​](https://docs.viktor.ai/docs/tutorials/python-script-to-app/.md#introduction "Direct link to Introduction") Most Python projects start off with a simple script to help with a task, whether it is for automating or calculation purposes. These scripts can evolve into valuable tools that can have value far beyond your own use. In general, what keeps these scripts from being utilized by others is that it often does not have a user-friendly way of being operated (for example an intuitive interface), it generally requires an extensive user manual, and that distribution is nearly impossible, as these scripts almost always require a set of dependencies that need to be installed, not mentioning the rights that need to be allocated to the user to be able to install these programs and packages. The VIKTOR platform allows one to overcome these challenges by providing a platform, SDK and integration possibilities. In this piece we will provide a guide to easily convert your script into a VIKTOR web application, which will allow others to also share the value that you created, without the bottlenecks usually encountered. In this guide, we will explore how to convert your Python project to a VIKTOR app. We will cover: 1. [Where to start](https://docs.viktor.ai/docs/tutorials/python-script-to-app/.md#where-to-start) 2. [Let's convert your script!](https://docs.viktor.ai/docs/tutorials/python-script-to-app/.md#lets-convert-your-script) 3. [What's next?](https://docs.viktor.ai/docs/tutorials/python-script-to-app/.md#whats-next) By the end of this guide, you will have a clear understanding how to convert your Python project to a VIKTOR app. info If you do not have a suitable Python script, consider writing something that you are familiar with such as a basic plot. This will remove the chance of knowledge gaps that you would have if you are given a script and allows you to focus on the VIKTOR elements. Throughout the guide, we added some links with additional information; but don't let them distract you too much. Stay focused on understanding the content. After this, you will know everything you need to convert your Python project to an app. ## Where to start[​](https://docs.viktor.ai/docs/tutorials/python-script-to-app/.md#where-to-start "Direct link to Where to start") Faster alternative with the App Builder You can also convert your Python script directly using the [App Builder](https://docs.viktor.ai/docs/app-builder/.md) — upload your script as context and it will generate the VIKTOR app for you. For the sake of this guide it is important to understand the fundamentals and typical layout of a VIKTOR app. These fundamentals are, however, elaborated upon earlier during the VIKTOR onboarding. So, if you want to directly get started in the steps to convert your script to an app, skip to the [Let’s convert your script!](https://docs.viktor.ai/docs/tutorials/python-script-to-app/.md#lets-convert-your-script)! ### VIKTOR framework fundamentals[​](https://docs.viktor.ai/docs/tutorials/python-script-to-app/.md#viktor-framework-fundamentals "Direct link to VIKTOR framework fundamentals") As the goal with this guide is to help you convert your script to a VIKTOR app, it is helpful to understand the fundamentals that make up the VIKTOR framework. In an attempt to give the clearest overview of the fundamentals, without oversimplifying, let us start with what we believe a good starting point is in understanding the VIKTOR framework. There are three aspects that are important to keep in mind when converting your script to an app, which are: 1. **Input:** The variables that can be adjusted for a calculation 2. **Results:** Results can either be presented visually or downloaded in a given file format. 3. **Stateless and containerized calculation:** A stateless calculation’s outcomes are not influenced by previous events, except if part of the calculation’s outcome is to alter the input (which will then alter the outcome of the next calculation). A deployed app also runs in isolation, which is what is meant by being containerized. These three points are important to remember when considering converting a script to a VIKTOR application. ### VIKTOR code layout[​](https://docs.viktor.ai/docs/tutorials/python-script-to-app/.md#viktor-code-layout "Direct link to VIKTOR code layout") Now that we know how VIKTOR’s framework fundamentally works, let us look at an example of a VIKTOR app to explain a typical VIKTOR app code layout: ![An example of a VIKTOR app\'s code and interface.](/assets/images/tutorial-script-to-app-example-app-code-34de9a527edf3d75068b220cde4b4262.png) Be aware that this is just an example to explain the fundamentals from a code’s perspective, and that the VIKTOR platform provides an endless number of possibilities. Noting above’s example, let us try to connect the fundamentals to this example. #### Input[​](https://docs.viktor.ai/docs/tutorials/python-script-to-app/.md#input "Direct link to Input") As a fundamental, the VIKTOR platform forces the developer to determine what the input variables of the calculation should be. This is done by defining all input parameters in the `Parametrization` class. There is an extensive amount of input, so this should not limit the developer. Refer to the [User input, fields and buttons](https://docs.viktor.ai/docs/create-apps/user-input/.md) section in the documentation for a clear overview of the possibilities. ![Example of VIKTOR input widgets](/assets/images/tutorial-script-to-app-inputs-aa1ea4cb3441a5bd4558826d42f89dbf.webp) #### Results[​](https://docs.viktor.ai/docs/tutorials/python-script-to-app/.md#results "Direct link to Results") Whether the result of the calculation is a visualization of sorts or a download, this is a result of a method that is defined in the `Controller` class. A download is simply a file of bytes or strings, so any format can be downloaded. For visualizations, the following is possible: * **Images** (PNG, JPEG, SVG, GIF): these formats need to be saved to memory by using `BytesIO`, `StringIO` or VIKTOR’s `File` * **Maps** * **3D geometries** (any object that can be converted to a glb/gltf format, or by using the primitive geometries available in the VIKTOR SDK) * **PDFs** * Any result in **HTML** * **Plotly** Refer to the [Results and visualizations](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md) section in the documentation to read up more on this. ![The range of output that can be generated with VIKTOR](/assets/images/tutorial-script-to-app-visualisation-fdf3ac772a336bb47f3c598f90d55fe8.gif) #### Stateless calculation[​](https://docs.viktor.ai/docs/tutorials/python-script-to-app/.md#stateless-calculation "Direct link to Stateless calculation") Any method that produces a result, presents a visualization, or produces a download must contain some logic. This logic can be defined directly in the method, split up into different methods, or defined in functions or classes in other files or directories within the app project. The requirement is that the code is written in such a way that the input provided (which can be retrieved from the `params` argument of the `Controller` class) always produces the same result when the input remains unchanged. In the event where a stateful event is wanted, the VIKTOR platform provides a `Storage` capability that allows developers to write data to a storage database that can be retrieved for the next calculation. #### Containerized calculation[​](https://docs.viktor.ai/docs/tutorials/python-script-to-app/.md#containerized-calculation "Direct link to Containerized calculation") As the intent of building a web app is to run it on a server rather than locally, the app with all its logic and files needs to be able to run in an isolated environment. Therefore, one needs to make sure that the entire development is done within the project folder, and that, when referring to files and folders, that these paths are referenced relatively. ![What is stateless, containerized code, and what alternatives does VIKTOR bring.](/assets/images/tutorial-script-to-app-stateless-4253f8181ef631aae75c31cfd7cde478.png) #### *Other things to consider…*[​](https://docs.viktor.ai/docs/tutorials/python-script-to-app/.md#other-things-to-consider "Direct link to other-things-to-consider") * If your code is written such that files are written to your local drive, it is suggested to convert this to saving the file to memory, or to use the VIKTOR SDK `Storage` functionality to store the file to a database. * If the Python code uses system dependencies or software that cannot be installed using `pip install`, we suggest using the integrations we provide. Or rewrite your code to use code that does not require these dependencies. ## Let’s convert your script\![​](https://docs.viktor.ai/docs/tutorials/python-script-to-app/.md#lets-convert-your-script "Direct link to Let’s convert your script!") Now that we know the VIKTOR platform from fundamentals, and we have an idea how the code structure works for a VIKTOR application, let’s take that knowledge to convert a script to a VIKTOR application. ![The steps to convert a simple script to an app.](/assets/images/tutorial-script-to-app-steps-9cba2580799a959a6cc35328a0de3847.png) Take the following steps: ### 1. Create a VIKTOR app project.[​](https://docs.viktor.ai/docs/tutorials/python-script-to-app/.md#1-create-a-viktor-app-project "Direct link to 1. Create a VIKTOR app project.") To create a new VIKTOR application project, use the `viktor-cli` to generate a project file structure automatically. The command to use is: ``` viktor-cli create-app --app-type editor <name-of-your-project> ``` ### 2. Collect all requirements of the python script.[​](https://docs.viktor.ai/docs/tutorials/python-script-to-app/.md#2-collect-all-requirements-of-the-python-script "Direct link to 2. Collect all requirements of the python script.") A good place to start would be to collect a list of all the python packages that are being used in the script. Some examples of frequently used Python packages are: * Numpy * Scipy * Matplotlib * Pandas * Etc. Add these packages to the `requirements.txt` file. info If the Python script only works for a given Python version, make sure to indicate this in the `viktor.config.toml` file. ### 3. Convert script to a function.[​](https://docs.viktor.ai/docs/tutorials/python-script-to-app/.md#3-convert-script-to-a-function "Direct link to 3. Convert script to a function.") A script can be converted to a VIKTOR app in many ways. One of the simpler ways of converting a script would be to rewrite the code such that it can run by calling a single function. This would entail you only need to consider what should be the result of the calculation, and then make sure that the result that you want to produce is returned by the function. E.g. if the result of the code is to produce a matplotlib plot, return a matplotlib figure, or if the result is a pandas dataframe, return that. If your code writes a file to a local drive, rewrite the code such that it returns the file as an object saved to memory, e.g. `BytesIO`, `StringIO` or `File`. ### 4. Create a view/download in the VIKTOR Controller[​](https://docs.viktor.ai/docs/tutorials/python-script-to-app/.md#4-create-a-viewdownload-in-the-viktor-controller "Direct link to 4. Create a view/download in the VIKTOR Controller") In this step we will create a view or download functionality that can be seen in the interface of the VIKTOR app. Here are the steps: To use the newly created function in your VIKTOR app, import the function into the `app.py` file where the bare-bones VIKTOR app code structure resides. Depending on whether you would like to create a download functionality or visualization, follow the steps described in the subsection: #### 4.1 Download[​](https://docs.viktor.ai/docs/tutorials/python-script-to-app/.md#41-download "Direct link to 4.1 Download") Here are the steps for a download functionality: 1. Create a download button: In the `Parametrization`, create a field with a `DownloadButton`, similar to the code snippet presented below: ``` import viktor as vkt class Parametrization(vkt.Parametrization): download_btn = vkt.DownloadButton('Download file', method='download_file') ``` 2. In the `Controller`, create a method with the same name as defined in the `method` argument (in the given example, `download_file`). Here is an example how this would look like: ``` import viktor as vkt class Controller(vkt.Controller): parametrization = Parametrization def download_file(self, params, **kwargs): return vkt.DownloadResult(file_content='', file_name='my_file.txt') ``` 3. Add your function to the method. The `file_content` that the VIKTOR platform expects is either string, bytes, `File` or `BytesIO`. Therefore, make sure to convert the type produced by the function if it does not suit any of the given types. ``` import viktor as vkt from .my_project import my_function # assuming that your function is within another file # Assuming that your function is within this project def my_function(): ... return class Controller(vkt.Controller): parametrization = Parametrization def download_file(self, params, **kwargs): result = my_function() return vkt.DownloadResult(file_content=result, file_name='my_file.txt') ``` #### 4.2 Visualization[​](https://docs.viktor.ai/docs/tutorials/python-script-to-app/.md#42-visualization "Direct link to 4.2 Visualization") Here are the steps for a visualization: 1. Determine what type of visualization you want to create from the result of your function. 2. In the `Controller`, create a method with your name of choice. The result to be returned by the method is dependent on the type of visualization. 3. Add a decorator to your method that suits your visualization. 4. Add your function to the method. Depending on the View, the result may differ. Therefore, make sure to check the documentation for that given view, and convert the type produced by the function to the format that is expected. Here is an example of the result of the four steps: ``` import viktor as vkt from .my_project import my_function # assuming that your function is within another file # Assuming that your function is within this project def my_function(): ... return class Controller(vkt.Controller): parametrization = Parametrization @vkt.WebView("My View") def create_plot(self, params, **kwargs): my_result = my_function() return vkt.WebResult(my_result) ``` Here is a table overview of the steps, with the possible options: | Steps | Image | Map | 3D Geometry | PDF | HTML | Plotly | | ----------------------------------------- | ------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------- | | 1. Determine type of visualization | This could be static plots such as Matplotlib, Seaborn, etc. or other type of images. | GeoJSONs or locations that can be visualized on a map | Any type of geometry that can be converted to glb/gltf, or some simple parameters that can be converted to simple VIKTOR geometries. | Word and Excel files can be converted to PDFs within VIKTOR! | HTML or URLs can be imbedded. | Plotly is a Python package with which you can create dynamic plots. | | 2. Create method with correct return type | `ImageResult` | `MapResult` or `GeoJSONResult` | `GeometryResult` | `PDFResult` | `WebResult` | `PlotlyResult` | | 3. Add decorator to your method | `ImageView` | `MapView` or `GeoJSONView` | `GeometryView` | `PDFView` | `WebView` | `PlotlyView` | | 4. Add your function to the method. | `BytesIO` for PNG, JPG/JPEG and GIF, `StringIO` for SVG | `MapView`: a list of VIKTOR map objects<br />`GeoJSONView`: a GeoJSON dict | This could either be a VIKTOR `Group` object, consisting of VIKTOR primitive Geometry objects, or...<br />a glTF/GLB or 3DM file as a VIKTOR `File` ojbect | You could reference a PDF from a URL, a path, or, probably the most common one, as a VIKTOR `File` | The HTML could be retrieved from a URL, static file as a path, or as an HTML string | A Plotly `Figure` object | If all went well, you will now have an application that displays the result of your function. ### 5. Create fields as input for calculation.[​](https://docs.viktor.ai/docs/tutorials/python-script-to-app/.md#5-create-fields-as-input-for-calculation "Direct link to 5. Create fields as input for calculation.") We’ve created a visualization, but ideally, we would like to make the app dynamic based on input. To do this, the following steps can be followed: 1. Start by determining which variables you would like the user of the app to change. Add these variables as input to the function you’ve created from your script. 2. Add fields to the parametrization that correspond with these variables. For example, if there are three variables named `a`, `b` and `c` that can be adjusted, we can add these fields to the `Parametrization` as well: | Variable | Type | Field | | -------- | ------------------ | ----------- | | a | Float | NumberField | | b | Options of strings | OptionField | | c | File | FileField | | Etc. | | | ``` class Parametrization(vkt.Parametrization): a = vkt.NumberField('a') b = vkt.OptionField('b', options=['apple', 'pear', 'lemon']) c = vkt.FileField('Upload file') ``` 3. Add the parameters to the function. You may have noticed that the methods defined in the `Controller` have a `params` argument. You can access the parameters from that variable. Here is an example: ``` import viktor as vkt from .my_project import my_function # assuming that your function is within another file # Assuming that your function is within this project def my_function(a, b, c): ... return class Controller(vkt.Controller): parametrization = Parametrization @vkt.WebView("My View") def create_plot(self, params, **kwargs): result = my_function( a=params.a, b=params.b, c=params.c ) return vkt.WebResult(result) ``` ## What's next?[​](https://docs.viktor.ai/docs/tutorials/python-script-to-app/.md#whats-next "Direct link to What's next?") And that's it! By following these steps, one should be able to convert a Python script to a VIKTOR app in no time. The VIKTOR platform provides much, much more in terms of functionalities and features. Therefore, if you want to explore the possibilities to improve your app, consider consulting the documentation. Topics that are of great interest to developers are: * [Layout and styling](https://docs.viktor.ai/docs/create-apps/layout-and-styling/.md) * [Informing the end-user](https://docs.viktor.ai/docs/create-apps/inform-end-user/text-blocks/.md) * [Managing files](https://docs.viktor.ai/docs/create-apps/managing-files/downloading-files/.md) * [Software integrations](https://docs.viktor.ai/docs/create-apps/software-integrations/.md) * and so much [more...](https://docs.viktor.ai/docs/welcome/.md) There are also resources other than the documentation available that could help in the app development journey, such as: * [Blog posts](https://www.viktor.ai/blog/category/all/1) * [Other examples of apps](https://www.viktor.ai/apps-gallery/category/all/tag/all/1) * [White-papers (especially the one on "Building successful applications")](https://www.viktor.ai/white-papers) * [The community, for interactive discussions](https://community.viktor.ai/) --- # Tutorial - Spreadsheet Calculator info Level: **Beginners**<br />Time: **20 min**<br /> Prerequisites: * You have an account and completed the installation process. No account? Get one [here](https://www.viktor.ai/start-building-apps) * You have some experience with reading Python code * [![](/img/illustrations/free-version-banner.svg)](https://www.viktor.ai/start-building-apps) <br /> ***Not a reader?** feel free to follow this tutorial as a video* ## Introduction[​](https://docs.viktor.ai/docs/tutorials/spreadsheet-calculator/.md#introduction "Direct link to Introduction") Welcome to the spreadsheet calculations tutorial! In most branches of engineering, spreadsheets are the golden standard for sharing results and knowledge in a clear, well organised way. In this tutorial you will learn how to implement an existing calculation from an excel sheet into a VIKTOR web application. For this, the example we will use is a simply supported beam under load and all the calculations will be performed in the spreadsheet. In this tutorial we will cover: 1. [Create, install and start an empty app](https://docs.viktor.ai/docs/tutorials/spreadsheet-calculator/.md#1-create-install-and-start-an-empty-app) 2. [The Excel spreadsheet](https://docs.viktor.ai/docs/tutorials/spreadsheet-calculator/.md#2-the-excel-spreadsheet) 3. [Adding inputs and views](https://docs.viktor.ai/docs/tutorials/spreadsheet-calculator/.md#3-adding-inputs-and-views) 4. [Downloading the spreadsheet](https://docs.viktor.ai/docs/tutorials/spreadsheet-calculator/.md#4-download-the-spreadsheet) By the end of this tutorial, you will have created a VIKTOR application that generates calculations from a spreadsheet and that will allow the user to download the results to share with colleagues. You can test the final result below: Faster alternative with the App Builder You can also generate a VIKTOR app directly from your spreadsheet using the [App Builder](https://docs.viktor.ai/docs/app-builder/.md) — upload the Excel file as context and the agent will convert it into a VIKTOR app for for you. ## 1. Create, install and start an empty app[​](https://docs.viktor.ai/docs/tutorials/spreadsheet-calculator/.md#1-create-install-and-start-an-empty-app "Direct link to 1. Create, install and start an empty app") Need help? Are you encountering an error? Take a look at the [**complete app code**](https://docs.viktor.ai/docs/tutorials/spreadsheet-calculator/.md#5-all-code-together). Also know that you can always ask for help at our [**Community Forum**](https://community.viktor.ai/), where our developers are ready to help with any question related to the installation, coding and more. Let's create, install and start an empty app. This will be the starting point for the rest of the tutorial. But before we start, make sure to shut down any app that is running (like the demo app) by closing the command-line shell (for example Powershell) or end the process using `Ctrl + C`. Follow these steps to create, install and start an empty app: 1. Open a terminal and run the following command to create the app on the VIKTOR platform and generate the initial code locally: ``` viktor-cli create-app "Spreadsheet tutorial" --init --app-type editor ``` 2. Open the newly created folder in your code editor and run `viktor-cli clean-start` in the terminal to install dependencies and connect the app to the platform. If all went well, your empty app is installed and connected to your development workspace. **Do not close the terminal** as this will break the connection with your app. The terminal in your code editor should show something like this: ``` INFO : Connecting to cloud.viktor.ai... INFO : Connection is established (use Ctrl+C to close) INFO : INFO : Navigate to the link below to see your app in the browser INFO : https://cloud.viktor.ai/workspaces/XXX/app INFO : INFO : App code loaded, waiting for jobs... ``` Re-starting your app * You only need to create an app template and install it once for each new app you want to make. * The app will update automatically once you start adding code in `app.py`, as long as you don't close the terminal or your code editor. * Did you close your code editor? Use `viktor-cli start` to start the app again. No need to install, clear, etc. **Did you encounter any errors?** * Always make sure to check the spelling of everything you placed in the command-line, a small mistake and the command you are trying to run may not be recognised! * If you are encountering: ``` ERROR: Exiting because of an error: no requirements.txt file PS C:\Users\<username>\viktor-apps> ``` Then you are not in the correct folder! check the command-line and navigate to the spreadsheet-tutorial folder. * If you are encountering: ``` Error: App definition is not compatible with the data currently stored in the database. Use the command 'viktor-cli clear' to clear the database. PS C:\Users\<username>\viktor-apps\spreadsheet-tutorial> ``` That means you have not cleared the database yet! Use the `viktor-cli clear` to clear and then you can use `viktor-cli start` to start the app. No need to install it again! Not seeing any of these errors? Head over to our community! There is a good chance another developer encountered it and solved it too! ## 2. The Excel spreadsheet[​](https://docs.viktor.ai/docs/tutorials/spreadsheet-calculator/.md#2-the-excel-spreadsheet "Direct link to 2. The Excel spreadsheet") As mentioned previously, this example will be of a simply supported beam under load. If you would like to use or modify the example spreadsheet used for this tutorial, you can download it [here](https://docs.viktor.ai/files/docs/spreadsheet-calculator-tutorial/beam_calculation.xls) \[1]. You will need to add your spreadsheet to the root directory/folder, in this case the one we made when we made the empty app named 'spreadsheet-tutorial'. \[1] source: [https://stuff.mit.edu](https://stuff.mit.edu/afs/athena/course/2/2.75/fundamentals/FUNdaMENTALs%20Book%20pdf/FUNdaMENTALS%20Design%20Spreadsheets/Topic%208%20Structures%20Design%20Spreadsheets/Beam_simply_supported.xls) (04-05-2020) The app should now have the following folder structure: ``` spreadsheet-tutorial ├── tests ├── app.py ├── beam_calculation.xls ├── CHANGELOG.md ├── README.md ├── requirements.txt └── viktor.config.toml ``` To be able to use a spreadsheet as a calculation tool within a VIKTOR app, a few modifications must be performed to the spreadsheet file (more elaboration on this can be found [here](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/spreadsheet-calculator/.md#calculation-sheet-set-up)). Open `beam_calculation.xls` and add two sheets: `viktor-input-sheet` and `viktor-output-sheet`. These sheets contain the input and output values respectively. In the `viktor-input-sheet`, add the following data: ![](/assets/images/spreadsheet-app-input-sheet-0660e7d09b6c3f614dd2d3136a0a0d3c.png) The values from `viktor-input-sheet` should now be used in the `Analysis` sheet. For example, cell C22 below refers to the "L" parameter defined in the `viktor-input-sheet` sheet: ![](/assets/images/spreadsheet-app-analysis-sheet-6d7b7c68f57038ec34004ccc2229ffc1.png) In the `viktor-output-sheet` the desired output parameters are defined, with their values taken from the `Analysis` sheet: ![](/assets/images/spreadsheet-app-output-sheet-d0eda0bd843b9c884176afb6d0af0cc1.png) You should now be able to change the values on the `viktor-input-sheet`, resulting in changed values in the `viktor-output-sheet`. If you got lost along the way, or want to take the easy route, download the fully adjusted spreadsheet [here](https://docs.viktor.ai/files/docs/spreadsheet-calculator-tutorial-complete/beam_calculation.xls). ### Coupling the spreadsheet[​](https://docs.viktor.ai/docs/tutorials/spreadsheet-calculator/.md#coupling-the-spreadsheet "Direct link to Coupling the spreadsheet") The spreadsheet is now ready to be used within the app. VIKTOR provides a helper class specifically for this task: [`SpreadsheetCalculation`](https://docs.viktor.ai/sdk/api/external/spreadsheet/.md#_SpreadsheetCalculation). The first thing that needs to be done is to make sure that we can get to the spreadsheet. For this you may add the function `fill_spreadsheet` as described below. The `app.py` file should now look like this: ``` import viktor as vkt from pathlib import Path SPREADSHEET_PATH = Path(__file__).parent / "beam_calculation.xls" def fill_spreadsheet(params) -> vkt.spreadsheet.SpreadsheetCalculation: inputs = [ vkt.spreadsheet.SpreadsheetCalculationInput('L', params.beam.length), vkt.spreadsheet.SpreadsheetCalculationInput('W', params.beam.width), vkt.spreadsheet.SpreadsheetCalculationInput('H', params.beam.height), vkt.spreadsheet.SpreadsheetCalculationInput('E', params.beam.E), vkt.spreadsheet.SpreadsheetCalculationInput('aw', params.loads.aw), vkt.spreadsheet.SpreadsheetCalculationInput('wa', params.loads.wa), vkt.spreadsheet.SpreadsheetCalculationInput('wL', params.loads.wL) ] return vkt.spreadsheet.SpreadsheetCalculation.from_path(SPREADSHEET_PATH, inputs=inputs) class Parametrization(vkt.Parametrization): pass class Controller(vkt.Controller): parametrization = Parametrization ``` Great! Now that we are ready to process the excel sheet, let's start with providing the user with the possibility to enter inputs for that sheet. ## 3. Adding inputs and views[​](https://docs.viktor.ai/docs/tutorials/spreadsheet-calculator/.md#3-adding-inputs-and-views "Direct link to 3. Adding inputs and views") Our app is still a bit empty, lets change that! First, lets add some inputs to our parametrization so that our user can make changes to the calculations. To reduce the clutter in our app, lets make a [`Section`](https://docs.viktor.ai/sdk/api/parametrization/.md#_Section) for this and fill it with the parameters of the beam. The end result can be downloaded [here](https://docs.viktor.ai/files/docs/spreadsheet-calculator-tutorial-complete.zip). Additionally, we will also add an [`Image`](https://docs.viktor.ai/sdk/api/parametrization/.md#_Image) to our parametrization that will allow the user to check the locations and orientations of the parameters. For this we need to make two more modifications to our app. First, add a new folder called 'assets' to our 'spreadsheet-tutorial' app folder. You need to add the beam schematic from the top of the Analysis sheet to this folder (can also be downloaded here: [beam\_schematic.png](https://docs.viktor.ai/files/docs/spreadsheet-calculator-tutorial/beam_schematic.png). The resulting folder structure would look like this: ``` spreadsheet-tutorial ├── tests ├── assets │ └── beam_schematic.png ├── app.py ├── beam_calculation.xls ├── CHANGELOG.md ├── README.md ├── requirements.txt └── viktor.config.toml ``` In the `viktor.config.toml` file remove the hashtag in order to add: `assets_path = "assets"` to the config. The full config file should now look like this: ``` # For all available configuration settings, please go to: # https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml app_type = 'editor' assets_path = 'assets' # packages = [] python_version = "3.14" # welcome_text = 'welcome.md' registered_name = 'spreadsheet-tutorial' ``` Update the `Parametrization` to show the required input fields: ``` ... class Parametrization(vkt.Parametrization): beam = vkt.Section('Beam') beam.schematic = vkt.Image(path="beam_schematic.png") beam.length = vkt.NumberField('Length (L)', suffix='mm', default=80, max=100) beam.width = vkt.NumberField('Width (W)', suffix='mm', default=10) beam.height = vkt.NumberField('Height (H)', suffix='mm', default=10) beam.E = vkt.NumberField('Modulus of Elasticity (E)', default=200000, suffix='N/mm2') ``` This will allow you to change the parameters of the beam which are used in our spreadsheet calculations. But you may also want to change the way we load the beam. Lets also add some input fields for that in a new `Section`. ``` ... class Parametrization(vkt.Parametrization): beam = vkt.Section('Beam') beam.schematic = vkt.Image(path="beam_schematic.png") beam.length = vkt.NumberField('Length (L)', suffix='mm', default=80, max=100) beam.width = vkt.NumberField('Width (W)', suffix='mm', default=10) beam.height = vkt.NumberField('Height (H)', suffix='mm', default=10) beam.E = vkt.NumberField('Modulus of Elasticity (E)', default=200000, suffix='N/mm2') loads = vkt.Section('Loads') loads.aw = vkt.NumberField('Starting point of load (aw)', suffix='mm', default=9) loads.lb = vkt.LineBreak() loads.wa = vkt.NumberField('Distributed load amplitude (wa)', suffix='N/mm', flex=40, default=5) loads.wL = vkt.NumberField('Distributed load amplitude (wL)', suffix='N/mm', flex=40, default=5) ``` ### Showing results and a schematic[​](https://docs.viktor.ai/docs/tutorials/spreadsheet-calculator/.md#showing-results-and-a-schematic "Direct link to Showing results and a schematic") If all went well, you should now be able to see all the inputs for the beam and loads in your app. Now let's display some results and a handy schematic so that the user knows what all the inputs mean and which way we have defined as positive and negative (coordinate system). For the results, let's add a [`TableView`](https://docs.viktor.ai/sdk/api/views/.md#_TableView) to our controller. You will need to use the method we made earlier to grab the results from the spreadsheet. ``` ... class Controller(vkt.Controller): parametrization = Parametrization @vkt.TableView("Outputs") def spreadsheet_calculation(self, params, **kwargs) -> vkt.TableResult: sheet = fill_spreadsheet(params) result = sheet.evaluate() column_headers = [vkt.TableHeader("Value", num_decimals=2), "Unit", "Description"] row_headers = [ "maximum_deflection", "maximum_bending_stress", ] data = [ [result.values["maximum_deflection"], "microns", ""], [result.values["maximum_bending_stress"], "N/mm2", "Maximum bending stress along the beam"], ] return vkt.TableResult(data, row_headers=row_headers, column_headers=column_headers) ``` After reloading the app, you should now be able to see the maximum deflection and maximum bending stress in the app. tip If you get stuck, you can always try to have a quick peek at the [complete code](https://docs.viktor.ai/docs/tutorials/spreadsheet-calculator/.md#6-all-code-together) at the end of this tutorial Beautiful! If all went well you should now be able to use the schematic as a reference to define your loads and dimensions of the beam and see the maximum stress and deflection in the `DataView`. ### Adding plots for analysis[​](https://docs.viktor.ai/docs/tutorials/spreadsheet-calculator/.md#adding-plots-for-analysis "Direct link to Adding plots for analysis") To perform some analysis, lets add a plot to show the curvature along the beam. All the data points for this are already in the excel file so you will only need to extract and plot this data. The data we are using for this example is the deflection data but you can use any other data that the sheet provides as the `pandas` dataframe will have all the data. We can then make a figure using the `plotly.express` package and display this figure in our application. First, let's add the `plotly`, `pandas` and `openpyxl` packages to our app by updating the `requirements.txt` to: ``` viktor==... plotly pandas openpyxl ``` Second, let's add the imports and the `PlotlyView` to the controller: ``` import viktor as vkt import pandas as pd import plotly.express as px from pathlib import Path ... class Controller(vkt.Controller): ... @vkt.PlotlyView('Beam Curvature') def beam_curvature(self, params, **kwargs): sheet = fill_spreadsheet(params) result = sheet.evaluate(include_filled_file=True) evaluated_file = vkt.File.from_data(result.file_content) with evaluated_file.open_binary() as fp: data_df = pd.read_excel(fp, sheet_name='Data') deflection_data = data_df['Deflection (microns)'].head(params.beam.length+1) fig = px.line(deflection_data, title='Beam deflection', labels={'value': 'Deflection (microns)', 'index': 'Length (mm)'}) return vkt.PlotlyResult(fig) ``` ## 4. Download the spreadsheet[​](https://docs.viktor.ai/docs/tutorials/spreadsheet-calculator/.md#4-download-the-spreadsheet "Direct link to 4. Download the spreadsheet") Now that we have all the functionality for our spreadsheet calculations, we can download the result as a spreadsheet to share with our colleagues in our next meeting. ``` ... class Parametrization(vkt.Parametrization): ... calculation_sheet = vkt.Section('Download') calculation_sheet.button = vkt.DownloadButton('Download', 'download_spreadsheet') ``` Then, to our controller class we need to add the method `download_spreadsheet` to download the spreadsheet. ``` ... class Controller(vkt.Controller): ... def download_spreadsheet(self, params, **kwargs): sheet = fill_spreadsheet(params) result = sheet.evaluate(include_filled_file=True) return vkt.DownloadResult(result.file_content, 'evaluated_beam.xlsx') ``` Give it a quick test to make sure you made no mistakes and everything works. Now admire the beautiful app you have made! ## 5. All code together[​](https://docs.viktor.ai/docs/tutorials/spreadsheet-calculator/.md#5-all-code-together "Direct link to 5. All code together") Congratulations!!! This is concludes the tutorial, you have now built a fully functional app to perform spreadsheet calculations. Enjoy!!! **Complete app.py code** ``` import viktor as vkt import pandas as pd import plotly.express as px from pathlib import Path SPREADSHEET_PATH = Path(__file__).parent / "beam_calculation.xls" def fill_spreadsheet(params) -> vkt.spreadsheet.SpreadsheetCalculation: inputs = [ vkt.spreadsheet.SpreadsheetCalculationInput('L', params.beam.length), vkt.spreadsheet.SpreadsheetCalculationInput('W', params.beam.width), vkt.spreadsheet.SpreadsheetCalculationInput('H', params.beam.height), vkt.spreadsheet.SpreadsheetCalculationInput('E', params.beam.E), vkt.spreadsheet.SpreadsheetCalculationInput('aw', params.loads.aw), vkt.spreadsheet.SpreadsheetCalculationInput('wa', params.loads.wa), vkt.spreadsheet.SpreadsheetCalculationInput('wL', params.loads.wL) ] return vkt.spreadsheet.SpreadsheetCalculation.from_path(SPREADSHEET_PATH, inputs=inputs) class Parametrization(vkt.Parametrization): beam = vkt.Section('Beam') beam.schematic = vkt.Image(path="beam_schematic.png") beam.length = vkt.NumberField('Length (L)', suffix='mm', default=80, max=100) beam.width = vkt.NumberField('Width (W)', suffix='mm', default=10) beam.height = vkt.NumberField('Height (H)', suffix='mm', default=10) beam.E = vkt.NumberField('Modulus of Elasticity (E)', default=200000, suffix='N/mm2') loads = vkt.Section('Loads') loads.aw = vkt.NumberField('Starting point of load (aw)', suffix='mm', default=9) loads.lb = vkt.LineBreak() loads.wa = vkt.NumberField('Distributed load amplitude (wa)', suffix='N/mm', flex=40, default=5) loads.wL = vkt.NumberField('Distributed load amplitude (wL)', suffix='N/mm', flex=40, default=5) calculation_sheet = vkt.Section('Download') calculation_sheet.button = vkt.DownloadButton('Download', 'download_spreadsheet') class Controller(vkt.Controller): parametrization = Parametrization @vkt.TableView("Outputs") def spreadsheet_calculation(self, params, **kwargs) -> vkt.TableResult: sheet = fill_spreadsheet(params) result = sheet.evaluate() column_headers = [vkt.TableHeader("Value", num_decimals=2), "Unit", "Description"] row_headers = [ "maximum_deflection", "maximum_bending_stress", ] data = [ [result.values["maximum_deflection"], "microns", ""], [result.values["maximum_bending_stress"], "", "Maximum bending stress along the beam"], ] return vkt.TableResult(data, row_headers=row_headers, column_headers=column_headers) @vkt.PlotlyView('Beam Curvature') def beam_curvature(self, params, **kwargs): sheet = fill_spreadsheet(params) result = sheet.evaluate(include_filled_file=True) evaluated_file = vkt.File.from_data(result.file_content) with evaluated_file.open_binary() as fp: data_df = pd.read_excel(fp, sheet_name='Data') deflection_data = data_df['Deflection (microns)'].head(params.beam.length+1) fig = px.line(deflection_data, title='Beam deflection', labels={'value': 'Deflection (microns)', 'index':'Length (mm)'}) return vkt.PlotlyResult(fig) def download_spreadsheet(self, params, **kwargs): sheet = fill_spreadsheet(params) result = sheet.evaluate(include_filled_file=True) return vkt.DownloadResult(result.file_content, 'evaluated_beam.xlsx') ``` The full app-repository can be downloaded [here](https://docs.viktor.ai/files/docs/spreadsheet-calculator-tutorial-complete.zip). ## Want to learn how VIKTOR works?[​](https://docs.viktor.ai/docs/tutorials/spreadsheet-calculator/.md#want-to-learn-how-viktor-works "Direct link to Want to learn how VIKTOR works?") If you are interested in how VIKTOR works behind the scenes, for example how it processes your input, expand the tabs below! #### How does it work?[​](https://docs.viktor.ai/docs/tutorials/spreadsheet-calculator/.md#how-does-it-work "Direct link to How does it work?") How does the Parametrization work? In the **Parameterization** class you can add input fields that allow the user to provide input to your app, and there are more than 20 [different input fields](https://docs.viktor.ai/docs/create-apps/user-input/.md) you can use, including numbers, text, colors, images and files. Inside the Parametrization class, you can also format the [layout of your app](https://docs.viktor.ai/docs/create-apps/layout-and-styling/.md) by adding sections, tabs, steps and pages. To show your Parametrization in the app, we need to add the line `parametrization = Parametrization` inside the `Controller` class, because it is the controller that determines what is shown and not. How does the Parametrization get saved? So you may be wondering, how do you get the information from the parametrization to my controller? Well, we do this automatically for you. The values of all parameters are stored in a single variable called `params` , which is accessible inside the Controller class. These variables are stored in a `Munch`; this is similar to a dictionary, but work with point denotation. Example: * Let's say we have a variable called `height` as a NumberField in our `Parameterization`. * To use it in a method in the `Controller`, define it as: `def my_method(self, params, **kwargs)` * You can now make calculations inside that method using our height parameter as `params.height`! How does the Controller work? The **Controller** class is the place where you add everything you want to calculate and show. As explained in this tutorial, we show results in a `View` and we always add views in our controller. You can even add several views in a single app by adding them to the controller class... and yes, we have [many Views](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md), for showing graphs, maps, 3D models, reports, images and more. In the Controller, you also do or call your calculation. Remember that the user input given in the parametrization, is accessible inside the Controller class in the variable The `params`. ## What's next[​](https://docs.viktor.ai/docs/tutorials/spreadsheet-calculator/.md#whats-next "Direct link to What's next") Very impressive! You have now learned the basics of working with external files and programs. In this tutorial, we have only scratched the surface of what you can do these integrations. So don’t stop your journey there! If you like an extra challenge, here are some ideas: * Convert your excel sheet to a pdf and show it in a `PDFView` * Try to adjust the geometry to show the deformation of the beam * Or even try to re-write the logic of your Excel file to a python script to use directly in the app code! If you enjoyed this spreadsheet tutorial and want to explore some of the possibilities with Excel and VIKTOR, check out some of our other [tutorials](https://docs.viktor.ai/docs/tutorials/.md) More about excel sheets You can find more information about how to use excel sheets in the [documents and spreadsheets guide](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/spreadsheet-calculator/.md). Also check more about [documents and spreadsheets in general](https://docs.viktor.ai/docs/create-apps/documents-and-spreadsheets/.md) --- # Device compatibility VIKTOR web applications are easy to distribute and use by others. There are, however, some restrictions in place in terms of supported platforms and software. ## Supported browsers[​](https://docs.viktor.ai/docs/use-apps/.md#supported-browsers "Direct link to Supported browsers") VIKTOR app use is supported (and regularly tested) on the following browsers: * Chrome (Windows, Mac, Linux) * Firefox (Windows, Mac, Linux) We support the latest versions of these browsers. If you encounter problems running our web application, check that your browser version is not outdated or that the browser you are using is not discontinued. ## Supported screen sizes[​](https://docs.viktor.ai/docs/use-apps/.md#supported-screen-sizes "Direct link to Supported screen sizes") The VIKTOR platform is built with desktop users in mind. While larger tablets might be able to display VIKTOR effectively in landscape mode, some features might not work as expected. ## Using VIKTOR apps on tablets[​](https://docs.viktor.ai/docs/use-apps/.md#using-viktor-apps-on-tablets "Direct link to Using VIKTOR apps on tablets") Using a VIKTOR app on a tablet is not officially supported, but might work depending on your usecase. We advice to test your specific usecase when you are considering use on a tablet. Some considerations: * screen size: if the tablet has a sufficiently large screen, the viktor interface probably scales well enough to work in landscape mode. * browser: chrome on android probably works, but is not actively tested. * input device: on a tablet, a touch screen is used instead of a mouse. This difference is not actively tested, but it seems that most functionality correctly works. Some things you can do to make the most of the limited screen size: * choose a flat app structure (`simple` or `editor`). This eliminates the entity tree and simplifies navigation. * separate your input on pages with only input or only output. Again, this makes the interface simpler. ## Using VIKTOR on mobile phones[​](https://docs.viktor.ai/docs/use-apps/.md#using-viktor-on-mobile-phones "Direct link to Using VIKTOR on mobile phones") Using VIKTOR apps from a mobile phone is not supported. Although it is technically possible to access the application from the web, the small screen makes the interface practically unusable. --- # Integrate your app in other software Sometimes it can be useful to integrate your VIKTOR app with other software, for example to: * Obtain data from an entity in your VIKTOR app, to be used in your calculation software * Push data from your BIM software (plugin) to one of your VIKTOR apps * Collect environment activity, to be shown in your own custom dashboard * Perform some calculation on the VIKTOR app to be further processed in your dedicated software There are 2 ways to do this: * Using the [SDK API](https://docs.viktor.ai/docs/api/sdk/.md) * Using the [REST API](https://docs.viktor.ai/docs/api/rest) For more information on the different APIs and when to use what, please refer to the [API documentation](https://docs.viktor.ai/docs/api/.md) To let an external AI agent discover and run your apps rather than integrating them in code, see [Connect agents via MCP](https://docs.viktor.ai/docs/create-apps/mcp/.md) (beta). --- # VIKTOR SDK The VIKTOR SDK is a Python package that gives your app everything it needs to become a VIKTOR app: ready-made components and helpful utilities that you use to build your app. You install it on your computer and use it in your Python code. That’s why you put import viktor as vkt at the start of your app.py file — it tells Python that you want to use the tools from the VIKTOR SDK in your app. There are two types of documentation to guide you: * **General documentation** – written in plain language and full of examples. It's great if you're new to the SDK or just want to understand how it works. * **SDK Reference documentation** – a more detailed, technical guide that lists all the functions and options you can use. Think of it as a dictionary for the SDK: you can use it to look up something specific whenever you need it. Together, these documents help you understand the SDK and give you the tools to create your own VIKTOR apps. * **Upgrading your SDK version** Keeping your VIKTOR SDK up to date is important to make sure your apps can use the latest features, improvements, and bug fixes. [Learn more](https://docs.viktor.ai/docs/publish-apps/upgrade-viktor-version/.md) <!-- --> [ ](https://docs.viktor.ai/docs/publish-apps/upgrade-viktor-version/.md) ## General SDK documentation[​](https://docs.viktor.ai/docs/viktor-sdk/.md#general-sdk-documentation "Direct link to General SDK documentation") Before you start diving into the details it’s good to learn the general concepts of VIKTOR. [![Layers icon](/img/icons/icon-layers.svg)](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure/.md) ### [Basic app structure](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure/.md) [* App file structure* Inputs (parametrization)* Results & visualizations](https://docs.viktor.ai/docs/getting-started/fundamentals/basic-app-structure/.md) [![Category icon](/img/icons/icon-category.svg)](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md) ### [App types](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md) [* Editor type* Simple type* Tree type](https://docs.viktor.ai/docs/getting-started/fundamentals/app-types/.md) ### VIKTOR components[​](https://docs.viktor.ai/docs/viktor-sdk/.md#viktor-components "Direct link to VIKTOR components") Learn about the different types of fields and visualizations VIKTOR has to offer. [![Inputs illustration](/img/illustrations/Illustration-inputs-frame.svg)](https://docs.viktor.ai/docs/create-apps/user-input/.md) ### [Inputs](https://docs.viktor.ai/docs/create-apps/user-input/.md) [Add fields, sliders, uploads, etc so users can give your app the information it needs.](https://docs.viktor.ai/docs/create-apps/user-input/.md) [![Results illustration](/img/illustrations/Illustration-results-frame.svg)](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md) ### [Results](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md) [Show plots, charts, 3D models, tables and maps to visualize the results.](https://docs.viktor.ai/docs/create-apps/results-and-visualizations/.md) [![Layouts illustration](/img/illustrations/illustration-layouts-frame.svg)](https://docs.viktor.ai/docs/create-apps/layout-and-styling/.md) ### [Layouts](https://docs.viktor.ai/docs/create-apps/layout-and-styling/.md) [Arrange how inputs, results, and other elements appear to make your app easy and intuitive to use.](https://docs.viktor.ai/docs/create-apps/layout-and-styling/.md) ## SDK Reference[​](https://docs.viktor.ai/docs/viktor-sdk/.md#sdk-reference "Direct link to SDK Reference") For a complete list of all functions, classes, and options in the SDK, check out the [SDK Reference documentation](https://docs.viktor.ai/sdk/api/.md). A list of all notable changes per SDK version can be found in the [Changelog](https://docs.viktor.ai/sdk/changelog). --- # Welcome to VIKTOR! <!-- --> VIKTOR is a platform that makes it easy to create powerful and user-friendly apps. Create apps to automate your workflow, integrate with different software packages, and get better insights into your project through interactive visualizations. > "Automate the boring, engineer the awesome!" - VIKTOR ## [Getting started](https://docs.viktor.ai/docs/getting-started/.md) [New to VIKTOR? This is the place to start!](https://docs.viktor.ai/docs/getting-started/.md) [![](/img/illustrations/illustration-getting-started-yellow.svg)](https://docs.viktor.ai/docs/getting-started/.md) ## [Develop apps](https://docs.viktor.ai/docs/create-apps/.md) [Learn everything about building your own app.](https://docs.viktor.ai/docs/create-apps/.md) [![](/img/illustrations/ilustration-local-development.svg)](https://docs.viktor.ai/docs/create-apps/.md) ### [Manage projects](https://docs.viktor.ai/docs/manage-projects/.md) [Learn how to manage projects in VIKTOR.](https://docs.viktor.ai/docs/manage-projects/.md) ### [Administrators](https://docs.viktor.ai/docs/manage-apps/.md) [Everything you need to know as an administrator.](https://docs.viktor.ai/docs/manage-apps/.md) ## Other resources[​](https://docs.viktor.ai/docs/welcome/.md#other-resources "Direct link to Other resources") * **What's new in VIKTOR** Find out about the latest features. [.](https://docs.viktor.ai/docs/whats-new) * **Community** Join our community and ask for support, share ideas and learn about the latest features. [.](https://community.viktor.ai/) * **Apps Gallery** Explore the app gallery, download the code, and use it to create your apps. [.](https://www.viktor.ai/apps-gallery/category/all/discipline/all/integration/all/1) --- # SDK Reference Welcome to the SDK reference page. Here you will find the detailed API reference of the VIKTOR SDK which you can use to build your applications. * A list of all notable changes per SDK version can be found in the [Changelog](https://docs.viktor.ai/sdk/changelog). * All deprecations & upgrades can be found in [Upgrades](https://docs.viktor.ai/sdk/upgrades). To upgrade the version used in your app, please look at [this guide](https://docs.viktor.ai/docs/publish-apps/upgrade-viktor-version/.md). --- # viktor.api\_v1 <!-- --> <!-- --> <!-- --> ## API[​](https://docs.viktor.ai/sdk/api/api-v1/.md#_API "Direct link to API") * *class *viktor.api\_v1.API(*environment=None*, *token=None*)[](#API "Link to this definition") Bases: `_API` Starting point of making an API call to, for example, retrieve properties of an entity. Can be initialized: > 1. within a VIKTOR app, without init-arguments, to perform API calls to any data within the corresponding workspace. > > 2. **(new in v14.9.0)** within a VIKTOR app, with token argument, to perform API calls to any data within the environment (cross-workspace). > > 3. **(new in v14.9.0)** outside a VIKTOR app, with token and environment arguments, to perform API calls to any data within the specified environment. Note that the permissions of a user (group) are reflected on the permissions of this API call, e.g. if a user only has read-navigate or read-basic permission, calling the params (read-all) of the object using this API will NOT work for this specific user. Example for case 1 (inside app, within context of current workspace): ``` from viktor.api_v1 import API api = API() current_entity = api.get_entity(entity_id) parent = current_entity.parent() parent_params = parent.last_saved_params ``` Example for case 2 (inside app, outside context of current workspace): ``` from viktor.api_v1 import API api = API(token=os.environ["TOKEN"]) for workspace in api.get_workspaces(): for entity in workspace.get_root_entities(): entity_params = entity.last_saved_params ``` Example for case 3 (external to VIKTOR platform): ``` from viktor.api_v1 import API if __name__ == "__main__": api = API(token=os.environ["TOKEN"], environment="cloud.us1.viktor.ai") for workspace in api.get_workspaces(): for entity in workspace.get_root_entities(): entity_params = entity.last_saved_params ``` * get\_workspace(*id\_*)[](#API.get_workspace "Link to this definition") New in v14.9.0 Get the workspace with given id. (Requires a token to be set on the API class) * Parameters: **id** – workspace\_id * Return type: [`Workspace`](#Workspace "viktor.api_v1.Workspace") - get\_workspaces(*\**, *app\_name=None*, *include\_archived=False*)[](#API.get_workspaces "Link to this definition") New in v14.9.0 Get the workspaces in the environment. (Requires a token to be set on the API class) * Parameters: * **app\_name** (`str` | `None`) – Filter the workspaces by app name. * **include\_archived** (`bool`) – True to include the archived workspaces. (Only permitted for Organization Admins) * Return type: [`WorkspaceList`](#WorkspaceList "viktor.api_v1.WorkspaceList") Can be used to iterate over the workspaces: > ``` > api = API(token=os.environ["TOKEN"]) > for workspace in api.get_workspaces(): > for entity in workspace.get_root_entities(): > ... > ``` * get\_entity\_type(*id\_*, *\**, *workspace\_id=None*)[](#API.get_entity_type "Link to this definition") New in v14.9.0 Get the entity type with given id. * Parameters: * **id** – entity\_type\_id * **workspace\_id** (`int`) – (optional) Provide workspace id if you want to access entity types outside the context of the app. * Return type: [`EntityType`](#EntityType "viktor.api_v1.EntityType") - get\_entity\_types(*\**, *workspace\_id=None*)[](#API.get_entity_types "Link to this definition") New in v14.9.0 Get the entity types. * Parameters: **workspace\_id** (`int`) – (optional) Provide id if you want to access resource from outside the context of the app * Return type: [`EntityTypeList`](#EntityTypeList "viktor.api_v1.EntityTypeList") * get\_entity(*id\_*, *\**, *privileged=False*, *workspace\_id=None*)[](#API.get_entity "Link to this definition") Reference the entity with given id, without contacting the API. * Parameters: * **id** – entity\_id * **privileged** (`bool`) – bypass the user access restrictions managed by the admin of an application. Warning If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag: * Make sure the app’s admin is aware that the code circumvents certain permissions at specific places. * Make sure to test the implementation thoroughly, to ensure no confidential data is leaked. API calls can only bypass the restrictions if the key enable\_privileged\_api is set to true in viktor.config.toml. This is to provide an additional layer of security / awareness. Restrictions can only be bypassed when using the API module within a VIKTOR app and within the context of the current workspace. * Return type: [`Entity`](#Entity "viktor.api_v1.Entity") - get\_entities\_by\_type(*entity\_type\_name*, *\**, *include\_params=True*, *privileged=False*, *workspace\_id=None*)[](#API.get_entities_by_type "Link to this definition") Get all entities of the given type. * Parameters: * **entity\_type\_name** (`str`) – entity type to get all entities for. * **workspace\_id** (`int`) – (optional) Provide id if you want to access resource from outside the context of the app * **privileged** (`bool`) – bypass the user access restrictions managed by the admin of an application. Warning If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag: * Make sure the app’s admin is aware that the code circumvents certain permissions at specific places. * Make sure to test the implementation thoroughly, to ensure no confidential data is leaked. API calls can only bypass the restrictions if the key enable\_privileged\_api is set to true in viktor.config.toml. This is to provide an additional layer of security / awareness. Restrictions can only be bypassed when using the API module within a VIKTOR app and within the context of the current workspace. * Return type: [`EntityList`](#EntityList "viktor.api_v1.EntityList") * get\_root\_entities(*\**, *include\_params=True*, *entity\_type\_names=None*, *privileged=False*, *workspace\_id=None*)[](#API.get_root_entities "Link to this definition") Get the root entities. * Parameters: * **include\_params** (`bool`) – True to include the parameters of the root entities. * **entity\_type\_names** (`List`\[`str`]) – Only filters the entities of the defined type(s) (default = None, returns all). * **workspace\_id** (`int`) – (optional) Provide id if you want to access resource from outside the context of the app * **privileged** (`bool`) – bypass the user access restrictions managed by the admin of an application. Warning If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag: * Make sure the app’s admin is aware that the code circumvents certain permissions at specific places. * Make sure to test the implementation thoroughly, to ensure no confidential data is leaked. API calls can only bypass the restrictions if the key enable\_privileged\_api is set to true in viktor.config.toml. This is to provide an additional layer of security / awareness. Restrictions can only be bypassed when using the API module within a VIKTOR app and within the context of the current workspace. * Return type: [`EntityList`](#EntityList "viktor.api_v1.EntityList") - get\_entity\_parent(*entity\_id*, *\**, *privileged=False*, *workspace\_id=None*)[](#API.get_entity_parent "Link to this definition") Get the parent entity of the entity with given id. * Parameters: * **workspace\_id** (`int`) – (optional) Provide id if you want to access resource from outside the context of the app * **privileged** (`bool`) – bypass the user access restrictions managed by the admin of an application. Warning If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag: * Make sure the app’s admin is aware that the code circumvents certain permissions at specific places. * Make sure to test the implementation thoroughly, to ensure no confidential data is leaked. API calls can only bypass the restrictions if the key enable\_privileged\_api is set to true in viktor.config.toml. This is to provide an additional layer of security / awareness. Restrictions can only be bypassed when using the API module within a VIKTOR app and within the context of the current workspace. * Return type: [`Entity`](#Entity "viktor.api_v1.Entity") * get\_entity\_children(*entity\_id*, *\**, *include\_params=True*, *entity\_type\_names=None*, *privileged=False*, *workspace\_id=None*)[](#API.get_entity_children "Link to this definition") Get the child entities of the entity with given id. * Parameters: * **include\_params** (`bool`) – True to include the parameters of the child entities. * **entity\_type\_names** (`List`\[`str`]) – Only filters the entities of the defined type(s) (default = None, returns all). * **privileged** (`bool`) – bypass the user access restrictions managed by the admin of an application. Warning If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag: * Make sure the app’s admin is aware that the code circumvents certain permissions at specific places. * Make sure to test the implementation thoroughly, to ensure no confidential data is leaked. API calls can only bypass the restrictions if the key enable\_privileged\_api is set to true in viktor.config.toml. This is to provide an additional layer of security / awareness. Restrictions can only be bypassed when using the API module within a VIKTOR app and within the context of the current workspace. * Return type: [`EntityList`](#EntityList "viktor.api_v1.EntityList") - get\_entity\_siblings(*entity\_id*, *\**, *include\_params=True*, *entity\_type\_names=None*, *privileged=False*, *workspace\_id=None*)[](#API.get_entity_siblings "Link to this definition") Get the sibling entities of the entity with given id. * Parameters: * **include\_params** (`bool`) – True to include the parameters of the sibling entities. * **entity\_type\_names** (`List`\[`str`]) – Only filters the entities of the defined type(s) (default = None, returns all). * **workspace\_id** (`int`) – (optional) Provide id if you want to access resource from outside the context of the app * **privileged** (`bool`) – bypass the user access restrictions managed by the admin of an application. Warning If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag: * Make sure the app’s admin is aware that the code circumvents certain permissions at specific places. * Make sure to test the implementation thoroughly, to ensure no confidential data is leaked. API calls can only bypass the restrictions if the key enable\_privileged\_api is set to true in viktor.config.toml. This is to provide an additional layer of security / awareness. Restrictions can only be bypassed when using the API module within a VIKTOR app and within the context of the current workspace. * Return type: [`EntityList`](#EntityList "viktor.api_v1.EntityList") * get\_entity\_revisions(*entity\_id*, *\**, *privileged=False*, *workspace\_id=None*)[](#API.get_entity_revisions "Link to this definition") Get all revisions of the entity with given id. * Parameters: * **entity\_id** (`int`) – id of the entity to get the revisions from. * **privileged** (`bool`) – bypass the user access restrictions managed by the admin of an application. Warning If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag: * Make sure the app’s admin is aware that the code circumvents certain permissions at specific places. * Make sure to test the implementation thoroughly, to ensure no confidential data is leaked. API calls can only bypass the restrictions if the key enable\_privileged\_api is set to true in viktor.config.toml. This is to provide an additional layer of security / awareness. Restrictions can only be bypassed when using the API module within a VIKTOR app and within the context of the current workspace. * Return type: [`EntityRevisionList`](#EntityRevisionList "viktor.api_v1.EntityRevisionList") - get\_entity\_file(*entity\_id*, *\**, *privileged=False*, *workspace\_id=None*)[](#API.get_entity_file "Link to this definition") Get the file of the entity with given id. * Parameters: * **entity\_id** (`int`) – id of the entity to get the file from. * **workspace\_id** (`int`) – (optional) Provide id if you want to access resource from outside the context of the app * **privileged** (`bool`) – bypass the user access restrictions managed by the admin of an application. Warning If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag: * Make sure the app’s admin is aware that the code circumvents certain permissions at specific places. * Make sure to test the implementation thoroughly, to ensure no confidential data is leaked. API calls can only bypass the restrictions if the key enable\_privileged\_api is set to true in viktor.config.toml. This is to provide an additional layer of security / awareness. Restrictions can only be bypassed when using the API module within a VIKTOR app and within the context of the current workspace. * Return type: [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") * Returns: File object (SourceType.URL) * Raises: **ValueError** – if file does not have a file associated with it. * get\_current\_user()[](#API.get_current_user "Link to this definition") Get the current user in the environment. * Return type: [`User`](#User "viktor.api_v1.User") - create\_child\_entity(*parent\_entity\_id*, *entity\_type\_name*, *name*, *\**, *params=None*, *privileged=False*, *workspace\_id=None*, *\*\*kwargs*)[](#API.create_child_entity "Link to this definition") Create a child entity with given name and type from parent entity with given id. Warning It is currently not possible to create a file-type entity Warning Be aware that changes made using this method might not be reflected in subsequent API calls (e.g. API.get\_entity\_children) within the same job because of memoization. * Parameters: * **parent\_entity\_id** (`int`) – id of the parent entity to create the child from. * **entity\_type\_name** (`str`) – type of the entity to be created (type must be a child-type of the parent entity). * **name** (`str`) – name of the entity to be created. * **params** (`dict` | `Munch`) – params to be stored on the newly created entity. * **workspace\_id** (`int`) – (optional) Provide id if you want to access resource from outside the context of the app * **privileged** (`bool`) – bypass the user access restrictions managed by the admin of an application. Warning If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag: * Make sure the app’s admin is aware that the code circumvents certain permissions at specific places. * Make sure to test the implementation thoroughly, to ensure no confidential data is leaked. API calls can only bypass the restrictions if the key enable\_privileged\_api is set to true in viktor.config.toml. This is to provide an additional layer of security / awareness. Restrictions can only be bypassed when using the API module within a VIKTOR app and within the context of the current workspace. * Return type: [`Entity`](#Entity "viktor.api_v1.Entity") * delete\_entity(*entity\_id*, *\**, *privileged=False*, *workspace\_id=None*)[](#API.delete_entity "Link to this definition") Delete the entity with given id. * Parameters: * **entity\_id** (`int`) – id of the entity to be deleted. * **workspace\_id** (`int`) – (optional) Provide id if you want to access resource from outside the context of the app * **privileged** (`bool`) – bypass the user access restrictions managed by the admin of an application. Warning If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag: * Make sure the app’s admin is aware that the code circumvents certain permissions at specific places. * Make sure to test the implementation thoroughly, to ensure no confidential data is leaked. API calls can only bypass the restrictions if the key enable\_privileged\_api is set to true in viktor.config.toml. This is to provide an additional layer of security / awareness. Restrictions can only be bypassed when using the API module within a VIKTOR app and within the context of the current workspace. * Return type: `None` - rename\_entity(*entity\_id*, *name*, *\**, *privileged=False*, *workspace\_id=None*)[](#API.rename_entity "Link to this definition") Rename the entity with given id (creates a revision). Warning Be aware that changes made using this method might not be reflected in subsequent API calls (e.g. Entity.name) within the same job because of memoization. * Parameters: * **entity\_id** (`int`) – id of the entity to rename. * **name** (`str`) – name of the newly created entity revision. * **privileged** (`bool`) – bypass the user access restrictions managed by the admin of an application. Warning If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag: * Make sure the app’s admin is aware that the code circumvents certain permissions at specific places. * Make sure to test the implementation thoroughly, to ensure no confidential data is leaked. API calls can only bypass the restrictions if the key enable\_privileged\_api is set to true in viktor.config.toml. This is to provide an additional layer of security / awareness. Restrictions can only be bypassed when using the API module within a VIKTOR app and within the context of the current workspace. * Return type: [`Entity`](#Entity "viktor.api_v1.Entity") * set\_entity\_params(*entity\_id*, *params*, *\**, *privileged=False*, *workspace\_id=None*)[](#API.set_entity_params "Link to this definition") Create a new revision of the entity with given id, storing given params. Warning Be aware that changes made using this method might not be reflected in subsequent API calls (e.g. Entity.last\_saved\_params) within the same job because of memoization. * Parameters: * **entity\_id** (`int`) – id of the entity to create a revision for. * **params** (`dict` | `Munch`) – params to be stored on the newly created entity revision. * **workspace\_id** (`int`) – (optional) Provide id if you want to access resource from outside the context of the app * **privileged** (`bool`) – bypass the user access restrictions managed by the admin of an application. Warning If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag: * Make sure the app’s admin is aware that the code circumvents certain permissions at specific places. * Make sure to test the implementation thoroughly, to ensure no confidential data is leaked. API calls can only bypass the restrictions if the key enable\_privileged\_api is set to true in viktor.config.toml. This is to provide an additional layer of security / awareness. Restrictions can only be bypassed when using the API module within a VIKTOR app and within the context of the current workspace. * Return type: [`Entity`](#Entity "viktor.api_v1.Entity") <!-- --> ## App[​](https://docs.viktor.ai/sdk/api/api-v1/.md#_App "Direct link to App") * *class *viktor.api\_v1.App(*api*, *id\_*, *name*, *\*\*\_kwargs*)[](#App "Link to this definition") New in v14.9.0 Warning Do not instantiate this class directly, it is created by the API. * Parameters: * **api** (`_API`) – API instance * **id** – ID of the App * **name** (`str`) – Name of the App <!-- --> ## AppVersion[​](https://docs.viktor.ai/sdk/api/api-v1/.md#_AppVersion "Direct link to AppVersion") * *class *viktor.api\_v1.AppVersion(*api*, *id\_*, *tag*, *status*, *app\_type*, *sdk\_version*, *python\_version*, *created\_at*, *\*\*\_kwargs*)[](#AppVersion "Link to this definition") New in v14.9.0 Warning Do not instantiate this class directly, it is created by the API. * Parameters: * **api** (`_API`) – API instance * **id** – ID of the AppVersion * **tag** (`str`) – Tag of the AppVersion * **status** (`str`) – Status of the AppVersion publish * **app\_type** (`str`) – Type of App as defined in the App definition * **sdk\_version** (`str`) – Version of the SDK * **python\_version** (`str`) – Version of the python * **created\_at** (`str`) – Timestamp of when AppVersion was created. <!-- --> ## ChatConversation[​](https://docs.viktor.ai/sdk/api/api-v1/.md#_ChatConversation "Direct link to ChatConversation") * *class *viktor.api\_v1.ChatConversation(*\**, *api*, *workspace\_id*, *entity\_id*, *latest\_exchange\_id*)[](#ChatConversation "Link to this definition") New in v14.21.0 Warning Do not instantiate this class directly, it is created by the API. * get\_messages()[](#ChatConversation.get_messages "Link to this definition") Get the full history of the conversation as a list of messages. Each message in the list has the following format: ``` { 'role': str, # user | assistant 'content': str, # the actual message } ``` * Return type: `list`\[`dict`\[`str`, `str`]] <!-- --> ## Entity[​](https://docs.viktor.ai/sdk/api/api-v1/.md#_Entity "Direct link to Entity") * *class *viktor.api\_v1.Entity(*api*, *workspace\_id*, *origin\_id*, *operations*, *resolved=None*)[](#Entity "Link to this definition") Warning Do not instantiate this class directly, it is created by the API. * children(*\**, *include\_params=True*, *entity\_type\_names=None*, *privileged=False*)[](#Entity.children "Link to this definition") Get the child entities. * Parameters: * **include\_params** (`bool`) – True to include the parameters of the child entities. * **entity\_type\_names** (`List`\[`str`]) – Only filters the entities of the defined type(s) (default = None, returns all). * **privileged** (`bool`) – bypass the user access restrictions managed by the admin of an application. Warning If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag: * Make sure the app’s admin is aware that the code circumvents certain permissions at specific places. * Make sure to test the implementation thoroughly, to ensure no confidential data is leaked. API calls can only bypass the restrictions if the key enable\_privileged\_api is set to true in viktor.config.toml. This is to provide an additional layer of security / awareness. Restrictions can only be bypassed when using the API module within a VIKTOR app and within the context of the current workspace. * Return type: [`EntityList`](#EntityList "viktor.api_v1.EntityList") - compute(*method\_name*, *\**, *params*, *timeout=None*)[](#Entity.compute "Link to this definition") New in v14.12.0 Run a callable entity controller method (view-method, button-method, step-method or preprocess-method) and return the result. * Parameters: * **method\_name** (`str`) – Name of the controller method to call * **params** (`dict` | `Munch`) – Params to call the method with * **timeout** (`int`) – Maximum job duration after which it will time out * Return type: `dict` * Returns: Return value of the controller method * create\_child(*entity\_type\_name*, *name*, *\**, *params=None*, *privileged=False*, *\*\*kwargs*)[](#Entity.create_child "Link to this definition") Create a child entity with given name and type. Warning It is currently not possible to create a file-type entity Warning Be aware that changes made using this method might not be reflected in subsequent API calls (e.g. API.get\_entity\_children) within the same job because of internal caching. * Parameters: * **entity\_type\_name** (`str`) – type of the entity to be created (type must be a child-type of the parent entity). * **name** (`str`) – name of the entity to be created. * **params** (`dict` | `Munch`) – params to be stored on the newly created entity. * **privileged** (`bool`) – bypass the user access restrictions managed by the admin of an application. Warning If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag: * Make sure the app’s admin is aware that the code circumvents certain permissions at specific places. * Make sure to test the implementation thoroughly, to ensure no confidential data is leaked. API calls can only bypass the restrictions if the key enable\_privileged\_api is set to true in viktor.config.toml. This is to provide an additional layer of security / awareness. Restrictions can only be bypassed when using the API module within a VIKTOR app and within the context of the current workspace. * Return type: [`Entity`](#Entity "viktor.api_v1.Entity") - delete(*\**, *privileged=False*)[](#Entity.delete "Link to this definition") Delete the entity. * Parameters: **privileged** (`bool`) – bypass the user access restrictions managed by the admin of an application. Warning If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag: * Make sure the app’s admin is aware that the code circumvents certain permissions at specific places. * Make sure to test the implementation thoroughly, to ensure no confidential data is leaked. API calls can only bypass the restrictions if the key enable\_privileged\_api is set to true in viktor.config.toml. This is to provide an additional layer of security / awareness. Restrictions can only be bypassed when using the API module within a VIKTOR app and within the context of the current workspace. * Return type: `None` * *property *entity\_type*: [EntityType](#EntityType "viktor.api_v1.EntityType")*[](#Entity.entity_type "Link to this definition") EntityType of the entity. - get\_file()[](#Entity.get_file "Link to this definition") Get the file of the entity. * Return type: [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") * Returns: File object (SourceType.URL) * Raises: **ValueError** – if file does not have a file associated with it. * *property *id*: int*[](#Entity.id "Link to this definition") id of the entity. - *property *last\_saved\_params*: munch.Munch*[](#Entity.last_saved_params "Link to this definition") Get the params of the last saved entity revision. * *property *last\_saved\_summary*: munch.Munch*[](#Entity.last_saved_summary "Link to this definition") Get the summary of the last saved entity revision. - *property *name*: str*[](#Entity.name "Link to this definition") Name of the entity. * parent(*\**, *privileged=False*)[](#Entity.parent "Link to this definition") Get the parent of the entity. * Parameters: **privileged** (`bool`) – bypass the user access restrictions managed by the admin of an application. Warning If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag: * Make sure the app’s admin is aware that the code circumvents certain permissions at specific places. * Make sure to test the implementation thoroughly, to ensure no confidential data is leaked. API calls can only bypass the restrictions if the key enable\_privileged\_api is set to true in viktor.config.toml. This is to provide an additional layer of security / awareness. Restrictions can only be bypassed when using the API module within a VIKTOR app and within the context of the current workspace. * Return type: [`Entity`](#Entity "viktor.api_v1.Entity") - rename(*name*, *\**, *privileged=False*)[](#Entity.rename "Link to this definition") Rename the entity (creates a revision). Warning Be aware that changes made using this method might not be reflected in subsequent API calls (e.g. Entity.name) within the same job because of memoization. * Parameters: * **name** (`str`) – name of the newly created entity revision. * **privileged** (`bool`) – bypass the user access restrictions managed by the admin of an application. Warning If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag: * Make sure the app’s admin is aware that the code circumvents certain permissions at specific places. * Make sure to test the implementation thoroughly, to ensure no confidential data is leaked. API calls can only bypass the restrictions if the key enable\_privileged\_api is set to true in viktor.config.toml. This is to provide an additional layer of security / awareness. Restrictions can only be bypassed when using the API module within a VIKTOR app and within the context of the current workspace. * Return type: [`Entity`](#Entity "viktor.api_v1.Entity") * revisions()[](#Entity.revisions "Link to this definition") Get all revisions of the entity. * Return type: [`EntityRevisionList`](#EntityRevisionList "viktor.api_v1.EntityRevisionList") - set\_params(*params*, *\**, *privileged=False*)[](#Entity.set_params "Link to this definition") Create a new revision of the entity, storing given params. Warning Be aware that changes made using this method might not be reflected in subsequent API calls (e.g. Entity.last\_saved\_params) within the same job because of memoization. * Parameters: * **params** (`dict` | `Munch`) – params to be stored on the newly created entity revision. * **privileged** (`bool`) – bypass the user access restrictions managed by the admin of an application. Warning If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag: * Make sure the app’s admin is aware that the code circumvents certain permissions at specific places. * Make sure to test the implementation thoroughly, to ensure no confidential data is leaked. API calls can only bypass the restrictions if the key enable\_privileged\_api is set to true in viktor.config.toml. This is to provide an additional layer of security / awareness. Restrictions can only be bypassed when using the API module within a VIKTOR app and within the context of the current workspace. * Return type: [`Entity`](#Entity "viktor.api_v1.Entity") * siblings(*\**, *include\_params=True*, *entity\_type\_names=None*, *privileged=False*)[](#Entity.siblings "Link to this definition") Get the sibling entities. * Parameters: * **include\_params** (`bool`) – True to include the parameters of the sibling entities. * **entity\_type\_names** (`List`\[`str`]) – Only filters the entities of the defined type(s) (default = None, returns all). * **privileged** (`bool`) – bypass the user access restrictions managed by the admin of an application. Warning If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag: * Make sure the app’s admin is aware that the code circumvents certain permissions at specific places. * Make sure to test the implementation thoroughly, to ensure no confidential data is leaked. API calls can only bypass the restrictions if the key enable\_privileged\_api is set to true in viktor.config.toml. This is to provide an additional layer of security / awareness. Restrictions can only be bypassed when using the API module within a VIKTOR app and within the context of the current workspace. * Return type: [`EntityList`](#EntityList "viktor.api_v1.EntityList") <!-- --> ## EntityList[​](https://docs.viktor.ai/sdk/api/api-v1/.md#_EntityList "Direct link to EntityList") * *class *viktor.api\_v1.EntityList(*api*, *workspace\_id*, *relation*, *origin*, *entity\_type\_names*, *include\_params*, *\**, *privileged=False*)[](#EntityList "Link to this definition") Warning Do not instantiate this class directly, it is created by the API. Object which resembles a list of Entity objects. Most commonly used list operations are supported: ``` # indexing children = entity.children() children[0] # first child entity children[-1] # last child entity # length number_of_children = len(children) # for loop for child in children: # perform operation on child ``` <!-- --> ## EntityRevision[​](https://docs.viktor.ai/sdk/api/api-v1/.md#_EntityRevision "Direct link to EntityRevision") * *class *viktor.api\_v1.EntityRevision(*api*, *id\_*, *params*, *created\_date*, *previous\_revision\_id=None*)[](#EntityRevision "Link to this definition") Warning Do not instantiate this class directly, it is created by the API. * Parameters: * **params** (`Munch`) – Stored params in the entity’s revision. * **created\_date** (`datetime`) – Date(time) of creation of the entity’s revision. * **previous\_revision\_id** (`int` | `None`) – Id of the chronologically previous revision (for diffing), or None for the first. <!-- --> ## EntityRevisionList[​](https://docs.viktor.ai/sdk/api/api-v1/.md#_EntityRevisionList "Direct link to EntityRevisionList") * *class *viktor.api\_v1.EntityRevisionList(*api*, *entity*, *\**, *privileged=False*)[](#EntityRevisionList "Link to this definition") Warning Do not instantiate this class directly, it is created by the API. Object which resembles a list of EntityRevision objects. Most commonly used list operations are supported: ``` # indexing revisions = entity.revisions() revisions[0] # first revision revisions[-1] # last revision # length number_of_revisions = len(revisions) # for loop for revision in revisions: # perform operation on revision ``` <!-- --> ## EntityType[​](https://docs.viktor.ai/sdk/api/api-v1/.md#_EntityType "Direct link to EntityType") * *class *viktor.api\_v1.EntityType(*api*, *id\_*, *class\_name*, *\*\*\_kwargs*)[](#EntityType "Link to this definition") Warning Do not instantiate this class directly, it is created by the API. * Parameters: * **id** – Unique ID of the entity type. * **name** – Entity type name (not label). <!-- --> ## EntityTypeList[​](https://docs.viktor.ai/sdk/api/api-v1/.md#_EntityTypeList "Direct link to EntityTypeList") * *class *viktor.api\_v1.EntityTypeList(*api*, *workspace\_id*)[](#EntityTypeList "Link to this definition") New in v14.9.0 Warning Do not instantiate this class directly, it is created by the API. Object which resembles a list of EntityType objects. Most commonly used list operations are supported: ``` # indexing entity_types = api.get_entity_types() entity_types[0] # first entity_type entity_types[-1] # last entity_type # length number_of_entity_types = len(entity_types) # for loop for entity_type in entity_types: # perform operation on entity_type ``` <!-- --> ## FileResource[​](https://docs.viktor.ai/sdk/api/api-v1/.md#_FileResource "Direct link to FileResource") * *class *viktor.api\_v1.FileResource(*workspace\_id*, *source\_id*, *api=None*)[](#FileResource "Link to this definition") File resource stored in the file manager. Warning Do not instantiate this class directly, it will be returned in the parameter set when using a [`FileField`](https://docs.viktor.ai/sdk/api/parametrization/.md#FileField "viktor.parametrization.FileField") or [`MultiFileField`](https://docs.viktor.ai/sdk/api/parametrization/.md#MultiFileField "viktor.parametrization.MultiFileField"). * *property *file*: [File](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")*[](#FileResource.file "Link to this definition") Returns the File object (URL-file) attached to the resource. - *property *filename*: str*[](#FileResource.filename "Link to this definition") Returns the filename of the resource (API call required!). * open(*encoding=None*)[](#FileResource.open "Link to this definition") New in v14.27.0 Open the file in text mode directly. ``` with params.my_file.open() as f: content = f.read() ``` * Parameters: **encoding** (`str`) – Text encoding (default: system encoding) * Return type: `TextIO` * Returns: Text file-like object - open\_binary()[](#FileResource.open_binary "Link to this definition") New in v14.27.0 Open the file in binary mode directly. ``` with params.my_file.open_binary() as f: content = f.read() ``` * Return type: `BinaryIO` * Returns: Binary file-like object <!-- --> ## Job[​](https://docs.viktor.ai/sdk/api/api-v1/.md#_Job "Direct link to Job") * *class *viktor.api\_v1.Job(*api*, *workspace\_id*, *id\_*)[](#Job "Link to this definition") New in v14.12.0 Warning Do not instantiate this class directly, it is created by the API. * get\_result(*\**, *timeout=15*)[](#Job.get_result "Link to this definition") Obtain the job result * Return type: `dict` * Returns: Job result * Raises: **TimeoutError** – If timeout is exceeded <!-- --> ## Label[​](https://docs.viktor.ai/sdk/api/api-v1/.md#_Label "Direct link to Label") * *class *viktor.api\_v1.Label(*api*, *id\_*, *name*, *description*, *color*, *\*\*\_kwargs*)[](#Label "Link to this definition") New in v14.9.0 Warning Do not instantiate this class directly, it is created by the API. * Parameters: * **api** (`_API`) – API instance * **id** – ID of the Label * **name** (`str`) – Name of the Label * **description** (`str`) – Description of the Label * **color** (`str`) – Color of the Label <!-- --> ## User[​](https://docs.viktor.ai/sdk/api/api-v1/.md#_User "Direct link to User") * *class *viktor.api\_v1.User(*api*, *\**, *id\_*, *first\_name*, *last\_name*, *email*, *job\_title*, *\*\*\_kwargs*)[](#User "Link to this definition") User information. Warning Do not instantiate this class directly, it is created by the API. * Parameters: * **id** – user’s id * **first\_name** (`str`) – user’s first name * **last\_name** (`str`) – user’s last name * **email** (`str`) – user’s email address * **job\_title** (`str`) – user’s job title - *property *full\_name*: str*[](#User.full_name "Link to this definition") User’s full name (first name + last name). <!-- --> ## Workspace[​](https://docs.viktor.ai/sdk/api/api-v1/.md#_Workspace "Direct link to Workspace") * *class *viktor.api\_v1.Workspace(*api*, *id\_*, *name*, *description*, *visibility*, *created\_at*, *updated\_at*, *is\_archived*, *app*, *app\_version*, *labels*, *\*\*kwargs*)[](#Workspace "Link to this definition") New in v14.9.0 Warning Do not instantiate this class directly, it is created by the API. Can be used to fetch additional data within the given workspace. ``` # Get workspace object workspace: Workspace = api.get_workspace(workspace_id) # Iterate over underlying data for entity in workspace.get_root_entities(): ... for entity_type in workspace.get_entity_types(): ... ``` * Parameters: * **id** – Unique ID of the workspace. * **name** (`str`) – Name of the workspace. * **description** (`str`) – Descriptive text of the workspace content. * **visibility** (`str`) – Visibility of the workspace. (Can be INTERNAL, PRIVATE, PUBLIC, or DEVELOPMENT) * **created\_at** (`str`) – Timestamp of when workspace was created. * **updated\_at** (`str`) – Timestamp of when workspace was last updated. * **is\_archived** (`bool`) – Whether the workspace is archived. * **app** (`dict` | `None`) – App assigned to the workspace. (Can be None for Development workspace) * **app\_version** (`dict` | `None`) – Published AppVersion assigned to the workspace. (Can be None for Development workspace) * **labels** (`List`\[`dict`]) – Labels assigned to the workspace. - entity\_compute(*\**, *entity\_id*, *method\_name*, *params*, *timeout=None*)[](#Workspace.entity_compute "Link to this definition") New in v14.12.0 Run a callable entity controller method (view-method, button-method, step-method or preprocess-method) and return the result. * Parameters: * **entity\_id** (`int`) – ID of the entity to call the method from * **method\_name** (`str`) – Name of the controller method to call * **params** (`dict` | `Munch`) – Params to call the method with * **timeout** (`int`) – Maximum job duration after which it will time out * Return type: `dict` * Returns: Return value of the controller method * get\_entity(*id\_*, *privileged=False*)[](#Workspace.get_entity "Link to this definition") Reference the entity with given id, without contacting the API. * Parameters: * **id** – entity\_id * **privileged** (`bool`) – bypass the user access restrictions managed by the admin of an application. Warning If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag: * Make sure the app’s admin is aware that the code circumvents certain permissions at specific places. * Make sure to test the implementation thoroughly, to ensure no confidential data is leaked. API calls can only bypass the restrictions if the key enable\_privileged\_api is set to true in viktor.config.toml. This is to provide an additional layer of security / awareness. Restrictions can only be bypassed when using the API module within a VIKTOR app and within the context of the current workspace. * Return type: [`Entity`](#Entity "viktor.api_v1.Entity") - get\_entity\_type(*id\_*)[](#Workspace.get_entity_type "Link to this definition") Get the entity type with given id in the workspace. * Return type: [`EntityType`](#EntityType "viktor.api_v1.EntityType") * get\_entity\_types()[](#Workspace.get_entity_types "Link to this definition") Get the entity types in the workspace. * Return type: [`EntityTypeList`](#EntityTypeList "viktor.api_v1.EntityTypeList") - get\_root\_entities(*\**, *include\_params=True*, *entity\_type\_names=None*, *privileged=False*)[](#Workspace.get_root_entities "Link to this definition") Get the root entities. * Parameters: * **include\_params** (`bool`) – True to include the parameters of the root entities. * **entity\_type\_names** (`List`\[`str`]) – Only filters the entities of the defined type(s) (default = None, returns all). * **privileged** (`bool`) – bypass the user access restrictions managed by the admin of an application. Warning If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag: * Make sure the app’s admin is aware that the code circumvents certain permissions at specific places. * Make sure to test the implementation thoroughly, to ensure no confidential data is leaked. API calls can only bypass the restrictions if the key enable\_privileged\_api is set to true in viktor.config.toml. This is to provide an additional layer of security / awareness. Restrictions can only be bypassed when using the API module within a VIKTOR app and within the context of the current workspace. * Return type: [`EntityList`](#EntityList "viktor.api_v1.EntityList") <!-- --> ## WorkspaceList[​](https://docs.viktor.ai/sdk/api/api-v1/.md#_WorkspaceList "Direct link to WorkspaceList") * *class *viktor.api\_v1.WorkspaceList(*api*, *app\_name=None*, *include\_archived=False*)[](#WorkspaceList "Link to this definition") New in v14.9.0 Warning Do not instantiate this class directly, it is created by the API. Object which resembles a list of Workspace objects. Most commonly used list operations are supported: ``` # indexing workspaces = api.get_workspaces() workspaces[0] # first workspace workspaces[-1] # last workspace # length number_of_workspaces = len(workspaces) # for loop for workspace in workspaces: # perform operation on workspace ``` --- # viktor.core <!-- --> <!-- --> <!-- --> ## Color[​](https://docs.viktor.ai/sdk/api/core/.md#_Color "Direct link to Color") * *class *viktor.core.Color(*r: int*, *g: int*, *b: int*)[](#Color "Link to this definition") Bases: [`Color`](#Color "viktor.core.Color") Create an immutable instance of Color * Parameters: * **r** – red-value (0-255) * **g** – green-value (0-255) * **b** – blue-value (0-255) **plotly / bokeh:** Color objects are directly compatible with plotly and bokeh: ``` import plotly.graph_objects as go from bokeh.plotting import figure color = vkt.Color(30, 144, 255) # plotly go.Scatter(x=x, y=y, mode='lines', line=dict(color=color, width=2)) # bokeh p = figure() p.line(x, y, line_color=color, line_width=2) ``` **matplotlib / seaborn:** Use the `.hex` property: ``` import matplotlib.pyplot as plt import seaborn as sns color = vkt.Color(30, 144, 255) # ✓ CORRECT: Use .hex property for matplotlib and seaborn ax.bar(x, height, color=color.hex) sns.lineplot(x=x, y=y, color=color.hex) # ❌ INCORRECT: matplotlib/seaborn do not accept Color objects directly # ax.bar(x, height, color=color) # sns.lineplot(x=x, y=y, color=color) ``` * *static *black()[](#Color.black "Link to this definition") * Return type: [`Color`](#Color "viktor.core.Color") - *static *blue()[](#Color.blue "Link to this definition") * Return type: [`Color`](#Color "viktor.core.Color") * *property *deltares*: int*[](#Color.deltares "Link to this definition") - *static *deltares\_to\_rgb(*value*)[](#Color.deltares_to_rgb "Link to this definition") Conversion from red-green-blue to Deltares-type color value. * Parameters: **value** (`int`) – Integer representation of the color as used in the Deltares software series. * Return type: `Tuple`\[`int`, `int`, `int`] * *classmethod *from\_deltares(*value*)[](#Color.from_deltares "Link to this definition") Color defined by Deltares-type integer. * Parameters: **value** (`int`) – Integer representation of the color as used in the Deltares software series. * Return type: [`Color`](#Color "viktor.core.Color") - *classmethod *from\_hex(*hex\_value*)[](#Color.from_hex "Link to this definition") Color defined by hexadecimal code. * Return type: [`Color`](#Color "viktor.core.Color") * *static *green()[](#Color.green "Link to this definition") * Return type: [`Color`](#Color "viktor.core.Color") - *property *hex*: str*[](#Color.hex "Link to this definition") Hexadecimal representation of the color. * *static *hex\_to\_rgb(*hex\_value*)[](#Color.hex_to_rgb "Link to this definition") Conversion from hexadecimal to red-green-blue value * Return type: `Tuple`\[`int`, `int`, `int`] - *static *lime()[](#Color.lime "Link to this definition") * Return type: [`Color`](#Color "viktor.core.Color") * *static *random()[](#Color.random "Link to this definition") Generate a random color. * Return type: [`Color`](#Color "viktor.core.Color") - *static *red()[](#Color.red "Link to this definition") * Return type: [`Color`](#Color "viktor.core.Color") * *property *rgb*: Tuple\[int, int, int]*[](#Color.rgb "Link to this definition") - *static *rgb\_to\_deltares(*r*, *g*, *b*)[](#Color.rgb_to_deltares "Link to this definition") Conversion from Deltares-type color value to red-green-blue value. :return Integer representation of the color as used in the Deltares software series. * Return type: `int` * *static *rgb\_to\_hex(*r*, *g*, *b*, *include\_hashtag=True*)[](#Color.rgb_to_hex "Link to this definition") Conversion from red-green-blue to hexadecimal value * Return type: `str` - *static *viktor\_black()[](#Color.viktor_black "Link to this definition") * Return type: [`Color`](#Color "viktor.core.Color") * *static *viktor\_blue()[](#Color.viktor_blue "Link to this definition") * Return type: [`Color`](#Color "viktor.core.Color") - *static *viktor\_yellow()[](#Color.viktor_yellow "Link to this definition") * Return type: [`Color`](#Color "viktor.core.Color") * *static *white()[](#Color.white "Link to this definition") * Return type: [`Color`](#Color "viktor.core.Color") <!-- --> ## Controller[​](https://docs.viktor.ai/sdk/api/core/.md#_Controller "Direct link to Controller") * *class *viktor.core.Controller(*\*\*kwargs*)[](#Controller "Link to this definition") The main function of the ViktorController is to “control” the information flow between the frontend (what is inputted by a user) and the application code (what is returned as a result of the user input). **(new in v14.15.0)** The ‘label’ attribute is now optional. * allow\_saving*: `bool` | `None`** = None*[](#Controller.allow_saving "Link to this definition") **(new in v14.24.0)** Specify whether user is allowed to save entities of this entity-type. May only be set for root entity types in tree-type app. - children*: `List`\[`str`] | `None`** = None*[](#Controller.children "Link to this definition") Optional list of child entity-types. * label*: `str` | `None`** = None*[](#Controller.label "Link to this definition") Entity-type label. - parametrization*: [`Parametrization`](https://docs.viktor.ai/sdk/api/parametrization/.md#Parametrization "viktor.parametrization.Parametrization") | `None`** = None*[](#Controller.parametrization "Link to this definition") [`viktor.parametrization.Parametrization`](https://docs.viktor.ai/sdk/api/parametrization/.md#Parametrization "viktor.parametrization.Parametrization") that describes the entity-type. * show\_children\_as*: `str` | `None`** = None*[](#Controller.show_children_as "Link to this definition") When children are defined, specify how they are shown in the interface (‘Table’ | ‘Cards’). - summary*: [`Summary`](https://docs.viktor.ai/sdk/api/views/.md#Summary "viktor.views.Summary") | `None`** = None*[](#Controller.summary "Link to this definition") [`viktor.views.Summary`](https://docs.viktor.ai/sdk/api/views/.md#Summary "viktor.views.Summary") of the entity-type. <!-- --> ## File[​](https://docs.viktor.ai/sdk/api/core/.md#_File "Direct link to File") * *class *viktor.core.File(*\**, *data=None*, *path=None*, *url=None*, *\*\*kwargs*)[](#File "Link to this definition") Creates a File object. Only 1 of data, path or url should be set, or File() for writable file. Or use the corresponding class-methods. A File object can have one of the following 4 types: > * SourceType.DATA: File object with in-memory data as its source > > > * Created with File.from\_data(…) > > > > * writable: False > > * SourceType.PATH: File object with an existing file (path) as its source > > > * Created with File.from\_path(…) > > > > * writable: False > > * SourceType.URL: File object with a URL as its source > > > * Created with File.from\_url(…) > > > > * writable: False > > * SourceType.WRITABLE: File object with a (temporary) writable file on disk as its source > > > * Created with File() > > > > * writable: True (writing always takes place at end of file) Note: Reading from a File with SourceType.URL downloads (part of the) URL content to a (temporary) file on disk, so that re-reading (previously read) content within the same open-context does not require downloading twice. Opening the File object a second time DOES involve downloading the content anew. If such a File needs to be opened multiple times, consider copying the File locally ([`copy()`](#File.copy "viktor.core.File.copy")), so that downloading takes place only once. Example usage: > ``` > data_file = vkt.File.from_data("my content") > path_file = vkt.File.from_path(Path(__file__).parent / "my_file.txt") > url_file = vkt.File.from_url("https://...") > writable_file = vkt.File() > > data_content = data_file.getvalue_binary() # bytes (b"my content") > path_content = path_file.getvalue() # str > > with url_file.open() as r: # open in text-mode, so read -> str > first_character = r.read(1) # downloads only partially > all_other_characters = r.read() # downloads the rest > > with writable_file.open_binary() as w: # open as binary-mode, so read/write -> bytes > w.write(b"my content") > > writable_content = writable_file.getvalue() # "my content" > ``` * Parameters: * **data** (`str` | `bytes` | `None`) – in-memory data source (also [`from_data()`](#File.from_data "viktor.core.File.from_data")) * **path** (`str` | `bytes` | `PathLike` | `None`) – existing file path source (also [`from_path()`](#File.from_path "viktor.core.File.from_path")) * **url** (`str` | `None`) – URL source (also [`from_url()`](#File.from_url "viktor.core.File.from_url")) - *class *SourceType(*\*values*)[](#File.SourceType "Link to this definition") Bases: `Enum` * DATA*: [`SourceType`](#File.SourceType "viktor.core.File.SourceType")** = 1*[](#File.SourceType.DATA "Link to this definition") - PATH*: [`SourceType`](#File.SourceType "viktor.core.File.SourceType")** = 2*[](#File.SourceType.PATH "Link to this definition") * URL*: [`SourceType`](#File.SourceType "viktor.core.File.SourceType")** = 3*[](#File.SourceType.URL "Link to this definition") - WRITABLE*: [`SourceType`](#File.SourceType "viktor.core.File.SourceType")** = 4*[](#File.SourceType.WRITABLE "Link to this definition") * copy(*writable=False*)[](#File.copy "Link to this definition") Make a local copy of the file to disk. Example usages: URL-file that needs to be opened multiple times: ``` # copying to path-file prevents re-downloading if opening more than once. path_file = url_file.copy() # download the complete content locally with path_file.open() as r: # no downloading ... with path_file.open() as r: # no downloading ... ``` Make writable file from read-only file: ``` writable_file = read_only_file.copy(writable=True) with writable_file.open() as w: w.write("my content") ``` * Parameters: **writable** (`bool`) – True to return writable file, False for read-only (default: False). * Return type: [`File`](#File "viktor.core.File") * Returns: File object (SourceType.WRITABLE if writable = True, else SourceType.PATH). - *classmethod *from\_data(*data*)[](#File.from_data "Link to this definition") Create a File object with in-memory data as its source. * Return type: [`File`](#File "viktor.core.File") * *classmethod *from\_path(*path*)[](#File.from_path "Link to this definition") Create a File object with an existing file (path) as its source. * Return type: [`File`](#File "viktor.core.File") - *classmethod *from\_url(*url*, *\**, *headers=None*)[](#File.from_url "Link to this definition") Create a File object with a URL as its source. * Return type: [`File`](#File "viktor.core.File") * getvalue(*encoding=None*)[](#File.getvalue "Link to this definition") Read the content (text) of the file in memory. For large files, open the file and read in chunks, to prevent the app from running out of memory. * Return type: `str` - getvalue\_binary()[](#File.getvalue_binary "Link to this definition") Read the content (binary) of the file in memory. For large files, open the file and read in chunks, to prevent the app from running out of memory. * Return type: `bytes` * open(*encoding=None*)[](#File.open "Link to this definition") Open the file in text-mode. * Parameters: **encoding** (`str`) – encoding used for reading the bytes -> str (default: default local encoding) * Return type: `TextIO` * Returns: opened text file - open\_binary()[](#File.open_binary "Link to this definition") Open the file in binary-mode. * Return type: `BinaryIO` * Returns: opened binary file * *property *source*: str | None*[](#File.source "Link to this definition") Source of the File object: * SourceType.DATA -> None * SourceType.PATH -> path of (readable) file on disk * SourceType.URL -> url * SourceType.WRITABLE -> path of (writable) file on disk - *property *source\_type*: [SourceType](#File.SourceType "viktor.core.File.SourceType")*[](#File.source_type "Link to this definition") Source type of the file. * *property *writable*: bool*[](#File.writable "Link to this definition") Whether the File is writable or not (only True for SourceType.WRITABLE). <!-- --> ## InitialEntity[​](https://docs.viktor.ai/sdk/api/core/.md#_InitialEntity "Direct link to InitialEntity") * *class *viktor.core.InitialEntity(*entity\_type\_name*, *name*, *\**, *params=None*, *children=None*, *show\_on\_dashboard=None*, *use\_as\_start\_page=None*)[](#InitialEntity "Link to this definition") Construct an initial entity in the app.\_\_init\_\_py file. ``` import viktor as vkt from .settings_database.controller import Controller as SettingsDatabaseController from .project_folder.controller import Controller as ProjectFolderController from .project.controller import Controller as ProjectController initial_entities = [ vkt.InitialEntity('SettingsDatabase', name='Settings', params=...), vkt.InitialEntity('ProjectFolder', name='Projects', children=[ vkt.InitialEntity('Project', 'Project X), vkt.InitialEntity('Project', 'Project Y), ]), ] ``` * Parameters: * **entity\_type\_name** (`str`) – Type of the initial entity. * **name** (`str`) – Name of the initial entity. * **params** (`dict` | `str`) – Optional params in dictionary format or path to a .json, relative to the app.\_\_init\_\_.py. Note that path traversal (beyond the root directory) is not permitted (e.g. “../../entity.json”). * **children** (`List`\[[`InitialEntity`](#InitialEntity "viktor.core.InitialEntity")]) – Optional child entities. * **show\_on\_dashboard** (`bool`) – Show/hide the entity on the dashboard. Only top-level entities can be shown (default: True) New in v13.7.0 * **use\_as\_start\_page** (`bool`) – Appoint the entity as the start page (instead of the dashboard). Only top-level entities can be appointed (default: False) New in v14.19.0 <!-- --> ## ParamsFromFile[​](https://docs.viktor.ai/sdk/api/core/.md#_ParamsFromFile "Direct link to ParamsFromFile") * *class *viktor.core.ParamsFromFile(*\**, *max\_size=None*, *file\_types=None*)[](#ParamsFromFile "Link to this definition") Decorator that can be used on a pre-process method during a file upload, to produce the parameter set that is stored in the database. Warning Prevent storing the complete file content on the properties if the file is large, as this may cause speed and/or stability issues. The file content can be retrieved at all times using the API whenever necessary. Example with nothing to store: ``` class Controller(vkt.Controller): ... @vkt.ParamsFromFile(...) def process_file(self, file: vkt.File, **kwargs): return {} ``` Example with parameters to store: ``` class Controller(vkt.Controller): ... @vkt.ParamsFromFile(...) def process_file(self, file: vkt.File, **kwargs): # app specific parsing logic file_content = file.getvalue() # or use reading in chunks, for large files number_of_entries = ... project_name = ... # linking the parsed output to the parametrization fields (names in database) return { 'tab': { 'section': { 'number_of_entries': number_of_entries, 'project_name': project_name } } } ``` Warning Loading the content of a large file in memory (file.getvalue()) may cause the app to crash (out-of-memory). Read the file content in chunks to avoid such memory issues (see [`File`](#File "viktor.core.File")). Note [`viktor.testing.mock_ParamsFromFile()`](https://docs.viktor.ai/sdk/api/testing/.md#mock_ParamsFromFile "viktor.testing.mock_ParamsFromFile") can be used to test methods decorated with ParamsFromFile. * Parameters: * **max\_size** (`int`) – optional restriction on file size in bytes (e.g. 10\_000\_000 = 10 MB). * **file\_types** (`Sequence`\[`str`]) – optional restriction on file type(s) (e.g. \[‘.png’, ‘.jpg’, ‘.jpeg’]). Note that the extensions are filtered regardless of capitalization. <!-- --> ## Storage[​](https://docs.viktor.ai/sdk/api/core/.md#_Storage "Direct link to Storage") * *class *viktor.core.Storage[](#Storage "Link to this definition") Starting point to communicate with the storage to, for example, set or retrieve analysis results. **(new in v14.28.0)**: Storage.set() Key length has been increased from 64 to 256 characters. The following actions are supported: ``` storage = vkt.Storage() # Setting data on a key storage.set('data_key_1', data=vkt.File.from_data('abc'), scope='entity') storage.set('data_key_2', data=vkt.File.from_data('def'), scope='entity') # Retrieve the data by key storage.get('data_key_1', scope='entity') # List available data keys (by prefix) storage.list(scope='entity') # lists all files in current entity scope storage.list(prefix='data_key_', scope='entity') # lists 'data_key_1', 'data_key_2', ... etc. # Delete data by key storage.delete('data_key_1', scope='entity') ``` For each of these methods, a scope can be defined to point to a specific section in the storage. These scopes ensure efficient arrangement and handling of data. The following scopes can be used: > * entity : when data needs to be accessed within a specific entity > > * workspace : when data needs to be accessed workspace-wide > > * session **(new in v14.28.0)** : when data needs to be accessed within an editor session * delete(*key*, *\**, *scope*, *entity=None*)[](#Storage.delete "Link to this definition") Delete a key-value pair for the specified scope. * Parameters: * **key** (`str`) – Unique key from which the key-value pair should be deleted. * **scope** (`str`) – Applicable scope, ‘entity’ | ‘workspace’ | ‘session’. * **entity** ([`Entity`](https://docs.viktor.ai/sdk/api/api-v1/.md#Entity "viktor.api_v1.Entity")) – Applicable entity, used in combination with scope==’entity’ (default: current entity). * Raises: * **FileNotFoundError** – When trying to delete a file that does not exist in the defined storage scope. * [**EntityNotFoundError**](https://docs.viktor.ai/sdk/api/errors/.md#EntityNotFoundError "viktor.errors.EntityNotFoundError") – When ‘entity’ no longer exists, or is not accessible. * Return type: `None` - get(*key*, *\**, *scope*, *entity=None*)[](#Storage.get "Link to this definition") Retrieve data from a key for the specified scope. * Parameters: * **key** (`str`) – Unique key from which the data should be retrieved. * **scope** (`str`) – Applicable scope, ‘entity’ | ‘workspace’ | ‘session’. * **entity** ([`Entity`](https://docs.viktor.ai/sdk/api/api-v1/.md#Entity "viktor.api_v1.Entity")) – Applicable entity, used in combination with scope==’entity’ (default: current entity). * Raises: * **FileNotFoundError** – When trying to retrieve a file that does not exist in the defined storage scope. * [**EntityNotFoundError**](https://docs.viktor.ai/sdk/api/errors/.md#EntityNotFoundError "viktor.errors.EntityNotFoundError") – When ‘entity’ no longer exists, or is not accessible. * Return type: [`File`](#File "viktor.core.File") * list(*\**, *prefix=None*, *scope*, *entity=None*)[](#Storage.list "Link to this definition") List all available key-value pairs for the specified scope. * Parameters: * **prefix** (`str`) – List all data of which the keys start with the provided prefix. Using a prefix potentially results in much higher performance due to a more efficient lookup in case of many stored files. * **scope** (`str`) – Applicable scope, ‘entity’ | ‘workspace’ | ‘session’. * **entity** ([`Entity`](https://docs.viktor.ai/sdk/api/api-v1/.md#Entity "viktor.api_v1.Entity")) – Applicable entity, used in combination with scope==’entity’ (default: current entity). * Raises: [**EntityNotFoundError**](https://docs.viktor.ai/sdk/api/errors/.md#EntityNotFoundError "viktor.errors.EntityNotFoundError") – When ‘entity’ no longer exists, or is not accessible. * Return type: `Dict`\[`str`, [`File`](#File "viktor.core.File")] - set(*key*, *data*, *\**, *scope*, *entity=None*)[](#Storage.set "Link to this definition") Set data on a key for the specified scope. * Parameters: * **key** (`str`) – Unique key on which the data is set (max. 256 characters). * **data** ([`File`](#File "viktor.core.File")) – Data to be stored. * **scope** (`str`) – Applicable scope, ‘entity’ | ‘workspace’ | ‘session’. * **entity** ([`Entity`](https://docs.viktor.ai/sdk/api/api-v1/.md#Entity "viktor.api_v1.Entity")) – Applicable entity, used in combination with scope==’entity’ (default: current entity). * Raises: [**EntityNotFoundError**](https://docs.viktor.ai/sdk/api/errors/.md#EntityNotFoundError "viktor.errors.EntityNotFoundError") – When ‘entity’ no longer exists, or is not accessible. * Return type: `None` <!-- --> ## UserMessage[​](https://docs.viktor.ai/sdk/api/core/.md#_UserMessage "Direct link to UserMessage") * *class *viktor.core.UserMessage[](#UserMessage "Link to this definition") New in v14.0.0 A non-breaking message that is shown to the user in the web-interface. Example usage: ``` vkt.UserMessage.warning("Show this warning") vkt.UserMessage.info("Show this info") vkt.UserMessage.success("Analysis successfully finished!") ``` * *classmethod *info(*message*)[](#UserMessage.info "Link to this definition") Show an info message to the user. * Return type: `None` - *classmethod *success(*message*)[](#UserMessage.success "Link to this definition") Show a success message to the user. * Return type: `None` * *classmethod *warning(*message*)[](#UserMessage.warning "Link to this definition") Show a warning message to the user. * Return type: `None` <!-- --> ## ViktorController[​](https://docs.viktor.ai/sdk/api/core/.md#_ViktorController "Direct link to ViktorController") * viktor.core.ViktorController[](#ViktorController "Link to this definition") alias of [`Controller`](#Controller "viktor.core.Controller") <!-- --> ## make\_data\_json\_serializable[​](https://docs.viktor.ai/sdk/api/core/.md#_make_data_json_serializable "Direct link to make_data_json_serializable") * viktor.core.make\_data\_json\_serializable(*input\_data*)[](#make_data_json_serializable "Link to this definition") The python built-in json dump does not support all the desired types. This function converts those, thereby enabling broader json conversion. * numpy number types -> equivalent python builtin * datetime.datetime and datetime.date -> isoformat str * tuple -> list (otherwise sub elements cannot be converted due to tuple immutability) - Return type: `Any` <!-- --> ## progress\_message[​](https://docs.viktor.ai/sdk/api/core/.md#_progress_message "Direct link to progress_message") * viktor.core.progress\_message(*message*, *percentage=None*)[](#progress_message "Link to this definition") Send a user facing progress message informing the progress of an evaluation. Messages are truncated to 500 characters * Parameters: * **message** (`str`) – Message shown to the user * **percentage** (`float`) – Value between 0 and 100 quantifying the progress * Return type: `None` --- # viktor.errors <!-- --> <!-- --> <!-- --> ## BadRequestError[​](https://docs.viktor.ai/sdk/api/errors/.md#_BadRequestError "Direct link to BadRequestError") * *exception *viktor.errors.BadRequestError[](#BadRequestError "Link to this definition") Bases: [`Error`](#Error "viktor.errors.Error") Exception raised if BE API returns 400. <!-- --> ## ComputeError[​](https://docs.viktor.ai/sdk/api/errors/.md#_ComputeError "Direct link to ComputeError") * *exception *viktor.errors.ComputeError[](#ComputeError "Link to this definition") Bases: [`Error`](#Error "viktor.errors.Error") Exception raised if the job computation didn’t finish successfully. <!-- --> ## EntityCreateError[​](https://docs.viktor.ai/sdk/api/errors/.md#_EntityCreateError "Direct link to EntityCreateError") * *exception *viktor.errors.EntityCreateError[](#EntityCreateError "Link to this definition") Bases: [`EntityError`](#EntityError "viktor.errors.EntityError") Exception raised if creation of an entity failed. <!-- --> ## EntityDeleteError[​](https://docs.viktor.ai/sdk/api/errors/.md#_EntityDeleteError "Direct link to EntityDeleteError") * *exception *viktor.errors.EntityDeleteError[](#EntityDeleteError "Link to this definition") Bases: [`EntityError`](#EntityError "viktor.errors.EntityError") Exception raised if deletion of an entity failed. <!-- --> ## EntityError[​](https://docs.viktor.ai/sdk/api/errors/.md#_EntityError "Direct link to EntityError") * *exception *viktor.errors.EntityError[](#EntityError "Link to this definition") Bases: [`Error`](#Error "viktor.errors.Error") Base class exception for all entity errors raised in the API. <!-- --> ## EntityNotFoundError[​](https://docs.viktor.ai/sdk/api/errors/.md#_EntityNotFoundError "Direct link to EntityNotFoundError") * *exception *viktor.errors.EntityNotFoundError[](#EntityNotFoundError "Link to this definition") Bases: [`EntityError`](#EntityError "viktor.errors.EntityError") Exception raised if an entity is requested using the api module but does not exist. <!-- --> ## EntityReviseError[​](https://docs.viktor.ai/sdk/api/errors/.md#_EntityReviseError "Direct link to EntityReviseError") * *exception *viktor.errors.EntityReviseError[](#EntityReviseError "Link to this definition") Bases: [`EntityError`](#EntityError "viktor.errors.EntityError") Exception raised if creating a revision (e.g. set params, rename) of an entity failed. <!-- --> ## Error[​](https://docs.viktor.ai/sdk/api/errors/.md#_Error "Direct link to Error") * *exception *viktor.errors.Error[](#Error "Link to this definition") Bases: `Exception` <!-- --> ## ExecutionError[​](https://docs.viktor.ai/sdk/api/errors/.md#_ExecutionError "Direct link to ExecutionError") * *exception *viktor.errors.ExecutionError[](#ExecutionError "Link to this definition") Bases: [`Error`](#Error "viktor.errors.Error") Exception raised if an error occurs during the execution of an external analysis. <!-- --> ## GEFClassificationError[​](https://docs.viktor.ai/sdk/api/errors/.md#_GEFClassificationError "Direct link to GEFClassificationError") * *exception *viktor.errors.GEFClassificationError[](#GEFClassificationError "Link to this definition") Bases: `Exception` Exception raised if an error occurs during classification of [`viktor.geo.GEFData`](https://docs.viktor.ai/sdk/api/geo/.md#GEFData "viktor.geo.GEFData"). <!-- --> ## GEFParsingError[​](https://docs.viktor.ai/sdk/api/errors/.md#_GEFParsingError "Direct link to GEFParsingError") * *exception *viktor.errors.GEFParsingError[](#GEFParsingError "Link to this definition") Bases: `Exception` Exception raised if an error occurs during parsing of a [`viktor.geo.GEFFile`](https://docs.viktor.ai/sdk/api/geo/.md#GEFFile "viktor.geo.GEFFile"). <!-- --> ## InputViolation[​](https://docs.viktor.ai/sdk/api/errors/.md#_InputViolation "Direct link to InputViolation") * *class *viktor.errors.InputViolation(*message*, *fields*)[](#InputViolation "Link to this definition") New in v13.7.0 Annotate fields that should be marked as invalid in the interface, along with a message. Example: ``` vkt.InputViolation("Width cannot be larger than height", fields=['width', 'height']) ``` * Parameters: * **message** (`str`) – Message that is shown to the user. * **fields** (`Sequence`\[`str`]) – Fields that are marked invalid in the interface. Note that these refer to the parametrization class attributes (e.g. ‘step\_1.field\_x’), and not the database location in case name is set. <!-- --> ## InternalError[​](https://docs.viktor.ai/sdk/api/errors/.md#_InternalError "Direct link to InternalError") * *exception *viktor.errors.InternalError[](#InternalError "Link to this definition") Bases: [`Error`](#Error "viktor.errors.Error") Exception applicable for incorrect internal VIKTOR logic. Please contact VIKTOR. <!-- --> ## LicenseError[​](https://docs.viktor.ai/sdk/api/errors/.md#_LicenseError "Direct link to LicenseError") * *exception *viktor.errors.LicenseError[](#LicenseError "Link to this definition") Bases: [`Error`](#Error "viktor.errors.Error") Exception raised if an external analysis cannot be executed due to license issues. <!-- --> ## ModelError[​](https://docs.viktor.ai/sdk/api/errors/.md#_ModelError "Direct link to ModelError") * *exception *viktor.errors.ModelError[](#ModelError "Link to this definition") Bases: [`Error`](#Error "viktor.errors.Error") Exception raised if an error occurs within the model of one of the bindings (e.g. SCIA, D-Settlement, …). <!-- --> ## ParsingError[​](https://docs.viktor.ai/sdk/api/errors/.md#_ParsingError "Direct link to ParsingError") * *exception *viktor.errors.ParsingError[](#ParsingError "Link to this definition") Bases: [`Error`](#Error "viktor.errors.Error") Exception raised if an error occurs during parsing. <!-- --> ## PermissionDeniedError[​](https://docs.viktor.ai/sdk/api/errors/.md#_PermissionDeniedError "Direct link to PermissionDeniedError") * *exception *viktor.errors.PermissionDeniedError[](#PermissionDeniedError "Link to this definition") Bases: [`Error`](#Error "viktor.errors.Error") Exception raised if a resource is requested using the api module but access is not permitted (403) <!-- --> ## PreconditionFailedError[​](https://docs.viktor.ai/sdk/api/errors/.md#_PreconditionFailedError "Direct link to PreconditionFailedError") * *exception *viktor.errors.PreconditionFailedError[](#PreconditionFailedError "Link to this definition") Bases: [`Error`](#Error "viktor.errors.Error") Exception raised if some precondition failed (412) <!-- --> ## ResourceNotFoundError[​](https://docs.viktor.ai/sdk/api/errors/.md#_ResourceNotFoundError "Direct link to ResourceNotFoundError") * *exception *viktor.errors.ResourceNotFoundError[](#ResourceNotFoundError "Link to this definition") Bases: [`Error`](#Error "viktor.errors.Error") Exception raised if a resource is requested using the api module but does not exist (404) <!-- --> ## SciaParsingError[​](https://docs.viktor.ai/sdk/api/errors/.md#_SciaParsingError "Direct link to SciaParsingError") * *exception *viktor.errors.SciaParsingError[](#SciaParsingError "Link to this definition") Bases: `Exception` Exception raised if an error occurs during parsing of SCIA output results. <!-- --> ## SpreadsheetError[​](https://docs.viktor.ai/sdk/api/errors/.md#_SpreadsheetError "Direct link to SpreadsheetError") * *exception *viktor.errors.SpreadsheetError[](#SpreadsheetError "Link to this definition") Bases: `Exception` Exception raised if an error occurs in the Excel or Spreadsheet service. <!-- --> ## SummaryError[​](https://docs.viktor.ai/sdk/api/errors/.md#_SummaryError "Direct link to SummaryError") * *exception *viktor.errors.SummaryError[](#SummaryError "Link to this definition") Bases: `Exception` Exception raised if an error occurs during the generation of the summary. <!-- --> ## UserError[​](https://docs.viktor.ai/sdk/api/errors/.md#_UserError "Direct link to UserError") * *exception *viktor.errors.UserError(*\*messages*, *input\_violations=None*)[](#UserError "Link to this definition") Bases: `Exception` New in v13.7.0 Exception that is shown to the user in the web-interface. Example: ``` raise vkt.UserError("The design is not feasible") ``` By providing input\_violations you can mark specific fields as invalid: ``` violations = [ vkt.InputViolation("Width cannot be larger than height", fields=['width', 'height']), vkt.InputViolation(...), ] raise vkt.UserError("The design is not feasible", input_violations=violations) ``` * Parameters: * **messages** (`Any`) – Messages to be shown to the user. * **input\_violations** (`Sequence`\[[`InputViolation`](#InputViolation "viktor.errors.InputViolation")]) – Mark fields invalid in the interface, along with a message. <!-- --> ## ViewError[​](https://docs.viktor.ai/sdk/api/errors/.md#_ViewError "Direct link to ViewError") * *exception *viktor.errors.ViewError[](#ViewError "Link to this definition") Bases: `Exception` Exception raised if an error occurs during the generation of a view. <!-- --> ## WordFileError[​](https://docs.viktor.ai/sdk/api/errors/.md#_WordFileError "Direct link to WordFileError") * *exception *viktor.errors.WordFileError[](#WordFileError "Link to this definition") Bases: `Exception` Exception raised if an error occurs during rendering of a Word file. <!-- --> ## WorkerSessionAttachError[​](https://docs.viktor.ai/sdk/api/errors/.md#_WorkerSessionAttachError "Direct link to WorkerSessionAttachError") * *exception *viktor.errors.WorkerSessionAttachError(*\*messages*, *reason=''*)[](#WorkerSessionAttachError "Link to this definition") Bases: [`WorkerSessionError`](#WorkerSessionError "viktor.errors.WorkerSessionError") New in 14.33.0 Exception raised when `viktor.external.autocad.attach()`, `viktor.external.civil3d.attach()`, `viktor.external.etabs.attach()` or `viktor.external.sap2000.attach()` could not attach to a running instance. The session was not established; start a new one to continue. * Parameters: * **messages** (`Any`) – Human-readable messages describing the failure. * **reason** (`str`) – Machine-readable cause: `"error_attach_no_instance"` (nothing running on the worker machine), `"error_attach_wrong_product"`, `"error_attach_refused"`, `"error_session_mode_not_supported"` (worker too old), `"no_worker_online"`, `"worker_kind_not_allowed"` (kind not enabled for the organization), `"error_timeout"` (no acknowledgement in time) or `"session_open_failed"` (unclassified). The set is open: handle an unknown reason as a generic attach failure. <!-- --> ## WorkerSessionError[​](https://docs.viktor.ai/sdk/api/errors/.md#_WorkerSessionError "Direct link to WorkerSessionError") * *exception *viktor.errors.WorkerSessionError[](#WorkerSessionError "Link to this definition") Bases: [`Error`](#Error "viktor.errors.Error") Exception raised when a worker session is lost (e.g. the bound worker disconnected, or the application it was driving was torn down). The session cannot be resumed. Start a new session to continue. --- # viktor.external.autocad <!-- --> <!-- --> <!-- --> ## AutoCADConnection[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AutoCADConnection "Direct link to AutoCADConnection") * *class *viktor.external.autocad.autocad.AutoCADConnection(*session*)[](#AutoCADConnection "Link to this definition") Bases: `_HandleConnection` New in 14.35.0 The `acad` object returned by [`connect()`](#connect "viktor.external.autocad.autocad.connect") or [`attach()`](#attach "viktor.external.autocad.autocad.attach"), used to control AutoCAD through its ActiveX Automation API. Each call returns the API result, or `[*out_params, ret]` when the call has output parameters. Objects returned by calls come back as opaque session-scoped handles, usable in further calls and as arguments; a property is read with call syntax (`line.Length()`) and written by plain assignment (`line.Layer = "STRUCTURE"`). Some members are refused by the worker for security and session safety (raising [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError")), and filename arguments are confined to the session’s working directory: save with `SaveAs` and a relative filename. The SDK sends calls to the worker in chunks. A result is read when your code first uses its value: in `==`, `if`, `float()`, `int()`, `str()`, `print()` or a loop. A failed call raises [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError") at that read, with the call and your line. Two things do not read a result: passing it to a later call, and unpacking it into names. So the example below sends all three calls in one chunk. `result is None` is always `False` on an unread result; use `== None`. Pass `defer=False` to [`connect()`](#connect "viktor.external.autocad.autocad.connect") / [`attach()`](#attach "viktor.external.autocad.autocad.attach") to send each call on its own. ``` circle = acad.ActiveDocument.ModelSpace.AddCircle([0, 0, 0], 1) low, high, _ = circle.GetBoundingBox() acad.ActiveDocument.ModelSpace.AddLine(low, high) ``` See [`batch()`](#AutoCADConnection.batch "viktor.external.autocad.autocad.AutoCADConnection.batch") when one loop makes more than a few hundred calls. Warning Do not instantiate this class directly; obtain it from [`connect()`](#connect "viktor.external.autocad.autocad.connect") or [`attach()`](#attach "viktor.external.autocad.autocad.attach"). * batch()[](#AutoCADConnection.batch "Link to this definition") New in v14.37.0 Send all calls of the block to the worker as one job when the block ends. Without the block the SDK sends calls in chunks of a few hundred, each one round trip. The gain grows with the size of the block; below a few hundred calls it changes nothing. You cannot read a result inside the block: a read raises `RuntimeError`. So do `isinstance()`, `print()`, `str()` and `repr()` on a result. Read the results after the block. The block runs as one job under the session `timeout` (300 s by default). For a very large block, increase `timeout` in [`connect()`](#connect "viktor.external.autocad.autocad.connect") / [`attach()`](#attach "viktor.external.autocad.autocad.attach"). ``` with sap.batch(): for x, y in points: # 5000 points name, ret = sap.FrameObj.AddByCoord(x, y, 0, x, y, 3, "", "W12X26") sap.FrameObj.SetGroupAssign(name, "Columns") # 10000 calls went to the worker in one job ``` Needs a deferred connection (`defer=True`). Blocks cannot be nested. Calls made before the block are sent when the block starts. * Return type: `ContextManager`\[`None`, `bool` | `None`] <!-- --> ## attach[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_attach "Direct link to attach") * viktor.external.autocad.autocad.attach(*timeout=300*, *defer=True*)[](#attach "Link to this definition") New in 14.35.0 Attach to the AutoCAD instance already running on the worker machine and control it through the AutoCAD ActiveX Automation API, like [`connect()`](#connect "viktor.external.autocad.autocad.connect"), but without starting a fresh instance. Typical use: a personal worker on the engineer’s own machine, so the app acts on the drawing they have open on screen. Warning This is a BETA feature. Requires a worker of kind `autocad`. Declare it in your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml/): ``` worker_integrations = [ "autocad", ] ``` Usage: ``` import viktor as vkt with vkt.autocad.attach(timeout=60) as acad: layer = acad.ActiveDocument.ActiveLayer.Name() # reads the drawing open in AutoCAD acad.ActiveDocument.Regen(0) # changes show in the user's window ``` Closing the session detaches without exiting the instance. The app can change the attached drawing but not save it in place: saving requires `SaveAs` with a relative filename, which writes into the session directory. Note The ActiveX members you call on `acad` (e.g. `acad.ActiveDocument.ModelSpace.AddLine`) mirror the AutoCAD Object Model and are not listed here. Look them up in the AutoCAD ActiveX Reference Guide on [Autodesk’s developer documentation](https://www.autodesk.com/developer-network/platform-technologies/autocad), or in the `acadauto.chm` help file in your AutoCAD installation directory. * Parameters: * **timeout** (`int`) – timeout in seconds for one chunk of calls; also bounds the attach itself, so keep it at or above the platform’s 30 second bind window. * **defer** (`bool`) – queue calls and send them to the worker in chunks; a result is fetched when your code first reads it (default: True). False sends every call at once and returns plain values. New in v14.37.0 * Return type: [`AutoCADConnection`](#AutoCADConnection "viktor.external.autocad.autocad.AutoCADConnection") Exceptions which can be raised during execution: > * [`viktor.errors.WorkerSessionAttachError`](https://docs.viktor.ai/sdk/api/errors/.md#WorkerSessionAttachError "viktor.errors.WorkerSessionAttachError"): the attach failed, e.g. no AutoCAD is running on the worker machine. `reason` names the cause; that set is open. > > * [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error during a call. Error message provides more information. > > * [`viktor.errors.WorkerSessionError`](https://docs.viktor.ai/sdk/api/errors/.md#WorkerSessionError "viktor.errors.WorkerSessionError"): the session was lost after attaching (e.g. the user closed the AutoCAD instance). The session cannot be resumed; start a new one to continue. > > * TimeoutError: a chunk of calls took longer than `timeout` <!-- --> ## connect[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_connect "Direct link to connect") * viktor.external.autocad.autocad.connect(*timeout=300*, *defer=True*)[](#connect "Link to this definition") New in 14.35.0 Connect to AutoCAD running on a connected VIKTOR worker and control it through the AutoCAD ActiveX Automation API directly from your app, as shown below. Always starts a fresh instance: if AutoCAD is already open on the worker machine the session is refused — close it there, or use [`attach()`](#attach "viktor.external.autocad.autocad.attach") to act on it. Warning This is a BETA feature. Requires a worker of kind `autocad`. Declare it in your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml/): ``` worker_integrations = [ "autocad", ] ``` Usage: ``` import viktor as vkt with vkt.autocad.connect(timeout=60) as acad: ms = acad.ActiveDocument.ModelSpace line = ms.AddLine([0, 0, 0], [6, 0, 0]) # returns a session-scoped object handle line.Layer = "STRUCTURE" # property write: plain assignment length = line.Length() # property read: call syntax (note the parens) acad.ActiveDocument.SaveAs("beam.dwg") # use a relative filename, not an absolute path ``` Note The ActiveX members you call on `acad` (e.g. `acad.ActiveDocument.ModelSpace.AddLine`) mirror the AutoCAD Object Model and are not listed here. Look them up in the AutoCAD ActiveX Reference Guide on [Autodesk’s developer documentation](https://www.autodesk.com/developer-network/platform-technologies/autocad), or in the `acadauto.chm` help file in your AutoCAD installation directory. * Parameters: * **timeout** (`int`) – timeout in seconds for one chunk of calls. Opening the session waits for AutoCAD to be ready, so it must also cover starting AutoCAD up on the worker. * **defer** (`bool`) – queue calls and send them to the worker in chunks; a result is fetched when your code first reads it (default: True). False sends every call at once and returns plain values. New in v14.37.0 * Return type: [`AutoCADConnection`](#AutoCADConnection "viktor.external.autocad.autocad.AutoCADConnection") Exceptions which can be raised during execution: > * [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information. A host whose AutoCAD license is not activated also fails this way: AutoCAD blocks on an interactive sign-in dialog that the worker cannot answer, so starting it up times out. > > * [`viktor.errors.WorkerSessionError`](https://docs.viktor.ai/sdk/api/errors/.md#WorkerSessionError "viktor.errors.WorkerSessionError"): the session was lost (e.g. its AutoCAD instance was torn down). The session cannot be resumed; start a new one to continue. > > * TimeoutError: a chunk of calls took longer than `timeout` <!-- --> AutoCAD enum values, generated from AutoCAD 26.0s (LMS Tech). <!-- --> ## Ac3DPolylineType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_Ac3DPolylineType "Direct link to Ac3DPolylineType") * *class *viktor.external.autocad.enums.Ac3DPolylineType(*\*values*)[](#Ac3DPolylineType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `Ac3DPolylineType` values, mirroring the product API’s names so code reads like its docs. * acCubicSpline3DPoly* = 2*[](#Ac3DPolylineType.acCubicSpline3DPoly "Link to this definition") - acQuadSpline3DPoly* = 1*[](#Ac3DPolylineType.acQuadSpline3DPoly "Link to this definition") * acSimple3DPoly* = 0*[](#Ac3DPolylineType.acSimple3DPoly "Link to this definition") <!-- --> ## AcARXDemandLoad[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcARXDemandLoad "Direct link to AcARXDemandLoad") * *class *viktor.external.autocad.enums.AcARXDemandLoad(*\*values*)[](#AcARXDemandLoad "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcARXDemandLoad` values, mirroring the product API’s names so code reads like its docs. * acDemanLoadDisable* = 0*[](#AcARXDemandLoad.acDemanLoadDisable "Link to this definition") - acDemandLoadCmdInvoke* = 2*[](#AcARXDemandLoad.acDemandLoadCmdInvoke "Link to this definition") * acDemandLoadOnObjectDetect* = 1*[](#AcARXDemandLoad.acDemandLoadOnObjectDetect "Link to this definition") <!-- --> ## AcActiveSpace[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcActiveSpace "Direct link to AcActiveSpace") * *class *viktor.external.autocad.enums.AcActiveSpace(*\*values*)[](#AcActiveSpace "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcActiveSpace` values, mirroring the product API’s names so code reads like its docs. * acModelSpace* = 1*[](#AcActiveSpace.acModelSpace "Link to this definition") - acPaperSpace* = 0*[](#AcActiveSpace.acPaperSpace "Link to this definition") <!-- --> ## AcAlignment[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcAlignment "Direct link to AcAlignment") * *class *viktor.external.autocad.enums.AcAlignment(*\*values*)[](#AcAlignment "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcAlignment` values, mirroring the product API’s names so code reads like its docs. * acAlignmentAligned* = 3*[](#AcAlignment.acAlignmentAligned "Link to this definition") - acAlignmentBottomCenter* = 13*[](#AcAlignment.acAlignmentBottomCenter "Link to this definition") * acAlignmentBottomLeft* = 12*[](#AcAlignment.acAlignmentBottomLeft "Link to this definition") - acAlignmentBottomRight* = 14*[](#AcAlignment.acAlignmentBottomRight "Link to this definition") * acAlignmentCenter* = 1*[](#AcAlignment.acAlignmentCenter "Link to this definition") - acAlignmentFit* = 5*[](#AcAlignment.acAlignmentFit "Link to this definition") * acAlignmentLeft* = 0*[](#AcAlignment.acAlignmentLeft "Link to this definition") - acAlignmentMiddle* = 4*[](#AcAlignment.acAlignmentMiddle "Link to this definition") * acAlignmentMiddleCenter* = 10*[](#AcAlignment.acAlignmentMiddleCenter "Link to this definition") - acAlignmentMiddleLeft* = 9*[](#AcAlignment.acAlignmentMiddleLeft "Link to this definition") * acAlignmentMiddleRight* = 11*[](#AcAlignment.acAlignmentMiddleRight "Link to this definition") - acAlignmentRight* = 2*[](#AcAlignment.acAlignmentRight "Link to this definition") * acAlignmentTopCenter* = 7*[](#AcAlignment.acAlignmentTopCenter "Link to this definition") - acAlignmentTopLeft* = 6*[](#AcAlignment.acAlignmentTopLeft "Link to this definition") * acAlignmentTopRight* = 8*[](#AcAlignment.acAlignmentTopRight "Link to this definition") <!-- --> ## AcAlignmentPointAcquisition[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcAlignmentPointAcquisition "Direct link to AcAlignmentPointAcquisition") * *class *viktor.external.autocad.enums.AcAlignmentPointAcquisition(*\*values*)[](#AcAlignmentPointAcquisition "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcAlignmentPointAcquisition` values, mirroring the product API’s names so code reads like its docs. * acAlignPntAcquisitionAutomatic* = 0*[](#AcAlignmentPointAcquisition.acAlignPntAcquisitionAutomatic "Link to this definition") - acAlignPntAcquisitionShiftToAcquire* = 1*[](#AcAlignmentPointAcquisition.acAlignPntAcquisitionShiftToAcquire "Link to this definition") <!-- --> ## AcAngleUnits[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcAngleUnits "Direct link to AcAngleUnits") * *class *viktor.external.autocad.enums.AcAngleUnits(*\*values*)[](#AcAngleUnits "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcAngleUnits` values, mirroring the product API’s names so code reads like its docs. * acDegreeMinuteSeconds* = 1*[](#AcAngleUnits.acDegreeMinuteSeconds "Link to this definition") - acDegrees* = 0*[](#AcAngleUnits.acDegrees "Link to this definition") * acGrads* = 2*[](#AcAngleUnits.acGrads "Link to this definition") - acRadians* = 3*[](#AcAngleUnits.acRadians "Link to this definition") <!-- --> ## AcAttachmentPoint[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcAttachmentPoint "Direct link to AcAttachmentPoint") * *class *viktor.external.autocad.enums.AcAttachmentPoint(*\*values*)[](#AcAttachmentPoint "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcAttachmentPoint` values, mirroring the product API’s names so code reads like its docs. * acAttachmentPointBottomCenter* = 8*[](#AcAttachmentPoint.acAttachmentPointBottomCenter "Link to this definition") - acAttachmentPointBottomLeft* = 7*[](#AcAttachmentPoint.acAttachmentPointBottomLeft "Link to this definition") * acAttachmentPointBottomRight* = 9*[](#AcAttachmentPoint.acAttachmentPointBottomRight "Link to this definition") - acAttachmentPointMiddleCenter* = 5*[](#AcAttachmentPoint.acAttachmentPointMiddleCenter "Link to this definition") * acAttachmentPointMiddleLeft* = 4*[](#AcAttachmentPoint.acAttachmentPointMiddleLeft "Link to this definition") - acAttachmentPointMiddleRight* = 6*[](#AcAttachmentPoint.acAttachmentPointMiddleRight "Link to this definition") * acAttachmentPointTopCenter* = 2*[](#AcAttachmentPoint.acAttachmentPointTopCenter "Link to this definition") - acAttachmentPointTopLeft* = 1*[](#AcAttachmentPoint.acAttachmentPointTopLeft "Link to this definition") * acAttachmentPointTopRight* = 3*[](#AcAttachmentPoint.acAttachmentPointTopRight "Link to this definition") <!-- --> ## AcAttributeMode[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcAttributeMode "Direct link to AcAttributeMode") * *class *viktor.external.autocad.enums.AcAttributeMode(*\*values*)[](#AcAttributeMode "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcAttributeMode` values, mirroring the product API’s names so code reads like its docs. * acAttributeModeConstant* = 2*[](#AcAttributeMode.acAttributeModeConstant "Link to this definition") - acAttributeModeInvisible* = 1*[](#AcAttributeMode.acAttributeModeInvisible "Link to this definition") * acAttributeModeLockPosition* = 16*[](#AcAttributeMode.acAttributeModeLockPosition "Link to this definition") - acAttributeModeMultipleLine* = 32*[](#AcAttributeMode.acAttributeModeMultipleLine "Link to this definition") * acAttributeModeNormal* = 0*[](#AcAttributeMode.acAttributeModeNormal "Link to this definition") - acAttributeModePreset* = 8*[](#AcAttributeMode.acAttributeModePreset "Link to this definition") * acAttributeModeVerify* = 4*[](#AcAttributeMode.acAttributeModeVerify "Link to this definition") <!-- --> ## AcBlockConnectionType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcBlockConnectionType "Direct link to AcBlockConnectionType") * *class *viktor.external.autocad.enums.AcBlockConnectionType(*\*values*)[](#AcBlockConnectionType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcBlockConnectionType` values, mirroring the product API’s names so code reads like its docs. * acConnectBase* = 1*[](#AcBlockConnectionType.acConnectBase "Link to this definition") - acConnectExtents* = 0*[](#AcBlockConnectionType.acConnectExtents "Link to this definition") <!-- --> ## AcBlockScaling[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcBlockScaling "Direct link to AcBlockScaling") * *class *viktor.external.autocad.enums.AcBlockScaling(*\*values*)[](#AcBlockScaling "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcBlockScaling` values, mirroring the product API’s names so code reads like its docs. * acAny* = 0*[](#AcBlockScaling.acAny "Link to this definition") - acUniform* = 1*[](#AcBlockScaling.acUniform "Link to this definition") <!-- --> ## AcBoolean[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcBoolean "Direct link to AcBoolean") * *class *viktor.external.autocad.enums.AcBoolean(*\*values*)[](#AcBoolean "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcBoolean` values, mirroring the product API’s names so code reads like its docs. * acFalse* = 0*[](#AcBoolean.acFalse "Link to this definition") - acTrue* = 1*[](#AcBoolean.acTrue "Link to this definition") <!-- --> ## AcBooleanType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcBooleanType "Direct link to AcBooleanType") * *class *viktor.external.autocad.enums.AcBooleanType(*\*values*)[](#AcBooleanType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcBooleanType` values, mirroring the product API’s names so code reads like its docs. * acIntersection* = 1*[](#AcBooleanType.acIntersection "Link to this definition") - acSubtraction* = 2*[](#AcBooleanType.acSubtraction "Link to this definition") * acUnion* = 0*[](#AcBooleanType.acUnion "Link to this definition") <!-- --> ## AcCellAlignment[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcCellAlignment "Direct link to AcCellAlignment") * *class *viktor.external.autocad.enums.AcCellAlignment(*\*values*)[](#AcCellAlignment "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcCellAlignment` values, mirroring the product API’s names so code reads like its docs. * acBottomCenter* = 8*[](#AcCellAlignment.acBottomCenter "Link to this definition") - acBottomLeft* = 7*[](#AcCellAlignment.acBottomLeft "Link to this definition") * acBottomRight* = 9*[](#AcCellAlignment.acBottomRight "Link to this definition") - acMiddleCenter* = 5*[](#AcCellAlignment.acMiddleCenter "Link to this definition") * acMiddleLeft* = 4*[](#AcCellAlignment.acMiddleLeft "Link to this definition") - acMiddleRight* = 6*[](#AcCellAlignment.acMiddleRight "Link to this definition") * acTopCenter* = 2*[](#AcCellAlignment.acTopCenter "Link to this definition") - acTopLeft* = 1*[](#AcCellAlignment.acTopLeft "Link to this definition") * acTopRight* = 3*[](#AcCellAlignment.acTopRight "Link to this definition") <!-- --> ## AcCellContentLayout[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcCellContentLayout "Direct link to AcCellContentLayout") * *class *viktor.external.autocad.enums.AcCellContentLayout(*\*values*)[](#AcCellContentLayout "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcCellContentLayout` values, mirroring the product API’s names so code reads like its docs. * acCellContentLayoutFlow* = 1*[](#AcCellContentLayout.acCellContentLayoutFlow "Link to this definition") - acCellContentLayoutStackedHorizontal* = 2*[](#AcCellContentLayout.acCellContentLayoutStackedHorizontal "Link to this definition") * acCellContentLayoutStackedVertical* = 4*[](#AcCellContentLayout.acCellContentLayoutStackedVertical "Link to this definition") <!-- --> ## AcCellContentType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcCellContentType "Direct link to AcCellContentType") * *class *viktor.external.autocad.enums.AcCellContentType(*\*values*)[](#AcCellContentType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcCellContentType` values, mirroring the product API’s names so code reads like its docs. * acCellContentTypeBlock* = 4*[](#AcCellContentType.acCellContentTypeBlock "Link to this definition") - acCellContentTypeField* = 2*[](#AcCellContentType.acCellContentTypeField "Link to this definition") * acCellContentTypeUnknown* = 0*[](#AcCellContentType.acCellContentTypeUnknown "Link to this definition") - acCellContentTypeValue* = 1*[](#AcCellContentType.acCellContentTypeValue "Link to this definition") <!-- --> ## AcCellEdgeMask[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcCellEdgeMask "Direct link to AcCellEdgeMask") * *class *viktor.external.autocad.enums.AcCellEdgeMask(*\*values*)[](#AcCellEdgeMask "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcCellEdgeMask` values, mirroring the product API’s names so code reads like its docs. * acBottomMask* = 4*[](#AcCellEdgeMask.acBottomMask "Link to this definition") - acLeftMask* = 8*[](#AcCellEdgeMask.acLeftMask "Link to this definition") * acRightMask* = 2*[](#AcCellEdgeMask.acRightMask "Link to this definition") - acTopMask* = 1*[](#AcCellEdgeMask.acTopMask "Link to this definition") <!-- --> ## AcCellMargin[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcCellMargin "Direct link to AcCellMargin") * *class *viktor.external.autocad.enums.AcCellMargin(*\*values*)[](#AcCellMargin "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcCellMargin` values, mirroring the product API’s names so code reads like its docs. * acCellMarginBottom* = 4*[](#AcCellMargin.acCellMarginBottom "Link to this definition") - acCellMarginHorzSpacing* = 16*[](#AcCellMargin.acCellMarginHorzSpacing "Link to this definition") * acCellMarginLeft* = 2*[](#AcCellMargin.acCellMarginLeft "Link to this definition") - acCellMarginRight* = 8*[](#AcCellMargin.acCellMarginRight "Link to this definition") * acCellMarginTop* = 1*[](#AcCellMargin.acCellMarginTop "Link to this definition") - acCellMarginVertSpacing* = 32*[](#AcCellMargin.acCellMarginVertSpacing "Link to this definition") <!-- --> ## AcCellOption[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcCellOption "Direct link to AcCellOption") * *class *viktor.external.autocad.enums.AcCellOption(*\*values*)[](#AcCellOption "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcCellOption` values, mirroring the product API’s names so code reads like its docs. * kCellOptionNone* = 0*[](#AcCellOption.kCellOptionNone "Link to this definition") - kInheritCellFormat* = 1*[](#AcCellOption.kInheritCellFormat "Link to this definition") <!-- --> ## AcCellProperty[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcCellProperty "Direct link to AcCellProperty") * *class *viktor.external.autocad.enums.AcCellProperty(*\*values*)[](#AcCellProperty "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcCellProperty` values, mirroring the product API’s names so code reads like its docs. * acAlignmentProperty* = 32*[](#AcCellProperty.acAlignmentProperty "Link to this definition") - acAllCellProperties* = 524287*[](#AcCellProperty.acAllCellProperties "Link to this definition") * acAutoScale* = 32768*[](#AcCellProperty.acAutoScale "Link to this definition") - acBackgroundColor* = 128*[](#AcCellProperty.acBackgroundColor "Link to this definition") * acBitProperties* = 245760*[](#AcCellProperty.acBitProperties "Link to this definition") - acContentColor* = 64*[](#AcCellProperty.acContentColor "Link to this definition") * acContentLayout* = 262144*[](#AcCellProperty.acContentLayout "Link to this definition") - acContentProperties* = 33662*[](#AcCellProperty.acContentProperties "Link to this definition") * acDataFormat* = 4*[](#AcCellProperty.acDataFormat "Link to this definition") - acDataType* = 2*[](#AcCellProperty.acDataType "Link to this definition") * acDataTypeAndFormat* = 6*[](#AcCellProperty.acDataTypeAndFormat "Link to this definition") - acEnableBackgroundColor* = 16384*[](#AcCellProperty.acEnableBackgroundColor "Link to this definition") * acFlowDirBtoT* = 131072*[](#AcCellProperty.acFlowDirBtoT "Link to this definition") - acInvalidCellProperty* = 0*[](#AcCellProperty.acInvalidCellProperty "Link to this definition") * acLock* = 1*[](#AcCellProperty.acLock "Link to this definition") - acMarginBottom* = 8192*[](#AcCellProperty.acMarginBottom "Link to this definition") * acMarginLeft* = 1024*[](#AcCellProperty.acMarginLeft "Link to this definition") - acMarginRight* = 4096*[](#AcCellProperty.acMarginRight "Link to this definition") * acMarginTop* = 2048*[](#AcCellProperty.acMarginTop "Link to this definition") - acMergeAll* = 65536*[](#AcCellProperty.acMergeAll "Link to this definition") * acRotation* = 8*[](#AcCellProperty.acRotation "Link to this definition") - acScale* = 16*[](#AcCellProperty.acScale "Link to this definition") * acTextHeight* = 512*[](#AcCellProperty.acTextHeight "Link to this definition") - acTextStyle* = 256*[](#AcCellProperty.acTextStyle "Link to this definition") <!-- --> ## AcCellState[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcCellState "Direct link to AcCellState") * *class *viktor.external.autocad.enums.AcCellState(*\*values*)[](#AcCellState "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcCellState` values, mirroring the product API’s names so code reads like its docs. * acCellStateContentLocked* = 1*[](#AcCellState.acCellStateContentLocked "Link to this definition") - acCellStateContentModified* = 32*[](#AcCellState.acCellStateContentModified "Link to this definition") * acCellStateContentReadOnly* = 2*[](#AcCellState.acCellStateContentReadOnly "Link to this definition") - acCellStateFormatLocked* = 4*[](#AcCellState.acCellStateFormatLocked "Link to this definition") * acCellStateFormatModified* = 64*[](#AcCellState.acCellStateFormatModified "Link to this definition") - acCellStateFormatReadOnly* = 8*[](#AcCellState.acCellStateFormatReadOnly "Link to this definition") * acCellStateLinked* = 16*[](#AcCellState.acCellStateLinked "Link to this definition") - acCellStateNone* = 0*[](#AcCellState.acCellStateNone "Link to this definition") <!-- --> ## AcCellType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcCellType "Direct link to AcCellType") * *class *viktor.external.autocad.enums.AcCellType(*\*values*)[](#AcCellType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcCellType` values, mirroring the product API’s names so code reads like its docs. * acBlockCell* = 2*[](#AcCellType.acBlockCell "Link to this definition") - acTextCell* = 1*[](#AcCellType.acTextCell "Link to this definition") * acUnknownCell* = 0*[](#AcCellType.acUnknownCell "Link to this definition") <!-- --> ## AcColor[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcColor "Direct link to AcColor") * *class *viktor.external.autocad.enums.AcColor(*\*values*)[](#AcColor "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcColor` values, mirroring the product API’s names so code reads like its docs. * acBlue* = 5*[](#AcColor.acBlue "Link to this definition") - acByBlock* = 0*[](#AcColor.acByBlock "Link to this definition") * acByLayer* = 256*[](#AcColor.acByLayer "Link to this definition") - acCyan* = 4*[](#AcColor.acCyan "Link to this definition") * acGreen* = 3*[](#AcColor.acGreen "Link to this definition") - acMagenta* = 6*[](#AcColor.acMagenta "Link to this definition") * acRed* = 1*[](#AcColor.acRed "Link to this definition") - acWhite* = 7*[](#AcColor.acWhite "Link to this definition") * acYellow* = 2*[](#AcColor.acYellow "Link to this definition") <!-- --> ## AcColorMethod[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcColorMethod "Direct link to AcColorMethod") * *class *viktor.external.autocad.enums.AcColorMethod(*\*values*)[](#AcColorMethod "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcColorMethod` values, mirroring the product API’s names so code reads like its docs. * acColorMethodByACI* = 195*[](#AcColorMethod.acColorMethodByACI "Link to this definition") - acColorMethodByBlock* = 193*[](#AcColorMethod.acColorMethodByBlock "Link to this definition") * acColorMethodByLayer* = 192*[](#AcColorMethod.acColorMethodByLayer "Link to this definition") - acColorMethodByRGB* = 194*[](#AcColorMethod.acColorMethodByRGB "Link to this definition") * acColorMethodForeground* = 197*[](#AcColorMethod.acColorMethodForeground "Link to this definition") <!-- --> ## AcCoordinateSystem[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcCoordinateSystem "Direct link to AcCoordinateSystem") * *class *viktor.external.autocad.enums.AcCoordinateSystem(*\*values*)[](#AcCoordinateSystem "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcCoordinateSystem` values, mirroring the product API’s names so code reads like its docs. * acDisplayDCS* = 2*[](#AcCoordinateSystem.acDisplayDCS "Link to this definition") - acOCS* = 4*[](#AcCoordinateSystem.acOCS "Link to this definition") * acPaperSpaceDCS* = 3*[](#AcCoordinateSystem.acPaperSpaceDCS "Link to this definition") - acUCS* = 1*[](#AcCoordinateSystem.acUCS "Link to this definition") * acWorld* = 0*[](#AcCoordinateSystem.acWorld "Link to this definition") <!-- --> ## AcDataLinkUpdateDirection[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcDataLinkUpdateDirection "Direct link to AcDataLinkUpdateDirection") * *class *viktor.external.autocad.enums.AcDataLinkUpdateDirection(*\*values*)[](#AcDataLinkUpdateDirection "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcDataLinkUpdateDirection` values, mirroring the product API’s names so code reads like its docs. * acUpdateDataFromSource* = 1*[](#AcDataLinkUpdateDirection.acUpdateDataFromSource "Link to this definition") - acUpdateSourceFromData* = 2*[](#AcDataLinkUpdateDirection.acUpdateSourceFromData "Link to this definition") <!-- --> ## AcDataLinkUpdateOption[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcDataLinkUpdateOption "Direct link to AcDataLinkUpdateOption") * *class *viktor.external.autocad.enums.AcDataLinkUpdateOption(*\*values*)[](#AcDataLinkUpdateOption "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcDataLinkUpdateOption` values, mirroring the product API’s names so code reads like its docs. * acUpdateOptionIncludeXrefs* = 1048576*[](#AcDataLinkUpdateOption.acUpdateOptionIncludeXrefs "Link to this definition") - acUpdateOptionNone* = 0*[](#AcDataLinkUpdateOption.acUpdateOptionNone "Link to this definition") * acUpdateOptionOverwriteContentModifiedAfterUpdate* = 131072*[](#AcDataLinkUpdateOption.acUpdateOptionOverwriteContentModifiedAfterUpdate "Link to this definition") - acUpdateOptionOverwriteFormatModifiedAfterUpdate* = 262144*[](#AcDataLinkUpdateOption.acUpdateOptionOverwriteFormatModifiedAfterUpdate "Link to this definition") * acUpdateOptionUpdateFullSourceRange* = 524288*[](#AcDataLinkUpdateOption.acUpdateOptionUpdateFullSourceRange "Link to this definition") <!-- --> ## AcDimArcLengthSymbol[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcDimArcLengthSymbol "Direct link to AcDimArcLengthSymbol") * *class *viktor.external.autocad.enums.AcDimArcLengthSymbol(*\*values*)[](#AcDimArcLengthSymbol "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcDimArcLengthSymbol` values, mirroring the product API’s names so code reads like its docs. * acSymAbove* = 1*[](#AcDimArcLengthSymbol.acSymAbove "Link to this definition") - acSymInFront* = 0*[](#AcDimArcLengthSymbol.acSymInFront "Link to this definition") * acSymNone* = 2*[](#AcDimArcLengthSymbol.acSymNone "Link to this definition") <!-- --> ## AcDimArrowheadType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcDimArrowheadType "Direct link to AcDimArrowheadType") * *class *viktor.external.autocad.enums.AcDimArrowheadType(*\*values*)[](#AcDimArrowheadType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcDimArrowheadType` values, mirroring the product API’s names so code reads like its docs. * acArrowArchTick* = 4*[](#AcDimArrowheadType.acArrowArchTick "Link to this definition") - acArrowBoxBlank* = 14*[](#AcDimArrowheadType.acArrowBoxBlank "Link to this definition") * acArrowBoxFilled* = 15*[](#AcDimArrowheadType.acArrowBoxFilled "Link to this definition") - acArrowClosed* = 2*[](#AcDimArrowheadType.acArrowClosed "Link to this definition") * acArrowClosedBlank* = 1*[](#AcDimArrowheadType.acArrowClosedBlank "Link to this definition") - acArrowDatumBlank* = 16*[](#AcDimArrowheadType.acArrowDatumBlank "Link to this definition") * acArrowDatumFilled* = 17*[](#AcDimArrowheadType.acArrowDatumFilled "Link to this definition") - acArrowDefault* = 0*[](#AcDimArrowheadType.acArrowDefault "Link to this definition") * acArrowDot* = 3*[](#AcDimArrowheadType.acArrowDot "Link to this definition") - acArrowDotBlank* = 12*[](#AcDimArrowheadType.acArrowDotBlank "Link to this definition") * acArrowDotSmall* = 11*[](#AcDimArrowheadType.acArrowDotSmall "Link to this definition") - acArrowIntegral* = 18*[](#AcDimArrowheadType.acArrowIntegral "Link to this definition") * acArrowNone* = 19*[](#AcDimArrowheadType.acArrowNone "Link to this definition") - acArrowOblique* = 5*[](#AcDimArrowheadType.acArrowOblique "Link to this definition") * acArrowOpen* = 6*[](#AcDimArrowheadType.acArrowOpen "Link to this definition") - acArrowOpen30* = 10*[](#AcDimArrowheadType.acArrowOpen30 "Link to this definition") * acArrowOpen90* = 9*[](#AcDimArrowheadType.acArrowOpen90 "Link to this definition") - acArrowOrigin* = 7*[](#AcDimArrowheadType.acArrowOrigin "Link to this definition") * acArrowOrigin2* = 8*[](#AcDimArrowheadType.acArrowOrigin2 "Link to this definition") - acArrowSmall* = 13*[](#AcDimArrowheadType.acArrowSmall "Link to this definition") * acArrowUserDefined* = 20*[](#AcDimArrowheadType.acArrowUserDefined "Link to this definition") <!-- --> ## AcDimCenterType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcDimCenterType "Direct link to AcDimCenterType") * *class *viktor.external.autocad.enums.AcDimCenterType(*\*values*)[](#AcDimCenterType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcDimCenterType` values, mirroring the product API’s names so code reads like its docs. * acCenterLine* = 1*[](#AcDimCenterType.acCenterLine "Link to this definition") - acCenterMark* = 0*[](#AcDimCenterType.acCenterMark "Link to this definition") * acCenterNone* = 2*[](#AcDimCenterType.acCenterNone "Link to this definition") <!-- --> ## AcDimFit[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcDimFit "Direct link to AcDimFit") * *class *viktor.external.autocad.enums.AcDimFit(*\*values*)[](#AcDimFit "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcDimFit` values, mirroring the product API’s names so code reads like its docs. * acArrowsOnly* = 1*[](#AcDimFit.acArrowsOnly "Link to this definition") - acBestFit* = 3*[](#AcDimFit.acBestFit "Link to this definition") * acTextAndArrows* = 0*[](#AcDimFit.acTextAndArrows "Link to this definition") - acTextOnly* = 2*[](#AcDimFit.acTextOnly "Link to this definition") <!-- --> ## AcDimFractionType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcDimFractionType "Direct link to AcDimFractionType") * *class *viktor.external.autocad.enums.AcDimFractionType(*\*values*)[](#AcDimFractionType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcDimFractionType` values, mirroring the product API’s names so code reads like its docs. * acDiagonal* = 1*[](#AcDimFractionType.acDiagonal "Link to this definition") - acHorizontal* = 0*[](#AcDimFractionType.acHorizontal "Link to this definition") * acNotStacked* = 2*[](#AcDimFractionType.acNotStacked "Link to this definition") <!-- --> ## AcDimHorizontalJustification[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcDimHorizontalJustification "Direct link to AcDimHorizontalJustification") * *class *viktor.external.autocad.enums.AcDimHorizontalJustification(*\*values*)[](#AcDimHorizontalJustification "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcDimHorizontalJustification` values, mirroring the product API’s names so code reads like its docs. * acFirstExtensionLine* = 1*[](#AcDimHorizontalJustification.acFirstExtensionLine "Link to this definition") - acHorzCentered* = 0*[](#AcDimHorizontalJustification.acHorzCentered "Link to this definition") * acOverFirstExtension* = 3*[](#AcDimHorizontalJustification.acOverFirstExtension "Link to this definition") - acOverSecondExtension* = 4*[](#AcDimHorizontalJustification.acOverSecondExtension "Link to this definition") * acSecondExtensionLine* = 2*[](#AcDimHorizontalJustification.acSecondExtensionLine "Link to this definition") <!-- --> ## AcDimLUnits[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcDimLUnits "Direct link to AcDimLUnits") * *class *viktor.external.autocad.enums.AcDimLUnits(*\*values*)[](#AcDimLUnits "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcDimLUnits` values, mirroring the product API’s names so code reads like its docs. * acDimLArchitectural* = 4*[](#AcDimLUnits.acDimLArchitectural "Link to this definition") - acDimLDecimal* = 2*[](#AcDimLUnits.acDimLDecimal "Link to this definition") * acDimLEngineering* = 3*[](#AcDimLUnits.acDimLEngineering "Link to this definition") - acDimLFractional* = 5*[](#AcDimLUnits.acDimLFractional "Link to this definition") * acDimLScientific* = 1*[](#AcDimLUnits.acDimLScientific "Link to this definition") - acDimLWindowsDesktop* = 6*[](#AcDimLUnits.acDimLWindowsDesktop "Link to this definition") <!-- --> ## AcDimPrecision[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcDimPrecision "Direct link to AcDimPrecision") * *class *viktor.external.autocad.enums.AcDimPrecision(*\*values*)[](#AcDimPrecision "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcDimPrecision` values, mirroring the product API’s names so code reads like its docs. * acDimPrecisionEight* = 8*[](#AcDimPrecision.acDimPrecisionEight "Link to this definition") - acDimPrecisionFive* = 5*[](#AcDimPrecision.acDimPrecisionFive "Link to this definition") * acDimPrecisionFour* = 4*[](#AcDimPrecision.acDimPrecisionFour "Link to this definition") - acDimPrecisionOne* = 1*[](#AcDimPrecision.acDimPrecisionOne "Link to this definition") * acDimPrecisionSeven* = 7*[](#AcDimPrecision.acDimPrecisionSeven "Link to this definition") - acDimPrecisionSix* = 6*[](#AcDimPrecision.acDimPrecisionSix "Link to this definition") * acDimPrecisionThree* = 3*[](#AcDimPrecision.acDimPrecisionThree "Link to this definition") - acDimPrecisionTwo* = 2*[](#AcDimPrecision.acDimPrecisionTwo "Link to this definition") * acDimPrecisionZero* = 0*[](#AcDimPrecision.acDimPrecisionZero "Link to this definition") <!-- --> ## AcDimTextMovement[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcDimTextMovement "Direct link to AcDimTextMovement") * *class *viktor.external.autocad.enums.AcDimTextMovement(*\*values*)[](#AcDimTextMovement "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcDimTextMovement` values, mirroring the product API’s names so code reads like its docs. * acDimLineWithText* = 0*[](#AcDimTextMovement.acDimLineWithText "Link to this definition") - acMoveTextAddLeader* = 1*[](#AcDimTextMovement.acMoveTextAddLeader "Link to this definition") * acMoveTextNoLeader* = 2*[](#AcDimTextMovement.acMoveTextNoLeader "Link to this definition") <!-- --> ## AcDimToleranceJustify[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcDimToleranceJustify "Direct link to AcDimToleranceJustify") * *class *viktor.external.autocad.enums.AcDimToleranceJustify(*\*values*)[](#AcDimToleranceJustify "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcDimToleranceJustify` values, mirroring the product API’s names so code reads like its docs. * acTolBottom* = 0*[](#AcDimToleranceJustify.acTolBottom "Link to this definition") - acTolMiddle* = 1*[](#AcDimToleranceJustify.acTolMiddle "Link to this definition") * acTolTop* = 2*[](#AcDimToleranceJustify.acTolTop "Link to this definition") <!-- --> ## AcDimToleranceMethod[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcDimToleranceMethod "Direct link to AcDimToleranceMethod") * *class *viktor.external.autocad.enums.AcDimToleranceMethod(*\*values*)[](#AcDimToleranceMethod "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcDimToleranceMethod` values, mirroring the product API’s names so code reads like its docs. * acTolBasic* = 4*[](#AcDimToleranceMethod.acTolBasic "Link to this definition") - acTolDeviation* = 2*[](#AcDimToleranceMethod.acTolDeviation "Link to this definition") * acTolLimits* = 3*[](#AcDimToleranceMethod.acTolLimits "Link to this definition") - acTolNone* = 0*[](#AcDimToleranceMethod.acTolNone "Link to this definition") * acTolSymmetrical* = 1*[](#AcDimToleranceMethod.acTolSymmetrical "Link to this definition") <!-- --> ## AcDimUnits[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcDimUnits "Direct link to AcDimUnits") * *class *viktor.external.autocad.enums.AcDimUnits(*\*values*)[](#AcDimUnits "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcDimUnits` values, mirroring the product API’s names so code reads like its docs. * acDimArchitectural* = 6*[](#AcDimUnits.acDimArchitectural "Link to this definition") - acDimArchitecturalStacked* = 4*[](#AcDimUnits.acDimArchitecturalStacked "Link to this definition") * acDimDecimal* = 2*[](#AcDimUnits.acDimDecimal "Link to this definition") - acDimEngineering* = 3*[](#AcDimUnits.acDimEngineering "Link to this definition") * acDimFractional* = 7*[](#AcDimUnits.acDimFractional "Link to this definition") - acDimFractionalStacked* = 5*[](#AcDimUnits.acDimFractionalStacked "Link to this definition") * acDimScientific* = 1*[](#AcDimUnits.acDimScientific "Link to this definition") - acDimWindowsDesktop* = 8*[](#AcDimUnits.acDimWindowsDesktop "Link to this definition") <!-- --> ## AcDimVerticalJustification[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcDimVerticalJustification "Direct link to AcDimVerticalJustification") * *class *viktor.external.autocad.enums.AcDimVerticalJustification(*\*values*)[](#AcDimVerticalJustification "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcDimVerticalJustification` values, mirroring the product API’s names so code reads like its docs. * acAbove* = 1*[](#AcDimVerticalJustification.acAbove "Link to this definition") - acJIS* = 3*[](#AcDimVerticalJustification.acJIS "Link to this definition") * acOutside* = 2*[](#AcDimVerticalJustification.acOutside "Link to this definition") - acUnder* = 4*[](#AcDimVerticalJustification.acUnder "Link to this definition") * acVertCentered* = 0*[](#AcDimVerticalJustification.acVertCentered "Link to this definition") <!-- --> ## AcDragDisplayMode[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcDragDisplayMode "Direct link to AcDragDisplayMode") * *class *viktor.external.autocad.enums.AcDragDisplayMode(*\*values*)[](#AcDragDisplayMode "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcDragDisplayMode` values, mirroring the product API’s names so code reads like its docs. * acDragDisplayAutomatically* = 2*[](#AcDragDisplayMode.acDragDisplayAutomatically "Link to this definition") - acDragDisplayOnRequest* = 1*[](#AcDragDisplayMode.acDragDisplayOnRequest "Link to this definition") * acDragDoNotDisplay* = 0*[](#AcDragDisplayMode.acDragDoNotDisplay "Link to this definition") <!-- --> ## AcDrawLeaderOrderType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcDrawLeaderOrderType "Direct link to AcDrawLeaderOrderType") * *class *viktor.external.autocad.enums.AcDrawLeaderOrderType(*\*values*)[](#AcDrawLeaderOrderType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcDrawLeaderOrderType` values, mirroring the product API’s names so code reads like its docs. * acDrawLeaderHeadFirst* = 0*[](#AcDrawLeaderOrderType.acDrawLeaderHeadFirst "Link to this definition") - acDrawLeaderTailFirst* = 1*[](#AcDrawLeaderOrderType.acDrawLeaderTailFirst "Link to this definition") <!-- --> ## AcDrawMLeaderOrderType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcDrawMLeaderOrderType "Direct link to AcDrawMLeaderOrderType") * *class *viktor.external.autocad.enums.AcDrawMLeaderOrderType(*\*values*)[](#AcDrawMLeaderOrderType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcDrawMLeaderOrderType` values, mirroring the product API’s names so code reads like its docs. * acDrawContentFirst* = 0*[](#AcDrawMLeaderOrderType.acDrawContentFirst "Link to this definition") - acDrawLeaderFirst* = 1*[](#AcDrawMLeaderOrderType.acDrawLeaderFirst "Link to this definition") <!-- --> ## AcDrawingAreaSCMCommand[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcDrawingAreaSCMCommand "Direct link to AcDrawingAreaSCMCommand") * *class *viktor.external.autocad.enums.AcDrawingAreaSCMCommand(*\*values*)[](#AcDrawingAreaSCMCommand "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcDrawingAreaSCMCommand` values, mirroring the product API’s names so code reads like its docs. * acEnableSCM* = 2*[](#AcDrawingAreaSCMCommand.acEnableSCM "Link to this definition") - acEnableSCMOptions* = 1*[](#AcDrawingAreaSCMCommand.acEnableSCMOptions "Link to this definition") * acEnter* = 0*[](#AcDrawingAreaSCMCommand.acEnter "Link to this definition") <!-- --> ## AcDrawingAreaSCMDefault[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcDrawingAreaSCMDefault "Direct link to AcDrawingAreaSCMDefault") * *class *viktor.external.autocad.enums.AcDrawingAreaSCMDefault(*\*values*)[](#AcDrawingAreaSCMDefault "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcDrawingAreaSCMDefault` values, mirroring the product API’s names so code reads like its docs. * acRepeatLastCommand* = 0*[](#AcDrawingAreaSCMDefault.acRepeatLastCommand "Link to this definition") - acSCM* = 1*[](#AcDrawingAreaSCMDefault.acSCM "Link to this definition") <!-- --> ## AcDrawingAreaSCMEdit[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcDrawingAreaSCMEdit "Direct link to AcDrawingAreaSCMEdit") * *class *viktor.external.autocad.enums.AcDrawingAreaSCMEdit(*\*values*)[](#AcDrawingAreaSCMEdit "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcDrawingAreaSCMEdit` values, mirroring the product API’s names so code reads like its docs. * acEdRepeatLastCommand* = 0*[](#AcDrawingAreaSCMEdit.acEdRepeatLastCommand "Link to this definition") - acEdSCM* = 1*[](#AcDrawingAreaSCMEdit.acEdSCM "Link to this definition") <!-- --> ## AcDrawingAreaShortCutMenu[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcDrawingAreaShortCutMenu "Direct link to AcDrawingAreaShortCutMenu") * *class *viktor.external.autocad.enums.AcDrawingAreaShortCutMenu(*\*values*)[](#AcDrawingAreaShortCutMenu "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcDrawingAreaShortCutMenu` values, mirroring the product API’s names so code reads like its docs. * acNoDrawingAreaShortCutMenu* = 0*[](#AcDrawingAreaShortCutMenu.acNoDrawingAreaShortCutMenu "Link to this definition") - acUseDefaultDrawingAreaShortCutMenu* = 1*[](#AcDrawingAreaShortCutMenu.acUseDefaultDrawingAreaShortCutMenu "Link to this definition") <!-- --> ## AcDrawingDirection[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcDrawingDirection "Direct link to AcDrawingDirection") * *class *viktor.external.autocad.enums.AcDrawingDirection(*\*values*)[](#AcDrawingDirection "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcDrawingDirection` values, mirroring the product API’s names so code reads like its docs. * acBottomToTop* = 4*[](#AcDrawingDirection.acBottomToTop "Link to this definition") - acByStyle* = 5*[](#AcDrawingDirection.acByStyle "Link to this definition") * acLeftToRight* = 1*[](#AcDrawingDirection.acLeftToRight "Link to this definition") - acRightToLeft* = 2*[](#AcDrawingDirection.acRightToLeft "Link to this definition") * acTopToBottom* = 3*[](#AcDrawingDirection.acTopToBottom "Link to this definition") <!-- --> ## AcDynamicBlockReferencePropertyUnitsType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcDynamicBlockReferencePropertyUnitsType "Direct link to AcDynamicBlockReferencePropertyUnitsType") * *class *viktor.external.autocad.enums.AcDynamicBlockReferencePropertyUnitsType(*\*values*)[](#AcDynamicBlockReferencePropertyUnitsType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcDynamicBlockReferencePropertyUnitsType` values, mirroring the product API’s names so code reads like its docs. * acAngular* = 1*[](#AcDynamicBlockReferencePropertyUnitsType.acAngular "Link to this definition") - acArea* = 3*[](#AcDynamicBlockReferencePropertyUnitsType.acArea "Link to this definition") * acDistance* = 2*[](#AcDynamicBlockReferencePropertyUnitsType.acDistance "Link to this definition") - acNoUnits* = 0*[](#AcDynamicBlockReferencePropertyUnitsType.acNoUnits "Link to this definition") <!-- --> ## AcEntityName[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcEntityName "Direct link to AcEntityName") * *class *viktor.external.autocad.enums.AcEntityName(*\*values*)[](#AcEntityName "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcEntityName` values, mirroring the product API’s names so code reads like its docs. * ac3dFace* = 1*[](#AcEntityName.ac3dFace "Link to this definition") - ac3dPolyline* = 2*[](#AcEntityName.ac3dPolyline "Link to this definition") * ac3dSolid* = 3*[](#AcEntityName.ac3dSolid "Link to this definition") - acArc* = 4*[](#AcEntityName.acArc "Link to this definition") * acAttribute* = 5*[](#AcEntityName.acAttribute "Link to this definition") - acAttributeReference* = 6*[](#AcEntityName.acAttributeReference "Link to this definition") * acBlockReference* = 7*[](#AcEntityName.acBlockReference "Link to this definition") - acCircle* = 8*[](#AcEntityName.acCircle "Link to this definition") * acDgnUnderlay* = 47*[](#AcEntityName.acDgnUnderlay "Link to this definition") - acDim3PointAngular* = 41*[](#AcEntityName.acDim3PointAngular "Link to this definition") * acDimAligned* = 9*[](#AcEntityName.acDimAligned "Link to this definition") - acDimAngular* = 10*[](#AcEntityName.acDimAngular "Link to this definition") * acDimArcLength* = 44*[](#AcEntityName.acDimArcLength "Link to this definition") - acDimDiametric* = 12*[](#AcEntityName.acDimDiametric "Link to this definition") * acDimOrdinate* = 13*[](#AcEntityName.acDimOrdinate "Link to this definition") - acDimRadial* = 14*[](#AcEntityName.acDimRadial "Link to this definition") * acDimRadialLarge* = 45*[](#AcEntityName.acDimRadialLarge "Link to this definition") - acDimRotated* = 15*[](#AcEntityName.acDimRotated "Link to this definition") * acDwfUnderlay* = 46*[](#AcEntityName.acDwfUnderlay "Link to this definition") - acEllipse* = 16*[](#AcEntityName.acEllipse "Link to this definition") * acExternalReference* = 42*[](#AcEntityName.acExternalReference "Link to this definition") - acGroup* = 37*[](#AcEntityName.acGroup "Link to this definition") * acHatch* = 17*[](#AcEntityName.acHatch "Link to this definition") - acLeader* = 18*[](#AcEntityName.acLeader "Link to this definition") * acLine* = 19*[](#AcEntityName.acLine "Link to this definition") - acMInsertBlock* = 38*[](#AcEntityName.acMInsertBlock "Link to this definition") * acMLeader* = 48*[](#AcEntityName.acMLeader "Link to this definition") - acMLine* = 40*[](#AcEntityName.acMLine "Link to this definition") * acMtext* = 21*[](#AcEntityName.acMtext "Link to this definition") - acNurbSurface* = 51*[](#AcEntityName.acNurbSurface "Link to this definition") * acPViewport* = 35*[](#AcEntityName.acPViewport "Link to this definition") - acPdfUnderlay* = 50*[](#AcEntityName.acPdfUnderlay "Link to this definition") * acPoint* = 22*[](#AcEntityName.acPoint "Link to this definition") - acPolyfaceMesh* = 39*[](#AcEntityName.acPolyfaceMesh "Link to this definition") * acPolyline* = 23*[](#AcEntityName.acPolyline "Link to this definition") - acPolylineLight* = 24*[](#AcEntityName.acPolylineLight "Link to this definition") * acPolymesh* = 25*[](#AcEntityName.acPolymesh "Link to this definition") - acRaster* = 26*[](#AcEntityName.acRaster "Link to this definition") * acRay* = 27*[](#AcEntityName.acRay "Link to this definition") - acRegion* = 28*[](#AcEntityName.acRegion "Link to this definition") * acShape* = 29*[](#AcEntityName.acShape "Link to this definition") - acSolid* = 30*[](#AcEntityName.acSolid "Link to this definition") * acSpline* = 31*[](#AcEntityName.acSpline "Link to this definition") - acSubDMesh* = 49*[](#AcEntityName.acSubDMesh "Link to this definition") * acTable* = 43*[](#AcEntityName.acTable "Link to this definition") - acText* = 32*[](#AcEntityName.acText "Link to this definition") * acTolerance* = 33*[](#AcEntityName.acTolerance "Link to this definition") - acTrace* = 34*[](#AcEntityName.acTrace "Link to this definition") * acXline* = 36*[](#AcEntityName.acXline "Link to this definition") <!-- --> ## AcExtendOption[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcExtendOption "Direct link to AcExtendOption") * *class *viktor.external.autocad.enums.AcExtendOption(*\*values*)[](#AcExtendOption "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcExtendOption` values, mirroring the product API’s names so code reads like its docs. * acExtendBoth* = 3*[](#AcExtendOption.acExtendBoth "Link to this definition") - acExtendNone* = 0*[](#AcExtendOption.acExtendNone "Link to this definition") * acExtendOtherEntity* = 2*[](#AcExtendOption.acExtendOtherEntity "Link to this definition") - acExtendThisEntity* = 1*[](#AcExtendOption.acExtendThisEntity "Link to this definition") <!-- --> ## AcFormatOption[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcFormatOption "Direct link to AcFormatOption") * *class *viktor.external.autocad.enums.AcFormatOption(*\*values*)[](#AcFormatOption "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcFormatOption` values, mirroring the product API’s names so code reads like its docs. * acForEditing* = 1*[](#AcFormatOption.acForEditing "Link to this definition") - acForExpression* = 2*[](#AcFormatOption.acForExpression "Link to this definition") * acIgnoreMtextFormat* = 8*[](#AcFormatOption.acIgnoreMtextFormat "Link to this definition") - acUseMaximumPrecision* = 4*[](#AcFormatOption.acUseMaximumPrecision "Link to this definition") * kFormatOptionNone* = 0*[](#AcFormatOption.kFormatOptionNone "Link to this definition") <!-- --> ## AcGradientPatternType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcGradientPatternType "Direct link to AcGradientPatternType") * *class *viktor.external.autocad.enums.AcGradientPatternType(*\*values*)[](#AcGradientPatternType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcGradientPatternType` values, mirroring the product API’s names so code reads like its docs. * acPreDefinedGradient* = 0*[](#AcGradientPatternType.acPreDefinedGradient "Link to this definition") - acUserDefinedGradient* = 1*[](#AcGradientPatternType.acUserDefinedGradient "Link to this definition") <!-- --> ## AcGridLineStyle[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcGridLineStyle "Direct link to AcGridLineStyle") * *class *viktor.external.autocad.enums.AcGridLineStyle(*\*values*)[](#AcGridLineStyle "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcGridLineStyle` values, mirroring the product API’s names so code reads like its docs. * acGridLineStyleDouble* = 2*[](#AcGridLineStyle.acGridLineStyleDouble "Link to this definition") - acGridLineStyleSingle* = 1*[](#AcGridLineStyle.acGridLineStyleSingle "Link to this definition") <!-- --> ## AcGridLineType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcGridLineType "Direct link to AcGridLineType") * *class *viktor.external.autocad.enums.AcGridLineType(*\*values*)[](#AcGridLineType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcGridLineType` values, mirroring the product API’s names so code reads like its docs. * acHorzBottom* = 4*[](#AcGridLineType.acHorzBottom "Link to this definition") - acHorzInside* = 2*[](#AcGridLineType.acHorzInside "Link to this definition") * acHorzTop* = 1*[](#AcGridLineType.acHorzTop "Link to this definition") - acInvalidGridLine* = 0*[](#AcGridLineType.acInvalidGridLine "Link to this definition") * acVertInside* = 16*[](#AcGridLineType.acVertInside "Link to this definition") - acVertLeft* = 8*[](#AcGridLineType.acVertLeft "Link to this definition") * acVertRight* = 32*[](#AcGridLineType.acVertRight "Link to this definition") <!-- --> ## AcHatchObjectType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcHatchObjectType "Direct link to AcHatchObjectType") * *class *viktor.external.autocad.enums.AcHatchObjectType(*\*values*)[](#AcHatchObjectType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcHatchObjectType` values, mirroring the product API’s names so code reads like its docs. * acGradientObject* = 1*[](#AcHatchObjectType.acGradientObject "Link to this definition") - acHatchObject* = 0*[](#AcHatchObjectType.acHatchObject "Link to this definition") <!-- --> ## AcHatchStyle[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcHatchStyle "Direct link to AcHatchStyle") * *class *viktor.external.autocad.enums.AcHatchStyle(*\*values*)[](#AcHatchStyle "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcHatchStyle` values, mirroring the product API’s names so code reads like its docs. * acHatchStyleIgnore* = 2*[](#AcHatchStyle.acHatchStyleIgnore "Link to this definition") - acHatchStyleNormal* = 0*[](#AcHatchStyle.acHatchStyleNormal "Link to this definition") * acHatchStyleOuter* = 1*[](#AcHatchStyle.acHatchStyleOuter "Link to this definition") <!-- --> ## AcHelixConstrainType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcHelixConstrainType "Direct link to AcHelixConstrainType") * *class *viktor.external.autocad.enums.AcHelixConstrainType(*\*values*)[](#AcHelixConstrainType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcHelixConstrainType` values, mirroring the product API’s names so code reads like its docs. * acHeight* = 2*[](#AcHelixConstrainType.acHeight "Link to this definition") - acTurnHeight* = 0*[](#AcHelixConstrainType.acTurnHeight "Link to this definition") * acTurns* = 1*[](#AcHelixConstrainType.acTurns "Link to this definition") <!-- --> ## AcHelixTwistType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcHelixTwistType "Direct link to AcHelixTwistType") * *class *viktor.external.autocad.enums.AcHelixTwistType(*\*values*)[](#AcHelixTwistType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcHelixTwistType` values, mirroring the product API’s names so code reads like its docs. * acCCW* = 0*[](#AcHelixTwistType.acCCW "Link to this definition") - acCW* = 1*[](#AcHelixTwistType.acCW "Link to this definition") <!-- --> ## AcHorizontalAlignment[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcHorizontalAlignment "Direct link to AcHorizontalAlignment") * *class *viktor.external.autocad.enums.AcHorizontalAlignment(*\*values*)[](#AcHorizontalAlignment "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcHorizontalAlignment` values, mirroring the product API’s names so code reads like its docs. * acHorizontalAlignmentAligned* = 3*[](#AcHorizontalAlignment.acHorizontalAlignmentAligned "Link to this definition") - acHorizontalAlignmentCenter* = 1*[](#AcHorizontalAlignment.acHorizontalAlignmentCenter "Link to this definition") * acHorizontalAlignmentFit* = 5*[](#AcHorizontalAlignment.acHorizontalAlignmentFit "Link to this definition") - acHorizontalAlignmentLeft* = 0*[](#AcHorizontalAlignment.acHorizontalAlignmentLeft "Link to this definition") * acHorizontalAlignmentMiddle* = 4*[](#AcHorizontalAlignment.acHorizontalAlignmentMiddle "Link to this definition") - acHorizontalAlignmentRight* = 2*[](#AcHorizontalAlignment.acHorizontalAlignmentRight "Link to this definition") <!-- --> ## AcISOPenWidth[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcISOPenWidth "Direct link to AcISOPenWidth") * *class *viktor.external.autocad.enums.AcISOPenWidth(*\*values*)[](#AcISOPenWidth "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcISOPenWidth` values, mirroring the product API’s names so code reads like its docs. * acPenWidth013* = 13*[](#AcISOPenWidth.acPenWidth013 "Link to this definition") - acPenWidth018* = 18*[](#AcISOPenWidth.acPenWidth018 "Link to this definition") * acPenWidth025* = 25*[](#AcISOPenWidth.acPenWidth025 "Link to this definition") - acPenWidth035* = 35*[](#AcISOPenWidth.acPenWidth035 "Link to this definition") * acPenWidth050* = 50*[](#AcISOPenWidth.acPenWidth050 "Link to this definition") - acPenWidth070* = 70*[](#AcISOPenWidth.acPenWidth070 "Link to this definition") * acPenWidth100* = 100*[](#AcISOPenWidth.acPenWidth100 "Link to this definition") - acPenWidth140* = 140*[](#AcISOPenWidth.acPenWidth140 "Link to this definition") * acPenWidth200* = 200*[](#AcISOPenWidth.acPenWidth200 "Link to this definition") - acPenWidthUnk* = -1*[](#AcISOPenWidth.acPenWidthUnk "Link to this definition") <!-- --> ## AcInsertUnits[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcInsertUnits "Direct link to AcInsertUnits") * *class *viktor.external.autocad.enums.AcInsertUnits(*\*values*)[](#AcInsertUnits "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcInsertUnits` values, mirroring the product API’s names so code reads like its docs. * acInsertUnitsAngstroms* = 11*[](#AcInsertUnits.acInsertUnitsAngstroms "Link to this definition") - acInsertUnitsAstronomicalUnits* = 18*[](#AcInsertUnits.acInsertUnitsAstronomicalUnits "Link to this definition") * acInsertUnitsCentimeters* = 5*[](#AcInsertUnits.acInsertUnitsCentimeters "Link to this definition") - acInsertUnitsDecameters* = 15*[](#AcInsertUnits.acInsertUnitsDecameters "Link to this definition") * acInsertUnitsDecimeters* = 14*[](#AcInsertUnits.acInsertUnitsDecimeters "Link to this definition") - acInsertUnitsFeet* = 2*[](#AcInsertUnits.acInsertUnitsFeet "Link to this definition") * acInsertUnitsGigameters* = 17*[](#AcInsertUnits.acInsertUnitsGigameters "Link to this definition") - acInsertUnitsHectometers* = 16*[](#AcInsertUnits.acInsertUnitsHectometers "Link to this definition") * acInsertUnitsInches* = 1*[](#AcInsertUnits.acInsertUnitsInches "Link to this definition") - acInsertUnitsKilometers* = 7*[](#AcInsertUnits.acInsertUnitsKilometers "Link to this definition") * acInsertUnitsLightYears* = 19*[](#AcInsertUnits.acInsertUnitsLightYears "Link to this definition") - acInsertUnitsMeters* = 6*[](#AcInsertUnits.acInsertUnitsMeters "Link to this definition") * acInsertUnitsMicroinches* = 8*[](#AcInsertUnits.acInsertUnitsMicroinches "Link to this definition") - acInsertUnitsMicrons* = 13*[](#AcInsertUnits.acInsertUnitsMicrons "Link to this definition") * acInsertUnitsMiles* = 3*[](#AcInsertUnits.acInsertUnitsMiles "Link to this definition") - acInsertUnitsMillimeters* = 4*[](#AcInsertUnits.acInsertUnitsMillimeters "Link to this definition") * acInsertUnitsMils* = 9*[](#AcInsertUnits.acInsertUnitsMils "Link to this definition") - acInsertUnitsNanometers* = 12*[](#AcInsertUnits.acInsertUnitsNanometers "Link to this definition") * acInsertUnitsParsecs* = 20*[](#AcInsertUnits.acInsertUnitsParsecs "Link to this definition") - acInsertUnitsUSSurveyFeet* = 21*[](#AcInsertUnits.acInsertUnitsUSSurveyFeet "Link to this definition") * acInsertUnitsUSSurveyInch* = 22*[](#AcInsertUnits.acInsertUnitsUSSurveyInch "Link to this definition") - acInsertUnitsUSSurveyMile* = 24*[](#AcInsertUnits.acInsertUnitsUSSurveyMile "Link to this definition") * acInsertUnitsUSSurveyYard* = 23*[](#AcInsertUnits.acInsertUnitsUSSurveyYard "Link to this definition") - acInsertUnitsUnitless* = 0*[](#AcInsertUnits.acInsertUnitsUnitless "Link to this definition") * acInsertUnitsYards* = 10*[](#AcInsertUnits.acInsertUnitsYards "Link to this definition") <!-- --> ## AcInsertUnitsAction[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcInsertUnitsAction "Direct link to AcInsertUnitsAction") * *class *viktor.external.autocad.enums.AcInsertUnitsAction(*\*values*)[](#AcInsertUnitsAction "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcInsertUnitsAction` values, mirroring the product API’s names so code reads like its docs. * acInsertUnitsAutoAssign* = 1*[](#AcInsertUnitsAction.acInsertUnitsAutoAssign "Link to this definition") - acInsertUnitsPrompt* = 0*[](#AcInsertUnitsAction.acInsertUnitsPrompt "Link to this definition") <!-- --> ## AcKeyboardAccelerator[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcKeyboardAccelerator "Direct link to AcKeyboardAccelerator") * *class *viktor.external.autocad.enums.AcKeyboardAccelerator(*\*values*)[](#AcKeyboardAccelerator "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcKeyboardAccelerator` values, mirroring the product API’s names so code reads like its docs. * acPreferenceClassic* = 0*[](#AcKeyboardAccelerator.acPreferenceClassic "Link to this definition") - acPreferenceCustom* = 1*[](#AcKeyboardAccelerator.acPreferenceCustom "Link to this definition") <!-- --> ## AcKeyboardPriority[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcKeyboardPriority "Direct link to AcKeyboardPriority") * *class *viktor.external.autocad.enums.AcKeyboardPriority(*\*values*)[](#AcKeyboardPriority "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcKeyboardPriority` values, mirroring the product API’s names so code reads like its docs. * acKeyboardEntry* = 1*[](#AcKeyboardPriority.acKeyboardEntry "Link to this definition") - acKeyboardEntryExceptScripts* = 2*[](#AcKeyboardPriority.acKeyboardEntryExceptScripts "Link to this definition") * acKeyboardRunningObjSnap* = 0*[](#AcKeyboardPriority.acKeyboardRunningObjSnap "Link to this definition") <!-- --> ## AcLayerStateMask[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcLayerStateMask "Direct link to AcLayerStateMask") * *class *viktor.external.autocad.enums.AcLayerStateMask(*\*values*)[](#AcLayerStateMask "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcLayerStateMask` values, mirroring the product API’s names so code reads like its docs. * acLsAll* = 65535*[](#AcLayerStateMask.acLsAll "Link to this definition") - acLsColor* = 32*[](#AcLayerStateMask.acLsColor "Link to this definition") * acLsFrozen* = 2*[](#AcLayerStateMask.acLsFrozen "Link to this definition") - acLsLineType* = 64*[](#AcLayerStateMask.acLsLineType "Link to this definition") * acLsLineWeight* = 128*[](#AcLayerStateMask.acLsLineWeight "Link to this definition") - acLsLocked* = 4*[](#AcLayerStateMask.acLsLocked "Link to this definition") * acLsNewViewport* = 16*[](#AcLayerStateMask.acLsNewViewport "Link to this definition") - acLsNone* = 0*[](#AcLayerStateMask.acLsNone "Link to this definition") * acLsOn* = 1*[](#AcLayerStateMask.acLsOn "Link to this definition") - acLsPlot* = 8*[](#AcLayerStateMask.acLsPlot "Link to this definition") * acLsPlotStyle* = 256*[](#AcLayerStateMask.acLsPlotStyle "Link to this definition") <!-- --> ## AcLeaderType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcLeaderType "Direct link to AcLeaderType") * *class *viktor.external.autocad.enums.AcLeaderType(*\*values*)[](#AcLeaderType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcLeaderType` values, mirroring the product API’s names so code reads like its docs. * acLineNoArrow* = 0*[](#AcLeaderType.acLineNoArrow "Link to this definition") - acLineWithArrow* = 2*[](#AcLeaderType.acLineWithArrow "Link to this definition") * acSplineNoArrow* = 1*[](#AcLeaderType.acSplineNoArrow "Link to this definition") - acSplineWithArrow* = 3*[](#AcLeaderType.acSplineWithArrow "Link to this definition") <!-- --> ## AcLineSpacingStyle[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcLineSpacingStyle "Direct link to AcLineSpacingStyle") * *class *viktor.external.autocad.enums.AcLineSpacingStyle(*\*values*)[](#AcLineSpacingStyle "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcLineSpacingStyle` values, mirroring the product API’s names so code reads like its docs. * acLineSpacingStyleAtLeast* = 1*[](#AcLineSpacingStyle.acLineSpacingStyleAtLeast "Link to this definition") - acLineSpacingStyleExactly* = 2*[](#AcLineSpacingStyle.acLineSpacingStyleExactly "Link to this definition") <!-- --> ## AcLineWeight[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcLineWeight "Direct link to AcLineWeight") * *class *viktor.external.autocad.enums.AcLineWeight(*\*values*)[](#AcLineWeight "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcLineWeight` values, mirroring the product API’s names so code reads like its docs. * acLnWt000* = 0*[](#AcLineWeight.acLnWt000 "Link to this definition") - acLnWt005* = 5*[](#AcLineWeight.acLnWt005 "Link to this definition") * acLnWt009* = 9*[](#AcLineWeight.acLnWt009 "Link to this definition") - acLnWt013* = 13*[](#AcLineWeight.acLnWt013 "Link to this definition") * acLnWt015* = 15*[](#AcLineWeight.acLnWt015 "Link to this definition") - acLnWt018* = 18*[](#AcLineWeight.acLnWt018 "Link to this definition") * acLnWt020* = 20*[](#AcLineWeight.acLnWt020 "Link to this definition") - acLnWt025* = 25*[](#AcLineWeight.acLnWt025 "Link to this definition") * acLnWt030* = 30*[](#AcLineWeight.acLnWt030 "Link to this definition") - acLnWt035* = 35*[](#AcLineWeight.acLnWt035 "Link to this definition") * acLnWt040* = 40*[](#AcLineWeight.acLnWt040 "Link to this definition") - acLnWt050* = 50*[](#AcLineWeight.acLnWt050 "Link to this definition") * acLnWt053* = 53*[](#AcLineWeight.acLnWt053 "Link to this definition") - acLnWt060* = 60*[](#AcLineWeight.acLnWt060 "Link to this definition") * acLnWt070* = 70*[](#AcLineWeight.acLnWt070 "Link to this definition") - acLnWt080* = 80*[](#AcLineWeight.acLnWt080 "Link to this definition") * acLnWt090* = 90*[](#AcLineWeight.acLnWt090 "Link to this definition") - acLnWt100* = 100*[](#AcLineWeight.acLnWt100 "Link to this definition") * acLnWt106* = 106*[](#AcLineWeight.acLnWt106 "Link to this definition") - acLnWt120* = 120*[](#AcLineWeight.acLnWt120 "Link to this definition") * acLnWt140* = 140*[](#AcLineWeight.acLnWt140 "Link to this definition") - acLnWt158* = 158*[](#AcLineWeight.acLnWt158 "Link to this definition") * acLnWt200* = 200*[](#AcLineWeight.acLnWt200 "Link to this definition") - acLnWt211* = 211*[](#AcLineWeight.acLnWt211 "Link to this definition") * acLnWtByBlock* = -2*[](#AcLineWeight.acLnWtByBlock "Link to this definition") - acLnWtByLayer* = -1*[](#AcLineWeight.acLnWtByLayer "Link to this definition") * acLnWtByLwDefault* = -3*[](#AcLineWeight.acLnWtByLwDefault "Link to this definition") <!-- --> ## AcLoadPalette[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcLoadPalette "Direct link to AcLoadPalette") * *class *viktor.external.autocad.enums.AcLoadPalette(*\*values*)[](#AcLoadPalette "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcLoadPalette` values, mirroring the product API’s names so code reads like its docs. * acPaletteByDrawing* = 0*[](#AcLoadPalette.acPaletteByDrawing "Link to this definition") - acPaletteBySession* = 1*[](#AcLoadPalette.acPaletteBySession "Link to this definition") <!-- --> ## AcLoftedSurfaceNormalType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcLoftedSurfaceNormalType "Direct link to AcLoftedSurfaceNormalType") * *class *viktor.external.autocad.enums.AcLoftedSurfaceNormalType(*\*values*)[](#AcLoftedSurfaceNormalType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcLoftedSurfaceNormalType` values, mirroring the product API’s names so code reads like its docs. * acAllNormal* = 5*[](#AcLoftedSurfaceNormalType.acAllNormal "Link to this definition") - acEndsNormal* = 4*[](#AcLoftedSurfaceNormalType.acEndsNormal "Link to this definition") * acFirstNormal* = 2*[](#AcLoftedSurfaceNormalType.acFirstNormal "Link to this definition") - acLastNormal* = 3*[](#AcLoftedSurfaceNormalType.acLastNormal "Link to this definition") * acRuled* = 0*[](#AcLoftedSurfaceNormalType.acRuled "Link to this definition") - acSmooth* = 1*[](#AcLoftedSurfaceNormalType.acSmooth "Link to this definition") * acUseDraftAngles* = 6*[](#AcLoftedSurfaceNormalType.acUseDraftAngles "Link to this definition") <!-- --> ## AcLoopType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcLoopType "Direct link to AcLoopType") * *class *viktor.external.autocad.enums.AcLoopType(*\*values*)[](#AcLoopType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcLoopType` values, mirroring the product API’s names so code reads like its docs. * acHatchLoopTypeDefault* = 0*[](#AcLoopType.acHatchLoopTypeDefault "Link to this definition") - acHatchLoopTypeDerived* = 4*[](#AcLoopType.acHatchLoopTypeDerived "Link to this definition") * acHatchLoopTypeExternal* = 1*[](#AcLoopType.acHatchLoopTypeExternal "Link to this definition") - acHatchLoopTypePolyline* = 2*[](#AcLoopType.acHatchLoopTypePolyline "Link to this definition") * acHatchLoopTypeTextbox* = 8*[](#AcLoopType.acHatchLoopTypeTextbox "Link to this definition") <!-- --> ## AcMLeaderContentType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcMLeaderContentType "Direct link to AcMLeaderContentType") * *class *viktor.external.autocad.enums.AcMLeaderContentType(*\*values*)[](#AcMLeaderContentType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcMLeaderContentType` values, mirroring the product API’s names so code reads like its docs. * acBlockContent* = 1*[](#AcMLeaderContentType.acBlockContent "Link to this definition") - acMTextContent* = 2*[](#AcMLeaderContentType.acMTextContent "Link to this definition") * acNoneContent* = 0*[](#AcMLeaderContentType.acNoneContent "Link to this definition") <!-- --> ## AcMLeaderType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcMLeaderType "Direct link to AcMLeaderType") * *class *viktor.external.autocad.enums.AcMLeaderType(*\*values*)[](#AcMLeaderType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcMLeaderType` values, mirroring the product API’s names so code reads like its docs. * acInVisibleLeader* = 0*[](#AcMLeaderType.acInVisibleLeader "Link to this definition") - acSplineLeader* = 2*[](#AcMLeaderType.acSplineLeader "Link to this definition") * acStraightLeader* = 1*[](#AcMLeaderType.acStraightLeader "Link to this definition") <!-- --> ## AcMLineJustification[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcMLineJustification "Direct link to AcMLineJustification") * *class *viktor.external.autocad.enums.AcMLineJustification(*\*values*)[](#AcMLineJustification "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcMLineJustification` values, mirroring the product API’s names so code reads like its docs. * acBottom* = 2*[](#AcMLineJustification.acBottom "Link to this definition") - acTop* = 0*[](#AcMLineJustification.acTop "Link to this definition") * acZero* = 1*[](#AcMLineJustification.acZero "Link to this definition") <!-- --> ## AcMeasurementUnits[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcMeasurementUnits "Direct link to AcMeasurementUnits") * *class *viktor.external.autocad.enums.AcMeasurementUnits(*\*values*)[](#AcMeasurementUnits "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcMeasurementUnits` values, mirroring the product API’s names so code reads like its docs. * acEnglish* = 0*[](#AcMeasurementUnits.acEnglish "Link to this definition") - acMetric* = 1*[](#AcMeasurementUnits.acMetric "Link to this definition") <!-- --> ## AcMenuFileType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcMenuFileType "Direct link to AcMenuFileType") * *class *viktor.external.autocad.enums.AcMenuFileType(*\*values*)[](#AcMenuFileType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcMenuFileType` values, mirroring the product API’s names so code reads like its docs. * acMenuFileCompiled* = 0*[](#AcMenuFileType.acMenuFileCompiled "Link to this definition") - acMenuFileSource* = 1*[](#AcMenuFileType.acMenuFileSource "Link to this definition") <!-- --> ## AcMenuGroupType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcMenuGroupType "Direct link to AcMenuGroupType") * *class *viktor.external.autocad.enums.AcMenuGroupType(*\*values*)[](#AcMenuGroupType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcMenuGroupType` values, mirroring the product API’s names so code reads like its docs. * acBaseMenuGroup* = 0*[](#AcMenuGroupType.acBaseMenuGroup "Link to this definition") - acPartialMenuGroup* = 1*[](#AcMenuGroupType.acPartialMenuGroup "Link to this definition") <!-- --> ## AcMenuItemType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcMenuItemType "Direct link to AcMenuItemType") * *class *viktor.external.autocad.enums.AcMenuItemType(*\*values*)[](#AcMenuItemType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcMenuItemType` values, mirroring the product API’s names so code reads like its docs. * acMenuItem* = 0*[](#AcMenuItemType.acMenuItem "Link to this definition") - acMenuSeparator* = 1*[](#AcMenuItemType.acMenuSeparator "Link to this definition") * acMenuSubMenu* = 2*[](#AcMenuItemType.acMenuSubMenu "Link to this definition") <!-- --> ## AcMergeCellStyleOption[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcMergeCellStyleOption "Direct link to AcMergeCellStyleOption") * *class *viktor.external.autocad.enums.AcMergeCellStyleOption(*\*values*)[](#AcMergeCellStyleOption "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcMergeCellStyleOption` values, mirroring the product API’s names so code reads like its docs. * acMergeCellStyleConvertDuplicatesToOverrides* = 4*[](#AcMergeCellStyleOption.acMergeCellStyleConvertDuplicatesToOverrides "Link to this definition") - acMergeCellStyleCopyDuplicates* = 1*[](#AcMergeCellStyleOption.acMergeCellStyleCopyDuplicates "Link to this definition") * acMergeCellStyleIgnoreNewStyles* = 8*[](#AcMergeCellStyleOption.acMergeCellStyleIgnoreNewStyles "Link to this definition") - acMergeCellStyleNone* = 0*[](#AcMergeCellStyleOption.acMergeCellStyleNone "Link to this definition") * acMergeCellStyleOverwriteDuplicates* = 2*[](#AcMergeCellStyleOption.acMergeCellStyleOverwriteDuplicates "Link to this definition") <!-- --> ## AcMeshCreaseType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcMeshCreaseType "Direct link to AcMeshCreaseType") * *class *viktor.external.autocad.enums.AcMeshCreaseType(*\*values*)[](#AcMeshCreaseType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcMeshCreaseType` values, mirroring the product API’s names so code reads like its docs. * acAlwaysCrease* = 1*[](#AcMeshCreaseType.acAlwaysCrease "Link to this definition") - acCreaseByLevel* = 2*[](#AcMeshCreaseType.acCreaseByLevel "Link to this definition") * acNoneCrease* = 0*[](#AcMeshCreaseType.acNoneCrease "Link to this definition") <!-- --> ## AcOlePlotQuality[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcOlePlotQuality "Direct link to AcOlePlotQuality") * *class *viktor.external.autocad.enums.AcOlePlotQuality(*\*values*)[](#AcOlePlotQuality "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcOlePlotQuality` values, mirroring the product API’s names so code reads like its docs. * acOPQHighGraphics* = 2*[](#AcOlePlotQuality.acOPQHighGraphics "Link to this definition") - acOPQLowGraphics* = 1*[](#AcOlePlotQuality.acOPQLowGraphics "Link to this definition") * acOPQMonochrome* = 0*[](#AcOlePlotQuality.acOPQMonochrome "Link to this definition") <!-- --> ## AcOleQuality[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcOleQuality "Direct link to AcOleQuality") * *class *viktor.external.autocad.enums.AcOleQuality(*\*values*)[](#AcOleQuality "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcOleQuality` values, mirroring the product API’s names so code reads like its docs. * acOQGraphics* = 2*[](#AcOleQuality.acOQGraphics "Link to this definition") - acOQHighPhoto* = 4*[](#AcOleQuality.acOQHighPhoto "Link to this definition") * acOQLineArt* = 0*[](#AcOleQuality.acOQLineArt "Link to this definition") - acOQPhoto* = 3*[](#AcOleQuality.acOQPhoto "Link to this definition") * acOQText* = 1*[](#AcOleQuality.acOQText "Link to this definition") <!-- --> ## AcOleType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcOleType "Direct link to AcOleType") * *class *viktor.external.autocad.enums.AcOleType(*\*values*)[](#AcOleType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcOleType` values, mirroring the product API’s names so code reads like its docs. * acOTEmbedded* = 2*[](#AcOleType.acOTEmbedded "Link to this definition") - acOTLink* = 1*[](#AcOleType.acOTLink "Link to this definition") * acOTStatic* = 3*[](#AcOleType.acOTStatic "Link to this definition") <!-- --> ## AcOnOff[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcOnOff "Direct link to AcOnOff") * *class *viktor.external.autocad.enums.AcOnOff(*\*values*)[](#AcOnOff "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcOnOff` values, mirroring the product API’s names so code reads like its docs. * acOff* = 0*[](#AcOnOff.acOff "Link to this definition") - acOn* = 1*[](#AcOnOff.acOn "Link to this definition") <!-- --> ## AcParseOption[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcParseOption "Direct link to AcParseOption") * *class *viktor.external.autocad.enums.AcParseOption(*\*values*)[](#AcParseOption "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcParseOption` values, mirroring the product API’s names so code reads like its docs. * acParseOptionNone* = 0*[](#AcParseOption.acParseOptionNone "Link to this definition") - acPreserveMtextFormat* = 2*[](#AcParseOption.acPreserveMtextFormat "Link to this definition") * acSetDefaultFormat* = 1*[](#AcParseOption.acSetDefaultFormat "Link to this definition") <!-- --> ## AcPatternType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcPatternType "Direct link to AcPatternType") * *class *viktor.external.autocad.enums.AcPatternType(*\*values*)[](#AcPatternType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcPatternType` values, mirroring the product API’s names so code reads like its docs. * acHatchPatternTypeCustomDefined* = 2*[](#AcPatternType.acHatchPatternTypeCustomDefined "Link to this definition") - acHatchPatternTypePreDefined* = 1*[](#AcPatternType.acHatchPatternTypePreDefined "Link to this definition") * acHatchPatternTypeUserDefined* = 0*[](#AcPatternType.acHatchPatternTypeUserDefined "Link to this definition") <!-- --> ## AcPlotOrientation[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcPlotOrientation "Direct link to AcPlotOrientation") * *class *viktor.external.autocad.enums.AcPlotOrientation(*\*values*)[](#AcPlotOrientation "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcPlotOrientation` values, mirroring the product API’s names so code reads like its docs. * acPlotOrientationLandscape* = 1*[](#AcPlotOrientation.acPlotOrientationLandscape "Link to this definition") - acPlotOrientationPortrait* = 0*[](#AcPlotOrientation.acPlotOrientationPortrait "Link to this definition") <!-- --> ## AcPlotPaperUnits[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcPlotPaperUnits "Direct link to AcPlotPaperUnits") * *class *viktor.external.autocad.enums.AcPlotPaperUnits(*\*values*)[](#AcPlotPaperUnits "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcPlotPaperUnits` values, mirroring the product API’s names so code reads like its docs. * acInches* = 0*[](#AcPlotPaperUnits.acInches "Link to this definition") - acMillimeters* = 1*[](#AcPlotPaperUnits.acMillimeters "Link to this definition") * acPixels* = 2*[](#AcPlotPaperUnits.acPixels "Link to this definition") <!-- --> ## AcPlotPolicy[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcPlotPolicy "Direct link to AcPlotPolicy") * *class *viktor.external.autocad.enums.AcPlotPolicy(*\*values*)[](#AcPlotPolicy "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcPlotPolicy` values, mirroring the product API’s names so code reads like its docs. * acPolicyLegacy* = 1*[](#AcPlotPolicy.acPolicyLegacy "Link to this definition") - acPolicyNamed* = 0*[](#AcPlotPolicy.acPolicyNamed "Link to this definition") <!-- --> ## AcPlotPolicyForLegacyDwgs[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcPlotPolicyForLegacyDwgs "Direct link to AcPlotPolicyForLegacyDwgs") * *class *viktor.external.autocad.enums.AcPlotPolicyForLegacyDwgs(*\*values*)[](#AcPlotPolicyForLegacyDwgs "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcPlotPolicyForLegacyDwgs` values, mirroring the product API’s names so code reads like its docs. * acPolicyLegacyDefault* = 0*[](#AcPlotPolicyForLegacyDwgs.acPolicyLegacyDefault "Link to this definition") - acPolicyLegacyLegacy* = 2*[](#AcPlotPolicyForLegacyDwgs.acPolicyLegacyLegacy "Link to this definition") * acPolicyLegacyQuery* = 1*[](#AcPlotPolicyForLegacyDwgs.acPolicyLegacyQuery "Link to this definition") <!-- --> ## AcPlotPolicyForNewDwgs[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcPlotPolicyForNewDwgs "Direct link to AcPlotPolicyForNewDwgs") * *class *viktor.external.autocad.enums.AcPlotPolicyForNewDwgs(*\*values*)[](#AcPlotPolicyForNewDwgs "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcPlotPolicyForNewDwgs` values, mirroring the product API’s names so code reads like its docs. * acPolicyNewDefault* = 0*[](#AcPlotPolicyForNewDwgs.acPolicyNewDefault "Link to this definition") - acPolicyNewLegacy* = 1*[](#AcPlotPolicyForNewDwgs.acPolicyNewLegacy "Link to this definition") <!-- --> ## AcPlotRotation[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcPlotRotation "Direct link to AcPlotRotation") * *class *viktor.external.autocad.enums.AcPlotRotation(*\*values*)[](#AcPlotRotation "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcPlotRotation` values, mirroring the product API’s names so code reads like its docs. * ac0degrees* = 0*[](#AcPlotRotation.ac0degrees "Link to this definition") - ac180degrees* = 2*[](#AcPlotRotation.ac180degrees "Link to this definition") * ac270degrees* = 3*[](#AcPlotRotation.ac270degrees "Link to this definition") - ac90degrees* = 1*[](#AcPlotRotation.ac90degrees "Link to this definition") <!-- --> ## AcPlotScale[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcPlotScale "Direct link to AcPlotScale") * *class *viktor.external.autocad.enums.AcPlotScale(*\*values*)[](#AcPlotScale "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcPlotScale` values, mirroring the product API’s names so code reads like its docs. * ac100\_1* = 32*[](#AcPlotScale.ac100_1 "Link to this definition") - ac10\_1* = 31*[](#AcPlotScale.ac10_1 "Link to this definition") * ac1\_1* = 16*[](#AcPlotScale.ac1_1 "Link to this definition") - ac1\_10* = 21*[](#AcPlotScale.ac1_10 "Link to this definition") * ac1\_100* = 27*[](#AcPlotScale.ac1_100 "Link to this definition") - ac1\_128in\_1ft* = 1*[](#AcPlotScale.ac1_128in_1ft "Link to this definition") * ac1\_16* = 22*[](#AcPlotScale.ac1_16 "Link to this definition") - ac1\_16in\_1ft* = 4*[](#AcPlotScale.ac1_16in_1ft "Link to this definition") * ac1\_2* = 17*[](#AcPlotScale.ac1_2 "Link to this definition") - ac1\_20* = 23*[](#AcPlotScale.ac1_20 "Link to this definition") * ac1\_2in\_1ft* = 10*[](#AcPlotScale.ac1_2in_1ft "Link to this definition") - ac1\_30* = 24*[](#AcPlotScale.ac1_30 "Link to this definition") * ac1\_32in\_1ft* = 3*[](#AcPlotScale.ac1_32in_1ft "Link to this definition") - ac1\_4* = 18*[](#AcPlotScale.ac1_4 "Link to this definition") * ac1\_40* = 25*[](#AcPlotScale.ac1_40 "Link to this definition") - ac1\_4in\_1ft* = 8*[](#AcPlotScale.ac1_4in_1ft "Link to this definition") * ac1\_5* = 19*[](#AcPlotScale.ac1_5 "Link to this definition") - ac1\_50* = 26*[](#AcPlotScale.ac1_50 "Link to this definition") * ac1\_64in\_1ft* = 2*[](#AcPlotScale.ac1_64in_1ft "Link to this definition") - ac1\_8* = 20*[](#AcPlotScale.ac1_8 "Link to this definition") * ac1\_8in\_1ft* = 6*[](#AcPlotScale.ac1_8in_1ft "Link to this definition") - ac1ft\_1ft* = 15*[](#AcPlotScale.ac1ft_1ft "Link to this definition") * ac1in\_1ft* = 12*[](#AcPlotScale.ac1in_1ft "Link to this definition") - ac2\_1* = 28*[](#AcPlotScale.ac2_1 "Link to this definition") * ac3\_16in\_1ft* = 7*[](#AcPlotScale.ac3_16in_1ft "Link to this definition") - ac3\_32in\_1ft* = 5*[](#AcPlotScale.ac3_32in_1ft "Link to this definition") * ac3\_4in\_1ft* = 11*[](#AcPlotScale.ac3_4in_1ft "Link to this definition") - ac3\_8in\_1ft* = 9*[](#AcPlotScale.ac3_8in_1ft "Link to this definition") * ac3in\_1ft* = 13*[](#AcPlotScale.ac3in_1ft "Link to this definition") - ac4\_1* = 29*[](#AcPlotScale.ac4_1 "Link to this definition") * ac6in\_1ft* = 14*[](#AcPlotScale.ac6in_1ft "Link to this definition") - ac8\_1* = 30*[](#AcPlotScale.ac8_1 "Link to this definition") * acScaleToFit* = 0*[](#AcPlotScale.acScaleToFit "Link to this definition") <!-- --> ## AcPlotType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcPlotType "Direct link to AcPlotType") * *class *viktor.external.autocad.enums.AcPlotType(*\*values*)[](#AcPlotType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcPlotType` values, mirroring the product API’s names so code reads like its docs. * acDisplay* = 0*[](#AcPlotType.acDisplay "Link to this definition") - acExtents* = 1*[](#AcPlotType.acExtents "Link to this definition") * acLayout* = 5*[](#AcPlotType.acLayout "Link to this definition") - acLimits* = 2*[](#AcPlotType.acLimits "Link to this definition") * acView* = 3*[](#AcPlotType.acView "Link to this definition") - acWindow* = 4*[](#AcPlotType.acWindow "Link to this definition") <!-- --> ## AcPointCloudColorType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcPointCloudColorType "Direct link to AcPointCloudColorType") * *class *viktor.external.autocad.enums.AcPointCloudColorType(*\*values*)[](#AcPointCloudColorType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcPointCloudColorType` values, mirroring the product API’s names so code reads like its docs. * acByColor* = 1*[](#AcPointCloudColorType.acByColor "Link to this definition") - acTrueColor* = 0*[](#AcPointCloudColorType.acTrueColor "Link to this definition") <!-- --> ## AcPointCloudExStylizationType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcPointCloudExStylizationType "Direct link to AcPointCloudExStylizationType") * *class *viktor.external.autocad.enums.AcPointCloudExStylizationType(*\*values*)[](#AcPointCloudExStylizationType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcPointCloudExStylizationType` values, mirroring the product API’s names so code reads like its docs. * acClassification* = 5*[](#AcPointCloudExStylizationType.acClassification "Link to this definition") - acElevation* = 4*[](#AcPointCloudExStylizationType.acElevation "Link to this definition") * acIntensities* = 3*[](#AcPointCloudExStylizationType.acIntensities "Link to this definition") - acNormals* = 2*[](#AcPointCloudExStylizationType.acNormals "Link to this definition") * acObject* = 1*[](#AcPointCloudExStylizationType.acObject "Link to this definition") - acRGB* = 0*[](#AcPointCloudExStylizationType.acRGB "Link to this definition") <!-- --> ## AcPointCloudIntensityStyle[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcPointCloudIntensityStyle "Direct link to AcPointCloudIntensityStyle") * *class *viktor.external.autocad.enums.AcPointCloudIntensityStyle(*\*values*)[](#AcPointCloudIntensityStyle "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcPointCloudIntensityStyle` values, mirroring the product API’s names so code reads like its docs. * acIntensityBlue* = 4*[](#AcPointCloudIntensityStyle.acIntensityBlue "Link to this definition") - acIntensityEditableFlag* = 5*[](#AcPointCloudIntensityStyle.acIntensityEditableFlag "Link to this definition") * acIntensityGrayscale* = 0*[](#AcPointCloudIntensityStyle.acIntensityGrayscale "Link to this definition") - acIntensityGreen* = 3*[](#AcPointCloudIntensityStyle.acIntensityGreen "Link to this definition") * acIntensityRainbow* = 1*[](#AcPointCloudIntensityStyle.acIntensityRainbow "Link to this definition") - acIntensityRed* = 2*[](#AcPointCloudIntensityStyle.acIntensityRed "Link to this definition") <!-- --> ## AcPointCloudStylizationType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcPointCloudStylizationType "Direct link to AcPointCloudStylizationType") * *class *viktor.external.autocad.enums.AcPointCloudStylizationType(*\*values*)[](#AcPointCloudStylizationType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcPointCloudStylizationType` values, mirroring the product API’s names so code reads like its docs. * acIntensity* = 3*[](#AcPointCloudStylizationType.acIntensity "Link to this definition") - acNormal* = 2*[](#AcPointCloudStylizationType.acNormal "Link to this definition") * acObjectColor* = 1*[](#AcPointCloudStylizationType.acObjectColor "Link to this definition") - acScanColor* = 0*[](#AcPointCloudStylizationType.acScanColor "Link to this definition") <!-- --> ## AcPolylineType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcPolylineType "Direct link to AcPolylineType") * *class *viktor.external.autocad.enums.AcPolylineType(*\*values*)[](#AcPolylineType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcPolylineType` values, mirroring the product API’s names so code reads like its docs. * acCubicSplinePoly* = 3*[](#AcPolylineType.acCubicSplinePoly "Link to this definition") - acFitCurvePoly* = 1*[](#AcPolylineType.acFitCurvePoly "Link to this definition") * acQuadSplinePoly* = 2*[](#AcPolylineType.acQuadSplinePoly "Link to this definition") - acSimplePoly* = 0*[](#AcPolylineType.acSimplePoly "Link to this definition") <!-- --> ## AcPolymeshType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcPolymeshType "Direct link to AcPolymeshType") * *class *viktor.external.autocad.enums.AcPolymeshType(*\*values*)[](#AcPolymeshType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcPolymeshType` values, mirroring the product API’s names so code reads like its docs. * acBezierSurfaceMesh* = 8*[](#AcPolymeshType.acBezierSurfaceMesh "Link to this definition") - acCubicSurfaceMesh* = 6*[](#AcPolymeshType.acCubicSurfaceMesh "Link to this definition") * acQuadSurfaceMesh* = 5*[](#AcPolymeshType.acQuadSurfaceMesh "Link to this definition") - acSimpleMesh* = 0*[](#AcPolymeshType.acSimpleMesh "Link to this definition") <!-- --> ## AcPredefBlockType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcPredefBlockType "Direct link to AcPredefBlockType") * *class *viktor.external.autocad.enums.AcPredefBlockType(*\*values*)[](#AcPredefBlockType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcPredefBlockType` values, mirroring the product API’s names so code reads like its docs. * acBlockBox* = 3*[](#AcPredefBlockType.acBlockBox "Link to this definition") - acBlockCircle* = 2*[](#AcPredefBlockType.acBlockCircle "Link to this definition") * acBlockHexagon* = 4*[](#AcPredefBlockType.acBlockHexagon "Link to this definition") - acBlockImperial* = 0*[](#AcPredefBlockType.acBlockImperial "Link to this definition") * acBlockSlot* = 1*[](#AcPredefBlockType.acBlockSlot "Link to this definition") - acBlockTriangle* = 5*[](#AcPredefBlockType.acBlockTriangle "Link to this definition") * acBlockUserDefined* = 6*[](#AcPredefBlockType.acBlockUserDefined "Link to this definition") <!-- --> ## AcPreviewMode[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcPreviewMode "Direct link to AcPreviewMode") * *class *viktor.external.autocad.enums.AcPreviewMode(*\*values*)[](#AcPreviewMode "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcPreviewMode` values, mirroring the product API’s names so code reads like its docs. * acFullPreview* = 1*[](#AcPreviewMode.acFullPreview "Link to this definition") - acPartialPreview* = 0*[](#AcPreviewMode.acPartialPreview "Link to this definition") <!-- --> ## AcPrinterSpoolAlert[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcPrinterSpoolAlert "Direct link to AcPrinterSpoolAlert") * *class *viktor.external.autocad.enums.AcPrinterSpoolAlert(*\*values*)[](#AcPrinterSpoolAlert "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcPrinterSpoolAlert` values, mirroring the product API’s names so code reads like its docs. * acPrinterAlertOnce* = 1*[](#AcPrinterSpoolAlert.acPrinterAlertOnce "Link to this definition") - acPrinterAlwaysAlert* = 0*[](#AcPrinterSpoolAlert.acPrinterAlwaysAlert "Link to this definition") * acPrinterNeverAlert* = 3*[](#AcPrinterSpoolAlert.acPrinterNeverAlert "Link to this definition") - acPrinterNeverAlertLogOnce* = 2*[](#AcPrinterSpoolAlert.acPrinterNeverAlertLogOnce "Link to this definition") <!-- --> ## AcProxyImage[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcProxyImage "Direct link to AcProxyImage") * *class *viktor.external.autocad.enums.AcProxyImage(*\*values*)[](#AcProxyImage "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcProxyImage` values, mirroring the product API’s names so code reads like its docs. * acProxyBoundingBox* = 2*[](#AcProxyImage.acProxyBoundingBox "Link to this definition") - acProxyNotShow* = 0*[](#AcProxyImage.acProxyNotShow "Link to this definition") * acProxyShow* = 1*[](#AcProxyImage.acProxyShow "Link to this definition") <!-- --> ## AcRegenType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcRegenType "Direct link to AcRegenType") * *class *viktor.external.autocad.enums.AcRegenType(*\*values*)[](#AcRegenType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcRegenType` values, mirroring the product API’s names so code reads like its docs. * acActiveViewport* = 0*[](#AcRegenType.acActiveViewport "Link to this definition") - acAllViewports* = 1*[](#AcRegenType.acAllViewports "Link to this definition") <!-- --> ## AcRotationAngle[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcRotationAngle "Direct link to AcRotationAngle") * *class *viktor.external.autocad.enums.AcRotationAngle(*\*values*)[](#AcRotationAngle "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcRotationAngle` values, mirroring the product API’s names so code reads like its docs. * acDegrees000* = 0*[](#AcRotationAngle.acDegrees000 "Link to this definition") - acDegrees090* = 1*[](#AcRotationAngle.acDegrees090 "Link to this definition") * acDegrees180* = 2*[](#AcRotationAngle.acDegrees180 "Link to this definition") - acDegrees270* = 3*[](#AcRotationAngle.acDegrees270 "Link to this definition") * acDegreesUnknown* = -1*[](#AcRotationAngle.acDegreesUnknown "Link to this definition") <!-- --> ## AcRowType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcRowType "Direct link to AcRowType") * *class *viktor.external.autocad.enums.AcRowType(*\*values*)[](#AcRowType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcRowType` values, mirroring the product API’s names so code reads like its docs. * acDataRow* = 1*[](#AcRowType.acDataRow "Link to this definition") - acHeaderRow* = 4*[](#AcRowType.acHeaderRow "Link to this definition") * acTitleRow* = 2*[](#AcRowType.acTitleRow "Link to this definition") - acUnknownRow* = 0*[](#AcRowType.acUnknownRow "Link to this definition") <!-- --> ## AcSaveAsType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcSaveAsType "Direct link to AcSaveAsType") * *class *viktor.external.autocad.enums.AcSaveAsType(*\*values*)[](#AcSaveAsType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcSaveAsType` values, mirroring the product API’s names so code reads like its docs. * ac2000\_Template* = 14*[](#AcSaveAsType.ac2000_Template "Link to this definition") - ac2000\_dwg* = 12*[](#AcSaveAsType.ac2000_dwg "Link to this definition") * ac2000\_dxf* = 13*[](#AcSaveAsType.ac2000_dxf "Link to this definition") - ac2004\_Template* = 26*[](#AcSaveAsType.ac2004_Template "Link to this definition") * ac2004\_dwg* = 24*[](#AcSaveAsType.ac2004_dwg "Link to this definition") - ac2004\_dxf* = 25*[](#AcSaveAsType.ac2004_dxf "Link to this definition") * ac2007\_Template* = 38*[](#AcSaveAsType.ac2007_Template "Link to this definition") - ac2007\_dwg* = 36*[](#AcSaveAsType.ac2007_dwg "Link to this definition") * ac2007\_dxf* = 37*[](#AcSaveAsType.ac2007_dxf "Link to this definition") - ac2010\_Template* = 50*[](#AcSaveAsType.ac2010_Template "Link to this definition") * ac2010\_dwg* = 48*[](#AcSaveAsType.ac2010_dwg "Link to this definition") - ac2010\_dxf* = 49*[](#AcSaveAsType.ac2010_dxf "Link to this definition") * ac2013\_Template* = 62*[](#AcSaveAsType.ac2013_Template "Link to this definition") - ac2013\_dwg* = 60*[](#AcSaveAsType.ac2013_dwg "Link to this definition") * ac2013\_dxf* = 61*[](#AcSaveAsType.ac2013_dxf "Link to this definition") - ac2018\_Template* = 66*[](#AcSaveAsType.ac2018_Template "Link to this definition") * ac2018\_dwg* = 64*[](#AcSaveAsType.ac2018_dwg "Link to this definition") - ac2018\_dxf* = 65*[](#AcSaveAsType.ac2018_dxf "Link to this definition") * acNative* = 64*[](#AcSaveAsType.acNative "Link to this definition") - acR12\_dxf* = 1*[](#AcSaveAsType.acR12_dxf "Link to this definition") * acR13\_dwg* = 4*[](#AcSaveAsType.acR13_dwg "Link to this definition") - acR13\_dxf* = 5*[](#AcSaveAsType.acR13_dxf "Link to this definition") * acR14\_dwg* = 8*[](#AcSaveAsType.acR14_dwg "Link to this definition") - acR14\_dxf* = 9*[](#AcSaveAsType.acR14_dxf "Link to this definition") * acR15\_Template* = 14*[](#AcSaveAsType.acR15_Template "Link to this definition") - acR15\_dwg* = 12*[](#AcSaveAsType.acR15_dwg "Link to this definition") * acR15\_dxf* = 13*[](#AcSaveAsType.acR15_dxf "Link to this definition") - acR18\_Template* = 26*[](#AcSaveAsType.acR18_Template "Link to this definition") * acR18\_dwg* = 24*[](#AcSaveAsType.acR18_dwg "Link to this definition") - acR18\_dxf* = 25*[](#AcSaveAsType.acR18_dxf "Link to this definition") * acUnknown* = -1*[](#AcSaveAsType.acUnknown "Link to this definition") <!-- --> ## AcSectionGeneration[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcSectionGeneration "Direct link to AcSectionGeneration") * *class *viktor.external.autocad.enums.AcSectionGeneration(*\*values*)[](#AcSectionGeneration "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcSectionGeneration` values, mirroring the product API’s names so code reads like its docs. * acSectionGenerationDestinationFile* = 64*[](#AcSectionGeneration.acSectionGenerationDestinationFile "Link to this definition") - acSectionGenerationDestinationNewBlock* = 16*[](#AcSectionGeneration.acSectionGenerationDestinationNewBlock "Link to this definition") * acSectionGenerationDestinationReplaceBlock* = 32*[](#AcSectionGeneration.acSectionGenerationDestinationReplaceBlock "Link to this definition") - acSectionGenerationSourceAllObjects* = 1*[](#AcSectionGeneration.acSectionGenerationSourceAllObjects "Link to this definition") * acSectionGenerationSourceSelectedObjects* = 2*[](#AcSectionGeneration.acSectionGenerationSourceSelectedObjects "Link to this definition") <!-- --> ## AcSectionState[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcSectionState "Direct link to AcSectionState") * *class *viktor.external.autocad.enums.AcSectionState(*\*values*)[](#AcSectionState "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcSectionState` values, mirroring the product API’s names so code reads like its docs. * acSectionStateBoundary* = 2*[](#AcSectionState.acSectionStateBoundary "Link to this definition") - acSectionStatePlane* = 1*[](#AcSectionState.acSectionStatePlane "Link to this definition") * acSectionStateVolume* = 4*[](#AcSectionState.acSectionStateVolume "Link to this definition") <!-- --> ## AcSectionState2[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcSectionState2 "Direct link to AcSectionState2") * *class *viktor.external.autocad.enums.AcSectionState2(*\*values*)[](#AcSectionState2 "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcSectionState2` values, mirroring the product API’s names so code reads like its docs. * acSectionState2Boundary* = 4*[](#AcSectionState2.acSectionState2Boundary "Link to this definition") - acSectionState2Plane* = 1*[](#AcSectionState2.acSectionState2Plane "Link to this definition") * acSectionState2Slice* = 2*[](#AcSectionState2.acSectionState2Slice "Link to this definition") - acSectionState2Volume* = 8*[](#AcSectionState2.acSectionState2Volume "Link to this definition") <!-- --> ## AcSectionSubItem[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcSectionSubItem "Direct link to AcSectionSubItem") * *class *viktor.external.autocad.enums.AcSectionSubItem(*\*values*)[](#AcSectionSubItem "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcSectionSubItem` values, mirroring the product API’s names so code reads like its docs. * acSectionSubItemBackLine* = 8*[](#AcSectionSubItem.acSectionSubItemBackLine "Link to this definition") - acSectionSubItemBackLineBottom* = 32*[](#AcSectionSubItem.acSectionSubItemBackLineBottom "Link to this definition") * acSectionSubItemBackLineTop* = 16*[](#AcSectionSubItem.acSectionSubItemBackLineTop "Link to this definition") - acSectionSubItemSectionLine* = 1*[](#AcSectionSubItem.acSectionSubItemSectionLine "Link to this definition") * acSectionSubItemSectionLineBottom* = 4*[](#AcSectionSubItem.acSectionSubItemSectionLineBottom "Link to this definition") - acSectionSubItemSectionLineTop* = 2*[](#AcSectionSubItem.acSectionSubItemSectionLineTop "Link to this definition") * acSectionSubItemVerticalLineBottom* = 128*[](#AcSectionSubItem.acSectionSubItemVerticalLineBottom "Link to this definition") - acSectionSubItemVerticalLineTop* = 64*[](#AcSectionSubItem.acSectionSubItemVerticalLineTop "Link to this definition") * acSectionSubItemkNone* = 0*[](#AcSectionSubItem.acSectionSubItemkNone "Link to this definition") <!-- --> ## AcSectionType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcSectionType "Direct link to AcSectionType") * *class *viktor.external.autocad.enums.AcSectionType(*\*values*)[](#AcSectionType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcSectionType` values, mirroring the product API’s names so code reads like its docs. * acSectionType2dSection* = 2*[](#AcSectionType.acSectionType2dSection "Link to this definition") - acSectionType3dSection* = 4*[](#AcSectionType.acSectionType3dSection "Link to this definition") * acSectionTypeLiveSection* = 1*[](#AcSectionType.acSectionTypeLiveSection "Link to this definition") <!-- --> ## AcSegmentAngleType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcSegmentAngleType "Direct link to AcSegmentAngleType") * *class *viktor.external.autocad.enums.AcSegmentAngleType(*\*values*)[](#AcSegmentAngleType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcSegmentAngleType` values, mirroring the product API’s names so code reads like its docs. * acDegrees15* = 1*[](#AcSegmentAngleType.acDegrees15 "Link to this definition") - acDegrees30* = 2*[](#AcSegmentAngleType.acDegrees30 "Link to this definition") * acDegrees45* = 3*[](#AcSegmentAngleType.acDegrees45 "Link to this definition") - acDegrees60* = 4*[](#AcSegmentAngleType.acDegrees60 "Link to this definition") * acDegrees90* = 6*[](#AcSegmentAngleType.acDegrees90 "Link to this definition") - acDegreesAny* = 0*[](#AcSegmentAngleType.acDegreesAny "Link to this definition") * acDegreesHorz* = 12*[](#AcSegmentAngleType.acDegreesHorz "Link to this definition") <!-- --> ## AcSelect[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcSelect "Direct link to AcSelect") * *class *viktor.external.autocad.enums.AcSelect(*\*values*)[](#AcSelect "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcSelect` values, mirroring the product API’s names so code reads like its docs. * acSelectionSetAll* = 5*[](#AcSelect.acSelectionSetAll "Link to this definition") - acSelectionSetCrossing* = 1*[](#AcSelect.acSelectionSetCrossing "Link to this definition") * acSelectionSetCrossingPolygon* = 7*[](#AcSelect.acSelectionSetCrossingPolygon "Link to this definition") - acSelectionSetFence* = 2*[](#AcSelect.acSelectionSetFence "Link to this definition") * acSelectionSetLast* = 4*[](#AcSelect.acSelectionSetLast "Link to this definition") - acSelectionSetPrevious* = 3*[](#AcSelect.acSelectionSetPrevious "Link to this definition") * acSelectionSetWindow* = 0*[](#AcSelect.acSelectionSetWindow "Link to this definition") - acSelectionSetWindowPolygon* = 6*[](#AcSelect.acSelectionSetWindowPolygon "Link to this definition") <!-- --> ## AcSelectType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcSelectType "Direct link to AcSelectType") * *class *viktor.external.autocad.enums.AcSelectType(*\*values*)[](#AcSelectType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcSelectType` values, mirroring the product API’s names so code reads like its docs. * acTableSelectCrossing* = 2*[](#AcSelectType.acTableSelectCrossing "Link to this definition") - acTableSelectWindow* = 1*[](#AcSelectType.acTableSelectWindow "Link to this definition") <!-- --> ## AcShadePlot[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcShadePlot "Direct link to AcShadePlot") * *class *viktor.external.autocad.enums.AcShadePlot(*\*values*)[](#AcShadePlot "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcShadePlot` values, mirroring the product API’s names so code reads like its docs. * acShadePlotAsDisplayed* = 0*[](#AcShadePlot.acShadePlotAsDisplayed "Link to this definition") - acShadePlotHidden* = 2*[](#AcShadePlot.acShadePlotHidden "Link to this definition") * acShadePlotRendered* = 3*[](#AcShadePlot.acShadePlotRendered "Link to this definition") - acShadePlotWireframe* = 1*[](#AcShadePlot.acShadePlotWireframe "Link to this definition") <!-- --> ## AcShadowDisplayType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcShadowDisplayType "Direct link to AcShadowDisplayType") * *class *viktor.external.autocad.enums.AcShadowDisplayType(*\*values*)[](#AcShadowDisplayType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcShadowDisplayType` values, mirroring the product API’s names so code reads like its docs. * acCastsAndReceivesShadows* = 0*[](#AcShadowDisplayType.acCastsAndReceivesShadows "Link to this definition") - acCastsShadows* = 1*[](#AcShadowDisplayType.acCastsShadows "Link to this definition") * acIgnoreShadows* = 3*[](#AcShadowDisplayType.acIgnoreShadows "Link to this definition") - acReceivesShadows* = 2*[](#AcShadowDisplayType.acReceivesShadows "Link to this definition") <!-- --> ## AcSplineFrameType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcSplineFrameType "Direct link to AcSplineFrameType") * *class *viktor.external.autocad.enums.AcSplineFrameType(*\*values*)[](#AcSplineFrameType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcSplineFrameType` values, mirroring the product API’s names so code reads like its docs. * acHide* = 1*[](#AcSplineFrameType.acHide "Link to this definition") - acShow* = 0*[](#AcSplineFrameType.acShow "Link to this definition") <!-- --> ## AcSplineKnotParameterizationType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcSplineKnotParameterizationType "Direct link to AcSplineKnotParameterizationType") * *class *viktor.external.autocad.enums.AcSplineKnotParameterizationType(*\*values*)[](#AcSplineKnotParameterizationType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcSplineKnotParameterizationType` values, mirroring the product API’s names so code reads like its docs. * acChord* = 0*[](#AcSplineKnotParameterizationType.acChord "Link to this definition") - acCustomParameterization* = 15*[](#AcSplineKnotParameterizationType.acCustomParameterization "Link to this definition") * acSqrtChord* = 1*[](#AcSplineKnotParameterizationType.acSqrtChord "Link to this definition") - acUniformParam* = 2*[](#AcSplineKnotParameterizationType.acUniformParam "Link to this definition") <!-- --> ## AcSplineMethodType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcSplineMethodType "Direct link to AcSplineMethodType") * *class *viktor.external.autocad.enums.AcSplineMethodType(*\*values*)[](#AcSplineMethodType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcSplineMethodType` values, mirroring the product API’s names so code reads like its docs. * acControlVertices* = 1*[](#AcSplineMethodType.acControlVertices "Link to this definition") - acFit* = 0*[](#AcSplineMethodType.acFit "Link to this definition") <!-- --> ## AcTableDirection[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcTableDirection "Direct link to AcTableDirection") * *class *viktor.external.autocad.enums.AcTableDirection(*\*values*)[](#AcTableDirection "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcTableDirection` values, mirroring the product API’s names so code reads like its docs. * acTableBottomToTop* = 1*[](#AcTableDirection.acTableBottomToTop "Link to this definition") - acTableTopToBottom* = 0*[](#AcTableDirection.acTableTopToBottom "Link to this definition") <!-- --> ## AcTableFlowDirection[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcTableFlowDirection "Direct link to AcTableFlowDirection") * *class *viktor.external.autocad.enums.AcTableFlowDirection(*\*values*)[](#AcTableFlowDirection "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcTableFlowDirection` values, mirroring the product API’s names so code reads like its docs. * acTableFlowDownOrUp* = 2*[](#AcTableFlowDirection.acTableFlowDownOrUp "Link to this definition") - acTableFlowLeft* = 4*[](#AcTableFlowDirection.acTableFlowLeft "Link to this definition") * acTableFlowRight* = 1*[](#AcTableFlowDirection.acTableFlowRight "Link to this definition") <!-- --> ## AcTableStyleOverrides[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcTableStyleOverrides "Direct link to AcTableStyleOverrides") * *class *viktor.external.autocad.enums.AcTableStyleOverrides(*\*values*)[](#AcTableStyleOverrides "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcTableStyleOverrides` values, mirroring the product API’s names so code reads like its docs. * acCellAlign* = 130*[](#AcTableStyleOverrides.acCellAlign "Link to this definition") - acCellBackgroundColor* = 132*[](#AcTableStyleOverrides.acCellBackgroundColor "Link to this definition") * acCellBackgroundFillNone* = 131*[](#AcTableStyleOverrides.acCellBackgroundFillNone "Link to this definition") - acCellBottomGridColor* = 138*[](#AcTableStyleOverrides.acCellBottomGridColor "Link to this definition") * acCellBottomGridLineWeight* = 142*[](#AcTableStyleOverrides.acCellBottomGridLineWeight "Link to this definition") - acCellBottomVisibility* = 146*[](#AcTableStyleOverrides.acCellBottomVisibility "Link to this definition") * acCellContentColor* = 133*[](#AcTableStyleOverrides.acCellContentColor "Link to this definition") - acCellDataType* = 148*[](#AcTableStyleOverrides.acCellDataType "Link to this definition") * acCellLeftGridColor* = 139*[](#AcTableStyleOverrides.acCellLeftGridColor "Link to this definition") - acCellLeftGridLineWeight* = 143*[](#AcTableStyleOverrides.acCellLeftGridLineWeight "Link to this definition") * acCellLeftVisibility* = 147*[](#AcTableStyleOverrides.acCellLeftVisibility "Link to this definition") - acCellRightGridColor* = 137*[](#AcTableStyleOverrides.acCellRightGridColor "Link to this definition") * acCellRightGridLineWeight* = 141*[](#AcTableStyleOverrides.acCellRightGridLineWeight "Link to this definition") - acCellRightVisibility* = 145*[](#AcTableStyleOverrides.acCellRightVisibility "Link to this definition") * acCellTextHeight* = 135*[](#AcTableStyleOverrides.acCellTextHeight "Link to this definition") - acCellTextStyle* = 134*[](#AcTableStyleOverrides.acCellTextStyle "Link to this definition") * acCellTopGridColor* = 136*[](#AcTableStyleOverrides.acCellTopGridColor "Link to this definition") - acCellTopGridLineWeight* = 140*[](#AcTableStyleOverrides.acCellTopGridLineWeight "Link to this definition") * acCellTopVisibility* = 144*[](#AcTableStyleOverrides.acCellTopVisibility "Link to this definition") - acDataHorzBottomColor* = 54*[](#AcTableStyleOverrides.acDataHorzBottomColor "Link to this definition") * acDataHorzBottomLineWeight* = 84*[](#AcTableStyleOverrides.acDataHorzBottomLineWeight "Link to this definition") - acDataHorzBottomVisibility* = 114*[](#AcTableStyleOverrides.acDataHorzBottomVisibility "Link to this definition") * acDataHorzInsideColor* = 53*[](#AcTableStyleOverrides.acDataHorzInsideColor "Link to this definition") - acDataHorzInsideLineWeight* = 83*[](#AcTableStyleOverrides.acDataHorzInsideLineWeight "Link to this definition") * acDataHorzInsideVisibility* = 113*[](#AcTableStyleOverrides.acDataHorzInsideVisibility "Link to this definition") - acDataHorzTopColor* = 52*[](#AcTableStyleOverrides.acDataHorzTopColor "Link to this definition") * acDataHorzTopLineWeight* = 82*[](#AcTableStyleOverrides.acDataHorzTopLineWeight "Link to this definition") - acDataHorzTopVisibility* = 112*[](#AcTableStyleOverrides.acDataHorzTopVisibility "Link to this definition") * acDataRowAlignment* = 17*[](#AcTableStyleOverrides.acDataRowAlignment "Link to this definition") - acDataRowColor* = 8*[](#AcTableStyleOverrides.acDataRowColor "Link to this definition") * acDataRowDataType* = 26*[](#AcTableStyleOverrides.acDataRowDataType "Link to this definition") - acDataRowFillColor* = 14*[](#AcTableStyleOverrides.acDataRowFillColor "Link to this definition") * acDataRowFillNone* = 11*[](#AcTableStyleOverrides.acDataRowFillNone "Link to this definition") - acDataRowTextHeight* = 23*[](#AcTableStyleOverrides.acDataRowTextHeight "Link to this definition") * acDataRowTextStyle* = 20*[](#AcTableStyleOverrides.acDataRowTextStyle "Link to this definition") - acDataVertInsideColor* = 56*[](#AcTableStyleOverrides.acDataVertInsideColor "Link to this definition") * acDataVertInsideLineWeight* = 86*[](#AcTableStyleOverrides.acDataVertInsideLineWeight "Link to this definition") - acDataVertInsideVisibility* = 116*[](#AcTableStyleOverrides.acDataVertInsideVisibility "Link to this definition") * acDataVertLeftColor* = 55*[](#AcTableStyleOverrides.acDataVertLeftColor "Link to this definition") - acDataVertLeftLineWeight* = 85*[](#AcTableStyleOverrides.acDataVertLeftLineWeight "Link to this definition") * acDataVertLeftVisibility* = 115*[](#AcTableStyleOverrides.acDataVertLeftVisibility "Link to this definition") - acDataVertRightColor* = 57*[](#AcTableStyleOverrides.acDataVertRightColor "Link to this definition") * acDataVertRightLineWeight* = 87*[](#AcTableStyleOverrides.acDataVertRightLineWeight "Link to this definition") - acDataVertRightVisibility* = 117*[](#AcTableStyleOverrides.acDataVertRightVisibility "Link to this definition") * acFlowDirection* = 3*[](#AcTableStyleOverrides.acFlowDirection "Link to this definition") - acHeaderHorzBottomColor* = 48*[](#AcTableStyleOverrides.acHeaderHorzBottomColor "Link to this definition") * acHeaderHorzBottomLineWeight* = 78*[](#AcTableStyleOverrides.acHeaderHorzBottomLineWeight "Link to this definition") - acHeaderHorzBottomVisibility* = 108*[](#AcTableStyleOverrides.acHeaderHorzBottomVisibility "Link to this definition") * acHeaderHorzInsideColor* = 47*[](#AcTableStyleOverrides.acHeaderHorzInsideColor "Link to this definition") - acHeaderHorzInsideLineWeight* = 77*[](#AcTableStyleOverrides.acHeaderHorzInsideLineWeight "Link to this definition") * acHeaderHorzInsideVisibility* = 107*[](#AcTableStyleOverrides.acHeaderHorzInsideVisibility "Link to this definition") - acHeaderHorzTopColor* = 46*[](#AcTableStyleOverrides.acHeaderHorzTopColor "Link to this definition") * acHeaderHorzTopLineWeight* = 76*[](#AcTableStyleOverrides.acHeaderHorzTopLineWeight "Link to this definition") - acHeaderHorzTopVisibility* = 106*[](#AcTableStyleOverrides.acHeaderHorzTopVisibility "Link to this definition") * acHeaderRowAlignment* = 16*[](#AcTableStyleOverrides.acHeaderRowAlignment "Link to this definition") - acHeaderRowColor* = 7*[](#AcTableStyleOverrides.acHeaderRowColor "Link to this definition") * acHeaderRowDataType* = 25*[](#AcTableStyleOverrides.acHeaderRowDataType "Link to this definition") - acHeaderRowFillColor* = 13*[](#AcTableStyleOverrides.acHeaderRowFillColor "Link to this definition") * acHeaderRowFillNone* = 10*[](#AcTableStyleOverrides.acHeaderRowFillNone "Link to this definition") - acHeaderRowTextHeight* = 22*[](#AcTableStyleOverrides.acHeaderRowTextHeight "Link to this definition") * acHeaderRowTextStyle* = 19*[](#AcTableStyleOverrides.acHeaderRowTextStyle "Link to this definition") - acHeaderSuppressed* = 2*[](#AcTableStyleOverrides.acHeaderSuppressed "Link to this definition") * acHeaderVertInsideColor* = 50*[](#AcTableStyleOverrides.acHeaderVertInsideColor "Link to this definition") - acHeaderVertInsideLineWeight* = 80*[](#AcTableStyleOverrides.acHeaderVertInsideLineWeight "Link to this definition") * acHeaderVertInsideVisibility* = 110*[](#AcTableStyleOverrides.acHeaderVertInsideVisibility "Link to this definition") - acHeaderVertLeftColor* = 49*[](#AcTableStyleOverrides.acHeaderVertLeftColor "Link to this definition") * acHeaderVertLeftLineWeight* = 79*[](#AcTableStyleOverrides.acHeaderVertLeftLineWeight "Link to this definition") - acHeaderVertLeftVisibility* = 109*[](#AcTableStyleOverrides.acHeaderVertLeftVisibility "Link to this definition") * acHeaderVertRightColor* = 51*[](#AcTableStyleOverrides.acHeaderVertRightColor "Link to this definition") - acHeaderVertRightLineWeight* = 81*[](#AcTableStyleOverrides.acHeaderVertRightLineWeight "Link to this definition") * acHeaderVertRightVisibility* = 111*[](#AcTableStyleOverrides.acHeaderVertRightVisibility "Link to this definition") - acHorzCellMargin* = 4*[](#AcTableStyleOverrides.acHorzCellMargin "Link to this definition") * acTitleHorzBottomColor* = 42*[](#AcTableStyleOverrides.acTitleHorzBottomColor "Link to this definition") - acTitleHorzBottomLineWeight* = 72*[](#AcTableStyleOverrides.acTitleHorzBottomLineWeight "Link to this definition") * acTitleHorzBottomVisibility* = 102*[](#AcTableStyleOverrides.acTitleHorzBottomVisibility "Link to this definition") - acTitleHorzInsideColor* = 41*[](#AcTableStyleOverrides.acTitleHorzInsideColor "Link to this definition") * acTitleHorzInsideLineWeight* = 71*[](#AcTableStyleOverrides.acTitleHorzInsideLineWeight "Link to this definition") - acTitleHorzInsideVisibility* = 101*[](#AcTableStyleOverrides.acTitleHorzInsideVisibility "Link to this definition") * acTitleHorzTopColor* = 40*[](#AcTableStyleOverrides.acTitleHorzTopColor "Link to this definition") - acTitleHorzTopLineWeight* = 70*[](#AcTableStyleOverrides.acTitleHorzTopLineWeight "Link to this definition") * acTitleHorzTopVisibility* = 100*[](#AcTableStyleOverrides.acTitleHorzTopVisibility "Link to this definition") - acTitleRowAlignment* = 15*[](#AcTableStyleOverrides.acTitleRowAlignment "Link to this definition") * acTitleRowColor* = 6*[](#AcTableStyleOverrides.acTitleRowColor "Link to this definition") - acTitleRowDataType* = 24*[](#AcTableStyleOverrides.acTitleRowDataType "Link to this definition") * acTitleRowFillColor* = 12*[](#AcTableStyleOverrides.acTitleRowFillColor "Link to this definition") - acTitleRowFillNone* = 9*[](#AcTableStyleOverrides.acTitleRowFillNone "Link to this definition") * acTitleRowTextHeight* = 21*[](#AcTableStyleOverrides.acTitleRowTextHeight "Link to this definition") - acTitleRowTextStyle* = 18*[](#AcTableStyleOverrides.acTitleRowTextStyle "Link to this definition") * acTitleSuppressed* = 1*[](#AcTableStyleOverrides.acTitleSuppressed "Link to this definition") - acTitleVertInsideColor* = 44*[](#AcTableStyleOverrides.acTitleVertInsideColor "Link to this definition") * acTitleVertInsideLineWeight* = 74*[](#AcTableStyleOverrides.acTitleVertInsideLineWeight "Link to this definition") - acTitleVertInsideVisibility* = 104*[](#AcTableStyleOverrides.acTitleVertInsideVisibility "Link to this definition") * acTitleVertLeftColor* = 43*[](#AcTableStyleOverrides.acTitleVertLeftColor "Link to this definition") - acTitleVertLeftLineWeight* = 73*[](#AcTableStyleOverrides.acTitleVertLeftLineWeight "Link to this definition") * acTitleVertLeftVisibility* = 103*[](#AcTableStyleOverrides.acTitleVertLeftVisibility "Link to this definition") - acTitleVertRightColor* = 45*[](#AcTableStyleOverrides.acTitleVertRightColor "Link to this definition") * acTitleVertRightLineWeight* = 75*[](#AcTableStyleOverrides.acTitleVertRightLineWeight "Link to this definition") - acTitleVertRightVisibility* = 105*[](#AcTableStyleOverrides.acTitleVertRightVisibility "Link to this definition") * acVertCellMargin* = 5*[](#AcTableStyleOverrides.acVertCellMargin "Link to this definition") <!-- --> ## AcTextAlignmentType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcTextAlignmentType "Direct link to AcTextAlignmentType") * *class *viktor.external.autocad.enums.AcTextAlignmentType(*\*values*)[](#AcTextAlignmentType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcTextAlignmentType` values, mirroring the product API’s names so code reads like its docs. * acCenterAlignment* = 1*[](#AcTextAlignmentType.acCenterAlignment "Link to this definition") - acLeftAlignment* = 0*[](#AcTextAlignmentType.acLeftAlignment "Link to this definition") * acRightAlignment* = 2*[](#AcTextAlignmentType.acRightAlignment "Link to this definition") <!-- --> ## AcTextAngleType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcTextAngleType "Direct link to AcTextAngleType") * *class *viktor.external.autocad.enums.AcTextAngleType(*\*values*)[](#AcTextAngleType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcTextAngleType` values, mirroring the product API’s names so code reads like its docs. * acAlwaysRightReadingAngle* = 2*[](#AcTextAngleType.acAlwaysRightReadingAngle "Link to this definition") - acHorizontalAngle* = 1*[](#AcTextAngleType.acHorizontalAngle "Link to this definition") * acInsertAngle* = 0*[](#AcTextAngleType.acInsertAngle "Link to this definition") <!-- --> ## AcTextAttachmentDirection[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcTextAttachmentDirection "Direct link to AcTextAttachmentDirection") * *class *viktor.external.autocad.enums.AcTextAttachmentDirection(*\*values*)[](#AcTextAttachmentDirection "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcTextAttachmentDirection` values, mirroring the product API’s names so code reads like its docs. * acAttachmentHorizontal* = 0*[](#AcTextAttachmentDirection.acAttachmentHorizontal "Link to this definition") - acAttachmentVertical* = 1*[](#AcTextAttachmentDirection.acAttachmentVertical "Link to this definition") <!-- --> ## AcTextAttachmentType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcTextAttachmentType "Direct link to AcTextAttachmentType") * *class *viktor.external.autocad.enums.AcTextAttachmentType(*\*values*)[](#AcTextAttachmentType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcTextAttachmentType` values, mirroring the product API’s names so code reads like its docs. * acAttachmentAllLine* = 8*[](#AcTextAttachmentType.acAttachmentAllLine "Link to this definition") - acAttachmentBottomLine* = 7*[](#AcTextAttachmentType.acAttachmentBottomLine "Link to this definition") * acAttachmentBottomOfBottom* = 6*[](#AcTextAttachmentType.acAttachmentBottomOfBottom "Link to this definition") - acAttachmentBottomOfTop* = 2*[](#AcTextAttachmentType.acAttachmentBottomOfTop "Link to this definition") * acAttachmentBottomOfTopLine* = 3*[](#AcTextAttachmentType.acAttachmentBottomOfTopLine "Link to this definition") - acAttachmentMiddle* = 4*[](#AcTextAttachmentType.acAttachmentMiddle "Link to this definition") * acAttachmentMiddleOfBottom* = 5*[](#AcTextAttachmentType.acAttachmentMiddleOfBottom "Link to this definition") - acAttachmentMiddleOfTop* = 1*[](#AcTextAttachmentType.acAttachmentMiddleOfTop "Link to this definition") * acAttachmentTopOfTop* = 0*[](#AcTextAttachmentType.acAttachmentTopOfTop "Link to this definition") <!-- --> ## AcTextFontStyle[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcTextFontStyle "Direct link to AcTextFontStyle") * *class *viktor.external.autocad.enums.AcTextFontStyle(*\*values*)[](#AcTextFontStyle "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcTextFontStyle` values, mirroring the product API’s names so code reads like its docs. * acFontBold* = 2*[](#AcTextFontStyle.acFontBold "Link to this definition") - acFontBoldItalic* = 3*[](#AcTextFontStyle.acFontBoldItalic "Link to this definition") * acFontItalic* = 1*[](#AcTextFontStyle.acFontItalic "Link to this definition") - acFontRegular* = 0*[](#AcTextFontStyle.acFontRegular "Link to this definition") <!-- --> ## AcTextGenerationFlag[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcTextGenerationFlag "Direct link to AcTextGenerationFlag") * *class *viktor.external.autocad.enums.AcTextGenerationFlag(*\*values*)[](#AcTextGenerationFlag "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcTextGenerationFlag` values, mirroring the product API’s names so code reads like its docs. * acTextFlagBackward* = 2*[](#AcTextGenerationFlag.acTextFlagBackward "Link to this definition") - acTextFlagUpsideDown* = 4*[](#AcTextGenerationFlag.acTextFlagUpsideDown "Link to this definition") <!-- --> ## AcToolbarDockStatus[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcToolbarDockStatus "Direct link to AcToolbarDockStatus") * *class *viktor.external.autocad.enums.AcToolbarDockStatus(*\*values*)[](#AcToolbarDockStatus "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcToolbarDockStatus` values, mirroring the product API’s names so code reads like its docs. * acToolbarDockBottom* = 1*[](#AcToolbarDockStatus.acToolbarDockBottom "Link to this definition") - acToolbarDockLeft* = 2*[](#AcToolbarDockStatus.acToolbarDockLeft "Link to this definition") * acToolbarDockRight* = 3*[](#AcToolbarDockStatus.acToolbarDockRight "Link to this definition") - acToolbarDockTop* = 0*[](#AcToolbarDockStatus.acToolbarDockTop "Link to this definition") * acToolbarFloating* = 4*[](#AcToolbarDockStatus.acToolbarFloating "Link to this definition") <!-- --> ## AcToolbarItemType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcToolbarItemType "Direct link to AcToolbarItemType") * *class *viktor.external.autocad.enums.AcToolbarItemType(*\*values*)[](#AcToolbarItemType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcToolbarItemType` values, mirroring the product API’s names so code reads like its docs. * acToolbarButton* = 0*[](#AcToolbarItemType.acToolbarButton "Link to this definition") - acToolbarControl* = 2*[](#AcToolbarItemType.acToolbarControl "Link to this definition") * acToolbarFlyout* = 3*[](#AcToolbarItemType.acToolbarFlyout "Link to this definition") - acToolbarSeparator* = 1*[](#AcToolbarItemType.acToolbarSeparator "Link to this definition") <!-- --> ## AcUnderlayLayerOverrideType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcUnderlayLayerOverrideType "Direct link to AcUnderlayLayerOverrideType") * *class *viktor.external.autocad.enums.AcUnderlayLayerOverrideType(*\*values*)[](#AcUnderlayLayerOverrideType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcUnderlayLayerOverrideType` values, mirroring the product API’s names so code reads like its docs. * acApplied* = 1*[](#AcUnderlayLayerOverrideType.acApplied "Link to this definition") - acNoOverrides* = 0*[](#AcUnderlayLayerOverrideType.acNoOverrides "Link to this definition") <!-- --> ## AcUnits[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcUnits "Direct link to AcUnits") * *class *viktor.external.autocad.enums.AcUnits(*\*values*)[](#AcUnits "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcUnits` values, mirroring the product API’s names so code reads like its docs. * acArchitectural* = 4*[](#AcUnits.acArchitectural "Link to this definition") - acDecimal* = 2*[](#AcUnits.acDecimal "Link to this definition") * acDefaultUnits* = -1*[](#AcUnits.acDefaultUnits "Link to this definition") - acEngineering* = 3*[](#AcUnits.acEngineering "Link to this definition") * acFractional* = 5*[](#AcUnits.acFractional "Link to this definition") - acScientific* = 1*[](#AcUnits.acScientific "Link to this definition") <!-- --> ## AcValueDataType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcValueDataType "Direct link to AcValueDataType") * *class *viktor.external.autocad.enums.AcValueDataType(*\*values*)[](#AcValueDataType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcValueDataType` values, mirroring the product API’s names so code reads like its docs. * acBuffer* = 128*[](#AcValueDataType.acBuffer "Link to this definition") - acDate* = 8*[](#AcValueDataType.acDate "Link to this definition") * acDouble* = 2*[](#AcValueDataType.acDouble "Link to this definition") - acGeneral* = 512*[](#AcValueDataType.acGeneral "Link to this definition") * acLong* = 1*[](#AcValueDataType.acLong "Link to this definition") - acObjectId* = 64*[](#AcValueDataType.acObjectId "Link to this definition") * acPoint2d* = 16*[](#AcValueDataType.acPoint2d "Link to this definition") - acPoint3d* = 32*[](#AcValueDataType.acPoint3d "Link to this definition") * acResbuf* = 256*[](#AcValueDataType.acResbuf "Link to this definition") - acString* = 4*[](#AcValueDataType.acString "Link to this definition") * acUnknownDataType* = 0*[](#AcValueDataType.acUnknownDataType "Link to this definition") <!-- --> ## AcValueUnitType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcValueUnitType "Direct link to AcValueUnitType") * *class *viktor.external.autocad.enums.AcValueUnitType(*\*values*)[](#AcValueUnitType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcValueUnitType` values, mirroring the product API’s names so code reads like its docs. * acUnitAngle* = 2*[](#AcValueUnitType.acUnitAngle "Link to this definition") - acUnitArea* = 4*[](#AcValueUnitType.acUnitArea "Link to this definition") * acUnitDistance* = 1*[](#AcValueUnitType.acUnitDistance "Link to this definition") - acUnitVolume* = 8*[](#AcValueUnitType.acUnitVolume "Link to this definition") * acUnitless* = 0*[](#AcValueUnitType.acUnitless "Link to this definition") <!-- --> ## AcVerticalAlignment[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcVerticalAlignment "Direct link to AcVerticalAlignment") * *class *viktor.external.autocad.enums.AcVerticalAlignment(*\*values*)[](#AcVerticalAlignment "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcVerticalAlignment` values, mirroring the product API’s names so code reads like its docs. * acVerticalAlignmentBaseline* = 0*[](#AcVerticalAlignment.acVerticalAlignmentBaseline "Link to this definition") - acVerticalAlignmentBottom* = 1*[](#AcVerticalAlignment.acVerticalAlignmentBottom "Link to this definition") * acVerticalAlignmentMiddle* = 2*[](#AcVerticalAlignment.acVerticalAlignmentMiddle "Link to this definition") - acVerticalAlignmentTop* = 3*[](#AcVerticalAlignment.acVerticalAlignmentTop "Link to this definition") <!-- --> ## AcVerticalTextAttachmentType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcVerticalTextAttachmentType "Direct link to AcVerticalTextAttachmentType") * *class *viktor.external.autocad.enums.AcVerticalTextAttachmentType(*\*values*)[](#AcVerticalTextAttachmentType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcVerticalTextAttachmentType` values, mirroring the product API’s names so code reads like its docs. * acAttachmentCenter* = 0*[](#AcVerticalTextAttachmentType.acAttachmentCenter "Link to this definition") - acAttachmentLinedCenter* = 1*[](#AcVerticalTextAttachmentType.acAttachmentLinedCenter "Link to this definition") <!-- --> ## AcViewportScale[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcViewportScale "Direct link to AcViewportScale") * *class *viktor.external.autocad.enums.AcViewportScale(*\*values*)[](#AcViewportScale "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcViewportScale` values, mirroring the product API’s names so code reads like its docs. * acVp100\_1* = 18*[](#AcViewportScale.acVp100_1 "Link to this definition") - acVp10\_1* = 17*[](#AcViewportScale.acVp10_1 "Link to this definition") * acVp1\_1* = 2*[](#AcViewportScale.acVp1_1 "Link to this definition") - acVp1\_10* = 7*[](#AcViewportScale.acVp1_10 "Link to this definition") * acVp1\_100* = 13*[](#AcViewportScale.acVp1_100 "Link to this definition") - acVp1\_128in\_1ft* = 19*[](#AcViewportScale.acVp1_128in_1ft "Link to this definition") * acVp1\_16* = 8*[](#AcViewportScale.acVp1_16 "Link to this definition") - acVp1\_16in\_1ft* = 22*[](#AcViewportScale.acVp1_16in_1ft "Link to this definition") * acVp1\_2* = 3*[](#AcViewportScale.acVp1_2 "Link to this definition") - acVp1\_20* = 9*[](#AcViewportScale.acVp1_20 "Link to this definition") * acVp1\_2in\_1ft* = 28*[](#AcViewportScale.acVp1_2in_1ft "Link to this definition") - acVp1\_30* = 10*[](#AcViewportScale.acVp1_30 "Link to this definition") * acVp1\_32in\_1ft* = 21*[](#AcViewportScale.acVp1_32in_1ft "Link to this definition") - acVp1\_4* = 4*[](#AcViewportScale.acVp1_4 "Link to this definition") * acVp1\_40* = 11*[](#AcViewportScale.acVp1_40 "Link to this definition") - acVp1\_4in\_1ft* = 26*[](#AcViewportScale.acVp1_4in_1ft "Link to this definition") * acVp1\_5* = 5*[](#AcViewportScale.acVp1_5 "Link to this definition") - acVp1\_50* = 12*[](#AcViewportScale.acVp1_50 "Link to this definition") * acVp1\_64in\_1ft* = 20*[](#AcViewportScale.acVp1_64in_1ft "Link to this definition") - acVp1\_8* = 6*[](#AcViewportScale.acVp1_8 "Link to this definition") * acVp1\_8in\_1ft* = 24*[](#AcViewportScale.acVp1_8in_1ft "Link to this definition") - acVp1and1\_2in\_1ft* = 31*[](#AcViewportScale.acVp1and1_2in_1ft "Link to this definition") * acVp1ft\_1ft* = 34*[](#AcViewportScale.acVp1ft_1ft "Link to this definition") - acVp1in\_1ft* = 30*[](#AcViewportScale.acVp1in_1ft "Link to this definition") * acVp2\_1* = 14*[](#AcViewportScale.acVp2_1 "Link to this definition") - acVp3\_16in\_1ft* = 25*[](#AcViewportScale.acVp3_16in_1ft "Link to this definition") * acVp3\_32in\_1ft* = 23*[](#AcViewportScale.acVp3_32in_1ft "Link to this definition") - acVp3\_4in\_1ft* = 29*[](#AcViewportScale.acVp3_4in_1ft "Link to this definition") * acVp3\_8in\_1ft* = 27*[](#AcViewportScale.acVp3_8in_1ft "Link to this definition") - acVp3in\_1ft* = 32*[](#AcViewportScale.acVp3in_1ft "Link to this definition") * acVp4\_1* = 15*[](#AcViewportScale.acVp4_1 "Link to this definition") - acVp6in\_1ft* = 33*[](#AcViewportScale.acVp6in_1ft "Link to this definition") * acVp8\_1* = 16*[](#AcViewportScale.acVp8_1 "Link to this definition") - acVpCustomScale* = 1*[](#AcViewportScale.acVpCustomScale "Link to this definition") * acVpScaleToFit* = 0*[](#AcViewportScale.acVpScaleToFit "Link to this definition") <!-- --> ## AcViewportSplitType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcViewportSplitType "Direct link to AcViewportSplitType") * *class *viktor.external.autocad.enums.AcViewportSplitType(*\*values*)[](#AcViewportSplitType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcViewportSplitType` values, mirroring the product API’s names so code reads like its docs. * acViewport2Horizontal* = 0*[](#AcViewportSplitType.acViewport2Horizontal "Link to this definition") - acViewport2Vertical* = 1*[](#AcViewportSplitType.acViewport2Vertical "Link to this definition") * acViewport3Above* = 6*[](#AcViewportSplitType.acViewport3Above "Link to this definition") - acViewport3Below* = 7*[](#AcViewportSplitType.acViewport3Below "Link to this definition") * acViewport3Horizontal* = 4*[](#AcViewportSplitType.acViewport3Horizontal "Link to this definition") - acViewport3Left* = 2*[](#AcViewportSplitType.acViewport3Left "Link to this definition") * acViewport3Right* = 3*[](#AcViewportSplitType.acViewport3Right "Link to this definition") - acViewport3Vertical* = 5*[](#AcViewportSplitType.acViewport3Vertical "Link to this definition") * acViewport4* = 8*[](#AcViewportSplitType.acViewport4 "Link to this definition") <!-- --> ## AcWindowState[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcWindowState "Direct link to AcWindowState") * *class *viktor.external.autocad.enums.AcWindowState(*\*values*)[](#AcWindowState "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcWindowState` values, mirroring the product API’s names so code reads like its docs. * acMax* = 3*[](#AcWindowState.acMax "Link to this definition") - acMin* = 2*[](#AcWindowState.acMin "Link to this definition") * acNorm* = 1*[](#AcWindowState.acNorm "Link to this definition") <!-- --> ## AcWireframeType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcWireframeType "Direct link to AcWireframeType") * *class *viktor.external.autocad.enums.AcWireframeType(*\*values*)[](#AcWireframeType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcWireframeType` values, mirroring the product API’s names so code reads like its docs. * acIsolines* = 0*[](#AcWireframeType.acIsolines "Link to this definition") - acIsoparms* = 1*[](#AcWireframeType.acIsoparms "Link to this definition") <!-- --> ## AcXRefDemandLoad[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcXRefDemandLoad "Direct link to AcXRefDemandLoad") * *class *viktor.external.autocad.enums.AcXRefDemandLoad(*\*values*)[](#AcXRefDemandLoad "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcXRefDemandLoad` values, mirroring the product API’s names so code reads like its docs. * acDemandLoadDisabled* = 0*[](#AcXRefDemandLoad.acDemandLoadDisabled "Link to this definition") - acDemandLoadEnabled* = 1*[](#AcXRefDemandLoad.acDemandLoadEnabled "Link to this definition") * acDemandLoadEnabledWithCopy* = 2*[](#AcXRefDemandLoad.acDemandLoadEnabledWithCopy "Link to this definition") <!-- --> ## AcZoomScaleType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcZoomScaleType "Direct link to AcZoomScaleType") * *class *viktor.external.autocad.enums.AcZoomScaleType(*\*values*)[](#AcZoomScaleType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcZoomScaleType` values, mirroring the product API’s names so code reads like its docs. * acZoomScaledAbsolute* = 0*[](#AcZoomScaleType.acZoomScaledAbsolute "Link to this definition") - acZoomScaledRelative* = 1*[](#AcZoomScaleType.acZoomScaledRelative "Link to this definition") * acZoomScaledRelativePSpace* = 2*[](#AcZoomScaleType.acZoomScaledRelativePSpace "Link to this definition") <!-- --> ## AcadSecurityParamsConstants[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcadSecurityParamsConstants "Direct link to AcadSecurityParamsConstants") * *class *viktor.external.autocad.enums.AcadSecurityParamsConstants(*\*values*)[](#AcadSecurityParamsConstants "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcadSecurityParamsConstants` values, mirroring the product API’s names so code reads like its docs. * ACADSECURITYPARAMS\_ALGID\_RC4* = 26625*[](#AcadSecurityParamsConstants.ACADSECURITYPARAMS_ALGID_RC4 "Link to this definition") <!-- --> ## AcadSecurityParamsType[​](https://docs.viktor.ai/sdk/api/external/autocad/.md#_AcadSecurityParamsType "Direct link to AcadSecurityParamsType") * *class *viktor.external.autocad.enums.AcadSecurityParamsType(*\*values*)[](#AcadSecurityParamsType "Link to this definition") Bases: `IntEnum` New in 14.35.0 AutoCAD `AcadSecurityParamsType` values, mirroring the product API’s names so code reads like its docs. * ACADSECURITYPARAMS\_ADD\_TIMESTAMP* = 32*[](#AcadSecurityParamsType.ACADSECURITYPARAMS_ADD_TIMESTAMP "Link to this definition") - ACADSECURITYPARAMS\_ENCRYPT\_DATA* = 1*[](#AcadSecurityParamsType.ACADSECURITYPARAMS_ENCRYPT_DATA "Link to this definition") * ACADSECURITYPARAMS\_ENCRYPT\_PROPS* = 2*[](#AcadSecurityParamsType.ACADSECURITYPARAMS_ENCRYPT_PROPS "Link to this definition") - ACADSECURITYPARAMS\_SIGN\_DATA* = 16*[](#AcadSecurityParamsType.ACADSECURITYPARAMS_SIGN_DATA "Link to this definition") --- # viktor.external.autodesk <!-- --> <!-- --> <!-- --> ## AutodeskFile[​](https://docs.viktor.ai/sdk/api/external/autodesk/.md#_AutodeskFile "Direct link to AutodeskFile") * *class *viktor.external.autodesk.AutodeskFile(*url*)[](#AutodeskFile "Link to this definition") New in v14.25.0 Represents a file stored on Autodesk cloud storage (<https://aps.autodesk.com/>) Example: ``` import viktor as vkt # Set up OAuth2 integration to get access token integration = vkt.external.OAuth2Integration("autodesk-integration") token = integration.get_access_token() # Get the AutodeskFile from a parametrization field autodesk_file = params.autodesk_file # value of AutodeskFileField # Get the AEC Data Model element group ID (requires API call) element_group_id = autodesk_file.get_aec_data_model_element_group_id(token) print(f"The element group id is: {element_group_id}") # Access file properties and metadata: project_id = autodesk_file.project_id # Can be extracted from URL urn = autodesk_file.urn # Get the unique resource name hub_id = autodesk_file.get_hub_id(token) # Requires API call region = autodesk_file.get_region(token) # Requires API call ``` * get\_aec\_data\_model\_element\_group\_id(*access\_token*)[](#AutodeskFile.get_aec_data_model_element_group_id "Link to this definition") New in v14.26.0 Get the AEC Data Model ElementGroup ID associated with this file. * Return type: `str` - get\_hub\_id(*access\_token*)[](#AutodeskFile.get_hub_id "Link to this definition") New in v14.26.0 Get the id of the hub this file belongs to. * Return type: `str` * get\_latest\_version(*access\_token*)[](#AutodeskFile.get_latest_version "Link to this definition") Get the latest version of the file on Autodesk cloud storage. * Parameters: **access\_token** (`str`) – Autodesk Platform Services token to access the file. * Return type: [`AutodeskFileVersion`](#AutodeskFileVersion "viktor.external.autodesk.AutodeskFileVersion") - get\_region(*access\_token*)[](#AutodeskFile.get_region "Link to this definition") New in v14.26.0 Get the region of the hub this file belongs to. * Return type: `str` * *property *project\_id*: str*[](#AutodeskFile.project_id "Link to this definition") New in v14.26.0 Get the id of the project this file belongs to. - *property *url*: str*[](#AutodeskFile.url "Link to this definition") URL of the file on Autodesk cloud storage. * *property *urn*: str*[](#AutodeskFile.urn "Link to this definition") New in v14.26.0 Get the unique resource name (also called “id”) of this file on Autodesk cloud storage. <!-- --> ## AutodeskFileVersion[​](https://docs.viktor.ai/sdk/api/external/autodesk/.md#_AutodeskFileVersion "Direct link to AutodeskFileVersion") * *class *viktor.external.autodesk.AutodeskFileVersion(*\_access\_token*, *\_data*)[](#AutodeskFileVersion "Link to this definition") New in v14.25.0 Warning Do not instantiate this class directly, it is created from [`AutodeskFile`](#AutodeskFile "viktor.external.autodesk.AutodeskFile"). * *property *attributes*: dict*[](#AutodeskFileVersion.attributes "Link to this definition") Get the attributes of this version of the file on Autodesk cloud storage. - get\_file()[](#AutodeskFileVersion.get_file "Link to this definition") Download the content of this version of the file from Autodesk cloud storage. * Return type: [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") * *property *storage\_url*: str | None*[](#AutodeskFileVersion.storage_url "Link to this definition") New in v14.26.0 Get the storage URL of this version of the file. - *property *urn*: str*[](#AutodeskFileVersion.urn "Link to this definition") Get the unique resource name (also called “id”) of this version of the file on Autodesk cloud storage. --- # viktor.external.axisvm <!-- --> <!-- --> <!-- --> ## AxisVMAnalysis[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_AxisVMAnalysis "Direct link to AxisVMAnalysis") * *class *viktor.external.axisvm.AxisVMAnalysis(*model*, *\**, *return\_results=True*, *return\_model=False*, *report\_template=None*)[](#AxisVMAnalysis "Link to this definition") Bases: [`ExternalProgram`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram "viktor.external.external_program.ExternalProgram") Perform an analysis using AxisVM on a third-party worker. To start an analysis call the method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute"), with an appropriate timeout (in seconds). To retrieve the results call the method [`get_results()`](#AxisVMAnalysis.get_results "viktor.external.axisvm.AxisVMAnalysis.get_results"), after [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute"). The model file can be retrieved by calling [`get_model_file()`](#AxisVMAnalysis.get_model_file "viktor.external.axisvm.AxisVMAnalysis.get_model_file") and the result by calling [`get_result_file()`](#AxisVMAnalysis.get_result_file "viktor.external.axisvm.AxisVMAnalysis.get_result_file"). Usage: ``` axisvm_analysis = AxisVMAnalysis(model, return_results=True, return_model=True) axisvm_analysis.execute(timeout=10) results = axisvm_analysis.get_results() model_file = axisvm_analysis.get_model_file() result_file = axisvm_analysis.get_result_file() ``` Exceptions which can be raised during calculation: > * [`ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information * Parameters: * **model** ([`Model`](#Model "viktor.external.axisvm.Model")) – AxisVM model ([`Model`](#Model "viktor.external.axisvm.Model")) * **return\_results** (`bool`) – If True, an analysis will be run and the result file is returned. * **return\_model** (`bool`) – If True, the model file is returned. * **report\_template** (`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – (optional) report template that is added to AxisVM file - get\_model\_file(*\**, *as\_file=False*)[](#AxisVMAnalysis.get_model_file "Link to this definition") Retrieve the model file (only if return\_model = True). [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute") must be called first. * Parameters: **as\_file** (`bool`) – Return as BytesIO (default) or File New in v13.5.0 * Return type: `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | `None` * get\_result\_file(*\**, *as\_file=False*)[](#AxisVMAnalysis.get_result_file "Link to this definition") Retrieve the result file (only if return\_results = True). [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute") must be called first. * Parameters: **as\_file** (`bool`) – Return as BytesIO (default) or File New in v13.5.0 * Return type: `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | `None` - get\_results()[](#AxisVMAnalysis.get_results "Link to this definition") Retrieve the results (only if return\_results = True). `execute()` must be called first. The format of the returned dictionary is: ``` { 'Forces': <dict>, 'Displacements': <dict>, 'Sections': <dict> } ``` * Return type: `dict` <!-- --> ## CircleArc[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_CircleArc "Direct link to CircleArc") * *class *viktor.external.axisvm.CircleArc(*center*, *normal\_vector*, *alpha*)[](#CircleArc "Link to this definition") Circular arc defined by its center, normal vector and angle. Used in various methods, in conjunction with a start and end point. * Parameters: * **center** (`Tuple`\[`float`, `float`, `float`]) – (x, y, z) position \[m] of the arc’s center point. * **normal\_vector** (`Tuple`\[`float`, `float`, `float`]) – (x, y, z) component \[m] of the arc plane’s normal vector. * **alpha** (`float`) – signed angle \[rad]. Positive angle is counterclockwise, from the start point. <!-- --> ## CrossSection[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_CrossSection "Direct link to CrossSection") * *class *viktor.external.axisvm.CrossSection(*id\_*, *name*)[](#CrossSection "Link to this definition") Bases: [`Object`](#Object "viktor.external.axisvm.Object") Do not use this \_\_init\_\_ directly, but create the object from [`Model`](#Model "viktor.external.axisvm.Model") * *class *Process(*\*values*)[](#CrossSection.Process "Link to this definition") Bases: `Enum` Manufacturing process. * COLD\_FORMED*: [`Process`](#CrossSection.Process "viktor.external.axisvm.CrossSection.Process")** = 3*[](#CrossSection.Process.COLD_FORMED "Link to this definition") - OTHER*: [`Process`](#CrossSection.Process "viktor.external.axisvm.CrossSection.Process")** = 0*[](#CrossSection.Process.OTHER "Link to this definition") * ROLLED*: [`Process`](#CrossSection.Process "viktor.external.axisvm.CrossSection.Process")** = 1*[](#CrossSection.Process.ROLLED "Link to this definition") - WELDED*: [`Process`](#CrossSection.Process "viktor.external.axisvm.CrossSection.Process")** = 2*[](#CrossSection.Process.WELDED "Link to this definition") - *property *name*: str*[](#CrossSection.name "Link to this definition") Name of the cross-section. <!-- --> ## CrossSectionInterface[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_CrossSectionInterface "Direct link to CrossSectionInterface") * *class *viktor.external.axisvm.CrossSectionInterface[](#CrossSectionInterface "Link to this definition") Bases: `_Interface` Do not use this \_\_init\_\_ directly, but use [`Model.cross_sections`](#Model.cross_sections "viktor.external.axisvm.Model.cross_sections") * create\_circular(*diameter*, *\**, *name=None*)[](#CrossSectionInterface.create_circular "Link to this definition") Create a circular cross-section with given diameter. * Parameters: * **diameter** (`float`) – diameter \[m] of the cross-section. * **name** (`str`) – name of the cross-section (must be unique) (default: auto). * Return type: [`CrossSection`](#CrossSection "viktor.external.axisvm.CrossSection") - create\_rectangular(*width*, *height*, *\**, *process=Process.OTHER*, *name=None*)[](#CrossSectionInterface.create_rectangular "Link to this definition") Create a rectangular cross-section with given width and height. * Parameters: * **width** (`float`) – width \[m] of the cross-section. * **height** (`float`) – height \[m] of the cross-section. * **process** ([`Process`](#CrossSection.Process "viktor.external.axisvm.CrossSection.Process")) – process (default: other). * **name** (`str`) – name of the cross-section (must be unique) (default: auto). * Return type: [`CrossSection`](#CrossSection "viktor.external.axisvm.CrossSection") <!-- --> ## Domain[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_Domain "Direct link to Domain") * *class *viktor.external.axisvm.Domain(*id\_*, *interface*)[](#Domain "Link to this definition") Bases: [`Object`](#Object "viktor.external.axisvm.Object") Do not use this \_\_init\_\_ directly, but create the object from [`Model`](#Model "viktor.external.axisvm.Model") * *class *EccentricityType(*\*values*)[](#Domain.EccentricityType "Link to this definition") Bases: `Enum` Type of eccentricity. * BOTTOM\_ALIGNED*: [`EccentricityType`](#Domain.EccentricityType "viktor.external.axisvm.Domain.EccentricityType")** = 5*[](#Domain.EccentricityType.BOTTOM_ALIGNED "Link to this definition") - CONSTANT*: [`EccentricityType`](#Domain.EccentricityType "viktor.external.axisvm.Domain.EccentricityType")** = 1*[](#Domain.EccentricityType.CONSTANT "Link to this definition") * ONE\_WAY*: [`EccentricityType`](#Domain.EccentricityType "viktor.external.axisvm.Domain.EccentricityType")** = 2*[](#Domain.EccentricityType.ONE_WAY "Link to this definition") - TOP\_ALIGNED*: [`EccentricityType`](#Domain.EccentricityType "viktor.external.axisvm.Domain.EccentricityType")** = 4*[](#Domain.EccentricityType.TOP_ALIGNED "Link to this definition") * TWO\_WAY*: [`EccentricityType`](#Domain.EccentricityType "viktor.external.axisvm.Domain.EccentricityType")** = 3*[](#Domain.EccentricityType.TWO_WAY "Link to this definition") - *class *MeshGeometry(*\*values*)[](#Domain.MeshGeometry "Link to this definition") Bases: `Enum` Mesh geometry type. * MIXED*: [`MeshGeometry`](#Domain.MeshGeometry "viktor.external.axisvm.Domain.MeshGeometry")** = 2*[](#Domain.MeshGeometry.MIXED "Link to this definition") - QUAD*: [`MeshGeometry`](#Domain.MeshGeometry "viktor.external.axisvm.Domain.MeshGeometry")** = 1*[](#Domain.MeshGeometry.QUAD "Link to this definition") * TRIANGLE*: [`MeshGeometry`](#Domain.MeshGeometry "viktor.external.axisvm.Domain.MeshGeometry")** = 0*[](#Domain.MeshGeometry.TRIANGLE "Link to this definition") * *class *MeshType(*\*values*)[](#Domain.MeshType "Link to this definition") Bases: `Enum` Contour division method. * ADAPTIVE*: [`MeshType`](#Domain.MeshType "viktor.external.axisvm.Domain.MeshType")** = 0*[](#Domain.MeshType.ADAPTIVE "Link to this definition") - UNIFORM*: [`MeshType`](#Domain.MeshType "viktor.external.axisvm.Domain.MeshType")** = 1*[](#Domain.MeshType.UNIFORM "Link to this definition") - *class *SurfaceType(*\*values*)[](#Domain.SurfaceType "Link to this definition") Bases: `Enum` Finite element type. * HOLE*: [`SurfaceType`](#Domain.SurfaceType "viktor.external.axisvm.Domain.SurfaceType")** = 0*[](#Domain.SurfaceType.HOLE "Link to this definition") - MEMBRANE\_STRAIN*: [`SurfaceType`](#Domain.SurfaceType "viktor.external.axisvm.Domain.SurfaceType")** = 2*[](#Domain.SurfaceType.MEMBRANE_STRAIN "Link to this definition") * MEMBRANE\_STRESS*: [`SurfaceType`](#Domain.SurfaceType "viktor.external.axisvm.Domain.SurfaceType")** = 1*[](#Domain.SurfaceType.MEMBRANE_STRESS "Link to this definition") - PLATE*: [`SurfaceType`](#Domain.SurfaceType "viktor.external.axisvm.Domain.SurfaceType")** = 3*[](#Domain.SurfaceType.PLATE "Link to this definition") * SHELL*: [`SurfaceType`](#Domain.SurfaceType "viktor.external.axisvm.Domain.SurfaceType")** = 4*[](#Domain.SurfaceType.SHELL "Link to this definition") * generate\_mesh(*mesh\_geometry*, *mesh\_size*, *\**, *mesh\_type=MeshType.UNIFORM*, *fit\_to\_point\_loads=None*, *fit\_to\_line\_loads=None*, *fit\_to\_surface\_loads=None*, *quad\_mesh\_quality=2*)[](#Domain.generate_mesh "Link to this definition") Generate a mesh on the domain. * Parameters: * **mesh\_geometry** ([`MeshGeometry`](#Domain.MeshGeometry "viktor.external.axisvm.Domain.MeshGeometry")) – mesh geometry type. * **mesh\_size** (`float`) – average mesh size \[m]. * **mesh\_type** ([`MeshType`](#Domain.MeshType "viktor.external.axisvm.Domain.MeshType")) – contour division method (default: uniform). * **fit\_to\_point\_loads** (`float`) – fit mesh to point loads (default: false). * **fit\_to\_line\_loads** (`float`) – fit mesh to line loads (default: false). * **fit\_to\_surface\_loads** (`float`) – fit mesh to surface loads (default: false) * **quad\_mesh\_quality** (`int`) – smoothing quality (1-6) (default: 2) * Return type: `None` - set\_eccentricity(*eccentricity\_type*, *\**, *ecc\_1=None*, *p1=None*, *ecc\_2=None*, *p2=None*, *ecc\_3=None*, *p3=None*)[](#Domain.set_eccentricity "Link to this definition") Set eccentricity for the domain. * Parameters: * **eccentricity\_type** ([`EccentricityType`](#Domain.EccentricityType "viktor.external.axisvm.Domain.EccentricityType")) – type of eccentricity. * **ecc\_1** (`float`) – eccentricity \[m] at reference point 1. * **p1** (`Tuple`\[`float`, `float`, `float`]) – (x, y, z) position \[m] of reference point 1. * **ecc\_2** (`float`) – eccentricity \[m] at reference point 2. * **p2** (`Tuple`\[`float`, `float`, `float`]) – (x, y, z) position \[m] of reference point 2. * **ecc\_3** (`float`) – eccentricity \[m] at reference point 3. * **p3** (`Tuple`\[`float`, `float`, `float`]) – (x, y, z) position \[m] of reference point 3. * Return type: `None` <!-- --> ## DomainInterface[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_DomainInterface "Direct link to DomainInterface") * *class *viktor.external.axisvm.DomainInterface[](#DomainInterface "Link to this definition") Bases: `_Interface` Do not use this \_\_init\_\_ directly, but use [`Model.domains`](#Model.domains "viktor.external.axisvm.Model.domains") * create(*lines*, *\**, *surface\_type*, *thickness*, *material*)[](#DomainInterface.create "Link to this definition") Create a domain from given lines. * Parameters: * **lines** (`List`\[[`Line`](#Line "viktor.external.axisvm.Line")]) – lines to create a domain from (lines must form a closed loop!). * **surface\_type** ([`SurfaceType`](#Domain.SurfaceType "viktor.external.axisvm.Domain.SurfaceType")) – finite element surface type. * **thickness** (`float`) – thickness \[m] of the surface. * **material** ([`Material`](#Material "viktor.external.axisvm.Material")) – material of the surface. * Return type: [`Domain`](#Domain "viktor.external.axisvm.Domain") - generate\_mesh\_on\_domains(*domains*, *mesh\_geometry*, *mesh\_size*, *\**, *mesh\_type=MeshType.UNIFORM*, *fit\_to\_point\_loads=None*, *fit\_to\_line\_loads=None*, *fit\_to\_surface\_loads=None*, *quad\_mesh\_quality=2*)[](#DomainInterface.generate_mesh_on_domains "Link to this definition") Generate a mesh on one or more domains. * Parameters: * **domains** (`List`\[[`Domain`](#Domain "viktor.external.axisvm.Domain")]) – domain(s) to generate the mesh on. * **mesh\_geometry** ([`MeshGeometry`](#Domain.MeshGeometry "viktor.external.axisvm.Domain.MeshGeometry")) – mesh geometry type. * **mesh\_size** (`float`) – average mesh size \[m]. * **mesh\_type** ([`MeshType`](#Domain.MeshType "viktor.external.axisvm.Domain.MeshType")) – contour division method (default: uniform). * **fit\_to\_point\_loads** (`float`) – fit mesh to point loads (default: false). * **fit\_to\_line\_loads** (`float`) – fit mesh to line loads (default: false). * **fit\_to\_surface\_loads** (`float`) – fit mesh to surface loads (default: false) * **quad\_mesh\_quality** (`int`) – smoothing quality (1-6) (default: 2) * Return type: `None` * set\_eccentricity(*domain*, *eccentricity\_type*, *\**, *ecc\_1=None*, *p1=None*, *ecc\_2=None*, *p2=None*, *ecc\_3=None*, *p3=None*)[](#DomainInterface.set_eccentricity "Link to this definition") Set eccentricity for a domain. * Parameters: * **domain** ([`Domain`](#Domain "viktor.external.axisvm.Domain")) – domain to set eccentricity. * **eccentricity\_type** ([`EccentricityType`](#Domain.EccentricityType "viktor.external.axisvm.Domain.EccentricityType")) – type of eccentricity. * **ecc\_1** (`float`) – eccentricity \[m] at reference point 1. * **p1** (`Tuple`\[`float`, `float`, `float`]) – (x, y, z) position \[m] of reference point 1. * **ecc\_2** (`float`) – eccentricity \[m] at reference point 2. * **p2** (`Tuple`\[`float`, `float`, `float`]) – (x, y, z) position \[m] of reference point 2. * **ecc\_3** (`float`) – eccentricity \[m] at reference point 3. * **p3** (`Tuple`\[`float`, `float`, `float`]) – (x, y, z) position \[m] of reference point 3. * Return type: `None` <!-- --> ## Line[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_Line "Direct link to Line") * *class *viktor.external.axisvm.Line(*id\_*, *interface*, *node1*, *node2*)[](#Line "Link to this definition") Bases: [`Object`](#Object "viktor.external.axisvm.Object") Do not use this \_\_init\_\_ directly, but create the object from [`Model`](#Model "viktor.external.axisvm.Model") * define\_as\_beam(*material*, *css\_start*, *css\_end=None*, *\**, *local\_z\_reference=None*)[](#Line.define_as_beam "Link to this definition") Define the line as beam with given material and cross-section. * Parameters: * **material** ([`Material`](#Material "viktor.external.axisvm.Material")) – material of the beam. * **css\_start** ([`CrossSection`](#CrossSection "viktor.external.axisvm.CrossSection")) – cross-section at the start node of the beam. * **css\_end** ([`CrossSection`](#CrossSection "viktor.external.axisvm.CrossSection")) – cross-section at the start node of the beam (default: same as css\_start). * **local\_z\_reference** ([`Reference`](#Reference "viktor.external.axisvm.Reference")) – local z-reference (must be of type vector) (default: auto). * Return type: [`Member`](#Member "viktor.external.axisvm.Member") - *property *end\_node*: [Node](#Node "viktor.external.axisvm.Node")*[](#Line.end_node "Link to this definition") End node of the line. * split\_by\_number(*n*)[](#Line.split_by_number "Link to this definition") Split the line in ‘n’ equal parts. * Parameters: **n** (`int`) – number of parts after the split. * Return type: `None` - *property *start\_node*: [Node](#Node "viktor.external.axisvm.Node")*[](#Line.start_node "Link to this definition") Start node of the line. <!-- --> ## LineInterface[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_LineInterface "Direct link to LineInterface") * *class *viktor.external.axisvm.LineInterface[](#LineInterface "Link to this definition") Bases: `_Interface` Do not use this \_\_init\_\_ directly, but use [`Model.lines`](#Model.lines "viktor.external.axisvm.Model.lines") * create(*start\_node*, *end\_node*, *circle\_arc=None*)[](#LineInterface.create "Link to this definition") Create a line between start and end node. * Parameters: * **start\_node** ([`Node`](#Node "viktor.external.axisvm.Node")) – start node. * **end\_node** ([`Node`](#Node "viktor.external.axisvm.Node")) – end node. * **circle\_arc** ([`CircleArc`](#CircleArc "viktor.external.axisvm.CircleArc")) – circular arc between the nodes (default: straight line). * Return type: [`Line`](#Line "viktor.external.axisvm.Line") - define\_as\_beam(*line*, *material*, *css\_start*, *css\_end=None*, *\**, *local\_z\_reference=None*)[](#LineInterface.define_as_beam "Link to this definition") Define a line as beam with given material and cross-section. * Parameters: * **line** ([`Line`](#Line "viktor.external.axisvm.Line")) – line to define as beam. * **material** ([`Material`](#Material "viktor.external.axisvm.Material")) – material of the beam. * **css\_start** ([`CrossSection`](#CrossSection "viktor.external.axisvm.CrossSection")) – cross-section at the start node of the beam. * **css\_end** ([`CrossSection`](#CrossSection "viktor.external.axisvm.CrossSection")) – cross-section at the start node of the beam (default: same as css\_start). * **local\_z\_reference** ([`Reference`](#Reference "viktor.external.axisvm.Reference")) – local z-reference (must be of type vector) (default: auto). * Return type: [`Member`](#Member "viktor.external.axisvm.Member") * split\_by\_number(*line*, *n*)[](#LineInterface.split_by_number "Link to this definition") Split a line in ‘n’ equal parts. * Parameters: * **line** ([`Line`](#Line "viktor.external.axisvm.Line")) – line to split. * **n** (`int`) – number of parts after the split. * Return type: `None` <!-- --> ## LineSupport[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_LineSupport "Direct link to LineSupport") * *class *viktor.external.axisvm.LineSupport(*id\_*)[](#LineSupport "Link to this definition") Bases: [`Object`](#Object "viktor.external.axisvm.Object") Do not use this \_\_init\_\_ directly, but create the object from [`Model`](#Model "viktor.external.axisvm.Model") * *class *NonLinearity(*\*values*)[](#LineSupport.NonLinearity "Link to this definition") Bases: `Enum` Type of non-linear behavior. * COMPRESSION\_ONLY*: [`NonLinearity`](#LineSupport.NonLinearity "viktor.external.axisvm.LineSupport.NonLinearity")** = 2*[](#LineSupport.NonLinearity.COMPRESSION_ONLY "Link to this definition") - LINEAR*: [`NonLinearity`](#LineSupport.NonLinearity "viktor.external.axisvm.LineSupport.NonLinearity")** = 0*[](#LineSupport.NonLinearity.LINEAR "Link to this definition") * TENSION\_ONLY*: [`NonLinearity`](#LineSupport.NonLinearity "viktor.external.axisvm.LineSupport.NonLinearity")** = 1*[](#LineSupport.NonLinearity.TENSION_ONLY "Link to this definition") <!-- --> ## LineSupportInterface[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_LineSupportInterface "Direct link to LineSupportInterface") * *class *viktor.external.axisvm.LineSupportInterface[](#LineSupportInterface "Link to this definition") Bases: `_Interface` Do not use this \_\_init\_\_ directly, but use [`Model.line_supports`](#Model.line_supports "viktor.external.axisvm.Model.line_supports") * create\_on\_member(*member*, *k\_x*, *k\_y*, *k\_z*, *\**, *non\_linearity\_x=NonLinearity.LINEAR*, *non\_linearity\_y=NonLinearity.LINEAR*, *non\_linearity\_z=NonLinearity.LINEAR*, *resistance\_fx=0.0*, *resistance\_fy=0.0*, *resistance\_fz=0.0*)[](#LineSupportInterface.create_on_member "Link to this definition") Create a line support on a member (beam), in the member’s coordinate system. * Parameters: * **member** ([`Member`](#Member "viktor.external.axisvm.Member")) – member (beam) to create the line support on. * **k\_x** (`float`) – stiffness \[kN/m/m] in the local x-direction. * **k\_y** (`float`) – stiffness \[kN/m/m] in the local y-direction. * **k\_z** (`float`) – stiffness \[kN/m/m] in the local z-direction. * **non\_linearity\_x** ([`NonLinearity`](#LineSupport.NonLinearity "viktor.external.axisvm.LineSupport.NonLinearity")) – non-linear behaviour in the local x-direction (default: linear). * **non\_linearity\_y** ([`NonLinearity`](#LineSupport.NonLinearity "viktor.external.axisvm.LineSupport.NonLinearity")) – non-linear behaviour in the local y-direction (default: linear). * **non\_linearity\_z** ([`NonLinearity`](#LineSupport.NonLinearity "viktor.external.axisvm.LineSupport.NonLinearity")) – non-linear behaviour in the local z-direction (default: linear). * **resistance\_fx** (`float`) – resistance \[kN/m] in the local x-direction (default: 0.0). * **resistance\_fy** (`float`) – resistance \[kN/m] in the local y-direction (default: 0.0). * **resistance\_fz** (`float`) – resistance \[kN/m] in the local z-direction (default: 0.0). * Return type: [`LineSupport`](#LineSupport "viktor.external.axisvm.LineSupport") <!-- --> ## Load[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_Load "Direct link to Load") * *class *viktor.external.axisvm.Load(*id\_*)[](#Load "Link to this definition") Bases: [`Object`](#Object "viktor.external.axisvm.Object") Do not use this \_\_init\_\_ directly, but create the object from [`Model`](#Model "viktor.external.axisvm.Model") * *class *Axis(*\*values*)[](#Load.Axis "Link to this definition") Bases: `Enum` * X*: [`Axis`](#Load.Axis "viktor.external.axisvm.Load.Axis")** = 0*[](#Load.Axis.X "Link to this definition") - XX*: [`Axis`](#Load.Axis "viktor.external.axisvm.Load.Axis")** = 3*[](#Load.Axis.XX "Link to this definition") * Y*: [`Axis`](#Load.Axis "viktor.external.axisvm.Load.Axis")** = 1*[](#Load.Axis.Y "Link to this definition") - YY*: [`Axis`](#Load.Axis "viktor.external.axisvm.Load.Axis")** = 4*[](#Load.Axis.YY "Link to this definition") * Z*: [`Axis`](#Load.Axis "viktor.external.axisvm.Load.Axis")** = 2*[](#Load.Axis.Z "Link to this definition") - ZZ*: [`Axis`](#Load.Axis "viktor.external.axisvm.Load.Axis")** = 5*[](#Load.Axis.ZZ "Link to this definition") - *class *DistributionType(*\*values*)[](#Load.DistributionType "Link to this definition") Bases: `Enum` * GLOBAL*: [`DistributionType`](#Load.DistributionType "viktor.external.axisvm.Load.DistributionType")** = 0*[](#Load.DistributionType.GLOBAL "Link to this definition") - LOCAL*: [`DistributionType`](#Load.DistributionType "viktor.external.axisvm.Load.DistributionType")** = 1*[](#Load.DistributionType.LOCAL "Link to this definition") * PROJECTED*: [`DistributionType`](#Load.DistributionType "viktor.external.axisvm.Load.DistributionType")** = 2*[](#Load.DistributionType.PROJECTED "Link to this definition") * *class *SurfaceDistributionType(*\*values*)[](#Load.SurfaceDistributionType "Link to this definition") Bases: `Enum` * PROJECTED*: [`SurfaceDistributionType`](#Load.SurfaceDistributionType "viktor.external.axisvm.Load.SurfaceDistributionType")** = 1*[](#Load.SurfaceDistributionType.PROJECTED "Link to this definition") - SURFACE*: [`SurfaceDistributionType`](#Load.SurfaceDistributionType "viktor.external.axisvm.Load.SurfaceDistributionType")** = 0*[](#Load.SurfaceDistributionType.SURFACE "Link to this definition") - *class *System(*\*values*)[](#Load.System "Link to this definition") Bases: `Enum` * GLOBAL*: [`System`](#Load.System "viktor.external.axisvm.Load.System")** = 0*[](#Load.System.GLOBAL "Link to this definition") - LOCAL*: [`System`](#Load.System "viktor.external.axisvm.Load.System")** = 1*[](#Load.System.LOCAL "Link to this definition") * REFERENCE*: [`System`](#Load.System "viktor.external.axisvm.Load.System")** = 2*[](#Load.System.REFERENCE "Link to this definition") <!-- --> ## LoadCase[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_LoadCase "Direct link to LoadCase") * *class *viktor.external.axisvm.LoadCase(*id\_*, *name*)[](#LoadCase "Link to this definition") Bases: [`Object`](#Object "viktor.external.axisvm.Object") Do not use this \_\_init\_\_ directly, but create the object from [`Model`](#Model "viktor.external.axisvm.Model") * *property *name*: str*[](#LoadCase.name "Link to this definition") Name of the load case. <!-- --> ## LoadCaseInterface[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_LoadCaseInterface "Direct link to LoadCaseInterface") * *class *viktor.external.axisvm.LoadCaseInterface[](#LoadCaseInterface "Link to this definition") Bases: `_Interface` Do not use this \_\_init\_\_ directly, but use [`Model.load_cases`](#Model.load_cases "viktor.external.axisvm.Model.load_cases") * create(*name=None*)[](#LoadCaseInterface.create "Link to this definition") Create a load case. * Parameters: **name** (`str`) – name of the load case (default: auto). * Return type: [`LoadCase`](#LoadCase "viktor.external.axisvm.LoadCase") <!-- --> ## LoadCombination[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_LoadCombination "Direct link to LoadCombination") * *class *viktor.external.axisvm.LoadCombination(*id\_*, *name*)[](#LoadCombination "Link to this definition") Bases: [`Object`](#Object "viktor.external.axisvm.Object") Do not use this \_\_init\_\_ directly, but create the object from [`Model`](#Model "viktor.external.axisvm.Model") * *class *Type(*\*values*)[](#LoadCombination.Type "Link to this definition") Bases: `Enum` * OTHER*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 0*[](#LoadCombination.Type.OTHER "Link to this definition") - SLS\_1*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 1*[](#LoadCombination.Type.SLS_1 "Link to this definition") * SLS\_2*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 2*[](#LoadCombination.Type.SLS_2 "Link to this definition") - SLS\_3*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 3*[](#LoadCombination.Type.SLS_3 "Link to this definition") * SLS\_CHAR*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 1*[](#LoadCombination.Type.SLS_CHAR "Link to this definition") - SLS\_FREQ*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 2*[](#LoadCombination.Type.SLS_FREQ "Link to this definition") * SLS\_QUASI*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 3*[](#LoadCombination.Type.SLS_QUASI "Link to this definition") - ULS*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 4*[](#LoadCombination.Type.ULS "Link to this definition") * ULS\_1*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 4*[](#LoadCombination.Type.ULS_1 "Link to this definition") - ULS\_2*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 5*[](#LoadCombination.Type.ULS_2 "Link to this definition") * ULS\_3*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 6*[](#LoadCombination.Type.ULS_3 "Link to this definition") - ULS\_A*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 9*[](#LoadCombination.Type.ULS_A "Link to this definition") * ULS\_A1*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 12*[](#LoadCombination.Type.ULS_A1 "Link to this definition") - ULS\_A2*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 13*[](#LoadCombination.Type.ULS_A2 "Link to this definition") * ULS\_A3*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 14*[](#LoadCombination.Type.ULS_A3 "Link to this definition") - ULS\_A4*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 15*[](#LoadCombination.Type.ULS_A4 "Link to this definition") * ULS\_A5*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 16*[](#LoadCombination.Type.ULS_A5 "Link to this definition") - ULS\_A6*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 17*[](#LoadCombination.Type.ULS_A6 "Link to this definition") * ULS\_A7*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 18*[](#LoadCombination.Type.ULS_A7 "Link to this definition") - ULS\_A8*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 19*[](#LoadCombination.Type.ULS_A8 "Link to this definition") * ULS\_AB*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 8*[](#LoadCombination.Type.ULS_AB "Link to this definition") - ULS\_ALL*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 7*[](#LoadCombination.Type.ULS_ALL "Link to this definition") * ULS\_ALL\_AB*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 11*[](#LoadCombination.Type.ULS_ALL_AB "Link to this definition") - ULS\_B*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 10*[](#LoadCombination.Type.ULS_B "Link to this definition") * ULS\_EXCEPTIONAL*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 6*[](#LoadCombination.Type.ULS_EXCEPTIONAL "Link to this definition") - ULS\_SEISMIC*: [`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")** = 5*[](#LoadCombination.Type.ULS_SEISMIC "Link to this definition") - *property *name*: str*[](#LoadCombination.name "Link to this definition") Name of the load case. <!-- --> ## LoadCombinationInterface[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_LoadCombinationInterface "Direct link to LoadCombinationInterface") * *class *viktor.external.axisvm.LoadCombinationInterface[](#LoadCombinationInterface "Link to this definition") Bases: `_Interface` Do not use this \_\_init\_\_ directly, but use [`Model.load_combinations`](#Model.load_combinations "viktor.external.axisvm.Model.load_combinations") * create(*combination\_type*, *load\_case\_factors*, *\**, *name=None*)[](#LoadCombinationInterface.create "Link to this definition") Create a load combination from given load cases and factors. * Parameters: * **combination\_type** ([`Type`](#LoadCombination.Type "viktor.external.axisvm.LoadCombination.Type")) – load combination type. * **load\_case\_factors** (`Dict`\[[`LoadCase`](#LoadCase "viktor.external.axisvm.LoadCase"), `float`]) – factorized load cases {load\_case: factor}. * **name** (`str`) – name of the load combination (default: auto). * Return type: [`LoadCombination`](#LoadCombination "viktor.external.axisvm.LoadCombination") <!-- --> ## LoadInterface[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_LoadInterface "Direct link to LoadInterface") * *class *viktor.external.axisvm.LoadInterface[](#LoadInterface "Link to this definition") Bases: `_Interface` Do not use this \_\_init\_\_ directly, but use [`Model.loads`](#Model.loads "viktor.external.axisvm.Model.loads") * create\_beam\_self\_weight(*load\_case*, *member*)[](#LoadInterface.create_beam_self_weight "Link to this definition") Create a self-weight load on a member (beam). * Parameters: * **load\_case** ([`LoadCase`](#LoadCase "viktor.external.axisvm.LoadCase")) – load case to add the load to. * **member** ([`Member`](#Member "viktor.external.axisvm.Member")) – member to create the load on. * Return type: [`Load`](#Load "viktor.external.axisvm.Load") - create\_domain\_constant(*load\_case*, *domain*, *load*, *\**, *distribution\_type=SurfaceDistributionType.SURFACE*, *system=System.GLOBAL*)[](#LoadInterface.create_domain_constant "Link to this definition") Create a constant distributed load on a domain. * Parameters: * **load\_case** ([`LoadCase`](#LoadCase "viktor.external.axisvm.LoadCase")) – load case to add the load to. * **domain** ([`Domain`](#Domain "viktor.external.axisvm.Domain")) – domain to create the load on. * **load** (`Tuple`\[`float`, `float`, `float`]) – magnitude of the load (x, y, z) \[kN]. * **distribution\_type** ([`SurfaceDistributionType`](#Load.SurfaceDistributionType "viktor.external.axisvm.Load.SurfaceDistributionType")) – distribution type (default: SURFACE). * **system** ([`System`](#Load.System "viktor.external.axisvm.Load.System")) – coordinate system (default: GLOBAL). * Return type: [`Load`](#Load "viktor.external.axisvm.Load") * create\_domain\_linear(*load\_case*, *domain*, *load*, *\**, *component*, *point\_1*, *point\_2*, *point\_3*, *distribution\_type=DistributionType.GLOBAL*, *load\_on\_hole=False*)[](#LoadInterface.create_domain_linear "Link to this definition") Create a linear distributed load on a domain. * Parameters: * **load\_case** ([`LoadCase`](#LoadCase "viktor.external.axisvm.LoadCase")) – load case to add the load to. * **domain** ([`Domain`](#Domain "viktor.external.axisvm.Domain")) – domain to create the load on. * **load** (`Tuple`\[`float`, `float`, `float`]) – magnitude of the load at (point\_1, point\_2, point\_3) \[kN]. * **component** ([`Axis`](#Load.Axis "viktor.external.axisvm.Load.Axis")) – direction of the load (X, Y, Z only). * **point\_1** (`Tuple`\[`float`, `float`, `float`]) – (x, y, z) position \[m] of reference point 1. * **point\_2** (`Tuple`\[`float`, `float`, `float`]) – (x, y, z) position \[m] of reference point 2. * **point\_3** (`Tuple`\[`float`, `float`, `float`]) – (x, y, z) position \[m] of reference point 3. * **distribution\_type** ([`DistributionType`](#Load.DistributionType "viktor.external.axisvm.Load.DistributionType")) – distribution type (default: GLOBAL). * **load\_on\_hole** (`bool`) – apply load on hole (default: False -> loads disappear on holes). * Return type: [`Load`](#Load "viktor.external.axisvm.Load") - create\_domain\_self\_weight(*load\_case*, *domain*)[](#LoadInterface.create_domain_self_weight "Link to this definition") Create a self-weight load on a domain. * Parameters: * **load\_case** ([`LoadCase`](#LoadCase "viktor.external.axisvm.LoadCase")) – load case to add the load to. * **domain** ([`Domain`](#Domain "viktor.external.axisvm.Domain")) – domain to create the load on. * Return type: [`Load`](#Load "viktor.external.axisvm.Load") <!-- --> ## Material[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_Material "Direct link to Material") * *class *viktor.external.axisvm.Material(*id\_*, *name*)[](#Material "Link to this definition") Bases: [`Object`](#Object "viktor.external.axisvm.Object") Do not use this \_\_init\_\_ directly, but create the object from [`Model`](#Model "viktor.external.axisvm.Model") * *class *DesignCode(*\*values*)[](#Material.DesignCode "Link to this definition") Bases: `Enum` National design code. * CA\_BRIDGE*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 24*[](#Material.DesignCode.CA_BRIDGE "Link to this definition") - CA\_NBCC*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 22*[](#Material.DesignCode.CA_NBCC "Link to this definition") * CA\_ONTARIO*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 23*[](#Material.DesignCode.CA_ONTARIO "Link to this definition") - DUTCH\_NEN*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 5*[](#Material.DesignCode.DUTCH_NEN "Link to this definition") * EURO\_CODE*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 2*[](#Material.DesignCode.EURO_CODE "Link to this definition") - EURO\_CODE\_AUSTRIAN*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 10*[](#Material.DesignCode.EURO_CODE_AUSTRIAN "Link to this definition") * EURO\_CODE\_B*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 17*[](#Material.DesignCode.EURO_CODE_B "Link to this definition") - EURO\_CODE\_CZ*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 16*[](#Material.DesignCode.EURO_CODE_CZ "Link to this definition") * EURO\_CODE\_DK*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 19*[](#Material.DesignCode.EURO_CODE_DK "Link to this definition") - EURO\_CODE\_FIN*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 13*[](#Material.DesignCode.EURO_CODE_FIN "Link to this definition") * EURO\_CODE\_GER*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 8*[](#Material.DesignCode.EURO_CODE_GER "Link to this definition") - EURO\_CODE\_HU*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 15*[](#Material.DesignCode.EURO_CODE_HU "Link to this definition") * EURO\_CODE\_NL*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 12*[](#Material.DesignCode.EURO_CODE_NL "Link to this definition") - EURO\_CODE\_PL*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 18*[](#Material.DesignCode.EURO_CODE_PL "Link to this definition") * EURO\_CODE\_RO*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 14*[](#Material.DesignCode.EURO_CODE_RO "Link to this definition") - EURO\_CODE\_S*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 20*[](#Material.DesignCode.EURO_CODE_S "Link to this definition") * EURO\_CODE\_SK*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 25*[](#Material.DesignCode.EURO_CODE_SK "Link to this definition") - EURO\_CODE\_UK*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 11*[](#Material.DesignCode.EURO_CODE_UK "Link to this definition") * GERMAN\_DIN1045\_1*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 6*[](#Material.DesignCode.GERMAN_DIN1045_1 "Link to this definition") - HUNGARIAN\_MSZ*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 1*[](#Material.DesignCode.HUNGARIAN_MSZ "Link to this definition") * ITALIAN*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 9*[](#Material.DesignCode.ITALIAN "Link to this definition") - OTHER*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 0*[](#Material.DesignCode.OTHER "Link to this definition") * ROMANIAN\_STAS*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 4*[](#Material.DesignCode.ROMANIAN_STAS "Link to this definition") - SWISS\_SIA26X*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 7*[](#Material.DesignCode.SWISS_SIA26X "Link to this definition") * US*: [`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")** = 21*[](#Material.DesignCode.US "Link to this definition") - *property *name*: str*[](#Material.name "Link to this definition") Name of the material. <!-- --> ## MaterialInterface[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_MaterialInterface "Direct link to MaterialInterface") * *class *viktor.external.axisvm.MaterialInterface[](#MaterialInterface "Link to this definition") Bases: `_Interface` Do not use this \_\_init\_\_ directly, but use [`Model.materials`](#Model.materials "viktor.external.axisvm.Model.materials") * add\_from\_catalog(*name*, *national\_design\_code*)[](#MaterialInterface.add_from_catalog "Link to this definition") Adds a material from the catalog. * Parameters: * **name** (`str`) – name of the material to be added (must exist in the corresponding national design code). * **national\_design\_code** ([`DesignCode`](#Material.DesignCode "viktor.external.axisvm.Material.DesignCode")) – national design code in which the material with given name resides. * Return type: [`Material`](#Material "viktor.external.axisvm.Material") - create\_concrete\_eurocode(*\**, *e\_x*, *e\_y=None*, *e\_z=None*, *nu\_x*, *nu\_y=None*, *nu\_z=None*, *alpha\_x=0.0*, *alpha\_y=None*, *alpha\_z=None*, *rho*, *f\_ck*, *gamma\_c*, *alpha\_cc*, *phi\_t=0.0*, *material\_code=None*, *name=None*)[](#MaterialInterface.create_concrete_eurocode "Link to this definition") Create a concrete material according to the Eurocode. * Parameters: * **e\_x** (`float`) – Young’s modulus of elasticity \[kN/m2] in local x-direction. * **e\_y** (`float`) – Young’s modulus of elasticity \[kN/m2] in local y-direction (default = e\_x). * **e\_z** (`float`) – Young’s modulus of elasticity \[kN/m2] in local z-direction (default = e\_x). * **nu\_x** (`float`) – Poisson’s ratio \[-] in local x-direction (0 <= nu <= 0.5). * **nu\_y** (`float`) – Poisson’s ratio \[-] in local y-direction (0 <= nu <= 0.5) (default = nu\_x). * **nu\_z** (`float`) – Poisson’s ratio \[-] in local z-direction (0 <= nu <= 0.5) (default = nu\_x). * **alpha\_x** (`float`) – thermal expansion coefficient \[1/C] in local x-direction (default = 0.0). * **alpha\_y** (`float`) – thermal expansion coefficient \[1/C] in local y-direction (default = alpha\_x). * **alpha\_z** (`float`) – thermal expansion coefficient \[1/C] in local z-direction (default = alpha\_x). * **rho** (`float`) – density \[kg/m3]. * **f\_ck** (`float`) – characteristic compressive cylinder strength \[kN/m2] at 28 days. * **gamma\_c** (`float`) – safety factor \[-]. * **alpha\_cc** (`float`) – concrete strength-reduction factor for sustained loading \[-]. * **phi\_t** (`float`) – creeping factor \[-] (default = 0.0). * **material\_code** (`str`) – material code name, as shown in the interface (default: auto). * **name** (`str`) – material name, as shown in the interface (default: auto). * Return type: [`Material`](#Material "viktor.external.axisvm.Material") <!-- --> ## Member[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_Member "Direct link to Member") * *class *viktor.external.axisvm.Member(*line*, *type\_*)[](#Member "Link to this definition") Bases: [`Object`](#Object "viktor.external.axisvm.Object") Do not use this \_\_init\_\_ directly, but create the object from [`Model`](#Model "viktor.external.axisvm.Model") <!-- --> ## Model[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_Model "Direct link to Model") * *class *viktor.external.axisvm.Model[](#Model "Link to this definition") Can be used to construct an AxisVM model, which can be used as input of [`AxisVMAnalysis`](#AxisVMAnalysis "viktor.external.axisvm.AxisVMAnalysis"). Objects are created/modified through the methods on their respective interface (see the properties below for all available interfaces). The following basic actions can be performed on all interfaces (example: node interface): * cast to list, indexing and slicing: > ``` > nodes = list(model.nodes) # List[Node] > node2 = model.nodes[1] # Node > nodes_2_3 = model.nodes[1:3] # List[Node] > ``` * iteration: > ``` > for node in model.nodes: > print(node.id) > ``` * length: > ``` > number_of_nodes = len(model.nodes) > ``` * containment check: > ``` > node_in_model = node in model.nodes # bool > ``` Example usage: ``` model = Model() material = model.materials.add_from_catalog('C12/15', AxisVMMaterial.DesignCode.EURO_CODE) cross_section = model.cross_sections.create_rectangular(0.01, 0.01) n1 = model.nodes.create(0, 0, 0) n2 = model.nodes.create(1, 0, 0) beam = model.lines.create(n1, n2).define_as_beam(material, cross_section) model.node_supports.create_relative_to_member(n1, stiffness_x=1e10, stiffness_y=1e10, stiffness_z=1e10, stiffness_xx=1e10, stiffness_yy=1e10, stiffness_zz=1e10) load_case = model.load_cases.create() model.loads.create_beam_self_weight(load_case, beam) model.results.nodal_displacements([n2]) ``` * *property *cross\_sections*: [CrossSectionInterface](#CrossSectionInterface "viktor.external.axisvm.CrossSectionInterface")*[](#Model.cross_sections "Link to this definition") Interface for creating cross-sections. - *property *domains*: [DomainInterface](#DomainInterface "viktor.external.axisvm.DomainInterface")*[](#Model.domains "Link to this definition") Interface for creating domains. * *property *line\_supports*: [LineSupportInterface](#LineSupportInterface "viktor.external.axisvm.LineSupportInterface")*[](#Model.line_supports "Link to this definition") Interface for creating line supports. - *property *lines*: [LineInterface](#LineInterface "viktor.external.axisvm.LineInterface")*[](#Model.lines "Link to this definition") Interface for creating lines, beams, etc. * *property *load\_cases*: [LoadCaseInterface](#LoadCaseInterface "viktor.external.axisvm.LoadCaseInterface")*[](#Model.load_cases "Link to this definition") Interface for creating load cases. - *property *load\_combinations*: [LoadCombinationInterface](#LoadCombinationInterface "viktor.external.axisvm.LoadCombinationInterface")*[](#Model.load_combinations "Link to this definition") Interface for creating load combinations. * *property *loads*: [LoadInterface](#LoadInterface "viktor.external.axisvm.LoadInterface")*[](#Model.loads "Link to this definition") Interface for creating loads. - *property *materials*: [MaterialInterface](#MaterialInterface "viktor.external.axisvm.MaterialInterface")*[](#Model.materials "Link to this definition") Interface for creating materials. * *property *node\_supports*: [NodeSupportInterface](#NodeSupportInterface "viktor.external.axisvm.NodeSupportInterface")*[](#Model.node_supports "Link to this definition") Interface for creating node supports. - *property *nodes*: [NodeInterface](#NodeInterface "viktor.external.axisvm.NodeInterface")*[](#Model.nodes "Link to this definition") Interface for creating nodes. * *property *references*: [ReferenceInterface](#ReferenceInterface "viktor.external.axisvm.ReferenceInterface")*[](#Model.references "Link to this definition") Interface for creating reference points, vectors, axes, planes and angles. - *property *results*: [ResultInterface](#ResultInterface "viktor.external.axisvm.ResultInterface")*[](#Model.results "Link to this definition") Interface for requesting results from the worker (only requested results will be returned). * *property *sections*: [SectionInterface](#SectionInterface "viktor.external.axisvm.SectionInterface")*[](#Model.sections "Link to this definition") Interface for creating sections, on which results can be obtained. <!-- --> ## Node[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_Node "Direct link to Node") * *class *viktor.external.axisvm.Node(*id\_*, *x*, *y*, *z*)[](#Node "Link to this definition") Bases: [`Object`](#Object "viktor.external.axisvm.Object") Do not use this \_\_init\_\_ directly, but create the object from [`Model`](#Model "viktor.external.axisvm.Model") * *property *x*: float*[](#Node.x "Link to this definition") X-coordinate. - *property *y*: float*[](#Node.y "Link to this definition") Y-coordinate. * *property *z*: float*[](#Node.z "Link to this definition") Z-coordinate. <!-- --> ## NodeInterface[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_NodeInterface "Direct link to NodeInterface") * *class *viktor.external.axisvm.NodeInterface[](#NodeInterface "Link to this definition") Bases: `_Interface` Do not use this \_\_init\_\_ directly, but use [`Model.nodes`](#Model.nodes "viktor.external.axisvm.Model.nodes") * create(*x*, *y*, *z*)[](#NodeInterface.create "Link to this definition") Create a node at the given position and with given degree-of-freedom. * Parameters: * **x** (`float`) – x-position \[m]. * **y** (`float`) – y-position \[m]. * **z** (`float`) – z-position \[m]. * Return type: [`Node`](#Node "viktor.external.axisvm.Node") <!-- --> ## NodeSupport[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_NodeSupport "Direct link to NodeSupport") * *class *viktor.external.axisvm.NodeSupport(*id\_*)[](#NodeSupport "Link to this definition") Bases: [`Object`](#Object "viktor.external.axisvm.Object") Do not use this \_\_init\_\_ directly, but create the object from [`Model`](#Model "viktor.external.axisvm.Model") <!-- --> ## NodeSupportInterface[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_NodeSupportInterface "Direct link to NodeSupportInterface") * *class *viktor.external.axisvm.NodeSupportInterface(*lines*)[](#NodeSupportInterface "Link to this definition") Bases: `_Interface` Do not use this \_\_init\_\_ directly, but use [`Model.node_supports`](#Model.node_supports "viktor.external.axisvm.Model.node_supports") * create\_relative\_to\_member(*node*, *\**, *stiffness\_x=0.0*, *stiffness\_y=0.0*, *stiffness\_z=0.0*, *stiffness\_xx=0.0*, *stiffness\_yy=0.0*, *stiffness\_zz=0.0*, *resistance\_x=0.0*, *resistance\_y=0.0*, *resistance\_z=0.0*, *resistance\_xx=0.0*, *resistance\_yy=0.0*, *resistance\_zz=0.0*, *non\_linearity\_x=NonLinearity.LINEAR*, *non\_linearity\_y=NonLinearity.LINEAR*, *non\_linearity\_z=NonLinearity.LINEAR*, *non\_linearity\_xx=NonLinearity.LINEAR*, *non\_linearity\_yy=NonLinearity.LINEAR*, *non\_linearity\_zz=NonLinearity.LINEAR*)[](#NodeSupportInterface.create_relative_to_member "Link to this definition") Create a nodal support, relative to the member’s local coordinate system. * Parameters: * **node** ([`Node`](#Node "viktor.external.axisvm.Node")) – node to create the support on. Must be an end-point of a member of type beam or rib. * **stiffness\_x** (`float`) – translational stiffness \[kN/m] in local x-direction (default = 0.0). * **stiffness\_y** (`float`) – translational stiffness \[kN/m] in local y-direction (default = 0.0). * **stiffness\_z** (`float`) – translational stiffness \[kN/m] in local z-direction (default = 0.0). * **stiffness\_xx** (`float`) – rotational stiffness \[kNm/rad] around the local x-axis (default = 0.0). * **stiffness\_yy** (`float`) – rotational stiffness \[kNm/rad] around the local y-axis (default = 0.0). * **stiffness\_zz** (`float`) – rotational stiffness \[kNm/rad] around the local z-axis (default = 0.0). * **resistance\_x** (`float`) – translational resistance \[kN/m] in local x-direction (default = 0.0). * **resistance\_y** (`float`) – translational resistance \[kN/m] in local y-direction (default = 0.0). * **resistance\_z** (`float`) – translational resistance \[kN/m] in local z-direction (default = 0.0). * **resistance\_xx** (`float`) – rotational resistance \[kNm/m] around the local x-axis (default = 0.0). * **resistance\_yy** (`float`) – rotational resistance \[kNm/m] around the local y-axis (default = 0.0). * **resistance\_zz** (`float`) – rotational resistance \[kNm/m] around the local z-axis (default = 0.0). * **non\_linearity\_x** ([`NonLinearity`](#LineSupport.NonLinearity "viktor.external.axisvm.LineSupport.NonLinearity")) – translational non-linear behaviour in local x-direction (default: linear). * **non\_linearity\_y** ([`NonLinearity`](#LineSupport.NonLinearity "viktor.external.axisvm.LineSupport.NonLinearity")) – translational non-linear behaviour in local y-direction (default: linear). * **non\_linearity\_z** ([`NonLinearity`](#LineSupport.NonLinearity "viktor.external.axisvm.LineSupport.NonLinearity")) – translational non-linear behaviour in local z-direction (default: linear). * **non\_linearity\_xx** ([`NonLinearity`](#LineSupport.NonLinearity "viktor.external.axisvm.LineSupport.NonLinearity")) – rotational non-linear behaviour around the local x-axis (default: linear). * **non\_linearity\_yy** ([`NonLinearity`](#LineSupport.NonLinearity "viktor.external.axisvm.LineSupport.NonLinearity")) – rotational non-linear behaviour around the local y-axis (default: linear). * **non\_linearity\_zz** ([`NonLinearity`](#LineSupport.NonLinearity "viktor.external.axisvm.LineSupport.NonLinearity")) – rotational non-linear behaviour around the local z-axis (default: linear). * Return type: [`NodeSupport`](#NodeSupport "viktor.external.axisvm.NodeSupport") <!-- --> ## Object[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_Object "Direct link to Object") * *class *viktor.external.axisvm.Object(*id\_*)[](#Object "Link to this definition") Bases: `ABC` Abstract base class of all AxisVM objects. Do not use this \_\_init\_\_ directly. * *property *id*: int*[](#Object.id "Link to this definition") Object id. <!-- --> ## Reference[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_Reference "Direct link to Reference") * *class *viktor.external.axisvm.Reference(*id\_*)[](#Reference "Link to this definition") Bases: [`Object`](#Object "viktor.external.axisvm.Object"), `ABC` Do not use this \_\_init\_\_ directly, but create the object from [`Model`](#Model "viktor.external.axisvm.Model") <!-- --> ## ReferenceInterface[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_ReferenceInterface "Direct link to ReferenceInterface") * *class *viktor.external.axisvm.ReferenceInterface[](#ReferenceInterface "Link to this definition") Bases: `_Interface` Do not use this \_\_init\_\_ directly, but use [`Model.references`](#Model.references "viktor.external.axisvm.Model.references") * create\_angle(*angle*)[](#ReferenceInterface.create_angle "Link to this definition") Create a reference angle. * Parameters: **angle** (`float`) – angle \[rad]. * Return type: [`Reference`](#Reference "viktor.external.axisvm.Reference") - create\_axis(*point\_1*, *point\_2*)[](#ReferenceInterface.create_axis "Link to this definition") Create a reference axis. * Parameters: * **point\_1** (`Tuple`\[`float`, `float`, `float`]) – (x, y, z) position \[m] of the start point. * **point\_2** (`Tuple`\[`float`, `float`, `float`]) – (x, y, z) position \[m] of the end point. * Return type: [`Reference`](#Reference "viktor.external.axisvm.Reference") * create\_plane(*point\_1*, *point\_2*, *point\_3*)[](#ReferenceInterface.create_plane "Link to this definition") Create a reference plane. * Parameters: * **point\_1** (`Tuple`\[`float`, `float`, `float`]) – (x, y, z) position \[m] of point 1. * **point\_2** (`Tuple`\[`float`, `float`, `float`]) – (x, y, z) position \[m] of point 2. * **point\_3** (`Tuple`\[`float`, `float`, `float`]) – (x, y, z) position \[m] of point 3. * Return type: [`Reference`](#Reference "viktor.external.axisvm.Reference") - create\_point(*x*, *y*, *z*)[](#ReferenceInterface.create_point "Link to this definition") Create a reference point. * Parameters: * **x** (`float`) – x-position \[m]. * **y** (`float`) – y-position \[m]. * **z** (`float`) – z-position \[m]. * Return type: [`Reference`](#Reference "viktor.external.axisvm.Reference") * create\_vector(*point\_1*, *point\_2*)[](#ReferenceInterface.create_vector "Link to this definition") Create a reference vector. * Parameters: * **point\_1** (`Tuple`\[`float`, `float`, `float`]) – (x, y, z) position \[m] of the start point. * **point\_2** (`Tuple`\[`float`, `float`, `float`]) – (x, y, z) position \[m] of the end point. * Return type: [`Reference`](#Reference "viktor.external.axisvm.Reference") <!-- --> ## ResultInterface[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_ResultInterface "Direct link to ResultInterface") * *class *viktor.external.axisvm.ResultInterface(*nodes*, *node\_supports*, *lines*, *sections*)[](#ResultInterface "Link to this definition") * line\_forces(*members=None*, *\**, *by\_load\_case=True*)[](#ResultInterface.line_forces "Link to this definition") Request line forces for all load cases or combinations. * Parameters: * **members** (`List`\[[`Member`](#Member "viktor.external.axisvm.Member")]) – members to request the results for, or None for all members (default: all members). * **by\_load\_case** (`bool`) – True to get the result on all load cases; False to get results on all load combinations. * Return type: `None` - nodal\_displacements(*nodes=None*, *\**, *by\_load\_case=True*)[](#ResultInterface.nodal_displacements "Link to this definition") Request nodal displacements for all load cases or combinations. * Parameters: * **nodes** (`List`\[[`Node`](#Node "viktor.external.axisvm.Node")]) – nodes to request the results for, or None for all nodes (default: all nodes). * **by\_load\_case** (`bool`) – True to get result on all load cases; False to get results on all load combinations. * Return type: `None` * nodal\_support\_forces(*node\_supports=None*, *\**, *by\_load\_case=True*)[](#ResultInterface.nodal_support_forces "Link to this definition") Request nodal support forces for all load cases or combinations. * Parameters: * **node\_supports** (`List`\[[`NodeSupport`](#NodeSupport "viktor.external.axisvm.NodeSupport")]) – node supports to request the results for, or None for all node supports (default: all node supports). * **by\_load\_case** (`bool`) – True to get result on all load cases; False to get results on all load combinations. * Return type: `None` - section\_surface\_forces(*sections*, *cases*, *chain\_index=1*)[](#ResultInterface.section_surface_forces "Link to this definition") Request section chain’s surface forces for given load combinations. * Parameters: * **sections** (`List`\[[`Section`](#Section "viktor.external.axisvm.Section")]) – sections to request the results for, or None for all sections (default: all sections). * **cases** (`List`\[[`LoadCombination`](#LoadCombination "viktor.external.axisvm.LoadCombination")]) – list of load combinations to request the results for. * **chain\_index** (`int`) – index of the segment chain to request the results for (default: 1). * Return type: `None` * section\_surface\_stresses(*sections*, *cases*, *chain\_index=1*)[](#ResultInterface.section_surface_stresses "Link to this definition") Request section chain’s surface stresses for given load combinations. * Parameters: * **sections** (`List`\[[`Section`](#Section "viktor.external.axisvm.Section")]) – sections to request the results for, or None for all sections (default: all sections). * **cases** (`List`\[[`LoadCombination`](#LoadCombination "viktor.external.axisvm.LoadCombination")]) – list of load combinations to request the results for. * **chain\_index** (`int`) – index of the segment chain to request the results for (default: 1). * Return type: `None` <!-- --> ## Section[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_Section "Direct link to Section") * *class *viktor.external.axisvm.Section(*id\_*, *interface*, *name*)[](#Section "Link to this definition") Bases: [`Object`](#Object "viktor.external.axisvm.Object") Do not use this \_\_init\_\_ directly, but create the object from [`Model`](#Model "viktor.external.axisvm.Model") * *property *name*: str*[](#Section.name "Link to this definition") Name of the section. <!-- --> ## SectionInterface[​](https://docs.viktor.ai/sdk/api/external/axisvm/.md#_SectionInterface "Direct link to SectionInterface") * *class *viktor.external.axisvm.SectionInterface[](#SectionInterface "Link to this definition") Bases: `_Interface` Do not use this \_\_init\_\_ directly, but use [`Model.sections`](#Model.sections "viktor.external.axisvm.Model.sections") * create(*start\_point*, *end\_point*, *normal\_vector*, *\**, *name=None*)[](#SectionInterface.create "Link to this definition") Create a section (segment) from coordinates, to obtain results from. * Parameters: * **start\_point** (`Tuple`\[`float`, `float`, `float`]) – (x, y, z) position \[m] of the section’s start point. * **end\_point** (`Tuple`\[`float`, `float`, `float`]) – (x, y, z) position \[m] of the section’s end point. * **normal\_vector** (`Tuple`\[`float`, `float`, `float`]) – (x, y, z) components \[m] of the section plane’s normal vector. * **name** (`str`) – name of the section (default: auto). * Return type: [`Section`](#Section "viktor.external.axisvm.Section") --- # viktor.external.dfoundations <!-- --> <!-- --> <!-- --> ## BearingPilesCalculationOptions[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_BearingPilesCalculationOptions "Direct link to BearingPilesCalculationOptions") * *class *viktor.external.dfoundations.BearingPilesCalculationOptions(*calculation\_type*, *rigid*, *max\_allowed\_settlement\_str\_geo=150*, *max\_allowed\_settlement\_sls=150*, *max\_allowed\_relative\_rotation\_str\_geo=100*, *max\_allowed\_relative\_rotation\_sls=300*, *\**, *xi3=None*, *xi4=None*, *gamma\_b=None*, *gamma\_s=None*, *gamma\_fnk=None*, *area=None*, *e\_ea\_gem=None*, *write\_intermediate\_results=False*, *use\_pile\_group=True*, *overrule\_excavation=False*, *suppress\_qciii\_reduction=False*, *use\_almere\_rules=False*, *use\_extra\_almere\_rules=False*, *trajectory\_begin\_end\_interval=None*, *net\_bearing\_capacity=None*, *cpt\_test\_level=None*)[](#BearingPilesCalculationOptions "Link to this definition") Bases: `_CalculationOptions` * Parameters: * **calculation\_type** ([`CalculationType`](#CalculationType "viktor.external.dfoundations.CalculationType")) * **rigid** (`bool`) – True for rigid, False for non-rigid * **max\_allowed\_settlement\_str\_geo** (`int`) – \[mm] * **max\_allowed\_relative\_rotation\_str\_geo** (`int`) – 1 : \[-] * **max\_allowed\_settlement\_sls** (`int`) – \[mm] * **max\_allowed\_relative\_rotation\_sls** (`int`) – 1 : \[-] * **xi3** (`float`) – ξ\_3 \[-] * **xi4** (`float`) – ξ\_4 \[-] * **gamma\_b** (`float`) – γ\_b \[-] * **gamma\_s** (`float`) – γ\_s \[-] * **gamma\_fnk** (`float`) – γ\_f;nk \[-] * **area** (`float`) – \[m²] * **e\_ea\_gem** (`float`) – E\_ea;gem \[kN/m2] * **write\_intermediate\_results** (`bool`) * **use\_pile\_group** (`bool`) * **overrule\_excavation** (`bool`) * **suppress\_qciii\_reduction** (`bool`) * **use\_almere\_rules** (`bool`) * **use\_extra\_almere\_rules** (`bool`) * **trajectory\_begin\_end\_interval** (`Tuple`\[`float`, `float`, `float`]) – tuple(\[m], \[m], \[m]) * **net\_bearing\_capacity** (`int`) – \[kN] * **cpt\_test\_level** (`float`) – \[m] * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – * if ‘calculation\_type’ is DESIGN\_CALCULATION or INDICATION\_BEARING\_CAPACITY or PILE\_TIP\_LEVEL\_AND\_NET\_BEARING\_CAPACITY and trajectory\_begin\_end\_interval’ is not set. * if the number of iterations > 151, based on the provided ‘trajectory\_begin\_end\_interval’. * if ‘calculation\_type’ is PILE\_TIP\_LEVEL\_AND\_NET\_BEARING\_CAPACITY and ‘net\_bearing\_capacity’ is not set. * if ‘calculation\_type’ is DESIGN\_CALCULATION or COMPLETE\_CALCULATION and ‘cpt\_test\_level’ is not set. <!-- --> ## BearingPilesModel[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_BearingPilesModel "Direct link to BearingPilesModel") * *class *viktor.external.dfoundations.BearingPilesModel(*construction\_sequence*, *calculation\_options*, *excavation\_level*, *reduction\_cone\_resistance=None*, *\**, *create\_default\_materials=True*)[](#BearingPilesModel "Link to this definition") Bases: `_Model` Create a Bearing Piles (EC7-NL) model. * Parameters: * **construction\_sequence** ([`ConstructionSequence`](#ConstructionSequence "viktor.external.dfoundations.ConstructionSequence")) * **calculation\_options** ([`BearingPilesCalculationOptions`](#BearingPilesCalculationOptions "viktor.external.dfoundations.BearingPilesCalculationOptions")) * **excavation\_level** (`float`) – \[m] * **reduction\_cone\_resistance** (`float`) – Distance edge pile to excavation boundary \[m] to implement ‘Begemann’. ‘None’ to implement ‘Safe (NEN)’. * **create\_default\_materials** (`bool`) – whether to start with the default D-Foundations materials. The default materials are: > * BClay, clean, moderate > > * BClay, clean, modstiff > > * BClay, clean, stiff > > * BClay, clean, weak > > * BClay, sl san, moderate > > * BClay, sl san, modstiff > > * BClay, sl san, stiff > > * BClay, sl san, weak > > * BGravel, clean, moderate > > * BGravel, clean, stiff > > * BGravel, ve sil, moderate > > * BGravel, ve sil, stiff > > * BLoam, clean, moderate > > * BLoam, clean, modstiff > > * BLoam, clean, stiff > > * BLoam, clean, weak > > * BLoam, sl san, moderate > > * BLoam, sl san, modstiff > > * BLoam, sl san, stiff > > * BLoam, sl san, weak > > * BPeat, sl san, moderate > > * BPeat, sl san, stiff > > * BPeat, sl san, weak > > * BSand, clean, loose > > * BSand, clean, moderate > > * BSand, clean, stiff > > * BSand, ve sil, loose > > * BSand, ve sil, moderate > > * BSand, ve sil, stiff > > * Clay, clean, moderate > > * Clay, clean, stiff > > * Clay, clean, weak > > * Clay, organ, moderate > > * Clay, organ, weak > > * Clay, sl san, moderate > > * Clay, sl san, stiff > > * Clay, sl san, weak > > * Clay, ve san, stiff > > * Gravel, sl sil, loose > > * Gravel, sl sil, moderate > > * Gravel, sl sil, stiff > > * Gravel, ve sil, loose > > * Gravel, ve sil, moderate > > * Gravel, ve sil, stiff > > * Loam, sl san, moderate > > * Loam, sl san, stiff > > * Loam, sl san, weak > > * Loam, ve san, stiff > > * Peat, mod pl, moderate > > * Peat, not pl, weak > > * Sand, clean, loose > > * Sand, clean, moderate > > * Sand, clean, stiff > > * Sand, sl sil, moderate > > * Sand, ve sil, loose * materials[](#BearingPilesModel.materials "Link to this definition") Lists all materials currently in de model. - profiles[](#BearingPilesModel.profiles "Link to this definition") Lists all profiles currently in de model. * pile\_types[](#BearingPilesModel.pile_types "Link to this definition") Lists all pile types currently in de model. - piles[](#BearingPilesModel.piles "Link to this definition") Lists all piles currently in de model. * generate\_input\_file(*metadata=None*, *\**, *as\_file=False*)[](#BearingPilesModel.generate_input_file "Link to this definition") Generate a D-Foundations input file. Note This method needs to be mocked in (automated) unit and integration tests. * Parameters: * **metadata** ([`Metadata`](#Metadata "viktor.external.dfoundations.Metadata")) – Metadata which will be written to the input file. If no metadata is provided, default data will be used. * **as\_file** (`bool`) – return as BytesIO (default) or File * Return type: [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | `BytesIO` - create\_material(*name*, *soil\_type*, *gamma\_unsat*, *gamma\_sat*, *friction\_angle*, *diameter\_d50=0.2*, *color=None*)[](#BearingPilesModel.create_material "Link to this definition") Create a material with the given name and properties. * Parameters: * **name** (`str`) – name of the material to create (max. 25 characters) * **soil\_type** ([`SoilType`](#SoilType "viktor.external.dfoundations.SoilType")) – \[-] * **gamma\_unsat** (`float`) – gamma-unsaturated, dry \[kN/m³] * **gamma\_sat** (`float`) – gamma-saturated, wet \[kN/m³] * **friction\_angle** (`float`) – phi \[degree] * **diameter\_d50** (`float`) – median \[mm] * **color** ([`Color`](https://docs.viktor.ai/sdk/api/core/.md#Color "viktor.core.Color")) – color for visualization in deltares software (None for default color ‘white’) * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – * if material with given name already exists in the model * if name is longer than 25 characters * Return type: `None` * create\_pile(*name*, *x*, *y*, *pile\_head\_level*, *surcharge*, *limit\_state\_str\_geo*, *serviceability\_limit\_state*)[](#BearingPilesModel.create_pile "Link to this definition") Create a pile with given properties. * Parameters: * **name** (`str`) – name of the pile. Must be unique. Max. 10 characters. * **x** (`float`) – \[m] * **y** (`float`) – \[m] * **pile\_head\_level** (`float`) – \[m R.L.] * **surcharge** (`float`) – \[kN/m2] * **limit\_state\_str\_geo** (`float`) – Limit state STR/GEO \[kN] * **serviceability\_limit\_state** (`float`) – \[kN] * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – * if pile with given name already exists. * if name exceeds the max. number of characters (10). * Return type: `None` - create\_pile\_type(*name*, *shape*, *pile\_type*, *slip\_layer*, *type\_sand\_gravel=None*, *type\_clay\_loam\_peat=None*, *type\_p=None*, *load\_settlement\_curve=None*, *material=None*, *factor\_sand\_gravel=None*, *factor\_clay\_loam\_peat=None*, *factor\_pile\_class=None*, *e\_modulus=None*, *slip\_layer\_adhesion=None*, *\**, *use\_pre\_2016=False*, *as\_prefab=False*, *qciii\_reduction=None*, *overrule\_tip\_section\_factor=None*, *overrule\_tip\_shape\_factor=None*)[](#BearingPilesModel.create_pile_type "Link to this definition") Create a pile type with the given properties. * Parameters: * **name** (`str`) – name of the pile type. Must be unique. Max. 10 characters. * **shape** (`_PileShape`) – pile type shape class instance. See below for possible shapes. * **pile\_type** ([`PileType`](#PileType "viktor.external.dfoundations.PileType")) – predefined/user-defined pile type. Only certain types are valid in combination with the provided ‘shape’. For more information on valid combinations, please refer to the D-Foundations software. * **slip\_layer** ([`PileSlipLayer`](#PileSlipLayer "viktor.external.dfoundations.PileSlipLayer")) * **type\_sand\_gravel** ([`PileType`](#PileType "viktor.external.dfoundations.PileType")) – pile type for α\_s sand/gravel * **type\_clay\_loam\_peat** ([`PileTypeClayLoamPeat`](#PileTypeClayLoamPeat "viktor.external.dfoundations.PileTypeClayLoamPeat")) – pile type for α\_s clay/loam/peat * **type\_p** ([`PileType`](#PileType "viktor.external.dfoundations.PileType")) – pile type for α\_p * **load\_settlement\_curve** ([`PileLoadSettlementCurve`](#PileLoadSettlementCurve "viktor.external.dfoundations.PileLoadSettlementCurve")) * **material** ([`PileMaterial`](#PileMaterial "viktor.external.dfoundations.PileMaterial")) * **factor\_sand\_gravel** (`float`) – α\_s \[-]. Only required if ‘type\_sand\_gravel’ is of type user-defined. * **factor\_clay\_loam\_peat** (`float`) – α\_s \[-]. Only required if ‘type\_clay\_loam\_peat’ is of type user-defined. * **factor\_pile\_class** (`float`) – α\_p \[-]. Only required if ‘type\_p’ is of type user-defined. * **e\_modulus** (`float`) – Young’s modulus \[kN/m2]. Only required if ‘material’ is of type user-defined. * **slip\_layer\_adhesion** (`float`) – Representative cohesion \[kN/m2]. Only required if ‘slip\_layer’ is of type user-defined. * **use\_pre\_2016** (`bool`) * **as\_prefab** (`bool`) * **qciii\_reduction** (`float`) – \[%] * **overrule\_tip\_section\_factor** (`float`) – Pile top cross section factor (s) \[-] * **overrule\_tip\_shape\_factor** (`float`) – Pile tip shape factor (β) \[-] * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – * if ‘pile\_type’ is of type user-defined and ‘type\_sand\_gravel’ is not set. * if ‘pile\_type’ is of type user-defined and ‘type\_clay\_loam\_peat’ is not set. * if ‘pile\_type’ is of type user-defined and ‘material’ is not set. * if ‘pile\_type’ is of type user-defined and ‘type\_p’ is not set. * if ‘pile\_type’ is of type user-defined and ‘load\_settlement\_curve’ is not set. * if ‘type\_sand\_gravel’ is of type user-defined and ‘factor\_sand\_gravel’ is not set. * if ‘type\_clay\_loam\_peat’ is of type user-defined and ‘factor\_clay\_loam\_peat’ is not set. * if ‘material’ is of type user-defined and ‘e\_modulus’ is not set. * if ‘type\_p’ is of type user-defined and ‘factor\_pile\_class’ is not set. * if ‘slip\_layer’ is of type user-defined and ‘slip\_layer\_adhesion’ is not set. * if an invalid ‘shape’ is provided. * if a ‘pile\_type’ is provided that is invalid in combination with the given ‘shape’. * if one of the types PileType.USER\_DEFINED\_VIBRATING or PileType.USER\_DEFINED\_LOW\_VIBRATING is selected for ‘type\_sand\_gravel’ or ‘type\_p’ (no valid options). * if a pile type with the give name already exists. * if ‘factor\_sand\_gravel’, ‘factor\_clay\_loam\_peat’ or ‘factor\_pile\_class’ is outside valid range 0-9. * if ‘overrule\_tip\_section\_factor’ or ‘overrule\_tip\_shape\_factor’ is outside valid range 0-10. * Return type: `None` Possible shapes are: > * RectPile > > * RectEnlPile > > * SectionPile > > * RoundPile > > * TaperPile > > * HollowPile > > * HollowOpenPile > > * RoundEnlPile > > * LostTipPile > > * DrivenBasePile > > * HShapedPile * create\_profile(*name*, *layers*, *x*, *y*, *measurements*, *phreatic\_level*, *pile\_tip\_level*, *overconsolidation\_ratio*, *top\_positive\_skin\_friction*, *bottom\_negative\_skin\_friction*, *expected\_ground\_level\_settlement*, *\**, *cpt\_rule=CPTRule.NEN*, *min\_layer\_thickness=0.1*)[](#BearingPilesModel.create_profile "Link to this definition") Create a profile manually. * Parameters: * **name** (`str`) – name of the profile (must be unique). * **layers** (`List`\[[`ProfileLayer`](#ProfileLayer "viktor.external.dfoundations.ProfileLayer")]) – list of layers. * **x** (`float`) – \[m] * **y** (`float`) – \[m] * **measurements** (`List`\[`Tuple`\[`float`, `float`]]) – list of measurement data (level \[m], qc-value \[MPa]). * **phreatic\_level** (`float`) – \[m] * **pile\_tip\_level** (`float`) – \[m] * **overconsolidation\_ratio** (`float`) – overconsolidation ratio of bearing zone \[-] * **top\_positive\_skin\_friction** (`float`) – top of positive skin friction \[m] * **bottom\_negative\_skin\_friction** (`float`) – bottom of negative skin friction \[m] * **expected\_ground\_level\_settlement** (`float`) – \[m] * **cpt\_rule** ([`CPTRule`](#CPTRule "viktor.external.dfoundations.CPTRule")) * **min\_layer\_thickness** (`float`) – \[m] * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – * if max. number of profiles (350) was reached. * if profile with the given name already exists. * if a material exists within one of the layers of which the name does not exist in the model. * if measurements exceeds max. number of rows (5000). * if layers exceeds max. number for a single profile (100). * Return type: `None` - import\_profile(*cpt*, *layers*, *x*, *y*, *phreatic\_level*, *pile\_tip\_level*, *overconsolidation\_ratio*, *top\_positive\_skin\_friction*, *bottom\_negative\_skin\_friction*, *expected\_ground\_level\_settlement*, *name=None*, *manual\_ground\_level=None*, *\**, *cpt\_rule=CPTRule.NEN*, *min\_layer\_thickness=0.1*)[](#BearingPilesModel.import_profile "Link to this definition") Create a profile by importing a CPT-file. * Parameters: * **cpt** ([`GEFData`](https://docs.viktor.ai/sdk/api/geo/.md#GEFData "viktor.geo.GEFData")) – CPT file to import. * **layers** (`List`\[[`ProfileLayer`](#ProfileLayer "viktor.external.dfoundations.ProfileLayer")]) – list of layers. * **x** (`float`) – \[m] * **y** (`float`) – \[m] * **phreatic\_level** (`float`) – \[m] * **pile\_tip\_level** (`float`) – \[m] * **overconsolidation\_ratio** (`float`) – overconsolidation ratio of bearing zone \[-] * **top\_positive\_skin\_friction** (`float`) – top of positive skin friction \[m] * **bottom\_negative\_skin\_friction** (`float`) – bottom of negative skin friction \[m] * **expected\_ground\_level\_settlement** (`float`) – \[m] * **name** (`str`) – name of the profile (must be unique). None for default (name of the cpt). * **manual\_ground\_level** (`float`) – set to override the ground level \[m] from the cpt. * **cpt\_rule** ([`CPTRule`](#CPTRule "viktor.external.dfoundations.CPTRule")) * **min\_layer\_thickness** (`float`) – \[m] * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – * if max. number of profiles (350) was reached. * if profile with the given name already exists. * if a material exists within one of the layers of which the name does not exist in the model. * if measurements exceeds max. number of rows (5000). * if layers exceeds max. number for a single profile (100). * if ground level could not be read from cpt file. * Return type: `None` <!-- --> ## CPTRule[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_CPTRule "Direct link to CPTRule") * *class *viktor.external.dfoundations.CPTRule(*\*values*)[](#CPTRule "Link to this definition") Bases: `Enum` * CUR*: [`CPTRule`](#CPTRule "viktor.external.dfoundations.CPTRule")** = 1*[](#CPTRule.CUR "Link to this definition") - NEN*: [`CPTRule`](#CPTRule "viktor.external.dfoundations.CPTRule")** = 0*[](#CPTRule.NEN "Link to this definition") * NEN\_STRESS*: [`CPTRule`](#CPTRule "viktor.external.dfoundations.CPTRule")** = 0*[](#CPTRule.NEN_STRESS "Link to this definition") - QC\_ONLY*: [`CPTRule`](#CPTRule "viktor.external.dfoundations.CPTRule")** = 3*[](#CPTRule.QC_ONLY "Link to this definition") * TYPE\_3*: [`CPTRule`](#CPTRule "viktor.external.dfoundations.CPTRule")** = 2*[](#CPTRule.TYPE_3 "Link to this definition") <!-- --> ## CalculationType[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_CalculationType "Direct link to CalculationType") * *class *viktor.external.dfoundations.CalculationType(*\*values*)[](#CalculationType "Link to this definition") Bases: `Enum` * BEARING\_CAPACITY\_AT\_FIXED\_PILE\_TIP\_LEVEL*: [`CalculationType`](#CalculationType "viktor.external.dfoundations.CalculationType")** = 3*[](#CalculationType.BEARING_CAPACITY_AT_FIXED_PILE_TIP_LEVEL "Link to this definition") - COMPLETE\_CALCULATION*: [`CalculationType`](#CalculationType "viktor.external.dfoundations.CalculationType")** = 1*[](#CalculationType.COMPLETE_CALCULATION "Link to this definition") * DESIGN\_CALCULATION*: [`CalculationType`](#CalculationType "viktor.external.dfoundations.CalculationType")** = 0*[](#CalculationType.DESIGN_CALCULATION "Link to this definition") - INDICATION\_BEARING\_CAPACITY*: [`CalculationType`](#CalculationType "viktor.external.dfoundations.CalculationType")** = 2*[](#CalculationType.INDICATION_BEARING_CAPACITY "Link to this definition") * PILE\_TIP\_LEVEL\_AND\_NET\_BEARING\_CAPACITY*: [`CalculationType`](#CalculationType "viktor.external.dfoundations.CalculationType")** = 4*[](#CalculationType.PILE_TIP_LEVEL_AND_NET_BEARING_CAPACITY "Link to this definition") <!-- --> ## ConstructionSequence[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_ConstructionSequence "Direct link to ConstructionSequence") * *class *viktor.external.dfoundations.ConstructionSequence(*\*values*)[](#ConstructionSequence "Link to this definition") Bases: `Enum` * CPT\_EXCAVATION\_INSTALL*: [`ConstructionSequence`](#ConstructionSequence "viktor.external.dfoundations.ConstructionSequence")** = 1*[](#ConstructionSequence.CPT_EXCAVATION_INSTALL "Link to this definition") - CPT\_INSTALL\_EXCAVATION*: [`ConstructionSequence`](#ConstructionSequence "viktor.external.dfoundations.ConstructionSequence")** = 6*[](#ConstructionSequence.CPT_INSTALL_EXCAVATION "Link to this definition") * EXCAVATION\_CPT\_BOTH\_BEFORE\_AND\_AFTER\_INSTALL*: [`ConstructionSequence`](#ConstructionSequence "viktor.external.dfoundations.ConstructionSequence")** = 7*[](#ConstructionSequence.EXCAVATION_CPT_BOTH_BEFORE_AND_AFTER_INSTALL "Link to this definition") - EXCAVATION\_CPT\_INSTALL*: [`ConstructionSequence`](#ConstructionSequence "viktor.external.dfoundations.ConstructionSequence")** = 3*[](#ConstructionSequence.EXCAVATION_CPT_INSTALL "Link to this definition") * EXCAVATION\_INSTALL\_CPT*: [`ConstructionSequence`](#ConstructionSequence "viktor.external.dfoundations.ConstructionSequence")** = 4*[](#ConstructionSequence.EXCAVATION_INSTALL_CPT "Link to this definition") - INSTALL\_CPT\_EXCAVATION*: [`ConstructionSequence`](#ConstructionSequence "viktor.external.dfoundations.ConstructionSequence")** = 2*[](#ConstructionSequence.INSTALL_CPT_EXCAVATION "Link to this definition") * INSTALL\_EXCAVATION\_CPT*: [`ConstructionSequence`](#ConstructionSequence "viktor.external.dfoundations.ConstructionSequence")** = 5*[](#ConstructionSequence.INSTALL_EXCAVATION_CPT "Link to this definition") <!-- --> ## DFoundationsAnalysis[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_DFoundationsAnalysis "Direct link to DFoundationsAnalysis") * *class *viktor.external.dfoundations.DFoundationsAnalysis(*input\_file*)[](#DFoundationsAnalysis "Link to this definition") Bases: [`ExternalProgram`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram "viktor.external.external_program.ExternalProgram") DFoundationsAnalysis can be used to perform an analysis using D-Foundations on a third-party worker. To start an analysis call the method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute"), with an appropriate timeout (in seconds). To retrieve the results call the method [`get_output_file()`](#DFoundationsAnalysis.get_output_file "viktor.external.dfoundations.DFoundationsAnalysis.get_output_file"), after [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute"). Note: the input for the BytesIO object should be of type bytes. You can convert a string to bytes by calling the method `encode()`. Default encoding is ‘utf-8’. Usage: ``` input_file = BytesIO("dfoundations input file body".encode('utf-8')) dfoundations_analysis = DFoundationsAnalysis(input_file=input_file) dfoundations_analysis.execute(timeout=10) output_file = dfoundations_analysis.get_output_file() ``` Exceptions which can be raised during calculation: - [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information * Parameters: **input\_file** (`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – .foi input file. - get\_output\_file(*extension='.fod'*, *\**, *as\_file=False*)[](#DFoundationsAnalysis.get_output_file "Link to this definition") * Method can be used to retrieve the results generated by running an external analysis. Call method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute") first and [`get_output_file()`](#DFoundationsAnalysis.get_output_file "viktor.external.dfoundations.DFoundationsAnalysis.get_output_file") afterwards. - Parameters: * **extension** (`str`) – extension of the file you want to return; one of: ‘.fos’, ‘.fod’, ‘.error.log’, ‘.err’ * **as\_file** (`bool`) – return as BytesIO (default) or File - Return type: `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | `None` - Returns: * File, if as\_file = True * BytesIO, if as\_file = False (default) <!-- --> ## DrivenBasePile[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_DrivenBasePile "Direct link to DrivenBasePile") * *class *viktor.external.dfoundations.DrivenBasePile(*base\_diameter*, *pile\_diameter*, *base\_height*)[](#DrivenBasePile "Link to this definition") Bases: [`RoundEnlPile`](#RoundEnlPile "viktor.external.dfoundations.RoundEnlPile") Round pile with in situ formed base. Round pile with enlarged base. * Parameters: * **base\_diameter** (`float`) – \[m] * **pile\_diameter** (`float`) – \[m]. Must be smaller than ‘base\_diameter’. * **base\_height** (`float`) – \[m] * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – if ‘pile\_diameter’ is not smaller than ‘base\_diameter’. <!-- --> ## HShapedPile[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_HShapedPile "Direct link to HShapedPile") * *class *viktor.external.dfoundations.HShapedPile(*height*, *width*, *thickness\_web*, *thickness\_flange*)[](#HShapedPile "Link to this definition") Bases: `_PileShape` H-shaped profile. * Parameters: * **height** (`float`) – \[m] * **width** (`float`) – \[m] * **thickness\_web** (`float`) – \[mm]. Must be smaller than ‘width’. * **thickness\_flange** (`float`) – \[mm]. Must be smaller than half of ‘height’. * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – * if ‘thickness\_web’ is not smaller than ‘width’. * if ‘thickness\_flange’ is not smaller than half of ‘height’. <!-- --> ## HollowOpenPile[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_HollowOpenPile "Direct link to HollowOpenPile") * *class *viktor.external.dfoundations.HollowOpenPile(*external\_diameter*, *wall\_thickness*)[](#HollowOpenPile "Link to this definition") Bases: `_PileShape` Round open-ended hollow pile. * Parameters: * **external\_diameter** (`float`) – \[m] * **wall\_thickness** (`float`) – \[mm]. Must be smaller than half of ‘external\_diameter’. * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – if ‘wall\_thickness’ is not smaller than half of ‘external\_diameter’. - *property *internal\_diameter*: float*[](#HollowOpenPile.internal_diameter "Link to this definition") <!-- --> ## HollowPile[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_HollowPile "Direct link to HollowPile") * *class *viktor.external.dfoundations.HollowPile(*external\_diameter*, *wall\_thickness*)[](#HollowPile "Link to this definition") Bases: `_PileShape` Round hollow pile with closed base. * Parameters: * **external\_diameter** (`float`) – \[m] * **wall\_thickness** (`float`) – \[mm]. Must be smaller than half of ‘external\_diameter’. * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – if ‘wall\_thickness’ is not smaller than half of ‘external\_diameter’. - *property *internal\_diameter*: float*[](#HollowPile.internal_diameter "Link to this definition") <!-- --> ## LostTipPile[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_LostTipPile "Direct link to LostTipPile") * *class *viktor.external.dfoundations.LostTipPile(*base\_diameter*, *pile\_diameter*)[](#LostTipPile "Link to this definition") Bases: `_PileShape` Round pile with lost tip. * Parameters: * **base\_diameter** (`float`) – \[m] * **pile\_diameter** (`float`) – \[m]. Must be smaller than ‘base\_diameter’. * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – if ‘pile\_diameter’ is not smaller than ‘base\_diameter’. <!-- --> ## MaxConeResistType[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_MaxConeResistType "Direct link to MaxConeResistType") * *class *viktor.external.dfoundations.MaxConeResistType(*\*values*)[](#MaxConeResistType "Link to this definition") Bases: `Enum` * MANUAL*: [`MaxConeResistType`](#MaxConeResistType "viktor.external.dfoundations.MaxConeResistType")** = 1*[](#MaxConeResistType.MANUAL "Link to this definition") - STANDARD*: [`MaxConeResistType`](#MaxConeResistType "viktor.external.dfoundations.MaxConeResistType")** = 0*[](#MaxConeResistType.STANDARD "Link to this definition") <!-- --> ## Metadata[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_Metadata "Direct link to Metadata") * *class *viktor.external.dfoundations.Metadata(*file\_name='-'*, *company='-'*, *title\_1='-'*, *title\_2='-'*, *geotechnical\_consultant=''*, *design\_engineer=''*, *principal=''*, *project\_id=''*, *location=''*, *current\_date=False*, *current\_time=False*)[](#Metadata "Link to this definition") Data container for metadata to be added to the D-Foundations input file. * Parameters: * **file\_name** (`str`) – file name, as shown in the input file header * **company** (`str`) – company name, as shown in the input file header * **title\_1** (`str`) * **title\_2** (`str`) * **geotechnical\_consultant** (`str`) * **design\_engineer** (`str`) * **principal** (`str`) * **project\_id** (`str`) * **location** (`str`) * **current\_date** (`bool`) – date, as shown in the input file header * **current\_time** (`bool`) – time, as shown in the input file header <!-- --> ## OutputFileParser[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_OutputFileParser "Direct link to OutputFileParser") * *class *viktor.external.dfoundations.OutputFileParser(*fod\_file*)[](#OutputFileParser "Link to this definition") Helper class to extract results from a D-Foundations output file (.fod). Currently the following versions are (partly) supported: * * v17: * Tension Piles model * Bearing Piles model - Preliminary Design (calculation options only) * * v19: * Tension Piles model * Bearing Piles model - Verification Example usage: ``` parser = OutputFileParser(fod_file) calculation_parameters = parser.calculation_parameters results = parser.results(False) ``` * Parameters: **fod\_file** (`StringIO`) – D-Foundations output file (.fod) - *abstract property *calculation\_parameters*: Dict\[str, float | bool]*[](#OutputFileParser.calculation_parameters "Link to this definition") Calculation parameters. * *property *raw\_results*: str*[](#OutputFileParser.raw_results "Link to this definition") - *abstractmethod *results(*as\_pandas=True*)[](#OutputFileParser.results "Link to this definition") All result data. * Parameters: **as\_pandas** (`bool`) – True to return the results as a dictionary of pandas DataFrame objects. False for dicts. * Return type: `Dict`\[`str`, `DataFrame` | `Dict`\[`str`, `Any`]] <!-- --> ## PileLoadSettlementCurve[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_PileLoadSettlementCurve "Direct link to PileLoadSettlementCurve") * *class *viktor.external.dfoundations.PileLoadSettlementCurve(*\*values*)[](#PileLoadSettlementCurve "Link to this definition") Bases: `Enum` * ONE*: [`PileLoadSettlementCurve`](#PileLoadSettlementCurve "viktor.external.dfoundations.PileLoadSettlementCurve")** = 0*[](#PileLoadSettlementCurve.ONE "Link to this definition") - THREE*: [`PileLoadSettlementCurve`](#PileLoadSettlementCurve "viktor.external.dfoundations.PileLoadSettlementCurve")** = 2*[](#PileLoadSettlementCurve.THREE "Link to this definition") * TWO*: [`PileLoadSettlementCurve`](#PileLoadSettlementCurve "viktor.external.dfoundations.PileLoadSettlementCurve")** = 1*[](#PileLoadSettlementCurve.TWO "Link to this definition") <!-- --> ## PileMaterial[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_PileMaterial "Direct link to PileMaterial") * *class *viktor.external.dfoundations.PileMaterial(*\*values*)[](#PileMaterial "Link to this definition") Bases: `Enum` * CONCRETE*: [`PileMaterial`](#PileMaterial "viktor.external.dfoundations.PileMaterial")** = 0*[](#PileMaterial.CONCRETE "Link to this definition") - STEEL*: [`PileMaterial`](#PileMaterial "viktor.external.dfoundations.PileMaterial")** = 1*[](#PileMaterial.STEEL "Link to this definition") * TIMBER*: [`PileMaterial`](#PileMaterial "viktor.external.dfoundations.PileMaterial")** = 2*[](#PileMaterial.TIMBER "Link to this definition") - USER\_DEFINED*: [`PileMaterial`](#PileMaterial "viktor.external.dfoundations.PileMaterial")** = 3*[](#PileMaterial.USER_DEFINED "Link to this definition") * WOOD*: [`PileMaterial`](#PileMaterial "viktor.external.dfoundations.PileMaterial")** = 2*[](#PileMaterial.WOOD "Link to this definition") <!-- --> ## PileSlipLayer[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_PileSlipLayer "Direct link to PileSlipLayer") * *class *viktor.external.dfoundations.PileSlipLayer(*\*values*)[](#PileSlipLayer "Link to this definition") Bases: `Enum` * BENTONITE*: [`PileSlipLayer`](#PileSlipLayer "viktor.external.dfoundations.PileSlipLayer")** = 2*[](#PileSlipLayer.BENTONITE "Link to this definition") - BITUMEN*: [`PileSlipLayer`](#PileSlipLayer "viktor.external.dfoundations.PileSlipLayer")** = 3*[](#PileSlipLayer.BITUMEN "Link to this definition") * NONE*: [`PileSlipLayer`](#PileSlipLayer "viktor.external.dfoundations.PileSlipLayer")** = 0*[](#PileSlipLayer.NONE "Link to this definition") - SYNTHETIC*: [`PileSlipLayer`](#PileSlipLayer "viktor.external.dfoundations.PileSlipLayer")** = 1*[](#PileSlipLayer.SYNTHETIC "Link to this definition") * USER\_DEFINED*: [`PileSlipLayer`](#PileSlipLayer "viktor.external.dfoundations.PileSlipLayer")** = 4*[](#PileSlipLayer.USER_DEFINED "Link to this definition") <!-- --> ## PileType[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_PileType "Direct link to PileType") * *class *viktor.external.dfoundations.PileType(*\*values*)[](#PileType "Link to this definition") Bases: `Enum` * BORED\_DRILLING*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 12*[](#PileType.BORED_DRILLING "Link to this definition") - BORED\_SHELLING*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 13*[](#PileType.BORED_SHELLING "Link to this definition") * CLOSED\_STEEL*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 1*[](#PileType.CLOSED_STEEL "Link to this definition") - CONTINUOUS\_FLIGHT\_AUGER*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 11*[](#PileType.CONTINUOUS_FLIGHT_AUGER "Link to this definition") * DRIVEN\_TUBE\_BACK\_DRIVING*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 2*[](#PileType.DRIVEN_TUBE_BACK_DRIVING "Link to this definition") - DRIVEN\_TUBE\_BACK\_VIBRATION*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 3*[](#PileType.DRIVEN_TUBE_BACK_VIBRATION "Link to this definition") * GROUTED\_STEEL\_PIPE*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 24*[](#PileType.GROUTED_STEEL_PIPE "Link to this definition") - GROUTED\_STEEL\_PROFILE*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 23*[](#PileType.GROUTED_STEEL_PROFILE "Link to this definition") * MICRO\_ANCHOR\_BORED*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 20*[](#PileType.MICRO_ANCHOR_BORED "Link to this definition") - MICRO\_ANCHOR\_SCREWED*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 21*[](#PileType.MICRO_ANCHOR_SCREWED "Link to this definition") * MICRO\_DOUBLE\_EXTORTED*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 16*[](#PileType.MICRO_DOUBLE_EXTORTED "Link to this definition") - MICRO\_DOUBLE\_NOT\_EXTORTED*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 17*[](#PileType.MICRO_DOUBLE_NOT_EXTORTED "Link to this definition") * MICRO\_SINGLE\_EXTORTED*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 18*[](#PileType.MICRO_SINGLE_EXTORTED "Link to this definition") - MICRO\_SINGLE\_NOT\_EXTORTED*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 19*[](#PileType.MICRO_SINGLE_NOT_EXTORTED "Link to this definition") * MICRO\_VIBRATED*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 22*[](#PileType.MICRO_VIBRATED "Link to this definition") - MV*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 15*[](#PileType.MV "Link to this definition") * OPEN\_STEEL*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 14*[](#PileType.OPEN_STEEL "Link to this definition") - PREFAB\_CONCRETE*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 0*[](#PileType.PREFAB_CONCRETE "Link to this definition") * PREFAB\_WITHOUT\_GROUT*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 9*[](#PileType.PREFAB_WITHOUT_GROUT "Link to this definition") - PREFAB\_WITH\_GROUT*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 8*[](#PileType.PREFAB_WITH_GROUT "Link to this definition") * SCREW\_LOST\_TIP*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 6*[](#PileType.SCREW_LOST_TIP "Link to this definition") - SCREW\_WITH\_GROUT*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 7*[](#PileType.SCREW_WITH_GROUT "Link to this definition") * STEEL*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 10*[](#PileType.STEEL "Link to this definition") - STRAIGHT\_TIMBER*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 5*[](#PileType.STRAIGHT_TIMBER "Link to this definition") * TAPERED\_TIMBER*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 4*[](#PileType.TAPERED_TIMBER "Link to this definition") - USER\_DEFINED*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 27*[](#PileType.USER_DEFINED "Link to this definition") * USER\_DEFINED\_LOW\_VIBRATING*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 26*[](#PileType.USER_DEFINED_LOW_VIBRATING "Link to this definition") - USER\_DEFINED\_VIBRATING*: [`PileType`](#PileType "viktor.external.dfoundations.PileType")** = 25*[](#PileType.USER_DEFINED_VIBRATING "Link to this definition") <!-- --> ## PileTypeClayLoamPeat[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_PileTypeClayLoamPeat "Direct link to PileTypeClayLoamPeat") * *class *viktor.external.dfoundations.PileTypeClayLoamPeat(*\*values*)[](#PileTypeClayLoamPeat "Link to this definition") Bases: `Enum` * ACCORDING\_TO\_STANDARD*: [`PileTypeClayLoamPeat`](#PileTypeClayLoamPeat "viktor.external.dfoundations.PileTypeClayLoamPeat")** = 0*[](#PileTypeClayLoamPeat.ACCORDING_TO_STANDARD "Link to this definition") - USER\_DEFINED*: [`PileTypeClayLoamPeat`](#PileTypeClayLoamPeat "viktor.external.dfoundations.PileTypeClayLoamPeat")** = 1*[](#PileTypeClayLoamPeat.USER_DEFINED "Link to this definition") <!-- --> ## ProfileLayer[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_ProfileLayer "Direct link to ProfileLayer") * *class *viktor.external.dfoundations.ProfileLayer(*top\_level*, *material*, *ad\_pore\_pressure\_at\_top=0.0*, *ad\_pore\_pressure\_at\_bottom=0.0*, *ocr=1.0*)[](#ProfileLayer "Link to this definition") Data container for a single layer within a profile. * Parameters: * **top\_level** (`float`) – \[m] * **material** (`str`) – name of the material. * **ad\_pore\_pressure\_at\_top** (`float`) – \[kN/m2]. Tensions Piles (EC7-NL) model only. Ignored for other model types. * **ad\_pore\_pressure\_at\_bottom** (`float`) – \[kN/m2]. Tensions Piles (EC7-NL) model only. Ignored for other model types. * **ocr** (`float`) – \[-]. Tensions Piles (EC7-NL) model only. Ignored for other model types. - *property *material*: str*[](#ProfileLayer.material "Link to this definition") <!-- --> ## RectEnlPile[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_RectEnlPile "Direct link to RectEnlPile") * *class *viktor.external.dfoundations.RectEnlPile(*base\_width*, *base\_length*, *base\_height*, *shaft\_width*, *shaft\_length*)[](#RectEnlPile "Link to this definition") Bases: `_PileShape` Round pile with enlarged base. * Parameters: * **base\_width** (`float`) – \[m] * **base\_length** (`float`) – \[m] * **base\_height** (`float`) – \[m] * **shaft\_width** (`float`) – \[m]. Must be smaller than ‘base\_width’. * **shaft\_length** (`float`) – \[m]. Must be smaller than ‘base\_length’. * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – * if ‘shaft\_width’ is not smaller than ‘base\_width’. * if ‘shaft\_length’ is not smaller than ‘base\_length’. <!-- --> ## RectPile[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_RectPile "Direct link to RectPile") * *class *viktor.external.dfoundations.RectPile(*width*, *length*)[](#RectPile "Link to this definition") Bases: `_PileShape` Rectangular pile. * Parameters: * **width** (`float`) – \[m] * **length** (`float`) – \[m] <!-- --> ## RoundEnlPile[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_RoundEnlPile "Direct link to RoundEnlPile") * *class *viktor.external.dfoundations.RoundEnlPile(*base\_diameter*, *pile\_diameter*, *base\_height*)[](#RoundEnlPile "Link to this definition") Bases: [`LostTipPile`](#LostTipPile "viktor.external.dfoundations.LostTipPile") Round pile with enlarged base. * Parameters: * **base\_diameter** (`float`) – \[m] * **pile\_diameter** (`float`) – \[m]. Must be smaller than ‘base\_diameter’. * **base\_height** (`float`) – \[m] * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – if ‘pile\_diameter’ is not smaller than ‘base\_diameter’. <!-- --> ## RoundPile[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_RoundPile "Direct link to RoundPile") * *class *viktor.external.dfoundations.RoundPile(*diameter*)[](#RoundPile "Link to this definition") Bases: `_PileShape` Round pile. * Parameters: **diameter** (`float`) – \[m] <!-- --> ## SectionPile[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_SectionPile "Direct link to SectionPile") * *class *viktor.external.dfoundations.SectionPile(*width*, *length*)[](#SectionPile "Link to this definition") Bases: [`RectPile`](#RectPile "viktor.external.dfoundations.RectPile") Section pile. Rectangular pile. * Parameters: * **width** (`float`) – \[m] * **length** (`float`) – \[m] <!-- --> ## SoilType[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_SoilType "Direct link to SoilType") * *class *viktor.external.dfoundations.SoilType(*\*values*)[](#SoilType "Link to this definition") Bases: `Enum` * CLAY*: [`SoilType`](#SoilType "viktor.external.dfoundations.SoilType")** = 3*[](#SoilType.CLAY "Link to this definition") - GRAVEL*: [`SoilType`](#SoilType "viktor.external.dfoundations.SoilType")** = 0*[](#SoilType.GRAVEL "Link to this definition") * LOAM*: [`SoilType`](#SoilType "viktor.external.dfoundations.SoilType")** = 2*[](#SoilType.LOAM "Link to this definition") - PEAT*: [`SoilType`](#SoilType "viktor.external.dfoundations.SoilType")** = 4*[](#SoilType.PEAT "Link to this definition") * SAND*: [`SoilType`](#SoilType "viktor.external.dfoundations.SoilType")** = 1*[](#SoilType.SAND "Link to this definition") <!-- --> ## TaperPile[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_TaperPile "Direct link to TaperPile") * *class *viktor.external.dfoundations.TaperPile(*diameter\_tip*, *increase*)[](#TaperPile "Link to this definition") Bases: `_PileShape` Round tapered pile. * Parameters: * **diameter\_tip** (`float`) – \[m] * **increase** (`float`) – \[m/m’] <!-- --> ## TensionPilesCalculationOptions[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_TensionPilesCalculationOptions "Direct link to TensionPilesCalculationOptions") * *class *viktor.external.dfoundations.TensionPilesCalculationOptions(*calculation\_type*, *rigid*, *unit\_weight\_water=9.81*, *surcharge=0.0*, *\**, *xi3=None*, *xi4=None*, *gamma\_m\_var\_qc=None*, *gamma\_st=None*, *gamma\_gamma=None*, *use\_compaction=False*, *overrule\_excavation=False*, *overrule\_excess\_pore\_pressure=True*, *trajectory\_begin\_end\_interval=None*, *net\_bearing\_capacity=None*)[](#TensionPilesCalculationOptions "Link to this definition") Bases: `_CalculationOptions` Data container for the calculation options for a Tension Piles (EC7-NL) model. * Parameters: * **calculation\_type** ([`CalculationType`](#CalculationType "viktor.external.dfoundations.CalculationType")) – valid types: * CalculationType.INDICATION\_BEARING\_CAPACITY * CalculationType.BEARING\_CAPACITY\_AT\_FIXED\_PILE\_TIP\_LEVEL * CalculationType.PILE\_TIP\_LEVEL\_AND\_NET\_BEARING\_CAPACITY * **rigid** (`bool`) – True for rigid, False for non-rigid * **unit\_weight\_water** (`float`) – \[kN/m3] * **surcharge** (`float`) – \[kN/m2] * **xi3** (`float`) – ξ\_3 \[-] * **xi4** (`float`) – ξ\_4 \[-] * **gamma\_m\_var\_qc** (`float`) – γ\_m;var;qc \[-] * **gamma\_st** (`float`) – γ\_st \[-] * **gamma\_gamma** (`float`) – γ\_γ \[-] * **overrule\_excavation** (`bool`) * **use\_compaction** (`bool`) * **overrule\_excess\_pore\_pressure** (`bool`) * **trajectory\_begin\_end\_interval** (`Tuple`\[`float`, `float`, `float`]) – tuple(\[m], \[m], \[m]) * **net\_bearing\_capacity** (`int`) – \[kN] * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – * if ‘calculation\_type’ is not one of the valid types. * if ‘calculation\_type’ is INDICATION\_BEARING\_CAPACITY or PILE\_TIP\_LEVEL\_AND\_NET\_BEARING\_CAPACITY and ‘trajectory\_begin\_end\_interval’ is not set. * if the number of iterations > 151, based on the provided ‘trajectory\_begin\_end\_interval’. * if ‘calculation\_type’ is PILE\_TIP\_LEVEL\_AND\_NET\_BEARING\_CAPACITY and ‘net\_bearing\_capacity’ is not set. <!-- --> ## TensionPilesModel[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_TensionPilesModel "Direct link to TensionPilesModel") * *class *viktor.external.dfoundations.TensionPilesModel(*construction\_sequence*, *calculation\_options*, *excavation\_level*, *reduction\_cone\_resistance=None*, *\**, *create\_default\_materials=True*)[](#TensionPilesModel "Link to this definition") Bases: `_Model` Create a Tension Piles (EC7-NL) model. * Parameters: * **construction\_sequence** ([`ConstructionSequence`](#ConstructionSequence "viktor.external.dfoundations.ConstructionSequence")) * **calculation\_options** ([`TensionPilesCalculationOptions`](#TensionPilesCalculationOptions "viktor.external.dfoundations.TensionPilesCalculationOptions")) * **excavation\_level** (`float`) – \[m] * **reduction\_cone\_resistance** (`float`) – Distance edge pile to excavation boundary \[m] to implement ‘Begemann’. ‘None’ to implement ‘Safe (NEN)’. * **create\_default\_materials** (`bool`) – whether to start with the default D-Foundations materials. The default materials are: > * BClay, clean, moderate > > * BClay, clean, modstiff > > * BClay, clean, stiff > > * BClay, clean, weak > > * BClay, sl san, moderate > > * BClay, sl san, modstiff > > * BClay, sl san, stiff > > * BClay, sl san, weak > > * BGravel, clean, moderate > > * BGravel, clean, stiff > > * BGravel, ve sil, moderate > > * BGravel, ve sil, stiff > > * BLoam, clean, moderate > > * BLoam, clean, modstiff > > * BLoam, clean, stiff > > * BLoam, clean, weak > > * BLoam, sl san, moderate > > * BLoam, sl san, modstiff > > * BLoam, sl san, stiff > > * BLoam, sl san, weak > > * BPeat, sl san, moderate > > * BPeat, sl san, stiff > > * BPeat, sl san, weak > > * BSand, clean, loose > > * BSand, clean, moderate > > * BSand, clean, stiff > > * BSand, ve sil, loose > > * BSand, ve sil, moderate > > * BSand, ve sil, stiff > > * Clay, clean, moderate > > * Clay, clean, stiff > > * Clay, clean, weak > > * Clay, organ, moderate > > * Clay, organ, weak > > * Clay, sl san, moderate > > * Clay, sl san, stiff > > * Clay, sl san, weak > > * Clay, ve san, stiff > > * Gravel, sl sil, loose > > * Gravel, sl sil, moderate > > * Gravel, sl sil, stiff > > * Gravel, ve sil, loose > > * Gravel, ve sil, moderate > > * Gravel, ve sil, stiff > > * Loam, sl san, moderate > > * Loam, sl san, stiff > > * Loam, sl san, weak > > * Loam, ve san, stiff > > * Peat, mod pl, moderate > > * Peat, not pl, weak > > * Sand, clean, loose > > * Sand, clean, moderate > > * Sand, clean, stiff > > * Sand, sl sil, moderate > > * Sand, ve sil, loose * materials[](#TensionPilesModel.materials "Link to this definition") Lists all materials currently in de model. - profiles[](#TensionPilesModel.profiles "Link to this definition") Lists all profiles currently in de model. * pile\_types[](#TensionPilesModel.pile_types "Link to this definition") Lists all pile types currently in de model. - piles[](#TensionPilesModel.piles "Link to this definition") Lists all piles currently in de model. * generate\_input\_file(*metadata=None*, *\**, *as\_file=False*)[](#TensionPilesModel.generate_input_file "Link to this definition") Generate a D-Foundations input file. Note This method needs to be mocked in (automated) unit and integration tests. * Parameters: * **metadata** ([`Metadata`](#Metadata "viktor.external.dfoundations.Metadata")) – Metadata which will be written to the input file. If no metadata is provided, default data will be used. * **as\_file** (`bool`) – return as BytesIO (default) or File * Return type: [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | `BytesIO` - create\_material(*name*, *soil\_type*, *gamma\_unsat*, *gamma\_sat*, *friction\_angle*, *diameter\_d50=0.2*, *max\_cone\_resist\_type=MaxConeResistType.STANDARD*, *max\_cone\_resist=0.0*, *apply\_tension=True*, *min\_void\_ratio=0.4*, *max\_void\_ratio=0.8*, *color=None*)[](#TensionPilesModel.create_material "Link to this definition") Create a material with the given name and properties. * Parameters: * **name** (`str`) – name of the material to create (max. 25 characters) * **color** ([`Color`](https://docs.viktor.ai/sdk/api/core/.md#Color "viktor.core.Color")) – color for visualization in deltares software (None for default color ‘white’) * **soil\_type** ([`SoilType`](#SoilType "viktor.external.dfoundations.SoilType")) – \[-] * **gamma\_unsat** (`float`) – gamma-unsaturated, dry \[kN/m³] * **gamma\_sat** (`float`) – gamma-saturated, wet \[kN/m³] * **friction\_angle** (`float`) – phi \[degree] * **diameter\_d50** (`float`) – median \[mm] * **max\_cone\_resist\_type** ([`MaxConeResistType`](#MaxConeResistType "viktor.external.dfoundations.MaxConeResistType")) – \[-] * **max\_cone\_resist** (`float`) – \[MPa] * **apply\_tension** (`bool`) – True (default) / False * **min\_void\_ratio** (`float`) – \[-] * **max\_void\_ratio** (`float`) – \[-] * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – * if material with given name already exists in the model * if name is longer than 25 characters * Return type: `None` * create\_pile(*name*, *x*, *y*, *pile\_head\_level*, *load\_max\_min=None*)[](#TensionPilesModel.create_pile "Link to this definition") Create a pile with given properties. * Parameters: * **name** (`str`) – name of the pile. Must be unique. Max. 10 characters. * **x** (`float`) – \[m] * **y** (`float`) – \[m] * **pile\_head\_level** (`float`) – \[m R.L.] * **load\_max\_min** (`Tuple`\[`float`, `float`]) – (max. load \[kN], min. load \[kN]). None for ‘No’ use of alternating loads. * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – * if pile with given name already exists. * if name exceeds the max. number of characters (10). * Return type: `None` - create\_pile\_type(*name*, *shape*, *type\_sand\_gravel*, *type\_clay\_loam\_peat*, *material*, *factor\_sand\_gravel=None*, *factor\_clay\_loam\_peat=None*, *unit\_weight\_material=None*)[](#TensionPilesModel.create_pile_type "Link to this definition") Create a pile type with the given properties. * Parameters: * **name** (`str`) – name of the pile type. Must be unique. Max. 10 characters. * **shape** (`_PileShape`) – pile type shape class instance. See below for possible shapes. * **type\_sand\_gravel** ([`PileType`](#PileType "viktor.external.dfoundations.PileType")) – pile type for α\_t sand/gravel. predefined/user-defined pile type. Only certain types are valid in combination with the provided ‘shape’. For more information on valid combinations, please refer to the D-Foundations software. * **type\_clay\_loam\_peat** ([`PileTypeClayLoamPeat`](#PileTypeClayLoamPeat "viktor.external.dfoundations.PileTypeClayLoamPeat")) – pile type for α\_t clay/loam/peat. * **material** ([`PileMaterial`](#PileMaterial "viktor.external.dfoundations.PileMaterial")) * **factor\_sand\_gravel** (`float`) – α\_t \[-]. Only required if ‘type\_sand\_gravel’ is of type user-defined. * **factor\_clay\_loam\_peat** (`float`) – α\_t \[-]. Only required if ‘type\_sand\_gravel’ is of type user-defined. * **unit\_weight\_material** (`float`) – unit weight pile material \[kN/m3]. Only required if ‘material’ is of type ser-defined. * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – * if ‘type\_sand\_gravel’ is of type user-defined and ‘factor\_sand\_gravel’ is not set. * if ‘type\_clay\_loam\_peat’ is of type user-defined and ‘factor\_clay\_loam\_peat’ is not set. * if ‘material’ is of type user-defined and ‘unit\_weight\_material’ is not set. * if an invalid ‘shape’ is provided. * if a ‘type\_sand\_gravel’ is provided that is invalid in combination with the given ‘shape’. * if a pile type with the give name already exists. * if ‘factor\_sand\_gravel’ or ‘factor\_clay\_loam\_peat’ is outside valid range 0-9. * Return type: `None` Possible shapes are: > * RectPile > > * RectEnlPile > > * UserPile > > * RoundPile > > * TaperPile > > * HollowPile > > * HollowOpenPile > > * RoundEnlPile > > * LostTipPile > > * DrivenBasePile > > * HShapedPile * create\_profile(*name*, *layers*, *x*, *y*, *measurements*, *phreatic\_level*, *pile\_tip\_level*, *top\_tension\_zone*, *\**, *cpt\_rule=CPTRule.NEN*, *min\_layer\_thickness=0.1*)[](#TensionPilesModel.create_profile "Link to this definition") Create a profile manually. * Parameters: * **name** (`str`) – name of the profile (must be unique). * **layers** (`List`\[[`ProfileLayer`](#ProfileLayer "viktor.external.dfoundations.ProfileLayer")]) – list of layers. * **x** (`float`) – \[m] * **y** (`float`) – \[m] * **measurements** (`List`\[`Tuple`\[`float`, `float`]]) – list of measurement data (level \[m], qc-value \[MPa]). * **phreatic\_level** (`float`) – \[m] * **pile\_tip\_level** (`float`) – \[m] * **top\_tension\_zone** (`float`) – Top of tension zone \[m] * **cpt\_rule** ([`CPTRule`](#CPTRule "viktor.external.dfoundations.CPTRule")) * **min\_layer\_thickness** (`float`) – \[m] * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – * if max. number of profiles (350) was reached. * if profile with the given name already exists. * if a material exists within one of the layers of which the name does not exist in the model. * if measurements exceeds max. number of rows (5000). * if layers exceeds max. number for a single profile (100). * Return type: `None` - import\_profile(*cpt*, *layers*, *x*, *y*, *phreatic\_level*, *pile\_tip\_level*, *top\_tension\_zone*, *name=None*, *manual\_ground\_level=None*, *\**, *cpt\_rule=CPTRule.NEN*, *min\_layer\_thickness=0.1*)[](#TensionPilesModel.import_profile "Link to this definition") Create a profile by importing a CPT-file. * Parameters: * **cpt** ([`GEFData`](https://docs.viktor.ai/sdk/api/geo/.md#GEFData "viktor.geo.GEFData")) – CPT file to import. * **layers** (`List`\[[`ProfileLayer`](#ProfileLayer "viktor.external.dfoundations.ProfileLayer")]) – list of layers. * **x** (`float`) – \[m] * **y** (`float`) – \[m] * **phreatic\_level** (`float`) – \[m] * **pile\_tip\_level** (`float`) – \[m] * **top\_tension\_zone** (`float`) – Top of tension zone \[m] * **name** (`str`) – name of the profile (must be unique). None for default (name of the cpt). * **manual\_ground\_level** (`float`) – set to override the ground level \[m] from the cpt. * **cpt\_rule** ([`CPTRule`](#CPTRule "viktor.external.dfoundations.CPTRule")) * **min\_layer\_thickness** (`float`) – \[m] * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – * if max. number of profiles (350) was reached. * if profile with the given name already exists. * if a material exists within one of the layers of which the name does not exist in the model. * if measurements exceeds max. number of rows (5000). * if layers exceeds max. number for a single profile (100). * if ground level could not be read from cpt file. * Return type: `None` <!-- --> ## UserPile[​](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#_UserPile "Direct link to UserPile") * *class *viktor.external.dfoundations.UserPile(*circumference*, *cross\_section*)[](#UserPile "Link to this definition") Bases: `_PileShape` User defined pile. * Parameters: * **circumference** (`float`) – \[m] * **cross\_section** (`float`) – \[m2] --- # viktor.external.dgeostability <!-- --> <!-- --> <!-- --> ## DGeoStabilityAnalysis[​](https://docs.viktor.ai/sdk/api/external/dgeostability/.md#_DGeoStabilityAnalysis "Direct link to DGeoStabilityAnalysis") * *class *viktor.external.dgeostability.DGeoStabilityAnalysis(*input\_file*)[](#DGeoStabilityAnalysis "Link to this definition") Bases: [`ExternalProgram`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram "viktor.external.external_program.ExternalProgram") DGeoStabilityAnalysis can be used to perform an analysis using DGeoStability on a third-party worker. To start an analysis call the method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute"), with an appropriate timeout (in seconds). To retrieve the results call the method [`get_output_file()`](#DGeoStabilityAnalysis.get_output_file "viktor.external.dgeostability.DGeoStabilityAnalysis.get_output_file"), after [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute"). Usage: ``` dgeostability_analysis = DGeoStabilityAnalysis(input_file=input_file) dgeostability_analysis.execute(timeout=10) output_file = dgeostability_analysis.get_output_file() ``` Exceptions which can be raised during calculation: - [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information * Parameters: **input\_file** (`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – .sti input file. - get\_output\_file(*extension='.sto'*, *\**, *as\_file=False*)[](#DGeoStabilityAnalysis.get_output_file "Link to this definition") Method can be used to retrieve the results generated by running an external analysis. Call method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute") first and [`get_output_file()`](#DGeoStabilityAnalysis.get_output_file "viktor.external.dgeostability.DGeoStabilityAnalysis.get_output_file") afterwards. * Parameters: * **extension** (`str`) – extension of the file you want to return; ‘.sto’, ‘.error.log’, ‘.err’ * **as\_file** (`bool`) – Return as BytesIO (default) or File New in v13.5.0 * Return type: `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | `None` --- # viktor.external.dsettlement <!-- --> <!-- --> <!-- --> ## CalculationModel[​](https://docs.viktor.ai/sdk/api/external/dsettlement/.md#_CalculationModel "Direct link to CalculationModel") * *class *viktor.external.dsettlement.CalculationModel(*\*values*)[](#CalculationModel "Link to this definition") Bases: `Enum` * ISOTACHE*: [`CalculationModel`](#CalculationModel "viktor.external.dsettlement.CalculationModel")** = 2*[](#CalculationModel.ISOTACHE "Link to this definition") - NEN\_BJERRUM*: [`CalculationModel`](#CalculationModel "viktor.external.dsettlement.CalculationModel")** = 1*[](#CalculationModel.NEN_BJERRUM "Link to this definition") * NEN\_KOPPEJAN*: [`CalculationModel`](#CalculationModel "viktor.external.dsettlement.CalculationModel")** = 0*[](#CalculationModel.NEN_KOPPEJAN "Link to this definition") <!-- --> ## ConsolidationModel[​](https://docs.viktor.ai/sdk/api/external/dsettlement/.md#_ConsolidationModel "Direct link to ConsolidationModel") * *class *viktor.external.dsettlement.ConsolidationModel(*\*values*)[](#ConsolidationModel "Link to this definition") Bases: `Enum` * DARCY*: [`ConsolidationModel`](#ConsolidationModel "viktor.external.dsettlement.ConsolidationModel")** = 0*[](#ConsolidationModel.DARCY "Link to this definition") - TERZAGHI*: [`ConsolidationModel`](#ConsolidationModel "viktor.external.dsettlement.ConsolidationModel")** = 1*[](#ConsolidationModel.TERZAGHI "Link to this definition") <!-- --> ## DSettlementAnalysis[​](https://docs.viktor.ai/sdk/api/external/dsettlement/.md#_DSettlementAnalysis "Direct link to DSettlementAnalysis") * *class *viktor.external.dsettlement.DSettlementAnalysis(*input\_file*)[](#DSettlementAnalysis "Link to this definition") Bases: [`ExternalProgram`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram "viktor.external.external_program.ExternalProgram") DSettlementAnalysis can be used to perform an analysis using DSettlement on a third-party worker. To start an analysis call the method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute"), with an appropriate timeout (in seconds). To retrieve the results call the method [`get_output_file()`](#DSettlementAnalysis.get_output_file "viktor.external.dsettlement.DSettlementAnalysis.get_output_file"), after [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute"). Usage: ``` input_file = File.from_data("dsettlement input file body") dsettlement_analysis = DSettlementAnalysis(input_file=input_file) dsettlement_analysis.execute(timeout=10) output_file = dsettlement_analysis.get_output_file() # obtain output file in BytesIO sld_file = dsettlement_analysis.get_sld_file() # obtain sld file in StringIO (to post-process) ``` Exceptions which can be raised during calculation: - [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information * Parameters: **input\_file** (`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – .sli input file. - get\_output\_file(*extension='.sld'*, *\**, *as\_file=False*)[](#DSettlementAnalysis.get_output_file "Link to this definition") Method can be used to retrieve the results generated by running an external analysis. Call method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute") first and [`get_output_file()`](#DSettlementAnalysis.get_output_file "viktor.external.dsettlement.DSettlementAnalysis.get_output_file") afterwards. * Parameters: * **extension** (`str`) – extension of the file you want to return; one of: ‘.sld’, ‘.slo’, ‘.error.log’, ‘.err’ * **as\_file** (`bool`) – return as BytesIO (default) or File New in v13.5.0 * Return type: `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | `None` * get\_sld\_file(*\**, *as\_file=False*)[](#DSettlementAnalysis.get_sld_file "Link to this definition") Method to retrieve the sld (result) file. * Parameters: **as\_file** (`bool`) – return as StringIO (default) or File New in v13.5.0 * Raises: **ValueError** – if file can not be obtained. * Return type: `StringIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") <!-- --> ## DrainGrid[​](https://docs.viktor.ai/sdk/api/external/dsettlement/.md#_DrainGrid "Direct link to DrainGrid") * *class *viktor.external.dsettlement.DrainGrid(*\*values*)[](#DrainGrid "Link to this definition") Bases: `Enum` * RECTANGULAR*: [`DrainGrid`](#DrainGrid "viktor.external.dsettlement.DrainGrid")** = 1*[](#DrainGrid.RECTANGULAR "Link to this definition") - TRIANGULAR*: [`DrainGrid`](#DrainGrid "viktor.external.dsettlement.DrainGrid")** = 0*[](#DrainGrid.TRIANGULAR "Link to this definition") * UNDETERMINED*: [`DrainGrid`](#DrainGrid "viktor.external.dsettlement.DrainGrid")** = 2*[](#DrainGrid.UNDETERMINED "Link to this definition") <!-- --> ## DrainType[​](https://docs.viktor.ai/sdk/api/external/dsettlement/.md#_DrainType "Direct link to DrainType") * *class *viktor.external.dsettlement.DrainType(*\*values*)[](#DrainType "Link to this definition") Bases: `Enum` * COLUMN*: [`DrainType`](#DrainType "viktor.external.dsettlement.DrainType")** = 1*[](#DrainType.COLUMN "Link to this definition") - SAND\_WALL*: [`DrainType`](#DrainType "viktor.external.dsettlement.DrainType")** = 2*[](#DrainType.SAND_WALL "Link to this definition") * STRIP*: [`DrainType`](#DrainType "viktor.external.dsettlement.DrainType")** = 0*[](#DrainType.STRIP "Link to this definition") <!-- --> ## DrainageSimpleMode[​](https://docs.viktor.ai/sdk/api/external/dsettlement/.md#_DrainageSimpleMode "Direct link to DrainageSimpleMode") * *class *viktor.external.dsettlement.DrainageSimpleMode(*begin\_time*, *end\_time*, *underpressure*, *dewatering\_head\_or\_pressure*)[](#DrainageSimpleMode "Link to this definition") Simple drainage schema; to be used in VerticalDrain. * Parameters: * **begin\_time** (`float`) – \[days] * **end\_time** (`float`) – \[days] * **underpressure** (`float`) – \[kPa] * **dewatering\_head\_or\_pressure** (`float`) – water head \[m] or tube pressure (if VerticalDrain.drain\_type = SAND\_WALL) \[kPa] <!-- --> ## Metadata[​](https://docs.viktor.ai/sdk/api/external/dsettlement/.md#_Metadata "Direct link to Metadata") * *class *viktor.external.dsettlement.Metadata(*file\_name='-'*, *company='-'*, *created\_by='-'*, *title\_1='-'*, *title\_2='-'*, *title\_3='-'*, *write\_date=False*, *write\_time=False*)[](#Metadata "Link to this definition") Data-class for defining metadata. * Parameters: * **file\_name** (`str`) * **company** (`str`) * **created\_by** (`str`) * **title\_1** (`str`) – max. 50 characters * **title\_2** (`str`) – max. 50 characters * **title\_3** (`str`) – max. 50 characters * **write\_date** (`bool`) – True to write the current date to the sli file; False for dummy (‘01/01/1900’) * **write\_time** (`bool`) – True to write the current date to the sli file; False for dummy (‘00:00:00’) * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – if title\_1, title\_2 or title\_3 has more than 50 characters <!-- --> ## Model1D[​](https://docs.viktor.ai/sdk/api/external/dsettlement/.md#_Model1D "Direct link to Model1D") * *class *viktor.external.dsettlement.Model1D(*calculation\_model*, *consolidation\_model*, *create\_default\_materials=True*, *\**, *natural\_strain=False*, *water\_unit\_weight=9.81*, *verticals\_discretization=100*, *verticals\_z\_coordinate=0.0*, *maintain\_profile=False*, *profile\_unit\_weight\_above\_phreatic\_level=10.0*, *profile\_unit\_weight\_below\_phreatic\_level=10.0*, *end\_of\_settlement\_calculation=10000*, *vertical\_drain=None*)[](#Model1D "Link to this definition") Bases: `_Model` Model for a 1D D-Settlement analysis. Example usage: ``` # instantiate 1D model model = Model1D(CalculationModel.NEN_KOPPEJAN, ConsolidationModel.TERZAGHI) # update the geometry model.create_material("my_mat", 21.0, 19.0, color=Color(0, 0, 0)) model.update_geometry(-1.0, [(1.0, "Loam"), (0.0, "my_mat")], phreatic_level=-3.0) # add load(s) model.create_uniform_load("my_load", 0, 0.001, 0.0, 0.0) # generate the input file input_file = model.generate_input_file() ``` * Parameters: * **calculation\_model** ([`CalculationModel`](#CalculationModel "viktor.external.dsettlement.CalculationModel")) * **consolidation\_model** ([`ConsolidationModel`](#ConsolidationModel "viktor.external.dsettlement.ConsolidationModel")) * **create\_default\_materials** (`bool`) – start with default materials or none * **natural\_strain** (`bool`) – if False -> linear strain * **water\_unit\_weight** (`float`) – in \[kN/m³] * **vertical\_drain** ([`VerticalDrain`](#VerticalDrain "viktor.external.dsettlement.VerticalDrain")) – parameters for vertical drains, or None (default) to disable option - materials[](#Model1D.materials "Link to this definition") * create\_material(*name*, *gam\_dry*, *gam\_wet*, *color=None*, *\**, *initial\_void\_ratio=0.0*, *cohesion=0.0*, *phi=0.0*, *precon\_isotache\_type=0*, *precon\_koppejan\_type=0*, *use\_equivalent\_age=0*, *equivalent\_age=0.0*, *pc=0.0*, *ocr=1.0*, *pop=0.0*, *limit\_stress=1.0*, *drained=0*, *ap\_as\_approximation\_by\_cp\_cs=0*, *cv=10.0*, *permeability\_ver=0.05*, *permeability\_hor\_factor=1.0*, *storage\_type=0*, *permeability\_strain\_modulus=1000000000000000.0*, *use\_prob\_defaults=1*, *std\_gam\_dry=0.0*, *std\_gam\_wet=0.0*, *std\_cv=0.0*, *std\_pc=0.0*, *std\_pri\_comp\_index=0.0*, *std\_sec\_comp\_index=0.0*, *std\_sec\_comp\_rate=0.0*, *std\_ocr=0.0*, *std\_permeability\_ver=0.0*, *std\_pop=0.0*, *std\_permeability\_hor\_factor=0.0*, *std\_initial\_void\_ratio=0.0*, *std\_permeability\_strain\_modulus=0.0*, *std\_limit\_stress=0.0*, *std\_cp=0.0*, *std\_cp1=0.0*, *std\_cs=0.0*, *std\_cs1=0.0*, *std\_ap=0.0*, *std\_asec=0.0*, *std\_car=0.0*, *std\_ca=0.0*, *std\_r\_ratio=0.0*, *std\_c\_ratio=0.0*, *std\_s\_ratio=0.0*, *std\_cr\_index=0.0*, *std\_cc\_index=0.0*, *std\_csw\_index=0.0*, *dist\_gam\_dry=2*, *dist\_gam\_wet=2*, *dist\_cv=2*, *dist\_pc=2*, *dist\_pri\_comp\_index=2*, *dist\_sec\_comp\_index=2*, *dist\_sec\_comp\_rate=2*, *dist\_ocr=2*, *dist\_permeability\_ver=2*, *dist\_pop=2*, *dist\_permeability\_hor\_factor=2*, *dist\_initial\_void\_ratio=2*, *dist\_permeability\_strain\_modulus=2*, *dist\_limit\_stress=2*, *dist\_cp=2*, *dist\_cp1=2*, *dist\_cs=2*, *dist\_cs1=2*, *dist\_ap=2*, *dist\_asec=2*, *dist\_car=2*, *dist\_ca=2*, *dist\_r\_ratio=2*, *dist\_c\_ratio=2*, *dist\_s\_ratio=2*, *dist\_cr\_index=2*, *dist\_cc\_index=2*, *dist\_csw\_index=2*, *cor\_cp\_cp1=0.0*, *cor\_cs\_cp1=0.0*, *cor\_cs1\_cp1=0.0*, *cor\_ap\_cp1=0.0*, *cor\_asec\_cp1=0.0*, *cor\_cr\_index\_cc\_index=0.0*, *cor\_r\_ratio\_c\_ratio=0.0*, *cor\_ca\_cc\_index\_or\_c\_ratio=0.0*, *cor\_pri\_comp\_index\_sec\_comp\_index=0.0*, *cor\_sec\_comp\_rate\_sec\_comp\_index=0.0*, *cp=1.0*, *cp1=1.0*, *cs=1.0*, *cs1=1.0*, *ap=1.0*, *asec=1.0*, *car=0.0*, *ca=1.0*, *comp\_ratio=1*, *r\_ratio=1.0*, *c\_ratio=1.0*, *s\_ratio=0.0*, *cr\_index=1.0*, *cc\_index=1.0*, *csw\_index=0.0*, *pri\_comp\_index=0.01*, *sec\_comp\_index=0.1*, *sec\_comp\_rate=0.005*, *horizontal\_behaviour\_type=2*, *elasticity=1000.0*, *default\_elasticity=1*)[](#Model1D.create_material "Link to this definition") Create a material with the given name and properties. * Parameters: * **name** (`str`) – name of the material to create (max. 25 characters) * **color** ([`Color`](https://docs.viktor.ai/sdk/api/core/.md#Color "viktor.core.Color")) – color for visualization in deltares software (None for random color) * **gam\_dry** (`float`) – unit weight above phreatic level in \[kN/m³] * **gam\_wet** (`float`) – unit weight below phreatic level in \[kN/m³] * **...****.** – etc. * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – * if material with given name already exists in the model * if name is longer than 25 characters * Return type: `None` - create\_uniform\_load(*name*, *time*, *unit\_weight*, *height*, *y\_application*)[](#Model1D.create_uniform_load "Link to this definition") Create a uniform load with the given name and properties. * Parameters: * **name** (`str`) – name of the uniform load to create * **time** (`int`) – in \[days], -1 for initial load * **unit\_weight** (`float`) – in \[kN/m³] * **height** (`float`) – in \[m] * **y\_application** (`float`) – in \[m] * Return type: `None` * set\_calculation\_times(*\*time*)[](#Model1D.set_calculation_times "Link to this definition") (Re)set calculation time(s) * Parameters: **time** (`int`) – one or more calculation times at which results will be obtained # todo: days * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – * if time < 0 or > end time * if duplicates exist * Return type: `None` - generate\_input\_file(*metadata=None*, *\**, *dissipation\_calculation=None*, *as\_file=False*)[](#Model1D.generate_input_file "Link to this definition") Generate a D-Settlement input file. Note This method needs to be mocked in (automated) unit and integration tests. * Parameters: * **metadata** ([`Metadata`](#Metadata "viktor.external.dsettlement.Metadata")) – Metadata which will be written to the input file. If no metadata is provided, default data will be used. * **dissipation\_calculation** (`_Vertical`) – select vertical to add dissipation calculation; ‘None’ to disable. * **as\_file** (`bool`) – return as BytesIO (default) or File New in v13.5.0 * Return type: `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") * *property *bottom\_level*: float*[](#Model1D.bottom_level "Link to this definition") - *property *layers*: List\[Tuple\[float, str]]*[](#Model1D.layers "Link to this definition") * *property *phreatic\_level*: float | None*[](#Model1D.phreatic_level "Link to this definition") - *property *top\_level*: float*[](#Model1D.top_level "Link to this definition") * update\_geometry(*bottom\_level*, *layers*, *phreatic\_level=None*)[](#Model1D.update_geometry "Link to this definition") Overwrite the current (default if not updated before) geometry with the given data. * Parameters: * **bottom\_level** (`float`) – bottom level of the bottom-most layer \[m] * **layers** (`List`\[`Tuple`\[`float`, `str`]]) – list of layers defined by top level \[m] and material name (must be created beforehand with [`create_material()`](#Model1D.create_material "viktor.external.dsettlement.Model1D.create_material") or one of the default materials). Should be defined from top to bottom. * **phreatic\_level** (`float`) – in \[m] * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – * if layers are not defined from top to bottom * if lowest layer top level is below given bottom level * if material with given name does not exist * Return type: `None` Example usage: ``` model.update_geometry(-1, [(1.0, "Loam"), (0.0, "Sand")], phreatic_level=-3) ``` <!-- --> ## Model2D[​](https://docs.viktor.ai/sdk/api/external/dsettlement/.md#_Model2D "Direct link to Model2D") * *class *viktor.external.dsettlement.Model2D(*calculation\_model*, *consolidation\_model*, *boundary\_bottom*, *create\_default\_materials=True*, *\**, *natural\_strain=False*, *limits=(0.0, 100.0)*, *water\_unit\_weight=9.81*, *verticals\_discretization=100*, *verticals\_z\_coordinate=0.0*, *maintain\_profile=False*, *profile\_time=0*, *profile\_unit\_weight\_above\_phreatic\_level=10.0*, *profile\_unit\_weight\_below\_phreatic\_level=10.0*, *end\_of\_settlement\_calculation=10000*, *stress\_distribution\_loads=False*, *vertical\_drain=None*)[](#Model2D "Link to this definition") Bases: `_Model` Model for a 2D D-Settlement analysis. Example usage: ``` # Initialize parameters for vertical drainage, to be used in the init of Model2D. vertical_drain = VerticalDrain(DrainType.SAND_WALL, 5.0, 90.0, 0.0, 2.0, 4.0, start_of_drainage=2.0, phreatic_level_in_drain=4.0) # Create the model (NEN - Koppejan / Terzaghi) with a starting bottom boundary, vertical drainage and # miscellaneous default parameters. model = Model2D(CalculationModel.NEN_KOPPEJAN, ConsolidationModel.TERZAGHI, boundary_bottom=[(0.0, 0.0), (100.0, 0.0)], vertical_drain=vertical_drain) # Create points for defining boundaries and pl-lines. points_boundary1 = [model.create_point(x, y) for (x, y) in [(0.0, 5.0), (50.0, 5.0), (100.0, 2.5)]] points_boundary2 = [model.create_point(x, y) for (x, y) in [(0.0, 5.0), (50.0, 5.0), (100.0, 7.5)]] points_boundary3 = [model.create_point(x, y) for (x, y) in [(0.0, 10.0), (25, 10.0), (75, 10.0), (100.0, 10.0)]] points_plline1 = [model.create_point(x, y) for (x, y) in [(0.0, 4.0), (100.0, 4.0)]] points_plline2 = [model.create_point(x, y) for (x, y) in [(0.0, 6.0), (100.0, 6.0)]] # Create the pl-lines. plline1 = model.create_pl_line(points_plline1, is_phreatic=True) plline2 = model.create_pl_line(points_plline2) # Create the layers. model.create_layer(points_boundary1, 'Sand', pl_line_top=99, pl_line_bottom=plline2) model.create_layer(points_boundary2, 'Soft Clay', pl_line_top=99, pl_line_bottom=99) model.create_layer(points_boundary3, 'Loam', pl_line_top=plline1, pl_line_bottom=99) # Create verticals. model.create_vertical(45.0) model.create_vertical(50.0) model.create_vertical(55.0) # Create loads. model.create_non_uniform_load('load1', [(25, 10.0), (50.0, 12.0), (75, 10.0)]) # Create calculation/residual times. model.set_calculation_times(1, 4, 2, 5) # Generate the input file for the model as if it was generated by D-Settlement. input_file = model.generate_input_file() ``` * Parameters: * **calculation\_model** ([`CalculationModel`](#CalculationModel "viktor.external.dsettlement.CalculationModel")) – Specifies which calculation model is used. * **consolidation\_model** ([`ConsolidationModel`](#ConsolidationModel "viktor.external.dsettlement.ConsolidationModel")) – Specifies which consolidation model is used. * **boundary\_bottom** (`List`\[`Tuple`\[`float`, `float`]]) – The bottom boundary of the geometry. * **create\_default\_materials** (`bool`) – start with default materials or none * **natural\_strain** (`bool`) – Indicates if natural strain is used. If False, linear strain is used. * **water\_unit\_weight** (`float`) – in \[kN/m³] * **stress\_distribution\_loads** (`bool`) – True for ‘Simulate’, False for ‘None’ (default). * **vertical\_drain** ([`VerticalDrain`](#VerticalDrain "viktor.external.dsettlement.VerticalDrain")) – parameters for vertical drains, or None (default) to disable option - materials[](#Model2D.materials "Link to this definition") * create\_material(*name*, *gam\_dry*, *gam\_wet*, *color=None*, *\**, *initial\_void\_ratio=0.0*, *cohesion=0.0*, *phi=0.0*, *precon\_isotache\_type=0*, *precon\_koppejan\_type=0*, *use\_equivalent\_age=0*, *equivalent\_age=0.0*, *pc=0.0*, *ocr=1.0*, *pop=0.0*, *limit\_stress=1.0*, *drained=0*, *ap\_as\_approximation\_by\_cp\_cs=0*, *cv=10.0*, *permeability\_ver=0.05*, *permeability\_hor\_factor=1.0*, *storage\_type=0*, *permeability\_strain\_modulus=1000000000000000.0*, *use\_prob\_defaults=1*, *std\_gam\_dry=0.0*, *std\_gam\_wet=0.0*, *std\_cv=0.0*, *std\_pc=0.0*, *std\_pri\_comp\_index=0.0*, *std\_sec\_comp\_index=0.0*, *std\_sec\_comp\_rate=0.0*, *std\_ocr=0.0*, *std\_permeability\_ver=0.0*, *std\_pop=0.0*, *std\_permeability\_hor\_factor=0.0*, *std\_initial\_void\_ratio=0.0*, *std\_permeability\_strain\_modulus=0.0*, *std\_limit\_stress=0.0*, *std\_cp=0.0*, *std\_cp1=0.0*, *std\_cs=0.0*, *std\_cs1=0.0*, *std\_ap=0.0*, *std\_asec=0.0*, *std\_car=0.0*, *std\_ca=0.0*, *std\_r\_ratio=0.0*, *std\_c\_ratio=0.0*, *std\_s\_ratio=0.0*, *std\_cr\_index=0.0*, *std\_cc\_index=0.0*, *std\_csw\_index=0.0*, *dist\_gam\_dry=2*, *dist\_gam\_wet=2*, *dist\_cv=2*, *dist\_pc=2*, *dist\_pri\_comp\_index=2*, *dist\_sec\_comp\_index=2*, *dist\_sec\_comp\_rate=2*, *dist\_ocr=2*, *dist\_permeability\_ver=2*, *dist\_pop=2*, *dist\_permeability\_hor\_factor=2*, *dist\_initial\_void\_ratio=2*, *dist\_permeability\_strain\_modulus=2*, *dist\_limit\_stress=2*, *dist\_cp=2*, *dist\_cp1=2*, *dist\_cs=2*, *dist\_cs1=2*, *dist\_ap=2*, *dist\_asec=2*, *dist\_car=2*, *dist\_ca=2*, *dist\_r\_ratio=2*, *dist\_c\_ratio=2*, *dist\_s\_ratio=2*, *dist\_cr\_index=2*, *dist\_cc\_index=2*, *dist\_csw\_index=2*, *cor\_cp\_cp1=0.0*, *cor\_cs\_cp1=0.0*, *cor\_cs1\_cp1=0.0*, *cor\_ap\_cp1=0.0*, *cor\_asec\_cp1=0.0*, *cor\_cr\_index\_cc\_index=0.0*, *cor\_r\_ratio\_c\_ratio=0.0*, *cor\_ca\_cc\_index\_or\_c\_ratio=0.0*, *cor\_pri\_comp\_index\_sec\_comp\_index=0.0*, *cor\_sec\_comp\_rate\_sec\_comp\_index=0.0*, *cp=1.0*, *cp1=1.0*, *cs=1.0*, *cs1=1.0*, *ap=1.0*, *asec=1.0*, *car=0.0*, *ca=1.0*, *comp\_ratio=1*, *r\_ratio=1.0*, *c\_ratio=1.0*, *s\_ratio=0.0*, *cr\_index=1.0*, *cc\_index=1.0*, *csw\_index=0.0*, *pri\_comp\_index=0.01*, *sec\_comp\_index=0.1*, *sec\_comp\_rate=0.005*, *horizontal\_behaviour\_type=2*, *elasticity=1000.0*, *default\_elasticity=1*)[](#Model2D.create_material "Link to this definition") Create a material with the given name and properties. * Parameters: * **name** (`str`) – name of the material to create (max. 25 characters) * **color** ([`Color`](https://docs.viktor.ai/sdk/api/core/.md#Color "viktor.core.Color")) – color for visualization in deltares software (None for random color) * **gam\_dry** (`float`) – unit weight above phreatic level in \[kN/m³] * **gam\_wet** (`float`) – unit weight below phreatic level in \[kN/m³] * **...****.** – etc. * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – * if material with given name already exists in the model * if name is longer than 25 characters * Return type: `None` - create\_uniform\_load(*name*, *time*, *unit\_weight*, *height*, *y\_application*)[](#Model2D.create_uniform_load "Link to this definition") Create a uniform load with the given name and properties. * Parameters: * **name** (`str`) – name of the uniform load to create * **time** (`int`) – in \[days], -1 for initial load * **unit\_weight** (`float`) – in \[kN/m³] * **height** (`float`) – in \[m] * **y\_application** (`float`) – in \[m] * Return type: `None` * set\_calculation\_times(*\*time*)[](#Model2D.set_calculation_times "Link to this definition") (Re)set calculation time(s) * Parameters: **time** (`int`) – one or more calculation times at which results will be obtained # todo: days * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – * if time < 0 or > end time * if duplicates exist * Return type: `None` - generate\_input\_file(*metadata=None*, *\**, *dissipation\_calculation=None*, *as\_file=False*)[](#Model2D.generate_input_file "Link to this definition") Generate a D-Settlement input file. Note This method needs to be mocked in (automated) unit and integration tests. * Parameters: * **metadata** ([`Metadata`](#Metadata "viktor.external.dsettlement.Metadata")) – Metadata which will be written to the input file. If no metadata is provided, default data will be used. * **dissipation\_calculation** (`_Vertical`) – select vertical to add dissipation calculation; ‘None’ to disable. * **as\_file** (`bool`) – return as BytesIO (default) or File New in v13.5.0 * Return type: `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") * create\_layer(*boundary\_top*, *material*, *pl\_line\_top*, *pl\_line\_bottom*)[](#Model2D.create_layer "Link to this definition") Define layers from bottom to top. * Parameters: * **boundary\_top** (`List`\[`_Point`]) – boundary at top of layer * **material** (`str`) – name of the material to be used (must be created beforehand) * **pl\_line\_top** (`_PlLine` | `int`) – pl-line at top, or 0 for no pressure, or 99 for interpolation * **pl\_line\_bottom** (`_PlLine` | `int`) – pl-line at bottom, or 0 for no pressure, or 99 for interpolation * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – * if material with given name does not exist * if boundary\_bottom is provided for layer other than first * if pl\_line\_top or pl\_line\_bottom are not valid * if ‘points’ contains duplicates * if start and end ‘points’ are not on the left and right boundary limit respectively * if ‘points’ are not in ascending X-direction * if ‘is\_phreatic’ is True but was already set before * Return type: `_Layer` - create\_non\_uniform\_load(*name*, *points*, *time=0*, *end\_time=0*, *gamma\_dry=10.0*, *gamma\_wet=10.0*, *temporary=False*)[](#Model2D.create_non_uniform_load "Link to this definition") Create a non-uniform load. DSettlement assumes that a non-uniform load is caused by soil self weight. Initial loads only affects the initial stresses and do not cause creep or consolidation. * Parameters: * **name** (`str`) – Name of the load. * **points** (`List`\[`Tuple`\[`float`, `float`]]) – Points, as x-y coordinates, of the load. The first and last points must be located on a layer or another non-uniform load. * **time** (`int`) – The moment the load is laid down \[days]. If time is set to -1 days, the load is considered an initial load. * **end\_time** (`int`) – The moment the load is removed (only in the case of temporary loads) \[days]. * **temporary** (`bool`) – Bool which indicates if the load is a temporary load. * **gamma\_dry** (`float`) – Total unit weight above phreatic level \[kN/m3]. * **gamma\_wet** (`float`) – Total unit weight below phreatic level \[kN/m3]. * Return type: `_NonUniformLoad` * create\_pl\_line(*points*, *is\_phreatic=False*)[](#Model2D.create_pl_line "Link to this definition") Create a piezometric level line (pl-line) from the given points. * Parameters: * **points** (`List`\[`_Point`]) – list of points that define the pl-line * **is\_phreatic** (`bool`) – whether to set the current pl-line as the phreatic line (overwrites previous!) * Return type: `_PlLine` * Returns: pl-line * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – * if ‘points’ contains duplicates * if start and end ‘points’ are not on the left and right boundary limit respectively * if ‘points’ are not in ascending X-direction * if ‘is\_phreatic’ is True but was already set before - create\_point(*x*, *y*)[](#Model2D.create_point "Link to this definition") Create a point with given x and y coordinates. * Parameters: * **x** (`float`) – in \[m] * **y** (`float`) – in \[m] * Return type: `_Point` * Returns: \_Point which can be used to create boundaries for layers or pl-lines. * create\_vertical(*x*)[](#Model2D.create_vertical "Link to this definition") Create vertical based on x-coordinate. * Parameters: **x** (`float`) – \[m] * Raises: [**ModelError**](https://docs.viktor.ai/sdk/api/errors/.md#ModelError "viktor.errors.ModelError") – if x < left boundary limit or > right boundary limit * Return type: `_Vertical` <!-- --> ## OutputFileParser[​](https://docs.viktor.ai/sdk/api/external/dsettlement/.md#_OutputFileParser "Direct link to OutputFileParser") * *class *viktor.external.dsettlement.OutputFileParser(*sld\_file*)[](#OutputFileParser "Link to this definition") Helper class to extract results from a D-Settlement output file (.sld). Example usage: ``` parser = OutputFileParser(sld_file) vertical_results = parser.vertical_results residual_times = parser.residual_times ``` * *property *raw\_results*: str*[](#OutputFileParser.raw_results "Link to this definition") Raw result data. For convenience, specific data can also be extracted using available methods. - *property *residual\_times*: Dict\[int, Dict\[str, List\[float]]]*[](#OutputFileParser.residual_times "Link to this definition") Returns the residual times. Structure of dictionary: ``` { vertical number: int: { Time: List[float] Settlement: List[float] ... } } ``` * *property *vertical\_results*: Dict\[int, Dict\[str, Any]]*[](#OutputFileParser.vertical_results "Link to this definition") Returns results for all verticals. Structure of dictionary: ``` { vertical number: int: { coordinates: { x: float z: float }, time_settlement_per_load: { time_step_count: int load_step_count: int time: List[float] [days] load_1: List[float] [kPa] load_2: List[float] [kPa] ... (depending on model) }, depths: List[float] leakages: List[float] -> empty for some models drained_layers: List[float] -> empty for some models stresses: { -> empty for some models initial_total_stress: List[float] ... (depending on model) }, vertical_data: { time: float: { settlement: List[float] ... (depending on model) } }, } } ``` <!-- --> ## VerticalDrain[​](https://docs.viktor.ai/sdk/api/external/dsettlement/.md#_VerticalDrain "Direct link to VerticalDrain") * *class *viktor.external.dsettlement.VerticalDrain(*drain\_type*, *range\_from*, *range\_to*, *bottom\_position*, *center\_to\_center*, *width\_diameter*, *thickness=None*, *position\_drain=None*, *grid=None*, *start\_of\_drainage=None*, *phreatic\_level\_in\_drain=None*, *schedule=None*)[](#VerticalDrain "Link to this definition") Data-class for setting vertical drain options. * Parameters: * **drain\_type** ([`DrainType`](#DrainType "viktor.external.dsettlement.DrainType")) – drain type. * **range\_from** (`float`) – range \[m] from which drainage takes place. * **range\_to** (`float`) – range \[m] to which drainage takes place. * **bottom\_position** (`float`) – position of bottom (depth) of drains \[m]. * **center\_to\_center** (`float`) – center-to-center distance of drains \[m]. * **width\_diameter** (`float`) – width (or diameter for drain\_type = COLUMN) of drains \[m]. * **thickness** (`float`) – thickness of strip \[m]. Must be set for drain\_type = STRIP. * **position\_drain** (`float`) – drain position \[m]. Must be set for drain\_type = SAND\_WALL (only if schedule is defined). * **grid** ([`DrainGrid`](#DrainGrid "viktor.external.dsettlement.DrainGrid")) – drain grid type. Must be set for drain\_type = STRIP | COLUMN. * **start\_of\_drainage** (`float`) – start time of drainage \[days]. Must be set for simple and no schedule. * **phreatic\_level\_in\_drain** (`float`) – phreatic level in drain \[m]. Must be set for simple and no schedule. * **schedule** ([`DrainageSimpleMode`](#DrainageSimpleMode "viktor.external.dsettlement.DrainageSimpleMode") | `List`\[`Tuple`\[`float`, `float`, `float`]]) – DrainageSimpleMode for simple schedule; list of (time \[days], underpressure \[kPa], water head \[m] (if drain\_type = STRIP | COLUMN) / tube pressure \[kPa] (if drain\_type = SAND\_WALL)) for detailed schedule (default: no schedule). - *property *position\_drain*: float | None*[](#VerticalDrain.position_drain "Link to this definition") --- # viktor.external.dsheetpiling <!-- --> <!-- --> <!-- --> ## DSheetPilingAnalysis[​](https://docs.viktor.ai/sdk/api/external/dsheetpiling/.md#_DSheetPilingAnalysis "Direct link to DSheetPilingAnalysis") * *class *viktor.external.dsheetpiling.DSheetPilingAnalysis(*input\_file*)[](#DSheetPilingAnalysis "Link to this definition") Bases: [`ExternalProgram`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram "viktor.external.external_program.ExternalProgram") DSheetPilingAnalysis can be used to perform an analysis using D-Sheet Piling on a third-party worker. To start an analysis call the method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute"), with an appropriate timeout (in seconds). To retrieve the results call the method [`get_output_file()`](#DSheetPilingAnalysis.get_output_file "viktor.external.dsheetpiling.DSheetPilingAnalysis.get_output_file"), after [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute"). Usage: ``` dsheetpiling_analysis = DSheetPilingAnalysis(input_file=input_file) dsheetpiling_analysis.execute(timeout=10) output_file = dsheetpiling_analysis.get_output_file() ``` Exceptions which can be raised during calculation: - [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information * Parameters: **input\_file** (`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – .shi input file. - get\_output\_file(*extension='.shd'*, *\**, *as\_file=False*)[](#DSheetPilingAnalysis.get_output_file "Link to this definition") Method can be used to retrieve the results generated by running an external analysis. Call method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute") first and [`get_output_file()`](#DSheetPilingAnalysis.get_output_file "viktor.external.dsheetpiling.DSheetPilingAnalysis.get_output_file") afterwards. * Parameters: * **extension** (`str`) – extension of the file you want to return; one of: ‘.shd’, ‘.shs’, ‘.shl’, ‘.sho’, ‘.error.log’, ‘.err’ * **as\_file** (`bool`) – Return as BytesIO (default) or File New in v13.5.0 * Return type: `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | `None` --- # viktor.external.dstability <!-- --> <!-- --> <!-- --> ## DStabilityAnalysis[​](https://docs.viktor.ai/sdk/api/external/dstability/.md#_DStabilityAnalysis "Direct link to DStabilityAnalysis") * *class *viktor.external.dstability.DStabilityAnalysis(*input\_file*)[](#DStabilityAnalysis "Link to this definition") Bases: [`ExternalProgram`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram "viktor.external.external_program.ExternalProgram") DStabilityAnalysis can be used to perform an analysis using D-Stability on a third-party worker. To start an analysis call the method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute"), with an appropriate timeout (in seconds). To retrieve the results call the method [`get_output_file()`](#DStabilityAnalysis.get_output_file "viktor.external.dstability.DStabilityAnalysis.get_output_file"), after [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute"). Example usage: ``` file = File() # create a writable File object path = Path(file.source) # request its path dstability_model.serialize(path) # let GEOLIB write to the file analysis = DStabilityAnalysis(input_file=file) # pass the file with content to DStabilityAnalysis analysis.execute(timeout=10) output_file = analysis.get_output_file() ``` Exceptions which can be raised during calculation: - [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information * Parameters: **input\_file** ([`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – File object with the body of the .stix input file. - get\_output\_file(*extension='.stix'*)[](#DStabilityAnalysis.get_output_file "Link to this definition") Method can be used to retrieve the results generated by running an external analysis. Call method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute") first and [`get_output_file()`](#DStabilityAnalysis.get_output_file "viktor.external.dstability.DStabilityAnalysis.get_output_file") afterwards. * Parameters: **extension** (`str`) – extension of the file you want to return; ‘.stix’ * Return type: [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | `None` --- # viktor.external.dynamo <!-- --> <!-- --> <!-- --> ## DynamoAnalysis[​](https://docs.viktor.ai/sdk/api/external/dynamo/.md#_DynamoAnalysis "Direct link to DynamoAnalysis") * *class *viktor.external.dynamo.DynamoAnalysis(*files=None*, *executable\_key='dynamo'*, *output\_filenames=None*)[](#DynamoAnalysis "Link to this definition") Bases: [`GenericAnalysis`](https://docs.viktor.ai/sdk/api/external/generic/.md#GenericAnalysis "viktor.external.generic.GenericAnalysis") New in 14.17.0 DynamoAnalysis can be used to evaluate a matlab script on third-party infrastructure. The script is expected to be blocking, i.e. if the executable is invoked from command prompt, it should wait until the script is finished. For security purposes the executable that should be called has to be defined in the configuration file of the worker. Usage: ``` files = [ ('input1.txt', file1), ('input2.txt', file2) ] analysis = DynamoAnalysis(files=files, output_filenames=["output.txt"]) analysis.execute(timeout=60) output_file = analysis.get_output_file("output.txt") ``` Exceptions which can be raised during calculation: > * [`viktor.errors.LicenseError`](https://docs.viktor.ai/sdk/api/errors/.md#LicenseError "viktor.errors.LicenseError"): no license available > > * [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information * Parameters: * **files** (`List`\[`Tuple`\[`str`, `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]] | `None`) – Files that are transferred to the working directory on the server. Each file is a tuple containing the content and the filename which is used to save on the infrastructure. * **executable\_key** (`str`) – The key of the executable that needs to be evaluated. This key should be present in the configuration file of the worker, defaults to run\_matlab. * **output\_filenames** (`List`\[`str`]) – A list of filenames (including extension) that are to be transferred back to the SDK. This filename is relative to the working directory. At least one of the attributes above should be included in the call. * Raises: **ValueError** – when no attribute is included in call. <!-- --> ## DynamoFile[​](https://docs.viktor.ai/sdk/api/external/dynamo/.md#_DynamoFile "Direct link to DynamoFile") * *class *viktor.external.dynamo.DynamoFile(*file*)[](#DynamoFile "Link to this definition") Dynamo file instantiated from an existing input .dyn file. This class allows for easy transformation of input nodes by means of the [`update()`](#DynamoFile.update "viktor.external.dynamo.DynamoFile.update") method. * Parameters: **file** ([`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Dynamo input file (.dyn). - generate()[](#DynamoFile.generate "Link to this definition") Generate the (updated) Dynamo input file. * Return type: [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") * get\_node\_id(*name*)[](#DynamoFile.get_node_id "Link to this definition") Retrieve the unique node id by name. * Parameters: **name** (`str`) – Name of the node. * Return type: `str` - update(*name*, *value*)[](#DynamoFile.update "Link to this definition") Update the value of an input node with specified name. * Parameters: * **name** (`str`) – Name of the input node. * **value** (`Any`) – New input value. * Return type: `None` <!-- --> ## convert\_geometry\_to\_glb[​](https://docs.viktor.ai/sdk/api/external/dynamo/.md#_convert_geometry_to_glb "Direct link to convert_geometry_to_glb") * viktor.external.dynamo.convert\_geometry\_to\_glb(*file*, *filter=None*)[](#convert_geometry_to_glb "Link to this definition") Convert a Dynamo geometry file (.json) to a GLB file, which can directly be used in a [`GeometryResult`](https://docs.viktor.ai/sdk/api/views/.md#GeometryResult "viktor.views.GeometryResult"). Filter specific geometric objects by id, obtained by calling [`get_node_id()`](#DynamoFile.get_node_id "viktor.external.dynamo.DynamoFile.get_node_id"): ``` input_file = DynamoFile(file) sphere_id = input_file.get_node_id("Sphere") # geometry node called "Sphere" ... geometry_file = dynamo_analysis.get_output_file(filename='geometry.json', as_file=True) # viktor.external.dynamo.DynamoAnalysis glb_file = convert_geometry_to_glb(geometry_file, filter=[sphere_id]) ``` * Parameters: * **file** ([`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Dynamo geometry file (.json). * **filter** (`List`\[`str`]) – Filter geometric objects by id (default: include all). * Return type: [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") <!-- --> ## get\_dynamo\_result[​](https://docs.viktor.ai/sdk/api/external/dynamo/.md#_get_dynamo_result "Direct link to get_dynamo_result") * viktor.external.dynamo.get\_dynamo\_result(*file*, *id\_*)[](#get_dynamo_result "Link to this definition") Extract results from a Dynamo output file (.xml) by means of a node ‘id’, which can be obtained by calling [`get_node_id()`](#DynamoFile.get_node_id "viktor.external.dynamo.DynamoFile.get_node_id"). Example using BytesIO: ``` input_file = DynamoFile(file) output_id = input_file.get_node_id("Area") # output node called "Area" ... output_file = dynamo_analysis.get_output_file(filename='output.xml') # viktor.external.dynamo.DynamoAnalysis result = get_dynamo_result(output_file, id_=output_id) ``` Example using [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File"): ``` input_file = DynamoFile(file) output_id = input_file.get_node_id("Area") # output node called "Area" ... output_file = dynamo_analysis.get_output_file(filename='output.xml', as_file=True) # viktor.external.dynamo.DynamoAnalysis with output_file.open_binary() as f: result = get_dynamo_result(f, id_=output_id) ``` * Parameters: * **file** (`BinaryIO`) – Dynamo output file (.xml). * **id** – Unique identifier of the output result node. * Return type: `str` --- # viktor.external.etabs <!-- --> <!-- --> <!-- --> ## ETABSAnalysis[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_ETABSAnalysis "Direct link to ETABSAnalysis") * *class *viktor.external.etabs.etabs.ETABSAnalysis(*script=None*, *script\_key=''*, *files=None*, *output\_filenames=None*)[](#ETABSAnalysis "Link to this definition") Bases: [`PythonAnalysis`](https://docs.viktor.ai/sdk/api/external/python/.md#PythonAnalysis "viktor.external.python.PythonAnalysis") New in 14.17.0 ETABSAnalysis can be used to evaluate an ETABS-python script on third-party infrastructure. The script is expected to be blocking, i.e. if the script is invoked from command prompt, it should wait until the executable is finished. The default behaviour, is that the python script is defined within the app and send to the worker to be executed on third-party infrastructure. If desired (due to security considerations) the worker can be configured to only run local scripts. These scripts must be defined the in worker configuration file and can be selected through the script\_key. Usage: ``` script = vkt.File.from_path(Path(__file__).parent / "run_etabs.py") files = [ ('input1.txt', file1), ] analysis = ETABSAnalysis(script=script, files=files, output_filenames=["output.txt"]) analysis.execute(timeout=60) output_file = analysis.get_output_file("output.txt") ``` Exceptions which can be raised during calculation: > * [`viktor.errors.LicenseError`](https://docs.viktor.ai/sdk/api/errors/.md#LicenseError "viktor.errors.LicenseError"): no license available > > * [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information * Parameters: * **script** ([`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Script file that is transferred to the working directory on the server. * **script\_key** (`str`) – The key of the script that needs to be run. Only use this when the worker is configured to run local scripts. This key should be present in the configuration file of the worker. * **files** (`List`\[`Tuple`\[`str`, `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]]) – Additional files that are transferred to the working directory on the server. Each file is a tuple containing the content and the filename which is used to save on the infrastructure. * **output\_filenames** (`List`\[`str`]) – A list of filenames (including extension) that are to be transferred back to the app. This filename is relative to the working directory. Either one of ‘script’ or ‘script\_key’ should be defined. * Raises: **ValueError** – when neither ‘script’ or ‘script\_key’ is included OR when both are included. <!-- --> ## ETABSConnection[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_ETABSConnection "Direct link to ETABSConnection") * *class *viktor.external.etabs.etabs.ETABSConnection(*session*)[](#ETABSConnection "Link to this definition") Bases: `_CSIConnection` New in 14.31.0 The `sap` object returned by [`connect()`](#connect "viktor.external.etabs.etabs.connect") or [`attach()`](#attach "viktor.external.etabs.etabs.attach"), used to control ETABS through the ETABS OAPI. Use the default OAPI calls with comtypes syntax. Each call returns the OAPI result: the status code, or `[*out_params, status]` when the call has output parameters. The SDK sends calls to the worker in chunks. A result is read when your code first uses its value: in `==`, `if`, `float()`, `int()`, `str()`, `print()` or a loop. A failed call raises [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError") at that read, with the call and your line. Two things do not read a result: passing it to a later call, and unpacking it into names. So the example below sends all three calls in one chunk. `result is None` is always `False` on an unread result; use `== None`. Pass `defer=False` to [`connect()`](#connect "viktor.external.etabs.etabs.connect") / [`attach()`](#attach "viktor.external.etabs.etabs.attach") to send each call on its own. ``` name, ret = sap.FrameObj.AddByCoord(0, 0, 0, 6, 0, 0, "", "Default", "Beam", "Global") sap.FrameObj.SetSection(name, "W12X26") ``` See [`batch()`](#ETABSConnection.batch "viktor.external.etabs.etabs.ETABSConnection.batch") when one loop makes more than a few hundred calls. Warning Do not instantiate this class directly; obtain it from [`connect()`](#connect "viktor.external.etabs.etabs.connect") or [`attach()`](#attach "viktor.external.etabs.etabs.attach"). * batch()[](#ETABSConnection.batch "Link to this definition") New in v14.37.0 Send all calls of the block to the worker as one job when the block ends. Without the block the SDK sends calls in chunks of a few hundred, each one round trip. The gain grows with the size of the block; below a few hundred calls it changes nothing. You cannot read a result inside the block: a read raises `RuntimeError`. So do `isinstance()`, `print()`, `str()` and `repr()` on a result. Read the results after the block. The block runs as one job under the session `timeout` (300 s by default). For a very large block, increase `timeout` in [`connect()`](#connect "viktor.external.etabs.etabs.connect") / [`attach()`](#attach "viktor.external.etabs.etabs.attach"). ``` with sap.batch(): for x, y in points: # 5000 points name, ret = sap.FrameObj.AddByCoord(x, y, 0, x, y, 3, "", "W12X26") sap.FrameObj.SetGroupAssign(name, "Columns") # 10000 calls went to the worker in one job ``` Needs a deferred connection (`defer=True`). Blocks cannot be nested. Calls made before the block are sent when the block starts. * Return type: `ContextManager`\[`None`, `bool` | `None`] - *property *application*: Any*[](#ETABSConnection.application "Link to this definition") Call OAPI members on the top-level application object rather than the SapModel. Example: ``` sap.application.Hide() version = sap.application.GetOAPIVersionNumber() ``` <!-- --> ## attach[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_attach "Direct link to attach") * viktor.external.etabs.etabs.attach(*timeout=300*, *defer=True*)[](#attach "Link to this definition") New in 14.33.0 Attach to the ETABS instance already running on the worker machine and control it through the ETABS OAPI, like [`connect()`](#connect "viktor.external.etabs.etabs.connect"), but without starting a fresh instance. Typical use: a personal worker on the engineer’s own machine, so the app acts on the model they have open on screen. Warning This is a BETA feature. Requires a worker of kind `etabsconnect`. Declare it in your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml/): ``` worker_integrations = [ "etabsconnect", ] ``` Usage: ``` import viktor as vkt with vkt.etabs.attach(timeout=60) as sap: [pt_i, pt_j, ret] = sap.FrameObj.GetPoints("B1", "", "") # reads the model open in ETABS ret = sap.View.RefreshView() # changes show in the user's window ``` Closing the session detaches without exiting the instance. The app can change the attached model but not save it in place: `File.Save` requires a relative filename and writes into the session directory. Note The OAPI members you call on `sap` (e.g. `sap.FrameObj.AddByCoord`) mirror the ETABS OAPI and are surfaced through IDE autocomplete rather than listed here. Look them up in the ETABS OAPI reference: the `CSI API ETABS v1.chm` help file in your ETABS installation directory (e.g. `C:/Program Files/Computers and Structures/ETABS <version>/`), or on CSI’s [developer site](https://www.csiamerica.com/developer). * Parameters: * **timeout** (`int`) – timeout in seconds for one chunk of calls; also bounds the attach itself, so keep it at or above the platform’s 30 second bind window. * **defer** (`bool`) – queue calls and send them to the worker in chunks; a result is fetched when your code first reads it (default: True). False sends every call at once and returns plain values. New in v14.37.0 * Return type: [`ETABSConnection`](#ETABSConnection "viktor.external.etabs.etabs.ETABSConnection") Exceptions which can be raised during execution: > * [`viktor.errors.WorkerSessionAttachError`](https://docs.viktor.ai/sdk/api/errors/.md#WorkerSessionAttachError "viktor.errors.WorkerSessionAttachError"): the attach failed, e.g. no ETABS is running on the worker machine, or the running instance is a different product. `reason` names the cause; that set is open. > > * [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error during a call. Error message provides more information. > > * [`viktor.errors.WorkerSessionError`](https://docs.viktor.ai/sdk/api/errors/.md#WorkerSessionError "viktor.errors.WorkerSessionError"): the session was lost after attaching (e.g. the user closed the ETABS instance). The session cannot be resumed; start a new one to continue. > > * TimeoutError: a chunk of calls took longer than `timeout` <!-- --> ## connect[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_connect "Direct link to connect") * viktor.external.etabs.etabs.connect(*timeout=300*, *defer=True*)[](#connect "Link to this definition") New in 14.31.0 Connect to ETABS running on a connected VIKTOR worker and control it through the ETABS OAPI directly from your app, as shown below. Always starts a fresh, empty instance; to act on the instance already running on the worker machine instead, use [`attach()`](#attach "viktor.external.etabs.etabs.attach"). Warning This is a BETA feature. Requires a worker of kind `etabsconnect`. Declare it in your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml/): ``` worker_integrations = [ "etabsconnect", ] ``` Usage: ``` import viktor as vkt with vkt.etabs.connect(timeout=60) as sap: ret = sap.InitializeNewModel(vkt.etabs.eUnits.kN_m_C) # a call returns the status code [beam_name, ret] = sap.FrameObj.AddByCoord(0, 0, 0, 6, 0, 0, "", "Default", "Beam", "Global") [pt_i, pt_j, ret] = sap.FrameObj.GetPoints(beam_name, "", "") # ...or out-params, then status sap.File.Save("model.edb") # use a relative filename, not an absolute path ``` Note The OAPI members you call on `sap` (e.g. `sap.FrameObj.AddByCoord`) mirror the ETABS OAPI and are surfaced through IDE autocomplete rather than listed here. Look them up in the ETABS OAPI reference: the `CSI API ETABS v1.chm` help file in your ETABS installation directory (e.g. `C:/Program Files/Computers and Structures/ETABS <version>/`), or on CSI’s [developer site](https://www.csiamerica.com/developer). * Parameters: * **timeout** (`int`) – timeout in seconds for one chunk of calls. * **defer** (`bool`) – queue calls and send them to the worker in chunks; a result is fetched when your code first reads it (default: True). False sends every call at once and returns plain values. New in v14.37.0 * Return type: [`ETABSConnection`](#ETABSConnection "viktor.external.etabs.etabs.ETABSConnection") Exceptions which can be raised during execution: > * [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information. A host whose ETABS license is not activated also fails this way: ETABS blocks on an interactive sign-in dialog that the worker cannot answer, so starting it up times out. > > * [`viktor.errors.WorkerSessionError`](https://docs.viktor.ai/sdk/api/errors/.md#WorkerSessionError "viktor.errors.WorkerSessionError"): the session was lost (e.g. its ETABS instance was torn down). The session cannot be resumed; start a new one to continue. > > * TimeoutError: a chunk of calls took longer than `timeout` <!-- --> ETABS enum values, generated from ETABS 23.3.1 (Ultimate). <!-- --> ## e2DFrameType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_e2DFrameType "Direct link to e2DFrameType") * *class *viktor.external.etabs.enums.e2DFrameType(*\*values*)[](#e2DFrameType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `e2DFrameType` values, mirroring the product API’s names so code reads like its docs. * ConcentricBraced* = 1*[](#e2DFrameType.ConcentricBraced "Link to this definition") - EccentricBraced* = 2*[](#e2DFrameType.EccentricBraced "Link to this definition") * PortalFrame* = 0*[](#e2DFrameType.PortalFrame "Link to this definition") <!-- --> ## e3DFrameType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_e3DFrameType "Direct link to e3DFrameType") * *class *viktor.external.etabs.enums.e3DFrameType(*\*values*)[](#e3DFrameType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `e3DFrameType` values, mirroring the product API’s names so code reads like its docs. * BeamSlab* = 2*[](#e3DFrameType.BeamSlab "Link to this definition") - FlatPlate* = 3*[](#e3DFrameType.FlatPlate "Link to this definition") * OpenFrame* = 0*[](#e3DFrameType.OpenFrame "Link to this definition") - PerimeterFrame* = 1*[](#e3DFrameType.PerimeterFrame "Link to this definition") <!-- --> ## eAreaDesignOrientation[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eAreaDesignOrientation "Direct link to eAreaDesignOrientation") * *class *viktor.external.etabs.enums.eAreaDesignOrientation(*\*values*)[](#eAreaDesignOrientation "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eAreaDesignOrientation` values, mirroring the product API’s names so code reads like its docs. * Floor* = 2*[](#eAreaDesignOrientation.Floor "Link to this definition") - Null* = 4*[](#eAreaDesignOrientation.Null "Link to this definition") * Other* = 5*[](#eAreaDesignOrientation.Other "Link to this definition") - Ramp\_DO\_NOT\_USE* = 3*[](#eAreaDesignOrientation.Ramp_DO_NOT_USE "Link to this definition") * Wall* = 1*[](#eAreaDesignOrientation.Wall "Link to this definition") <!-- --> ## eBridgeCodeAASHTO[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eBridgeCodeAASHTO "Direct link to eBridgeCodeAASHTO") * *class *viktor.external.etabs.enums.eBridgeCodeAASHTO(*\*values*)[](#eBridgeCodeAASHTO "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eBridgeCodeAASHTO` values, mirroring the product API’s names so code reads like its docs. * AASHTO\_LRFD\_2007* = 1*[](#eBridgeCodeAASHTO.AASHTO_LRFD_2007 "Link to this definition") - AASHTO\_LRFD\_2012* = 2*[](#eBridgeCodeAASHTO.AASHTO_LRFD_2012 "Link to this definition") * AASHTO\_LRFD\_2014* = 3*[](#eBridgeCodeAASHTO.AASHTO_LRFD_2014 "Link to this definition") - AASHTO\_LRFD\_2017* = 4*[](#eBridgeCodeAASHTO.AASHTO_LRFD_2017 "Link to this definition") * AASHTO\_LRFD\_2020* = 5*[](#eBridgeCodeAASHTO.AASHTO_LRFD_2020 "Link to this definition") - AASHTO\_STD\_2002* = 0*[](#eBridgeCodeAASHTO.AASHTO_STD_2002 "Link to this definition") <!-- --> ## eBridgeCodeInterims[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eBridgeCodeInterims "Direct link to eBridgeCodeInterims") * *class *viktor.external.etabs.enums.eBridgeCodeInterims(*\*values*)[](#eBridgeCodeInterims "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eBridgeCodeInterims` values, mirroring the product API’s names so code reads like its docs. * Interim\_2011* = 1*[](#eBridgeCodeInterims.Interim_2011 "Link to this definition") - Interim\_2012* = 2*[](#eBridgeCodeInterims.Interim_2012 "Link to this definition") * Interim\_2013* = 3*[](#eBridgeCodeInterims.Interim_2013 "Link to this definition") - Interim\_2014* = 4*[](#eBridgeCodeInterims.Interim_2014 "Link to this definition") * Interim\_2015* = 5*[](#eBridgeCodeInterims.Interim_2015 "Link to this definition") - NoInterims* = 0*[](#eBridgeCodeInterims.NoInterims "Link to this definition") <!-- --> ## eBridgeObjectBentPart[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eBridgeObjectBentPart "Direct link to eBridgeObjectBentPart") * *class *viktor.external.etabs.enums.eBridgeObjectBentPart(*\*values*)[](#eBridgeObjectBentPart "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eBridgeObjectBentPart` values, mirroring the product API’s names so code reads like its docs. * Bearing* = 3*[](#eBridgeObjectBentPart.Bearing "Link to this definition") - CapBeam* = 1*[](#eBridgeObjectBentPart.CapBeam "Link to this definition") * Column* = 2*[](#eBridgeObjectBentPart.Column "Link to this definition") - Wall* = 4*[](#eBridgeObjectBentPart.Wall "Link to this definition") <!-- --> ## eBridgeObjectFoundationPart[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eBridgeObjectFoundationPart "Direct link to eBridgeObjectFoundationPart") * *class *viktor.external.etabs.enums.eBridgeObjectFoundationPart(*\*values*)[](#eBridgeObjectFoundationPart "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eBridgeObjectFoundationPart` values, mirroring the product API’s names so code reads like its docs. * Footing* = 1*[](#eBridgeObjectFoundationPart.Footing "Link to this definition") - FoundationSpring* = 4*[](#eBridgeObjectFoundationPart.FoundationSpring "Link to this definition") * Pile* = 3*[](#eBridgeObjectFoundationPart.Pile "Link to this definition") - PileCap* = 2*[](#eBridgeObjectFoundationPart.PileCap "Link to this definition") <!-- --> ## eBridgeObjectType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eBridgeObjectType "Direct link to eBridgeObjectType") * *class *viktor.external.etabs.enums.eBridgeObjectType(*\*values*)[](#eBridgeObjectType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eBridgeObjectType` values, mirroring the product API’s names so code reads like its docs. * General* = 0*[](#eBridgeObjectType.General "Link to this definition") - Segmental* = 1*[](#eBridgeObjectType.Segmental "Link to this definition") <!-- --> ## eBridgeObjectUserPointType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eBridgeObjectUserPointType "Direct link to eBridgeObjectUserPointType") * *class *viktor.external.etabs.enums.eBridgeObjectUserPointType(*\*values*)[](#eBridgeObjectUserPointType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eBridgeObjectUserPointType` values, mirroring the product API’s names so code reads like its docs. * General* = 0*[](#eBridgeObjectUserPointType.General "Link to this definition") - SegmentalTendon* = 1*[](#eBridgeObjectUserPointType.SegmentalTendon "Link to this definition") <!-- --> ## eBridgeResponseDesignRating[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eBridgeResponseDesignRating "Direct link to eBridgeResponseDesignRating") * *class *viktor.external.etabs.enums.eBridgeResponseDesignRating(*\*values*)[](#eBridgeResponseDesignRating "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eBridgeResponseDesignRating` values, mirroring the product API’s names so code reads like its docs. * Design\_Crack\_Bot\_Crack\_Width* = 55*[](#eBridgeResponseDesignRating.Design_Crack_Bot_Crack_Width "Link to this definition") - Design\_Crack\_Top\_Bot\_Crack\_Widths* = 56*[](#eBridgeResponseDesignRating.Design_Crack_Top_Bot_Crack_Widths "Link to this definition") * Design\_Crack\_Top\_Crack\_Width* = 54*[](#eBridgeResponseDesignRating.Design_Crack_Top_Crack_Width "Link to this definition") - Design\_Fatigue\_Bot\_Flange\_Lateral\_Bending\_Stress\_Range* = 75*[](#eBridgeResponseDesignRating.Design_Fatigue_Bot_Flange_Lateral_Bending_Stress_Range "Link to this definition") * Design\_Fatigue\_Bot\_Flange\_Tensile\_Stress\_Range\_Without\_FLB* = 74*[](#eBridgeResponseDesignRating.Design_Fatigue_Bot_Flange_Tensile_Stress_Range_Without_FLB "Link to this definition") - Design\_Fatigue\_DC\_Ratio\_Web\_Shear* = 76*[](#eBridgeResponseDesignRating.Design_Fatigue_DC_Ratio_Web_Shear "Link to this definition") * Design\_Fatigue\_Top\_Flange\_Tensile\_Stress\_Range\_Without\_FLB* = 73*[](#eBridgeResponseDesignRating.Design_Fatigue_Top_Flange_Tensile_Stress_Range_Without_FLB "Link to this definition") - Design\_Flexure\_Moment\_About\_Horizontal\_Axis\_M3* = 64*[](#eBridgeResponseDesignRating.Design_Flexure_Moment_About_Horizontal_Axis_M3 "Link to this definition") * Design\_Principal\_Stress\_Beam\_Web\_Bot* = 61*[](#eBridgeResponseDesignRating.Design_Principal_Stress_Beam_Web_Bot "Link to this definition") - Design\_Principal\_Stress\_Beam\_Web\_Top* = 60*[](#eBridgeResponseDesignRating.Design_Principal_Stress_Beam_Web_Top "Link to this definition") * Design\_Principal\_Stress\_Envelope* = 57*[](#eBridgeResponseDesignRating.Design_Principal_Stress_Envelope "Link to this definition") - Design\_Principal\_Stress\_Neutral\_Axis* = 62*[](#eBridgeResponseDesignRating.Design_Principal_Stress_Neutral_Axis "Link to this definition") * Design\_Principal\_Stress\_Web\_Bot* = 59*[](#eBridgeResponseDesignRating.Design_Principal_Stress_Web_Bot "Link to this definition") - Design\_Principal\_Stress\_Web\_Top* = 58*[](#eBridgeResponseDesignRating.Design_Principal_Stress_Web_Top "Link to this definition") * Design\_Shear\_Controlling\_DC\_Ratio* = 43*[](#eBridgeResponseDesignRating.Design_Shear_Controlling_DC_Ratio "Link to this definition") - Design\_Shear\_Controlling\_Shear\_DC\_Ratio* = 34*[](#eBridgeResponseDesignRating.Design_Shear_Controlling_Shear_DC_Ratio "Link to this definition") * Design\_Shear\_Controlling\_Torsion\_DC\_Ratio* = 35*[](#eBridgeResponseDesignRating.Design_Shear_Controlling_Torsion_DC_Ratio "Link to this definition") - Design\_Shear\_Demand\_Concrete\_Shear\_Capacity\_Ratio* = 33*[](#eBridgeResponseDesignRating.Design_Shear_Demand_Concrete_Shear_Capacity_Ratio "Link to this definition") * Design\_Shear\_Longit\_Rebar\_Area* = 45*[](#eBridgeResponseDesignRating.Design_Shear_Longit_Rebar_Area "Link to this definition") - Design\_Shear\_Longit\_Rebar\_Area\_Beam* = 50*[](#eBridgeResponseDesignRating.Design_Shear_Longit_Rebar_Area_Beam "Link to this definition") * Design\_Shear\_Longit\_Rebar\_Area\_Bot\_Flange* = 48*[](#eBridgeResponseDesignRating.Design_Shear_Longit_Rebar_Area_Bot_Flange "Link to this definition") - Design\_Shear\_Longit\_Rebar\_Area\_Bot\_Slab* = 46*[](#eBridgeResponseDesignRating.Design_Shear_Longit_Rebar_Area_Bot_Slab "Link to this definition") * Design\_Shear\_Longit\_Rebar\_Area\_Slab* = 49*[](#eBridgeResponseDesignRating.Design_Shear_Longit_Rebar_Area_Slab "Link to this definition") - Design\_Shear\_Longit\_Rebar\_Area\_Top\_Slab* = 47*[](#eBridgeResponseDesignRating.Design_Shear_Longit_Rebar_Area_Top_Slab "Link to this definition") * Design\_Shear\_Longit\_Torsional\_Rebar\_Area\_PerL* = 51*[](#eBridgeResponseDesignRating.Design_Shear_Longit_Torsional_Rebar_Area_PerL "Link to this definition") - Design\_Shear\_Rebar\_Area\_PerL* = 44*[](#eBridgeResponseDesignRating.Design_Shear_Rebar_Area_PerL "Link to this definition") * Design\_Shear\_Required\_Extra\_Longit\_Rebar\_Area* = 37*[](#eBridgeResponseDesignRating.Design_Shear_Required_Extra_Longit_Rebar_Area "Link to this definition") - Design\_Shear\_Required\_Extra\_Longit\_Rebar\_Area\_Beam* = 42*[](#eBridgeResponseDesignRating.Design_Shear_Required_Extra_Longit_Rebar_Area_Beam "Link to this definition") * Design\_Shear\_Required\_Extra\_Longit\_Rebar\_Area\_Bot\_Slab* = 39*[](#eBridgeResponseDesignRating.Design_Shear_Required_Extra_Longit_Rebar_Area_Bot_Slab "Link to this definition") - Design\_Shear\_Required\_Extra\_Longit\_Rebar\_Area\_For\_Torsion* = 38*[](#eBridgeResponseDesignRating.Design_Shear_Required_Extra_Longit_Rebar_Area_For_Torsion "Link to this definition") * Design\_Shear\_Required\_Extra\_Longit\_Rebar\_Area\_Slab* = 41*[](#eBridgeResponseDesignRating.Design_Shear_Required_Extra_Longit_Rebar_Area_Slab "Link to this definition") - Design\_Shear\_Required\_Extra\_Longit\_Rebar\_Area\_Top\_Slab* = 40*[](#eBridgeResponseDesignRating.Design_Shear_Required_Extra_Longit_Rebar_Area_Top_Slab "Link to this definition") * Design\_Shear\_Required\_Extra\_Shear\_Rebar\_Area\_PerL* = 36*[](#eBridgeResponseDesignRating.Design_Shear_Required_Extra_Shear_Rebar_Area_PerL "Link to this definition") - Design\_Shear\_Torsion\_Plus\_Shear\_Rebar\_Area\_PerL* = 53*[](#eBridgeResponseDesignRating.Design_Shear_Torsion_Plus_Shear_Rebar_Area_PerL "Link to this definition") * Design\_Shear\_Torsion\_Rebar\_Area\_PerL* = 52*[](#eBridgeResponseDesignRating.Design_Shear_Torsion_Rebar_Area_PerL "Link to this definition") - Design\_Strength\_DC\_Ratio\_FlexureShearInteract\_Neg* = 71*[](#eBridgeResponseDesignRating.Design_Strength_DC_Ratio_FlexureShearInteract_Neg "Link to this definition") * Design\_Strength\_DC\_Ratio\_FlexureShearInteract\_Pos* = 70*[](#eBridgeResponseDesignRating.Design_Strength_DC_Ratio_FlexureShearInteract_Pos "Link to this definition") - Design\_Strength\_DC\_Ratio\_Negative\_Moment* = 66*[](#eBridgeResponseDesignRating.Design_Strength_DC_Ratio_Negative_Moment "Link to this definition") * Design\_Strength\_DC\_Ratio\_Net\_Section\_Fracture\_Neg* = 69*[](#eBridgeResponseDesignRating.Design_Strength_DC_Ratio_Net_Section_Fracture_Neg "Link to this definition") - Design\_Strength\_DC\_Ratio\_Net\_Section\_Fracture\_Pos* = 68*[](#eBridgeResponseDesignRating.Design_Strength_DC_Ratio_Net_Section_Fracture_Pos "Link to this definition") * Design\_Strength\_DC\_Ratio\_Positive\_Moment* = 65*[](#eBridgeResponseDesignRating.Design_Strength_DC_Ratio_Positive_Moment "Link to this definition") - Design\_Strength\_DC\_Ratio\_Shear* = 67*[](#eBridgeResponseDesignRating.Design_Strength_DC_Ratio_Shear "Link to this definition") * Design\_Strength\_Total\_Nominal\_Shear\_Force\_6\_10\_10\_4\_2* = 72*[](#eBridgeResponseDesignRating.Design_Strength_Total_Nominal_Shear_Force_6_10_10_4_2 "Link to this definition") - Design\_Tendon\_Stress\_Controlling\_DC\_Ratio* = 63*[](#eBridgeResponseDesignRating.Design_Tendon_Stress_Controlling_DC_Ratio "Link to this definition") * Rating\_ASM\_Rating* = 94*[](#eBridgeResponseDesignRating.Rating_ASM_Rating "Link to this definition") - Rating\_Flexure* = 81*[](#eBridgeResponseDesignRating.Rating_Flexure "Link to this definition") * Rating\_Flexure\_Factored\_Moment\_Resistance* = 82*[](#eBridgeResponseDesignRating.Rating_Flexure_Factored_Moment_Resistance "Link to this definition") - Rating\_Flexure\_Factored\_Moment\_Resistance\_UMr* = 83*[](#eBridgeResponseDesignRating.Rating_Flexure_Factored_Moment_Resistance_UMr "Link to this definition") * Rating\_Flexure\_Live\_load\_Capacity\_Factor\_F* = 84*[](#eBridgeResponseDesignRating.Rating_Flexure_Live_load_Capacity_Factor_F "Link to this definition") - Rating\_LFM\_Service\_Rating* = 96*[](#eBridgeResponseDesignRating.Rating_LFM_Service_Rating "Link to this definition") * Rating\_LFM\_Strength\_Rating* = 95*[](#eBridgeResponseDesignRating.Rating_LFM_Strength_Rating "Link to this definition") - Rating\_MinRebar\_Flexure\_Rating* = 92*[](#eBridgeResponseDesignRating.Rating_MinRebar_Flexure_Rating "Link to this definition") * Rating\_MinRebar\_Min\_Of\_Abs\_1\_2Mcr\_And\_Abs\_1\_33Mu\_For\_Neg* = 91*[](#eBridgeResponseDesignRating.Rating_MinRebar_Min_Of_Abs_1_2Mcr_And_Abs_1_33Mu_For_Neg "Link to this definition") - Rating\_MinRebar\_Min\_Of\_Abs\_1\_2Mcr\_And\_Abs\_1\_33Mu\_For\_Pos* = 90*[](#eBridgeResponseDesignRating.Rating_MinRebar_Min_Of_Abs_1_2Mcr_And_Abs_1_33Mu_For_Pos "Link to this definition") * Rating\_Service* = 93*[](#eBridgeResponseDesignRating.Rating_Service "Link to this definition") - Rating\_Service\_Flexure\_Rating* = 89*[](#eBridgeResponseDesignRating.Rating_Service_Flexure_Rating "Link to this definition") * Rating\_Shear* = 77*[](#eBridgeResponseDesignRating.Rating_Shear "Link to this definition") - Rating\_Shear\_Factored\_Shear\_Resistance* = 78*[](#eBridgeResponseDesignRating.Rating_Shear_Factored_Shear_Resistance "Link to this definition") * Rating\_Shear\_Factored\_Shear\_Resistance\_UVr* = 79*[](#eBridgeResponseDesignRating.Rating_Shear_Factored_Shear_Resistance_UVr "Link to this definition") - Rating\_Shear\_Live\_load\_Capacity\_Factor\_F* = 80*[](#eBridgeResponseDesignRating.Rating_Shear_Live_load_Capacity_Factor_F "Link to this definition") * Rating\_Strength\_Flexure\_Rating* = 86*[](#eBridgeResponseDesignRating.Rating_Strength_Flexure_Rating "Link to this definition") - Rating\_Strength\_Live\_load\_Capacity\_Factor\_F\_Moment\_M3* = 87*[](#eBridgeResponseDesignRating.Rating_Strength_Live_load_Capacity_Factor_F_Moment_M3 "Link to this definition") * Rating\_Strength\_Live\_load\_Capacity\_Factor\_F\_Shear\_V2* = 88*[](#eBridgeResponseDesignRating.Rating_Strength_Live_load_Capacity_Factor_F_Shear_V2 "Link to this definition") - Rating\_Strength\_Shear\_Rating* = 85*[](#eBridgeResponseDesignRating.Rating_Strength_Shear_Rating "Link to this definition") * S11\_Longitudinal\_Beam\_Bot\_Center* = 39*[](#eBridgeResponseDesignRating.S11_Longitudinal_Beam_Bot_Center "Link to this definition") - S11\_Longitudinal\_Beam\_Bot\_Envelope* = 32*[](#eBridgeResponseDesignRating.S11_Longitudinal_Beam_Bot_Envelope "Link to this definition") * S11\_Longitudinal\_Beam\_Bot\_Left* = 29*[](#eBridgeResponseDesignRating.S11_Longitudinal_Beam_Bot_Left "Link to this definition") - S11\_Longitudinal\_Beam\_Bot\_Right* = 31*[](#eBridgeResponseDesignRating.S11_Longitudinal_Beam_Bot_Right "Link to this definition") * S11\_Longitudinal\_Beam\_Top\_Center* = 10*[](#eBridgeResponseDesignRating.S11_Longitudinal_Beam_Top_Center "Link to this definition") - S11\_Longitudinal\_Beam\_Top\_Envelope* = 12*[](#eBridgeResponseDesignRating.S11_Longitudinal_Beam_Top_Envelope "Link to this definition") * S11\_Longitudinal\_Beam\_Top\_Left* = 9*[](#eBridgeResponseDesignRating.S11_Longitudinal_Beam_Top_Left "Link to this definition") - S11\_Longitudinal\_Beam\_Top\_Right* = 11*[](#eBridgeResponseDesignRating.S11_Longitudinal_Beam_Top_Right "Link to this definition") * S11\_Longitudinal\_Bot\_Center* = 15*[](#eBridgeResponseDesignRating.S11_Longitudinal_Bot_Center "Link to this definition") - S11\_Longitudinal\_Bot\_Envelope* = 18*[](#eBridgeResponseDesignRating.S11_Longitudinal_Bot_Envelope "Link to this definition") * S11\_Longitudinal\_Bot\_Left* = 13*[](#eBridgeResponseDesignRating.S11_Longitudinal_Bot_Left "Link to this definition") - S11\_Longitudinal\_Bot\_Left\_Corner* = 14*[](#eBridgeResponseDesignRating.S11_Longitudinal_Bot_Left_Corner "Link to this definition") * S11\_Longitudinal\_Bot\_Right* = 16*[](#eBridgeResponseDesignRating.S11_Longitudinal_Bot_Right "Link to this definition") - S11\_Longitudinal\_Bot\_Right\_Corner* = 17*[](#eBridgeResponseDesignRating.S11_Longitudinal_Bot_Right_Corner "Link to this definition") * S11\_Longitudinal\_Girder\_Bot\_Envelope* = 21*[](#eBridgeResponseDesignRating.S11_Longitudinal_Girder_Bot_Envelope "Link to this definition") - S11\_Longitudinal\_Girder\_Bot\_Left* = 19*[](#eBridgeResponseDesignRating.S11_Longitudinal_Girder_Bot_Left "Link to this definition") * S11\_Longitudinal\_Girder\_Bot\_Right* = 20*[](#eBridgeResponseDesignRating.S11_Longitudinal_Girder_Bot_Right "Link to this definition") - S11\_Longitudinal\_Slab\_Bot\_Beam\_Center* = 24*[](#eBridgeResponseDesignRating.S11_Longitudinal_Slab_Bot_Beam_Center "Link to this definition") * S11\_Longitudinal\_Slab\_Bot\_Beam\_Left* = 23*[](#eBridgeResponseDesignRating.S11_Longitudinal_Slab_Bot_Beam_Left "Link to this definition") - S11\_Longitudinal\_Slab\_Bot\_Beam\_Right* = 25*[](#eBridgeResponseDesignRating.S11_Longitudinal_Slab_Bot_Beam_Right "Link to this definition") * S11\_Longitudinal\_Slab\_Bot\_Center* = 26*[](#eBridgeResponseDesignRating.S11_Longitudinal_Slab_Bot_Center "Link to this definition") - S11\_Longitudinal\_Slab\_Bot\_Envelope* = 28*[](#eBridgeResponseDesignRating.S11_Longitudinal_Slab_Bot_Envelope "Link to this definition") * S11\_Longitudinal\_Slab\_Bot\_Left* = 22*[](#eBridgeResponseDesignRating.S11_Longitudinal_Slab_Bot_Left "Link to this definition") - S11\_Longitudinal\_Slab\_Bot\_Right* = 27*[](#eBridgeResponseDesignRating.S11_Longitudinal_Slab_Bot_Right "Link to this definition") * S11\_Longitudinal\_Slab\_Top\_Beam\_Center* = 6*[](#eBridgeResponseDesignRating.S11_Longitudinal_Slab_Top_Beam_Center "Link to this definition") - S11\_Longitudinal\_Slab\_Top\_Center* = 5*[](#eBridgeResponseDesignRating.S11_Longitudinal_Slab_Top_Center "Link to this definition") * S11\_Longitudinal\_Slab\_Top\_Envelope* = 8*[](#eBridgeResponseDesignRating.S11_Longitudinal_Slab_Top_Envelope "Link to this definition") - S11\_Longitudinal\_Slab\_Top\_Left* = 4*[](#eBridgeResponseDesignRating.S11_Longitudinal_Slab_Top_Left "Link to this definition") * S11\_Longitudinal\_Slab\_Top\_Right* = 7*[](#eBridgeResponseDesignRating.S11_Longitudinal_Slab_Top_Right "Link to this definition") - S11\_Longitudinal\_Top\_Center* = 1*[](#eBridgeResponseDesignRating.S11_Longitudinal_Top_Center "Link to this definition") * S11\_Longitudinal\_Top\_Envelope* = 3*[](#eBridgeResponseDesignRating.S11_Longitudinal_Top_Envelope "Link to this definition") - S11\_Longitudinal\_Top\_Left* = 0*[](#eBridgeResponseDesignRating.S11_Longitudinal_Top_Left "Link to this definition") * S11\_Longitudinal\_Top\_Right* = 2*[](#eBridgeResponseDesignRating.S11_Longitudinal_Top_Right "Link to this definition") <!-- --> ## eBridgeResponseDisplDOF[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eBridgeResponseDisplDOF "Direct link to eBridgeResponseDisplDOF") * *class *viktor.external.etabs.enums.eBridgeResponseDisplDOF(*\*values*)[](#eBridgeResponseDisplDOF "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eBridgeResponseDisplDOF` values, mirroring the product API’s names so code reads like its docs. * Avg\_Longitudinal\_Rotation* = 4*[](#eBridgeResponseDisplDOF.Avg_Longitudinal_Rotation "Link to this definition") - Longitudinal\_Displacement* = 2*[](#eBridgeResponseDisplDOF.Longitudinal_Displacement "Link to this definition") * Longitudinal\_Rotation* = 3*[](#eBridgeResponseDisplDOF.Longitudinal_Rotation "Link to this definition") - Transverse\_Displacement* = 1*[](#eBridgeResponseDisplDOF.Transverse_Displacement "Link to this definition") * Vertical\_Displacement* = 0*[](#eBridgeResponseDisplDOF.Vertical_Displacement "Link to this definition") <!-- --> ## eBridgeResponseDisplLoc[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eBridgeResponseDisplLoc "Direct link to eBridgeResponseDisplLoc") * *class *viktor.external.etabs.enums.eBridgeResponseDisplLoc(*\*values*)[](#eBridgeResponseDisplLoc "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eBridgeResponseDisplLoc` values, mirroring the product API’s names so code reads like its docs. * Left\_Web* = 5*[](#eBridgeResponseDisplLoc.Left_Web "Link to this definition") - Left\_Web\_Bottom* = 4*[](#eBridgeResponseDisplLoc.Left_Web_Bottom "Link to this definition") * Left\_Web\_Top* = 3*[](#eBridgeResponseDisplLoc.Left_Web_Top "Link to this definition") - Right\_Web* = 8*[](#eBridgeResponseDisplLoc.Right_Web "Link to this definition") * Right\_Web\_Bottom* = 7*[](#eBridgeResponseDisplLoc.Right_Web_Bottom "Link to this definition") - Right\_Web\_Top* = 6*[](#eBridgeResponseDisplLoc.Right_Web_Top "Link to this definition") * Slab\_Center* = 9*[](#eBridgeResponseDisplLoc.Slab_Center "Link to this definition") - Web* = 2*[](#eBridgeResponseDisplLoc.Web "Link to this definition") * Web\_Bottom* = 1*[](#eBridgeResponseDisplLoc.Web_Bottom "Link to this definition") - Web\_Top* = 0*[](#eBridgeResponseDisplLoc.Web_Top "Link to this definition") <!-- --> ## eBridgeResponseForce[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eBridgeResponseForce "Direct link to eBridgeResponseForce") * *class *viktor.external.etabs.enums.eBridgeResponseForce(*\*values*)[](#eBridgeResponseForce "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eBridgeResponseForce` values, mirroring the product API’s names so code reads like its docs. * Axial\_Force\_P* = 1*[](#eBridgeResponseForce.Axial_Force_P "Link to this definition") - Moment\_About\_Horizontal\_Axis\_M3* = 6*[](#eBridgeResponseForce.Moment_About_Horizontal_Axis_M3 "Link to this definition") * Moment\_About\_Vertical\_Axis\_M2* = 5*[](#eBridgeResponseForce.Moment_About_Vertical_Axis_M2 "Link to this definition") - Shear\_Horizontal\_V3* = 3*[](#eBridgeResponseForce.Shear_Horizontal_V3 "Link to this definition") * Shear\_Vertical\_V2* = 2*[](#eBridgeResponseForce.Shear_Vertical_V2 "Link to this definition") - Torsion\_T* = 4*[](#eBridgeResponseForce.Torsion_T "Link to this definition") <!-- --> ## eBridgeResponsePart[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eBridgeResponsePart "Direct link to eBridgeResponsePart") * *class *viktor.external.etabs.enums.eBridgeResponsePart(*\*values*)[](#eBridgeResponsePart "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eBridgeResponsePart` values, mirroring the product API’s names so code reads like its docs. * All\_Beams* = 7*[](#eBridgeResponsePart.All_Beams "Link to this definition") - All\_Girders* = 6*[](#eBridgeResponsePart.All_Girders "Link to this definition") * All\_Slabs* = 9*[](#eBridgeResponsePart.All_Slabs "Link to this definition") - All\_Webs* = 8*[](#eBridgeResponsePart.All_Webs "Link to this definition") * Beam* = 3*[](#eBridgeResponsePart.Beam "Link to this definition") - Entire\_Bridge\_Section* = 1*[](#eBridgeResponsePart.Entire_Bridge_Section "Link to this definition") * Entire\_Section\_Plus\_All\_Girders* = 10*[](#eBridgeResponsePart.Entire_Section_Plus_All_Girders "Link to this definition") - Girder* = 2*[](#eBridgeResponsePart.Girder "Link to this definition") * Slab* = 5*[](#eBridgeResponsePart.Slab "Link to this definition") - Web* = 4*[](#eBridgeResponsePart.Web "Link to this definition") <!-- --> ## eBridgeResponseStress[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eBridgeResponseStress "Direct link to eBridgeResponseStress") * *class *viktor.external.etabs.enums.eBridgeResponseStress(*\*values*)[](#eBridgeResponseStress "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eBridgeResponseStress` values, mirroring the product API’s names so code reads like its docs. * S11\_Lateral\_Bending\_Bot* = 25*[](#eBridgeResponseStress.S11_Lateral_Bending_Bot "Link to this definition") - S11\_Lateral\_Bending\_Top* = 22*[](#eBridgeResponseStress.S11_Lateral_Bending_Top "Link to this definition") * S11\_Lateral\_Bending\_Top\_ULeft* = 23*[](#eBridgeResponseStress.S11_Lateral_Bending_Top_ULeft "Link to this definition") - S11\_Lateral\_Bending\_Top\_URight* = 24*[](#eBridgeResponseStress.S11_Lateral_Bending_Top_URight "Link to this definition") * S11\_Longitudinal\_Bot\_Beam\_Left* = 16*[](#eBridgeResponseStress.S11_Longitudinal_Bot_Beam_Left "Link to this definition") - S11\_Longitudinal\_Bot\_Beam\_Right* = 17*[](#eBridgeResponseStress.S11_Longitudinal_Bot_Beam_Right "Link to this definition") * S11\_Longitudinal\_Bot\_Center* = 14*[](#eBridgeResponseStress.S11_Longitudinal_Bot_Center "Link to this definition") - S11\_Longitudinal\_Bot\_Envelope* = 18*[](#eBridgeResponseStress.S11_Longitudinal_Bot_Envelope "Link to this definition") * S11\_Longitudinal\_Bot\_Left* = 13*[](#eBridgeResponseStress.S11_Longitudinal_Bot_Left "Link to this definition") - S11\_Longitudinal\_Bot\_Right* = 15*[](#eBridgeResponseStress.S11_Longitudinal_Bot_Right "Link to this definition") * S11\_Longitudinal\_Top\_Beam\_Center* = 3*[](#eBridgeResponseStress.S11_Longitudinal_Top_Beam_Center "Link to this definition") - S11\_Longitudinal\_Top\_Bot\_Center* = 20*[](#eBridgeResponseStress.S11_Longitudinal_Top_Bot_Center "Link to this definition") * S11\_Longitudinal\_Top\_Bot\_Left* = 19*[](#eBridgeResponseStress.S11_Longitudinal_Top_Bot_Left "Link to this definition") - S11\_Longitudinal\_Top\_Bot\_Right* = 21*[](#eBridgeResponseStress.S11_Longitudinal_Top_Bot_Right "Link to this definition") * S11\_Longitudinal\_Top\_Center* = 1*[](#eBridgeResponseStress.S11_Longitudinal_Top_Center "Link to this definition") - S11\_Longitudinal\_Top\_Envelope* = 4*[](#eBridgeResponseStress.S11_Longitudinal_Top_Envelope "Link to this definition") * S11\_Longitudinal\_Top\_Left* = 0*[](#eBridgeResponseStress.S11_Longitudinal_Top_Left "Link to this definition") - S11\_Longitudinal\_Top\_Right* = 2*[](#eBridgeResponseStress.S11_Longitudinal_Top_Right "Link to this definition") * S11\_Longitudinal\_Top\_ULeft\_Center* = 6*[](#eBridgeResponseStress.S11_Longitudinal_Top_ULeft_Center "Link to this definition") - S11\_Longitudinal\_Top\_ULeft\_Envelope* = 8*[](#eBridgeResponseStress.S11_Longitudinal_Top_ULeft_Envelope "Link to this definition") * S11\_Longitudinal\_Top\_ULeft\_Left* = 5*[](#eBridgeResponseStress.S11_Longitudinal_Top_ULeft_Left "Link to this definition") - S11\_Longitudinal\_Top\_ULeft\_Right* = 7*[](#eBridgeResponseStress.S11_Longitudinal_Top_ULeft_Right "Link to this definition") * S11\_Longitudinal\_Top\_URight\_Center* = 10*[](#eBridgeResponseStress.S11_Longitudinal_Top_URight_Center "Link to this definition") - S11\_Longitudinal\_Top\_URight\_Envelope* = 12*[](#eBridgeResponseStress.S11_Longitudinal_Top_URight_Envelope "Link to this definition") * S11\_Longitudinal\_Top\_URight\_Left* = 9*[](#eBridgeResponseStress.S11_Longitudinal_Top_URight_Left "Link to this definition") - S11\_Longitudinal\_Top\_URight\_Right* = 11*[](#eBridgeResponseStress.S11_Longitudinal_Top_URight_Right "Link to this definition") <!-- --> ## eBridgeSegmentConstructionMethod[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eBridgeSegmentConstructionMethod "Direct link to eBridgeSegmentConstructionMethod") * *class *viktor.external.etabs.enums.eBridgeSegmentConstructionMethod(*\*values*)[](#eBridgeSegmentConstructionMethod "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eBridgeSegmentConstructionMethod` values, mirroring the product API’s names so code reads like its docs. * CastInPlace* = 1*[](#eBridgeSegmentConstructionMethod.CastInPlace "Link to this definition") - Precast* = 0*[](#eBridgeSegmentConstructionMethod.Precast "Link to this definition") <!-- --> ## eBridgeSegmentType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eBridgeSegmentType "Direct link to eBridgeSegmentType") * *class *viktor.external.etabs.enums.eBridgeSegmentType(*\*values*)[](#eBridgeSegmentType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eBridgeSegmentType` values, mirroring the product API’s names so code reads like its docs. * Closure* = 3*[](#eBridgeSegmentType.Closure "Link to this definition") - PierTable* = 1*[](#eBridgeSegmentType.PierTable "Link to this definition") * Rigid* = 0*[](#eBridgeSegmentType.Rigid "Link to this definition") - Segment* = 2*[](#eBridgeSegmentType.Segment "Link to this definition") <!-- --> ## eBridgeTendonCategory[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eBridgeTendonCategory "Direct link to eBridgeTendonCategory") * *class *viktor.external.etabs.enums.eBridgeTendonCategory(*\*values*)[](#eBridgeTendonCategory "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eBridgeTendonCategory` values, mirroring the product API’s names so code reads like its docs. * BottomSpan* = 2*[](#eBridgeTendonCategory.BottomSpan "Link to this definition") - Cantilever* = 1*[](#eBridgeTendonCategory.Cantilever "Link to this definition") * Continuity* = 4*[](#eBridgeTendonCategory.Continuity "Link to this definition") - General* = 0*[](#eBridgeTendonCategory.General "Link to this definition") * TopSpan* = 3*[](#eBridgeTendonCategory.TopSpan "Link to this definition") <!-- --> ## eCNameType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eCNameType "Direct link to eCNameType") * *class *viktor.external.etabs.enums.eCNameType(*\*values*)[](#eCNameType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eCNameType` values, mirroring the product API’s names so code reads like its docs. * LoadCase* = 0*[](#eCNameType.LoadCase "Link to this definition") - LoadCombo* = 1*[](#eCNameType.LoadCombo "Link to this definition") <!-- --> ## eConstraintAxis[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eConstraintAxis "Direct link to eConstraintAxis") * *class *viktor.external.etabs.enums.eConstraintAxis(*\*values*)[](#eConstraintAxis "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eConstraintAxis` values, mirroring the product API’s names so code reads like its docs. * AutoAxis* = 4*[](#eConstraintAxis.AutoAxis "Link to this definition") - X* = 1*[](#eConstraintAxis.X "Link to this definition") * Y* = 2*[](#eConstraintAxis.Y "Link to this definition") - Z* = 3*[](#eConstraintAxis.Z "Link to this definition") <!-- --> ## eConstraintType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eConstraintType "Direct link to eConstraintType") * *class *viktor.external.etabs.enums.eConstraintType(*\*values*)[](#eConstraintType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eConstraintType` values, mirroring the product API’s names so code reads like its docs. * Beam* = 5*[](#eConstraintType.Beam "Link to this definition") - Body* = 1*[](#eConstraintType.Body "Link to this definition") * Diaphragm* = 2*[](#eConstraintType.Diaphragm "Link to this definition") - Equal* = 6*[](#eConstraintType.Equal "Link to this definition") * Line* = 13*[](#eConstraintType.Line "Link to this definition") - Local* = 7*[](#eConstraintType.Local "Link to this definition") * Plate* = 3*[](#eConstraintType.Plate "Link to this definition") - Rod* = 4*[](#eConstraintType.Rod "Link to this definition") * Weld* = 8*[](#eConstraintType.Weld "Link to this definition") <!-- --> ## eDeckType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eDeckType "Direct link to eDeckType") * *class *viktor.external.etabs.enums.eDeckType(*\*values*)[](#eDeckType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eDeckType` values, mirroring the product API’s names so code reads like its docs. * Filled* = 1*[](#eDeckType.Filled "Link to this definition") - SolidSlab* = 3*[](#eDeckType.SolidSlab "Link to this definition") * Unfilled* = 2*[](#eDeckType.Unfilled "Link to this definition") <!-- --> ## eDesignActionType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eDesignActionType "Direct link to eDesignActionType") * *class *viktor.external.etabs.enums.eDesignActionType(*\*values*)[](#eDesignActionType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eDesignActionType` values, mirroring the product API’s names so code reads like its docs. * LongTermComposite* = 3*[](#eDesignActionType.LongTermComposite "Link to this definition") - NonComposite* = 1*[](#eDesignActionType.NonComposite "Link to this definition") * Other* = 5*[](#eDesignActionType.Other "Link to this definition") - ShortTermComposite* = 2*[](#eDesignActionType.ShortTermComposite "Link to this definition") * Staged* = 4*[](#eDesignActionType.Staged "Link to this definition") <!-- --> ## eDiaphragmOption[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eDiaphragmOption "Direct link to eDiaphragmOption") * *class *viktor.external.etabs.enums.eDiaphragmOption(*\*values*)[](#eDiaphragmOption "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eDiaphragmOption` values, mirroring the product API’s names so code reads like its docs. * DefinedDiaphragm* = 3*[](#eDiaphragmOption.DefinedDiaphragm "Link to this definition") - Disconnect* = 1*[](#eDiaphragmOption.Disconnect "Link to this definition") * FromShellObject* = 2*[](#eDiaphragmOption.FromShellObject "Link to this definition") <!-- --> ## eFileTypeIO[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eFileTypeIO "Direct link to eFileTypeIO") * *class *viktor.external.etabs.enums.eFileTypeIO(*\*values*)[](#eFileTypeIO "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eFileTypeIO` values, mirroring the product API’s names so code reads like its docs. * DBTablesAccess* = 3*[](#eFileTypeIO.DBTablesAccess "Link to this definition") - DBTablesExcel* = 2*[](#eFileTypeIO.DBTablesExcel "Link to this definition") * DBTablesText* = 4*[](#eFileTypeIO.DBTablesText "Link to this definition") - DBTablesXML* = 5*[](#eFileTypeIO.DBTablesXML "Link to this definition") * TextFile* = 1*[](#eFileTypeIO.TextFile "Link to this definition") <!-- --> ## eForce[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eForce "Direct link to eForce") * *class *viktor.external.etabs.enums.eForce(*\*values*)[](#eForce "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eForce` values, mirroring the product API’s names so code reads like its docs. * N* = 3*[](#eForce.N "Link to this definition") - NotApplicable* = 0*[](#eForce.NotApplicable "Link to this definition") * kN* = 4*[](#eForce.kN "Link to this definition") - kgf* = 5*[](#eForce.kgf "Link to this definition") * kip* = 2*[](#eForce.kip "Link to this definition") - lb* = 1*[](#eForce.lb "Link to this definition") * tonf* = 6*[](#eForce.tonf "Link to this definition") <!-- --> ## eFrameDesignOrientation[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eFrameDesignOrientation "Direct link to eFrameDesignOrientation") * *class *viktor.external.etabs.enums.eFrameDesignOrientation(*\*values*)[](#eFrameDesignOrientation "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eFrameDesignOrientation` values, mirroring the product API’s names so code reads like its docs. * Beam* = 2*[](#eFrameDesignOrientation.Beam "Link to this definition") - Brace* = 3*[](#eFrameDesignOrientation.Brace "Link to this definition") * Column* = 1*[](#eFrameDesignOrientation.Column "Link to this definition") - Null* = 4*[](#eFrameDesignOrientation.Null "Link to this definition") * Other* = 5*[](#eFrameDesignOrientation.Other "Link to this definition") <!-- --> ## eFramePropType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eFramePropType "Direct link to eFramePropType") * *class *viktor.external.etabs.enums.eFramePropType(*\*values*)[](#eFramePropType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eFramePropType` values, mirroring the product API’s names so code reads like its docs. * Angle* = 4*[](#eFramePropType.Angle "Link to this definition") - Auto* = 12*[](#eFramePropType.Auto "Link to this definition") * Box* = 6*[](#eFramePropType.Box "Link to this definition") - Bridge* = 16*[](#eFramePropType.Bridge "Link to this definition") * BucklingRestrainedBrace* = 33*[](#eFramePropType.BucklingRestrainedBrace "Link to this definition") - BuiltupICoverplate* = 23*[](#eFramePropType.BuiltupICoverplate "Link to this definition") * BuiltupIHybrid* = 26*[](#eFramePropType.BuiltupIHybrid "Link to this definition") - BuiltupUHybrid* = 27*[](#eFramePropType.BuiltupUHybrid "Link to this definition") * Channel* = 2*[](#eFramePropType.Channel "Link to this definition") - Circle* = 9*[](#eFramePropType.Circle "Link to this definition") * Cold\_2C* = 18*[](#eFramePropType.Cold_2C "Link to this definition") - Cold\_2L* = 21*[](#eFramePropType.Cold_2L "Link to this definition") * Cold\_Box* = 42*[](#eFramePropType.Cold_Box "Link to this definition") - Cold\_C* = 17*[](#eFramePropType.Cold_C "Link to this definition") * Cold\_Hat* = 22*[](#eFramePropType.Cold_Hat "Link to this definition") - Cold\_I* = 43*[](#eFramePropType.Cold_I "Link to this definition") * Cold\_L* = 20*[](#eFramePropType.Cold_L "Link to this definition") - Cold\_Pipe* = 44*[](#eFramePropType.Cold_Pipe "Link to this definition") * Cold\_T* = 45*[](#eFramePropType.Cold_T "Link to this definition") - Cold\_Z* = 19*[](#eFramePropType.Cold_Z "Link to this definition") * ConcreteBox* = 36*[](#eFramePropType.ConcreteBox "Link to this definition") - ConcreteCross* = 38*[](#eFramePropType.ConcreteCross "Link to this definition") * ConcretePipe* = 37*[](#eFramePropType.ConcretePipe "Link to this definition") - ConcreteTee* = 35*[](#eFramePropType.ConcreteTee "Link to this definition") * Concrete\_L* = 28*[](#eFramePropType.Concrete_L "Link to this definition") - CoreBrace\_BRB* = 34*[](#eFramePropType.CoreBrace_BRB "Link to this definition") * DbChannel* = 11*[](#eFramePropType.DbChannel "Link to this definition") - DblAngle* = 5*[](#eFramePropType.DblAngle "Link to this definition") * EncasedCircle* = 32*[](#eFramePropType.EncasedCircle "Link to this definition") - EncasedRectangle* = 31*[](#eFramePropType.EncasedRectangle "Link to this definition") * FilledPipe* = 30*[](#eFramePropType.FilledPipe "Link to this definition") - FilledTube* = 29*[](#eFramePropType.FilledTube "Link to this definition") * General* = 10*[](#eFramePropType.General "Link to this definition") - I* = 1*[](#eFramePropType.I "Link to this definition") * Joist* = 15*[](#eFramePropType.Joist "Link to this definition") - PCCGirderBox* = 47*[](#eFramePropType.PCCGirderBox "Link to this definition") * PCCGirderI* = 24*[](#eFramePropType.PCCGirderI "Link to this definition") - PCCGirderSuperT* = 41*[](#eFramePropType.PCCGirderSuperT "Link to this definition") * PCCGirderU* = 25*[](#eFramePropType.PCCGirderU "Link to this definition") - Pipe* = 7*[](#eFramePropType.Pipe "Link to this definition") * Rectangular* = 8*[](#eFramePropType.Rectangular "Link to this definition") - SD* = 13*[](#eFramePropType.SD "Link to this definition") * SteelPlate* = 39*[](#eFramePropType.SteelPlate "Link to this definition") - SteelRod* = 40*[](#eFramePropType.SteelRod "Link to this definition") * T* = 3*[](#eFramePropType.T "Link to this definition") - Trapezoidal* = 46*[](#eFramePropType.Trapezoidal "Link to this definition") * Variable* = 14*[](#eFramePropType.Variable "Link to this definition") <!-- --> ## eHingeDistributionType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eHingeDistributionType "Direct link to eHingeDistributionType") * *class *viktor.external.etabs.enums.eHingeDistributionType(*\*values*)[](#eHingeDistributionType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eHingeDistributionType` values, mirroring the product API’s names so code reads like its docs. * ContinuousSupport* = 4*[](#eHingeDistributionType.ContinuousSupport "Link to this definition") - DistributedPlasticity* = 2*[](#eHingeDistributionType.DistributedPlasticity "Link to this definition") * EqualSpacing* = 3*[](#eHingeDistributionType.EqualSpacing "Link to this definition") - NonlinearBeamColumn* = 1*[](#eHingeDistributionType.NonlinearBeamColumn "Link to this definition") * UserDefined* = 5*[](#eHingeDistributionType.UserDefined "Link to this definition") <!-- --> ## eHingeLengthOverwriteType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eHingeLengthOverwriteType "Direct link to eHingeLengthOverwriteType") * *class *viktor.external.etabs.enums.eHingeLengthOverwriteType(*\*values*)[](#eHingeLengthOverwriteType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eHingeLengthOverwriteType` values, mirroring the product API’s names so code reads like its docs. * Absolute* = 2*[](#eHingeLengthOverwriteType.Absolute "Link to this definition") - None\_* = 1*[](#eHingeLengthOverwriteType.None_ "Link to this definition") * Relative* = 3*[](#eHingeLengthOverwriteType.Relative "Link to this definition") <!-- --> ## eHingeLocationType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eHingeLocationType "Direct link to eHingeLocationType") * *class *viktor.external.etabs.enums.eHingeLocationType(*\*values*)[](#eHingeLocationType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eHingeLocationType` values, mirroring the product API’s names so code reads like its docs. * OffsetFromIEnd* = 2*[](#eHingeLocationType.OffsetFromIEnd "Link to this definition") - OffsetFromJEnd* = 3*[](#eHingeLocationType.OffsetFromJEnd "Link to this definition") * RelativeDistance* = 1*[](#eHingeLocationType.RelativeDistance "Link to this definition") <!-- --> ## eItemType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eItemType "Direct link to eItemType") * *class *viktor.external.etabs.enums.eItemType(*\*values*)[](#eItemType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eItemType` values, mirroring the product API’s names so code reads like its docs. * Group* = 1*[](#eItemType.Group "Link to this definition") - Objects* = 0*[](#eItemType.Objects "Link to this definition") * SelectedObjects* = 2*[](#eItemType.SelectedObjects "Link to this definition") <!-- --> ## eItemTypeElm[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eItemTypeElm "Direct link to eItemTypeElm") * *class *viktor.external.etabs.enums.eItemTypeElm(*\*values*)[](#eItemTypeElm "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eItemTypeElm` values, mirroring the product API’s names so code reads like its docs. * Element* = 1*[](#eItemTypeElm.Element "Link to this definition") - GroupElm* = 2*[](#eItemTypeElm.GroupElm "Link to this definition") * ObjectElm* = 0*[](#eItemTypeElm.ObjectElm "Link to this definition") - SelectionElm* = 3*[](#eItemTypeElm.SelectionElm "Link to this definition") <!-- --> ## eLength[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eLength "Direct link to eLength") * *class *viktor.external.etabs.enums.eLength(*\*values*)[](#eLength "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eLength` values, mirroring the product API’s names so code reads like its docs. * NotApplicable* = 0*[](#eLength.NotApplicable "Link to this definition") - cm* = 5*[](#eLength.cm "Link to this definition") * ft* = 2*[](#eLength.ft "Link to this definition") - inch* = 1*[](#eLength.inch "Link to this definition") * m* = 6*[](#eLength.m "Link to this definition") - micron* = 3*[](#eLength.micron "Link to this definition") * mm* = 4*[](#eLength.mm "Link to this definition") <!-- --> ## eLinkPropType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eLinkPropType "Direct link to eLinkPropType") * *class *viktor.external.etabs.enums.eLinkPropType(*\*values*)[](#eLinkPropType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eLinkPropType` values, mirroring the product API’s names so code reads like its docs. * Damper* = 2*[](#eLinkPropType.Damper "Link to this definition") - Gap* = 3*[](#eLinkPropType.Gap "Link to this definition") * Hook* = 4*[](#eLinkPropType.Hook "Link to this definition") - Isolator1* = 6*[](#eLinkPropType.Isolator1 "Link to this definition") * Isolator2* = 7*[](#eLinkPropType.Isolator2 "Link to this definition") - Isolator3* = 10*[](#eLinkPropType.Isolator3 "Link to this definition") * Linear* = 1*[](#eLinkPropType.Linear "Link to this definition") - MultilinearElastic* = 8*[](#eLinkPropType.MultilinearElastic "Link to this definition") * MultilinearPlastic* = 9*[](#eLinkPropType.MultilinearPlastic "Link to this definition") - PlasticWen* = 5*[](#eLinkPropType.PlasticWen "Link to this definition") <!-- --> ## eLoadCaseType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eLoadCaseType "Direct link to eLoadCaseType") * *class *viktor.external.etabs.enums.eLoadCaseType(*\*values*)[](#eLoadCaseType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eLoadCaseType` values, mirroring the product API’s names so code reads like its docs. * Buckling* = 10*[](#eLoadCaseType.Buckling "Link to this definition") - HyperStatic* = 14*[](#eLoadCaseType.HyperStatic "Link to this definition") * LinearDynamic* = 7*[](#eLoadCaseType.LinearDynamic "Link to this definition") - LinearHistory* = 5*[](#eLoadCaseType.LinearHistory "Link to this definition") * LinearStatic* = 1*[](#eLoadCaseType.LinearStatic "Link to this definition") - LinearStaticMultiStep* = 13*[](#eLoadCaseType.LinearStaticMultiStep "Link to this definition") * Modal* = 3*[](#eLoadCaseType.Modal "Link to this definition") - MovingLoad* = 9*[](#eLoadCaseType.MovingLoad "Link to this definition") * NonlinearDynamic* = 8*[](#eLoadCaseType.NonlinearDynamic "Link to this definition") - NonlinearHistory* = 6*[](#eLoadCaseType.NonlinearHistory "Link to this definition") * NonlinearStatic* = 2*[](#eLoadCaseType.NonlinearStatic "Link to this definition") - PowerSpectralDensity* = 12*[](#eLoadCaseType.PowerSpectralDensity "Link to this definition") * ResponseSpectrum* = 4*[](#eLoadCaseType.ResponseSpectrum "Link to this definition") - SteadyState* = 11*[](#eLoadCaseType.SteadyState "Link to this definition") <!-- --> ## eLoadPatternType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eLoadPatternType "Direct link to eLoadPatternType") * *class *viktor.external.etabs.enums.eLoadPatternType(*\*values*)[](#eLoadPatternType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eLoadPatternType` values, mirroring the product API’s names so code reads like its docs. * ActiveEarthPressure* = 45*[](#eLoadPatternType.ActiveEarthPressure "Link to this definition") - Bouyancy* = 36*[](#eLoadPatternType.Bouyancy "Link to this definition") * Braking* = 15*[](#eLoadPatternType.Braking "Link to this definition") - Centrifugal* = 16*[](#eLoadPatternType.Centrifugal "Link to this definition") * Construction* = 39*[](#eLoadPatternType.Construction "Link to this definition") - Creep* = 29*[](#eLoadPatternType.Creep "Link to this definition") * Dead* = 1*[](#eLoadPatternType.Dead "Link to this definition") - DeadManufacture* = 42*[](#eLoadPatternType.DeadManufacture "Link to this definition") * DeadWater* = 41*[](#eLoadPatternType.DeadWater "Link to this definition") - DeadWearing* = 40*[](#eLoadPatternType.DeadWearing "Link to this definition") * DownDrag* = 23*[](#eLoadPatternType.DownDrag "Link to this definition") - EarthHydrostatic* = 43*[](#eLoadPatternType.EarthHydrostatic "Link to this definition") * EarthSurcharge* = 22*[](#eLoadPatternType.EarthSurcharge "Link to this definition") - EuroLm1Char* = 48*[](#eLoadPatternType.EuroLm1Char "Link to this definition") * EuroLm1Freq* = 49*[](#eLoadPatternType.EuroLm1Freq "Link to this definition") - EuroLm2* = 50*[](#eLoadPatternType.EuroLm2 "Link to this definition") * EuroLm3* = 51*[](#eLoadPatternType.EuroLm3 "Link to this definition") - EuroLm4* = 52*[](#eLoadPatternType.EuroLm4 "Link to this definition") * Friction* = 17*[](#eLoadPatternType.Friction "Link to this definition") - HorizontalEarthPressure* = 20*[](#eLoadPatternType.HorizontalEarthPressure "Link to this definition") * Hyperstatic* = 35*[](#eLoadPatternType.Hyperstatic "Link to this definition") - Ice* = 18*[](#eLoadPatternType.Ice "Link to this definition") * Impact* = 38*[](#eLoadPatternType.Impact "Link to this definition") - Live* = 3*[](#eLoadPatternType.Live "Link to this definition") * LiveLoadSurcharge* = 31*[](#eLoadPatternType.LiveLoadSurcharge "Link to this definition") - LockedInForces* = 32*[](#eLoadPatternType.LockedInForces "Link to this definition") * Move* = 9*[](#eLoadPatternType.Move "Link to this definition") - MoveDeflection* = 57*[](#eLoadPatternType.MoveDeflection "Link to this definition") * MoveFatigue* = 55*[](#eLoadPatternType.MoveFatigue "Link to this definition") - MoveFatiguePermit* = 56*[](#eLoadPatternType.MoveFatiguePermit "Link to this definition") * MoveTrain* = 58*[](#eLoadPatternType.MoveTrain "Link to this definition") - Notional* = 12*[](#eLoadPatternType.Notional "Link to this definition") * Other* = 8*[](#eLoadPatternType.Other "Link to this definition") - PassiveEarthPressure* = 44*[](#eLoadPatternType.PassiveEarthPressure "Link to this definition") * PatternAuto* = 60*[](#eLoadPatternType.PatternAuto "Link to this definition") - PatternLive* = 13*[](#eLoadPatternType.PatternLive "Link to this definition") * PedestrianLL* = 33*[](#eLoadPatternType.PedestrianLL "Link to this definition") - PedestrianLLReduced* = 46*[](#eLoadPatternType.PedestrianLLReduced "Link to this definition") * Permit* = 54*[](#eLoadPatternType.Permit "Link to this definition") - Prestress* = 34*[](#eLoadPatternType.Prestress "Link to this definition") * PrestressTransfer* = 59*[](#eLoadPatternType.PrestressTransfer "Link to this definition") - Quake* = 5*[](#eLoadPatternType.Quake "Link to this definition") * QuakeDrift* = 61*[](#eLoadPatternType.QuakeDrift "Link to this definition") - QuakeVerticalOnly* = 62*[](#eLoadPatternType.QuakeVerticalOnly "Link to this definition") * ReduceLive* = 4*[](#eLoadPatternType.ReduceLive "Link to this definition") - Rooflive* = 11*[](#eLoadPatternType.Rooflive "Link to this definition") * SeaState* = 53*[](#eLoadPatternType.SeaState "Link to this definition") - Settlement* = 27*[](#eLoadPatternType.Settlement "Link to this definition") * Shrinkage* = 28*[](#eLoadPatternType.Shrinkage "Link to this definition") - Snow* = 7*[](#eLoadPatternType.Snow "Link to this definition") * SnowHighAltitude* = 47*[](#eLoadPatternType.SnowHighAltitude "Link to this definition") - StreamFlow* = 37*[](#eLoadPatternType.StreamFlow "Link to this definition") * SuperDead* = 2*[](#eLoadPatternType.SuperDead "Link to this definition") - Temperature* = 10*[](#eLoadPatternType.Temperature "Link to this definition") * TemperatureGradient* = 26*[](#eLoadPatternType.TemperatureGradient "Link to this definition") - VehicleCollision* = 24*[](#eLoadPatternType.VehicleCollision "Link to this definition") * VerticalEarthPressure* = 21*[](#eLoadPatternType.VerticalEarthPressure "Link to this definition") - VesselCollision* = 25*[](#eLoadPatternType.VesselCollision "Link to this definition") * WaterloadPressure* = 30*[](#eLoadPatternType.WaterloadPressure "Link to this definition") - Wave* = 14*[](#eLoadPatternType.Wave "Link to this definition") * Wind* = 6*[](#eLoadPatternType.Wind "Link to this definition") - WindOnLiveLoad* = 19*[](#eLoadPatternType.WindOnLiveLoad "Link to this definition") <!-- --> ## eMatCoupledType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eMatCoupledType "Direct link to eMatCoupledType") * *class *viktor.external.etabs.enums.eMatCoupledType(*\*values*)[](#eMatCoupledType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eMatCoupledType` values, mirroring the product API’s names so code reads like its docs. * FariaConcreteDamagePlasticity* = 4*[](#eMatCoupledType.FariaConcreteDamagePlasticity "Link to this definition") - ModifiedDarwinPecknoldConcrete* = 3*[](#eMatCoupledType.ModifiedDarwinPecknoldConcrete "Link to this definition") * None\_* = 1*[](#eMatCoupledType.None_ "Link to this definition") - VonMisesPlasticity* = 2*[](#eMatCoupledType.VonMisesPlasticity "Link to this definition") <!-- --> ## eMatType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eMatType "Direct link to eMatType") * *class *viktor.external.etabs.enums.eMatType(*\*values*)[](#eMatType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eMatType` values, mirroring the product API’s names so code reads like its docs. * Aluminum* = 4*[](#eMatType.Aluminum "Link to this definition") - ColdFormed* = 5*[](#eMatType.ColdFormed "Link to this definition") * Concrete* = 2*[](#eMatType.Concrete "Link to this definition") - Masonry* = 8*[](#eMatType.Masonry "Link to this definition") * NoDesign* = 3*[](#eMatType.NoDesign "Link to this definition") - Rebar* = 6*[](#eMatType.Rebar "Link to this definition") * Steel* = 1*[](#eMatType.Steel "Link to this definition") - Tendon* = 7*[](#eMatType.Tendon "Link to this definition") <!-- --> ## eMatTypeAluminum[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eMatTypeAluminum "Direct link to eMatTypeAluminum") * *class *viktor.external.etabs.enums.eMatTypeAluminum(*\*values*)[](#eMatTypeAluminum "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eMatTypeAluminum` values, mirroring the product API’s names so code reads like its docs. * SubType\_5052\_H34* = 3*[](#eMatTypeAluminum.SubType_5052_H34 "Link to this definition") - SubType\_6061\_T6* = 1*[](#eMatTypeAluminum.SubType_6061_T6 "Link to this definition") * SubType\_6063\_T6* = 2*[](#eMatTypeAluminum.SubType_6063_T6 "Link to this definition") <!-- --> ## eMatTypeColdFormed[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eMatTypeColdFormed "Direct link to eMatTypeColdFormed") * *class *viktor.external.etabs.enums.eMatTypeColdFormed(*\*values*)[](#eMatTypeColdFormed "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eMatTypeColdFormed` values, mirroring the product API’s names so code reads like its docs. * ASTM\_A653SQGr33* = 1*[](#eMatTypeColdFormed.ASTM_A653SQGr33 "Link to this definition") - ASTM\_A653SQGr50* = 2*[](#eMatTypeColdFormed.ASTM_A653SQGr50 "Link to this definition") <!-- --> ## eMatTypeConcrete[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eMatTypeConcrete "Direct link to eMatTypeConcrete") * *class *viktor.external.etabs.enums.eMatTypeConcrete(*\*values*)[](#eMatTypeConcrete "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eMatTypeConcrete` values, mirroring the product API’s names so code reads like its docs. * Chinese\_C20\_NormalWeight* = 9*[](#eMatTypeConcrete.Chinese_C20_NormalWeight "Link to this definition") - Chinese\_C30\_NormalWeight* = 10*[](#eMatTypeConcrete.Chinese_C30_NormalWeight "Link to this definition") * Chinese\_C40\_NormalWeight* = 11*[](#eMatTypeConcrete.Chinese_C40_NormalWeight "Link to this definition") - EN\_C12\_NormalWeight* = 22*[](#eMatTypeConcrete.EN_C12_NormalWeight "Link to this definition") * EN\_C16\_NormalWeight* = 23*[](#eMatTypeConcrete.EN_C16_NormalWeight "Link to this definition") - EN\_C20\_NormalWeight* = 24*[](#eMatTypeConcrete.EN_C20_NormalWeight "Link to this definition") * EN\_C25\_NormalWeight* = 25*[](#eMatTypeConcrete.EN_C25_NormalWeight "Link to this definition") - EN\_C30\_NormalWeight* = 26*[](#eMatTypeConcrete.EN_C30_NormalWeight "Link to this definition") * EN\_C35\_NormalWeight* = 27*[](#eMatTypeConcrete.EN_C35_NormalWeight "Link to this definition") - EN\_C40\_NormalWeight* = 28*[](#eMatTypeConcrete.EN_C40_NormalWeight "Link to this definition") * EN\_C45\_NormalWeight* = 29*[](#eMatTypeConcrete.EN_C45_NormalWeight "Link to this definition") - EN\_C50\_NormalWeight* = 30*[](#eMatTypeConcrete.EN_C50_NormalWeight "Link to this definition") * EN\_C55\_NormalWeight* = 31*[](#eMatTypeConcrete.EN_C55_NormalWeight "Link to this definition") - EN\_C60\_NormalWeight* = 32*[](#eMatTypeConcrete.EN_C60_NormalWeight "Link to this definition") * EN\_C70\_NormalWeight* = 33*[](#eMatTypeConcrete.EN_C70_NormalWeight "Link to this definition") - EN\_C80\_NormalWeight* = 34*[](#eMatTypeConcrete.EN_C80_NormalWeight "Link to this definition") * EN\_C90\_NormalWeight* = 35*[](#eMatTypeConcrete.EN_C90_NormalWeight "Link to this definition") - FC3000\_LightWeight* = 5*[](#eMatTypeConcrete.FC3000_LightWeight "Link to this definition") * FC3000\_NormalWeight* = 1*[](#eMatTypeConcrete.FC3000_NormalWeight "Link to this definition") - FC4000\_LightWeight* = 6*[](#eMatTypeConcrete.FC4000_LightWeight "Link to this definition") * FC4000\_NormalWeight* = 2*[](#eMatTypeConcrete.FC4000_NormalWeight "Link to this definition") - FC5000\_LightWeight* = 7*[](#eMatTypeConcrete.FC5000_LightWeight "Link to this definition") * FC5000\_NormalWeight* = 3*[](#eMatTypeConcrete.FC5000_NormalWeight "Link to this definition") - FC6000\_LightWeight* = 8*[](#eMatTypeConcrete.FC6000_LightWeight "Link to this definition") * FC6000\_NormalWeight* = 4*[](#eMatTypeConcrete.FC6000_NormalWeight "Link to this definition") - Indian\_M15\_NormalWeight* = 12*[](#eMatTypeConcrete.Indian_M15_NormalWeight "Link to this definition") * Indian\_M20\_NormalWeight* = 13*[](#eMatTypeConcrete.Indian_M20_NormalWeight "Link to this definition") - Indian\_M25\_NormalWeight* = 14*[](#eMatTypeConcrete.Indian_M25_NormalWeight "Link to this definition") * Indian\_M30\_NormalWeight* = 15*[](#eMatTypeConcrete.Indian_M30_NormalWeight "Link to this definition") - Indian\_M35\_NormalWeight* = 16*[](#eMatTypeConcrete.Indian_M35_NormalWeight "Link to this definition") * Indian\_M40\_NormalWeight* = 17*[](#eMatTypeConcrete.Indian_M40_NormalWeight "Link to this definition") - Indian\_M45\_NormalWeight* = 18*[](#eMatTypeConcrete.Indian_M45_NormalWeight "Link to this definition") * Indian\_M50\_NormalWeight* = 19*[](#eMatTypeConcrete.Indian_M50_NormalWeight "Link to this definition") - Indian\_M55\_NormalWeight* = 20*[](#eMatTypeConcrete.Indian_M55_NormalWeight "Link to this definition") * Indian\_M60\_NormalWeight* = 21*[](#eMatTypeConcrete.Indian_M60_NormalWeight "Link to this definition") <!-- --> ## eMatTypeRebar[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eMatTypeRebar "Direct link to eMatTypeRebar") * *class *viktor.external.etabs.enums.eMatTypeRebar(*\*values*)[](#eMatTypeRebar "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eMatTypeRebar` values, mirroring the product API’s names so code reads like its docs. * ASTM\_A615Gr40* = 1*[](#eMatTypeRebar.ASTM_A615Gr40 "Link to this definition") - ASTM\_A615Gr60* = 2*[](#eMatTypeRebar.ASTM_A615Gr60 "Link to this definition") * ASTM\_A615Gr75* = 3*[](#eMatTypeRebar.ASTM_A615Gr75 "Link to this definition") - ASTM\_A706* = 4*[](#eMatTypeRebar.ASTM_A706 "Link to this definition") * Chinese\_HPB235* = 5*[](#eMatTypeRebar.Chinese_HPB235 "Link to this definition") - Chinese\_HRB335* = 6*[](#eMatTypeRebar.Chinese_HRB335 "Link to this definition") * Chinese\_HRB400* = 7*[](#eMatTypeRebar.Chinese_HRB400 "Link to this definition") - Indian\_HYSD415* = 9*[](#eMatTypeRebar.Indian_HYSD415 "Link to this definition") * Indian\_HYSD500* = 10*[](#eMatTypeRebar.Indian_HYSD500 "Link to this definition") - Indian\_HYSD550* = 11*[](#eMatTypeRebar.Indian_HYSD550 "Link to this definition") * Indian\_Mild250* = 8*[](#eMatTypeRebar.Indian_Mild250 "Link to this definition") <!-- --> ## eMatTypeSteel[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eMatTypeSteel "Direct link to eMatTypeSteel") * *class *viktor.external.etabs.enums.eMatTypeSteel(*\*values*)[](#eMatTypeSteel "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eMatTypeSteel` values, mirroring the product API’s names so code reads like its docs. * ASTM\_A36* = 1*[](#eMatTypeSteel.ASTM_A36 "Link to this definition") - ASTM\_A500GrB\_Fy42* = 3*[](#eMatTypeSteel.ASTM_A500GrB_Fy42 "Link to this definition") * ASTM\_A500GrB\_Fy46* = 4*[](#eMatTypeSteel.ASTM_A500GrB_Fy46 "Link to this definition") - ASTM\_A53GrB* = 2*[](#eMatTypeSteel.ASTM_A53GrB "Link to this definition") * ASTM\_A572Gr50* = 5*[](#eMatTypeSteel.ASTM_A572Gr50 "Link to this definition") - ASTM\_A913Gr50* = 6*[](#eMatTypeSteel.ASTM_A913Gr50 "Link to this definition") * ASTM\_A992\_Fy50* = 7*[](#eMatTypeSteel.ASTM_A992_Fy50 "Link to this definition") - Chinese\_Q235* = 8*[](#eMatTypeSteel.Chinese_Q235 "Link to this definition") * Chinese\_Q345* = 9*[](#eMatTypeSteel.Chinese_Q345 "Link to this definition") - Chinese\_Q355* = 16*[](#eMatTypeSteel.Chinese_Q355 "Link to this definition") * EN100252\_S235* = 12*[](#eMatTypeSteel.EN100252_S235 "Link to this definition") - EN100252\_S275* = 13*[](#eMatTypeSteel.EN100252_S275 "Link to this definition") * EN100252\_S355* = 14*[](#eMatTypeSteel.EN100252_S355 "Link to this definition") - EN100252\_S450* = 15*[](#eMatTypeSteel.EN100252_S450 "Link to this definition") * Indian\_Fe250* = 10*[](#eMatTypeSteel.Indian_Fe250 "Link to this definition") - Indian\_Fe345* = 11*[](#eMatTypeSteel.Indian_Fe345 "Link to this definition") <!-- --> ## eMatTypeTendon[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eMatTypeTendon "Direct link to eMatTypeTendon") * *class *viktor.external.etabs.enums.eMatTypeTendon(*\*values*)[](#eMatTypeTendon "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eMatTypeTendon` values, mirroring the product API’s names so code reads like its docs. * ASTM\_A416Gr250* = 1*[](#eMatTypeTendon.ASTM_A416Gr250 "Link to this definition") - ASTM\_A416Gr270* = 2*[](#eMatTypeTendon.ASTM_A416Gr270 "Link to this definition") <!-- --> ## eNamedSetType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eNamedSetType "Direct link to eNamedSetType") * *class *viktor.external.etabs.enums.eNamedSetType(*\*values*)[](#eNamedSetType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eNamedSetType` values, mirroring the product API’s names so code reads like its docs. * All* = 0*[](#eNamedSetType.All "Link to this definition") - BridgeCalculationReport* = 17*[](#eNamedSetType.BridgeCalculationReport "Link to this definition") * BridgeCalculationReportSub* = 18*[](#eNamedSetType.BridgeCalculationReportSub "Link to this definition") - BridgeSeismicReport* = 15*[](#eNamedSetType.BridgeSeismicReport "Link to this definition") * BridgeSuperstructureResponse* = 16*[](#eNamedSetType.BridgeSuperstructureResponse "Link to this definition") - JointTHResponseSpectra* = 8*[](#eNamedSetType.JointTHResponseSpectra "Link to this definition") * NamedDisplay* = 9*[](#eNamedSetType.NamedDisplay "Link to this definition") - PlotFunctionTraces* = 10*[](#eNamedSetType.PlotFunctionTraces "Link to this definition") * PushoverCurve* = 11*[](#eNamedSetType.PushoverCurve "Link to this definition") - RunAnalysis* = 2*[](#eNamedSetType.RunAnalysis "Link to this definition") * RunBridgeDesignSeismic* = 5*[](#eNamedSetType.RunBridgeDesignSeismic "Link to this definition") - RunBridgeDesignSubstructure* = 4*[](#eNamedSetType.RunBridgeDesignSubstructure "Link to this definition") * RunBridgeDesignSuperstructure* = 3*[](#eNamedSetType.RunBridgeDesignSuperstructure "Link to this definition") - RunBridgeRatingSuperstructure* = 6*[](#eNamedSetType.RunBridgeRatingSuperstructure "Link to this definition") * RunMemberRating* = 7*[](#eNamedSetType.RunMemberRating "Link to this definition") - TableGroupSuperset* = 14*[](#eNamedSetType.TableGroupSuperset "Link to this definition") * TableSet* = 13*[](#eNamedSetType.TableSet "Link to this definition") - UpdateBridgeObject* = 1*[](#eNamedSetType.UpdateBridgeObject "Link to this definition") * VirtualWork* = 12*[](#eNamedSetType.VirtualWork "Link to this definition") <!-- --> ## eObjType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eObjType "Direct link to eObjType") * *class *viktor.external.etabs.enums.eObjType(*\*values*)[](#eObjType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eObjType` values, mirroring the product API’s names so code reads like its docs. * Area* = 3*[](#eObjType.Area "Link to this definition") - Frame* = 2*[](#eObjType.Frame "Link to this definition") * Point* = 1*[](#eObjType.Point "Link to this definition") - Solid* = 6*[](#eObjType.Solid "Link to this definition") <!-- --> ## eReturnCode[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eReturnCode "Direct link to eReturnCode") * *class *viktor.external.etabs.enums.eReturnCode(*\*values*)[](#eReturnCode "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eReturnCode` values, mirroring the product API’s names so code reads like its docs. * Deprecated* = -98*[](#eReturnCode.Deprecated "Link to this definition") - NoError* = 0*[](#eReturnCode.NoError "Link to this definition") * NotApplicable* = -100*[](#eReturnCode.NotApplicable "Link to this definition") - NotImplemented* = -99*[](#eReturnCode.NotImplemented "Link to this definition") * TableDoesNotExist* = -96*[](#eReturnCode.TableDoesNotExist "Link to this definition") - TableIsObsolete* = -97*[](#eReturnCode.TableIsObsolete "Link to this definition") * UnspecifiedError* = 1*[](#eReturnCode.UnspecifiedError "Link to this definition") <!-- --> ## eShellType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eShellType "Direct link to eShellType") * *class *viktor.external.etabs.enums.eShellType(*\*values*)[](#eShellType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eShellType` values, mirroring the product API’s names so code reads like its docs. * Layered* = 6*[](#eShellType.Layered "Link to this definition") - Membrane* = 3*[](#eShellType.Membrane "Link to this definition") * PlateThick\_DO\_NOT\_USE* = 5*[](#eShellType.PlateThick_DO_NOT_USE "Link to this definition") - PlateThin\_DO\_NOT\_USE* = 4*[](#eShellType.PlateThin_DO_NOT_USE "Link to this definition") * ShellThick* = 2*[](#eShellType.ShellThick "Link to this definition") - ShellThin* = 1*[](#eShellType.ShellThin "Link to this definition") <!-- --> ## eSlabType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eSlabType "Direct link to eSlabType") * *class *viktor.external.etabs.enums.eSlabType(*\*values*)[](#eSlabType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eSlabType` values, mirroring the product API’s names so code reads like its docs. * Drop* = 1*[](#eSlabType.Drop "Link to this definition") - Footing* = 6*[](#eSlabType.Footing "Link to this definition") * Mat* = 5*[](#eSlabType.Mat "Link to this definition") - Ribbed* = 3*[](#eSlabType.Ribbed "Link to this definition") * Slab* = 0*[](#eSlabType.Slab "Link to this definition") - Stiff\_DO\_NOT\_USE* = 2*[](#eSlabType.Stiff_DO_NOT_USE "Link to this definition") * Waffle* = 4*[](#eSlabType.Waffle "Link to this definition") <!-- --> ## eSolidPropFormulationType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eSolidPropFormulationType "Direct link to eSolidPropFormulationType") * *class *viktor.external.etabs.enums.eSolidPropFormulationType(*\*values*)[](#eSolidPropFormulationType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eSolidPropFormulationType` values, mirroring the product API’s names so code reads like its docs. * LegacyQuadratic* = 1*[](#eSolidPropFormulationType.LegacyQuadratic "Link to this definition") - LegacyStandard* = 0*[](#eSolidPropFormulationType.LegacyStandard "Link to this definition") * Quadratic* = 3*[](#eSolidPropFormulationType.Quadratic "Link to this definition") - Standard* = 2*[](#eSolidPropFormulationType.Standard "Link to this definition") <!-- --> ## eSuperObjectClass[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eSuperObjectClass "Direct link to eSuperObjectClass") * *class *viktor.external.etabs.enums.eSuperObjectClass(*\*values*)[](#eSuperObjectClass "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eSuperObjectClass` values, mirroring the product API’s names so code reads like its docs. * BridgeFoundation* = 3*[](#eSuperObjectClass.BridgeFoundation "Link to this definition") - Foundation* = 2*[](#eSuperObjectClass.Foundation "Link to this definition") * None\_* = 0*[](#eSuperObjectClass.None_ "Link to this definition") - SuperObject* = 1*[](#eSuperObjectClass.SuperObject "Link to this definition") <!-- --> ## eTemperature[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eTemperature "Direct link to eTemperature") * *class *viktor.external.etabs.enums.eTemperature(*\*values*)[](#eTemperature "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eTemperature` values, mirroring the product API’s names so code reads like its docs. * C* = 2*[](#eTemperature.C "Link to this definition") - F* = 1*[](#eTemperature.F "Link to this definition") * NotApplicable* = 0*[](#eTemperature.NotApplicable "Link to this definition") <!-- --> ## eTemplateType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eTemplateType "Direct link to eTemplateType") * *class *viktor.external.etabs.enums.eTemplateType(*\*values*)[](#eTemplateType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eTemplateType` values, mirroring the product API’s names so code reads like its docs. * Advanced* = 17*[](#eTemplateType.Advanced "Link to this definition") - Barrel* = 12*[](#eTemplateType.Barrel "Link to this definition") * Beam* = 2*[](#eTemplateType.Beam "Link to this definition") - BracedFrame* = 7*[](#eTemplateType.BracedFrame "Link to this definition") * Bridge* = 11*[](#eTemplateType.Bridge "Link to this definition") - BridgeWizard* = 23*[](#eTemplateType.BridgeWizard "Link to this definition") * CableBridges* = 29*[](#eTemplateType.CableBridges "Link to this definition") - Clear* = 1*[](#eTemplateType.Clear "Link to this definition") * Cylinder* = 13*[](#eTemplateType.Cylinder "Link to this definition") - Dome* = 14*[](#eTemplateType.Dome "Link to this definition") * EccentricFrame* = 8*[](#eTemplateType.EccentricFrame "Link to this definition") - Floor* = 16*[](#eTemplateType.Floor "Link to this definition") * Frame2D* = 21*[](#eTemplateType.Frame2D "Link to this definition") - Frame3D* = 22*[](#eTemplateType.Frame3D "Link to this definition") * Grid* = 0*[](#eTemplateType.Grid "Link to this definition") - PerimeterFrame* = 9*[](#eTemplateType.PerimeterFrame "Link to this definition") * PipesAndPlates* = 24*[](#eTemplateType.PipesAndPlates "Link to this definition") - PortalFrame* = 6*[](#eTemplateType.PortalFrame "Link to this definition") * ShearWall* = 15*[](#eTemplateType.ShearWall "Link to this definition") - Shells* = 25*[](#eTemplateType.Shells "Link to this definition") * SlopedTruss* = 3*[](#eTemplateType.SlopedTruss "Link to this definition") - SolidModels* = 26*[](#eTemplateType.SolidModels "Link to this definition") * SpaceFrame* = 10*[](#eTemplateType.SpaceFrame "Link to this definition") - SpaceTruss* = 5*[](#eTemplateType.SpaceTruss "Link to this definition") * Staircases* = 28*[](#eTemplateType.Staircases "Link to this definition") - StorageStructures* = 27*[](#eTemplateType.StorageStructures "Link to this definition") * Truss2D* = 19*[](#eTemplateType.Truss2D "Link to this definition") - Truss3D* = 20*[](#eTemplateType.Truss3D "Link to this definition") * UndergoundConcrete* = 18*[](#eTemplateType.UndergoundConcrete "Link to this definition") - VerticalTruss* = 4*[](#eTemplateType.VerticalTruss "Link to this definition") <!-- --> ## eUnits[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eUnits "Direct link to eUnits") * *class *viktor.external.etabs.enums.eUnits(*\*values*)[](#eUnits "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eUnits` values, mirroring the product API’s names so code reads like its docs. * N\_cm\_C* = 15*[](#eUnits.N_cm_C "Link to this definition") - N\_m\_C* = 10*[](#eUnits.N_m_C "Link to this definition") * N\_mm\_C* = 9*[](#eUnits.N_mm_C "Link to this definition") - Ton\_cm\_C* = 16*[](#eUnits.Ton_cm_C "Link to this definition") * Ton\_m\_C* = 12*[](#eUnits.Ton_m_C "Link to this definition") - Ton\_mm\_C* = 11*[](#eUnits.Ton_mm_C "Link to this definition") * kN\_cm\_C* = 13*[](#eUnits.kN_cm_C "Link to this definition") - kN\_m\_C* = 6*[](#eUnits.kN_m_C "Link to this definition") * kN\_mm\_C* = 5*[](#eUnits.kN_mm_C "Link to this definition") - kgf\_cm\_C* = 14*[](#eUnits.kgf_cm_C "Link to this definition") * kgf\_m\_C* = 8*[](#eUnits.kgf_m_C "Link to this definition") - kgf\_mm\_C* = 7*[](#eUnits.kgf_mm_C "Link to this definition") * kip\_ft\_F* = 4*[](#eUnits.kip_ft_F "Link to this definition") - kip\_in\_F* = 3*[](#eUnits.kip_in_F "Link to this definition") * lb\_ft\_F* = 2*[](#eUnits.lb_ft_F "Link to this definition") - lb\_in\_F* = 1*[](#eUnits.lb_in_F "Link to this definition") <!-- --> ## eWallPierRebarLayerType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eWallPierRebarLayerType "Direct link to eWallPierRebarLayerType") * *class *viktor.external.etabs.enums.eWallPierRebarLayerType(*\*values*)[](#eWallPierRebarLayerType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eWallPierRebarLayerType` values, mirroring the product API’s names so code reads like its docs. * Confinement\_EndZoneI* = 5*[](#eWallPierRebarLayerType.Confinement_EndZoneI "Link to this definition") - Confinement\_EndZoneJ* = 6*[](#eWallPierRebarLayerType.Confinement_EndZoneJ "Link to this definition") * Diagonal\_Each* = 7*[](#eWallPierRebarLayerType.Diagonal_Each "Link to this definition") - Horizontal\_Distributed\_MiddleZone\_Eachface* = 2*[](#eWallPierRebarLayerType.Horizontal_Distributed_MiddleZone_Eachface "Link to this definition") * Vertical\_Distributed\_EndZoneI\_Total* = 3*[](#eWallPierRebarLayerType.Vertical_Distributed_EndZoneI_Total "Link to this definition") - Vertical\_Distributed\_EndZoneJ\_Total* = 4*[](#eWallPierRebarLayerType.Vertical_Distributed_EndZoneJ_Total "Link to this definition") * Vertical\_Distributed\_MiddleZone\_Eachface* = 1*[](#eWallPierRebarLayerType.Vertical_Distributed_MiddleZone_Eachface "Link to this definition") <!-- --> ## eWallPropType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eWallPropType "Direct link to eWallPropType") * *class *viktor.external.etabs.enums.eWallPropType(*\*values*)[](#eWallPropType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eWallPropType` values, mirroring the product API’s names so code reads like its docs. * AutoSelectList* = 2*[](#eWallPropType.AutoSelectList "Link to this definition") - Specified* = 1*[](#eWallPropType.Specified "Link to this definition") <!-- --> ## eWallSpandrelRebarLayerType[​](https://docs.viktor.ai/sdk/api/external/etabs/.md#_eWallSpandrelRebarLayerType "Direct link to eWallSpandrelRebarLayerType") * *class *viktor.external.etabs.enums.eWallSpandrelRebarLayerType(*\*values*)[](#eWallSpandrelRebarLayerType "Link to this definition") Bases: `IntEnum` New in 14.31.0 ETABS `eWallSpandrelRebarLayerType` values, mirroring the product API’s names so code reads like its docs. * Diagonal\_Each* = 5*[](#eWallSpandrelRebarLayerType.Diagonal_Each "Link to this definition") - Horizontal\_Bottom\_Total* = 2*[](#eWallSpandrelRebarLayerType.Horizontal_Bottom_Total "Link to this definition") * Horizontal\_Distributed\_Eachface* = 3*[](#eWallSpandrelRebarLayerType.Horizontal_Distributed_Eachface "Link to this definition") - Horizontal\_Top\_Total* = 1*[](#eWallSpandrelRebarLayerType.Horizontal_Top_Total "Link to this definition") * Vertical\_Ties\_Distributed* = 4*[](#eWallSpandrelRebarLayerType.Vertical_Ties_Distributed "Link to this definition") --- # viktor.external.excel <!-- --> <!-- --> <!-- --> ## Excel[​](https://docs.viktor.ai/sdk/api/external/excel/.md#_Excel "Direct link to Excel") * *class *viktor.external.excel.Excel(*template*, *named\_input\_cells=None*, *direct\_input\_cells=None*, *macros=None*, *named\_output\_cells=None*, *direct\_output\_cells=None*, *extension='.xlsm'*, *typed\_results=False*)[](#Excel "Link to this definition") Bases: [`ExternalProgram`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram "viktor.external.external_program.ExternalProgram") Excel can be used to perform an analysis of an Excel sheet using a third-party worker. This Excel sheet may contain macros (i.e. .xlsm extension). To start an analysis call the method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute"), with an appropriate timeout (in seconds). To retrieve the results call the method [`get_named_cell_result()`](#Excel.get_named_cell_result "viktor.external.excel.Excel.get_named_cell_result") or [`get_direct_cell_result()`](#Excel.get_direct_cell_result "viktor.external.excel.Excel.get_direct_cell_result"), after [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute"). Example: ``` named_input_cells = [NamedInputCell('x', x)] direct_output_cells = [DirectOutputCell('Sheet1', 'B', 3)] excel_analysis = Excel(template, named_input_cells=named_input_cells, direct_output_cells=direct_output_cells, extension='.xlsx') excel_analysis.execute(timeout=10) result = excel.get_direct_cell_result('Sheet1', 'B', 3) ``` * Parameters: * **template** (`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Excel template to be filled, executed and returned. * **named\_input\_cells** (`List`\[[`NamedInputCell`](https://docs.viktor.ai/sdk/api/external/spreadsheet/.md#NamedInputCell "viktor.external.spreadsheet.NamedInputCell")]) – A list of named cells containing input values. * **direct\_input\_cells** (`List`\[[`DirectInputCell`](https://docs.viktor.ai/sdk/api/external/spreadsheet/.md#DirectInputCell "viktor.external.spreadsheet.DirectInputCell")]) – A list of direct cells containing input values. * **macros** (`List`\[[`Macro`](#Macro "viktor.external.excel.Macro")]) – A list of macros to be executed. The order of the list is preserved. This means the first macro in the list will be executed first, the second macro wil be executed second, etc. * **named\_output\_cells** (`List`\[[`NamedOutputCell`](https://docs.viktor.ai/sdk/api/external/spreadsheet/.md#NamedOutputCell "viktor.external.spreadsheet.NamedOutputCell")]) – A list of named cells of which the result after evaluation is desired. * **direct\_output\_cells** (`List`\[[`DirectOutputCell`](https://docs.viktor.ai/sdk/api/external/spreadsheet/.md#DirectOutputCell "viktor.external.spreadsheet.DirectOutputCell")]) – A list of direct cells of which the result after evaluation is desired. * **extension** (`str`) – Extension of the file you want to evaluate: ‘.xlsm’ | ‘.xlsx’. * **typed\_results** (`bool`) – Cell results are of the same type as spreadsheet, if False, all values are str Exceptions which can be raised during calculation: - [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information * *property *error\_message*: str | None*[](#Excel.error_message "Link to this definition") The error string containing information from the Excel worker when available, None otherwise. - execute(*timeout=30*)[](#Excel.execute "Link to this definition") Run method to start an external Excel analysis using a VIKTOR worker. Note This method needs to be mocked in (automated) unit and integration tests. * Parameters: **timeout** (`int`) – Timeout period in seconds. * Raises: * TimeoutError when timeout has been exceeded * ConnectionError if no worker installed or connected * [`viktor.errors.LicenseError`](https://docs.viktor.ai/sdk/api/errors/.md#LicenseError "viktor.errors.LicenseError") if no license is available * [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError") if the external program cannot execute with the provided inputs * Return type: `None` * *property *filled\_template*: BytesIO*[](#Excel.filled_template "Link to this definition") A BytesIO object which contains the filled template if available, otherwise raises a SpreadsheetError. - get\_direct\_cell\_result(*sheet\_name*, *column*, *row*)[](#Excel.get_direct_cell_result "Link to this definition") Function which may be called after excel.execute(). It can be used to fetch the result of a direct cell. * Parameters: * **sheet\_name** (`str`) – Name of the worksheet of the desired cell. * **column** (`str`) – Name of the column of the desired cell. * **row** (`int`) – Name of the row of the desired cell. * Returns: The result contained in the cell corresponding to (sheet\_name, column, row). * Return type: Check `worker_version` to know which type of result is expected: * worker\_version < 1 returns the result with type str. * worker version >= 1 returns the result with type depending on cell type: > * cell type integer / long returns integer > > * cell type single / double / currency / decimal returns float > > * cell type string returns string > > * cell type boolean returns boolean > > * cell type date returns RFC 3339 format string (e.g. “1998-02-23T00:00:00Z”) * get\_filled\_template()[](#Excel.get_filled_template "Link to this definition") New in v13.5.0 Retrieve the filled-in template if available, otherwise raises a SpreadsheetError. * Return type: [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") - get\_named\_cell\_result(*name*)[](#Excel.get_named_cell_result "Link to this definition") Function which may be called after excel.execute(). It can be used to fetch the result of a named cell. * Parameters: **name** (`str`) – Name of the named cell of which the result is desired. * Returns: The result contained in the named cell corresponding to name. * Return type: Check `worker_version` to know which type of result is expected: * worker\_version < 1 returns the result with type str. * worker version >= 1 returns the result with type depending on cell type: > * cell type integer / long returns integer > > * cell type single / double / currency / decimal returns float > > * cell type string returns string > > * cell type boolean returns boolean > > * cell type date returns RFC 3339 format string (e.g. “1998-02-23T00:00:00Z”) * result\_available()[](#Excel.result_available "Link to this definition") * Return type: `bool` * Returns: True if excel has returned a result. Warning! This does not necessarily have to be a successful result. - *property *success*: bool | None*[](#Excel.success "Link to this definition") True if excel has returned a successful result, False if excel has returned an unsuccessful result, None otherwise. <!-- --> ## Macro[​](https://docs.viktor.ai/sdk/api/external/excel/.md#_Macro "Direct link to Macro") * *class *viktor.external.excel.Macro(*command*)[](#Macro "Link to this definition") Class for defining an Excel macro. * Parameters: **command** (`str`) – the name of the Excel Macro command. - serialize()[](#Macro.serialize "Link to this definition") * Return type: `dict` --- # viktor.external.external\_program <!-- --> <!-- --> <!-- --> ## ExternalProgram[​](https://docs.viktor.ai/sdk/api/external/external-program/.md#_ExternalProgram "Direct link to ExternalProgram") * *class *viktor.external.external\_program.ExternalProgram(*queue\_name*, *version*)[](#ExternalProgram "Link to this definition") Bases: `ABC` Warning Do not use this class directly in an application! Base-class of an external analysis. * Parameters: * **queue\_name** (`str`) – Name of the external integration. * **version** (`int`) – Version of the API between SDK <-> worker. - execute(*timeout=25*)[](#ExternalProgram.execute "Link to this definition") Run method to start an external analysis using a VIKTOR worker. Note This method needs to be mocked in (automated) unit and integration tests. * Parameters: **timeout** (`int`) – Timeout period in seconds. * Raises: * TimeoutError when timeout has been exceeded * ConnectionError if no worker installed or connected * LicenseError if no license is available * ExecutionError if the external program cannot execute with the provided inputs * Return type: `None` <!-- --> ## OAuth2Integration[​](https://docs.viktor.ai/sdk/api/external/external-program/.md#_OAuth2Integration "Direct link to OAuth2Integration") * *class *viktor.external.external\_program.OAuth2Integration(*name*)[](#OAuth2Integration "Link to this definition") New in 14.23.0 Third-party OAuth 2.0 integration. Usage: ``` integration = vkt.external.OAuth2Integration('my-oauth2-integration') access_token = integration.get_access_token() # use access_token to do request on host URL associated with integration 'my-oauth2-integration' ``` * get\_access\_token()[](#OAuth2Integration.get_access_token "Link to this definition") Obtain the personal access token * Raises: * PermissionDeniedError: needs login from user * ResourceNotFoundError: integration not found * PreconditionFailedError: integration not assigned to this app * Return type: `str` --- # viktor.external.generic <!-- --> <!-- --> <!-- --> ## GenericAnalysis[​](https://docs.viktor.ai/sdk/api/external/generic/.md#_GenericAnalysis "Direct link to GenericAnalysis") * *class *viktor.external.generic.GenericAnalysis(*files=None*, *executable\_key=None*, *output\_filenames=None*)[](#GenericAnalysis "Link to this definition") Bases: [`ExternalProgram`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram "viktor.external.external_program.ExternalProgram") GenericAnalysis can be used to evaluate an executable on third-party infrastructure. The executable is expected to be blocking, i.e. if the executable is invoked from command prompt, it should wait until the executable is finished. For security purposes the executable that should be called has to be defined in the configuration file of the worker. Usage: ``` files = [ ('input1.txt', file1), ('input2.txt', file2) ] generic_analysis = GenericAnalysis(files=files, executable_key="someexecutable", output_filenames=["output.txt"]) generic_analysis.execute(timeout=60) output_file = generic_analysis.get_output_file("output.txt") ``` Exceptions which can be raised during calculation: > * [`viktor.errors.LicenseError`](https://docs.viktor.ai/sdk/api/errors/.md#LicenseError "viktor.errors.LicenseError"): no license available > > * [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information * Parameters: * **files** (`List`\[`Tuple`\[`str`, `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]] | `None`) – Files that are transferred to the working directory on the server. Each file is a tuple containing the content and the filename which is used to save on the infrastructure. * **executable\_key** (`str`) – The key of the executable that needs to be evaluated. This key should be present in the configuration file of the worker. * **output\_filenames** (`List`\[`str`]) – A list of filenames (including extension) that are to be transferred back to the app. This filename is relative to the working directory. * Raises: **ValueError** – when no attribute is included in call. - get\_output\_file(*filename*, *\**, *as\_file=False*)[](#GenericAnalysis.get_output_file "Link to this definition") Method can be used to retrieve the results generated by running an external analysis. Call method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute") first and [`get_output_file()`](#GenericAnalysis.get_output_file "viktor.external.generic.GenericAnalysis.get_output_file") afterwards. * Parameters: * **filename** (`str`) – The name of the file (including extension) that you want to get. * **as\_file** (`bool`) – Return as BytesIO (default) or File * Return type: `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | `None` --- # viktor.external.grasshopper <!-- --> <!-- --> <!-- --> ## GrasshopperAnalysis[​](https://docs.viktor.ai/sdk/api/external/grasshopper/.md#_GrasshopperAnalysis "Direct link to GrasshopperAnalysis") * *class *viktor.external.grasshopper.GrasshopperAnalysis(*\**, *script*, *input\_parameters=None*)[](#GrasshopperAnalysis "Link to this definition") Bases: [`ExternalProgram`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram "viktor.external.external_program.ExternalProgram") New in v14.8.0 Perform an analysis using Grasshopper on a remote server by means of a worker. To start an analysis call the method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute"), with an appropriate timeout (in seconds). To retrieve the output, call [`get_output()`](#GrasshopperAnalysis.get_output "viktor.external.grasshopper.GrasshopperAnalysis.get_output"). Usage: ``` my_input_parameters = { 'my_int': 1, 'my_bool': True, 'my_string': "test", 'my_list': [1, 2, 3], 'my_dict': {'{0;0;0}': [1], '{0;1;1}': [1, 2, 3]} } grasshopper_analysis = GrasshopperAnalysis(script=my_grasshopper_script, input_parameters=my_input_parameters) grasshopper_analysis.execute(timeout=10) output = grasshopper_analysis.get_output() ``` Exceptions which can be raised during calculation: > * [`ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information * Parameters: * **script** ([`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Grasshopper script (.gh) * **input\_parameters** (`Dict`\[`str`, `Any`]) – Input parameters to be passed to the grasshopper script in the form of a float dict. Key names will be matched with the Hops parameter names in Grasshopper and substituted accordingly - get\_output()[](#GrasshopperAnalysis.get_output "Link to this definition") Retrieve the output generated by running the Grasshopper analysis. Call method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute") first and [`get_output()`](#GrasshopperAnalysis.get_output "viktor.external.grasshopper.GrasshopperAnalysis.get_output") afterward. The output is in the form: ``` { "absolutetolerance": float, "angletolerance": float, "modelunits": str, "algo": str, "pointer": str, "cachesolve": bool, "recursionlevel": int, "values": list[dict] "warnings": list[str], "errors": list[str] } ``` * Return type: `dict` --- # viktor.external.grlweap <!-- --> <!-- --> <!-- --> ## GRLWeapAnalysis[​](https://docs.viktor.ai/sdk/api/external/grlweap/.md#_GRLWeapAnalysis "Direct link to GRLWeapAnalysis") * *class *viktor.external.grlweap.GRLWeapAnalysis(*input\_file*)[](#GRLWeapAnalysis "Link to this definition") Bases: [`ExternalProgram`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram "viktor.external.external_program.ExternalProgram") GRLWeapAnalysis can be used to perform an analysis using GRLWeap on a third-party worker. To start an analysis call the method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute"), with an appropriate timeout (in seconds). To retrieve the results call the method [`get_output_file()`](#GRLWeapAnalysis.get_output_file "viktor.external.grlweap.GRLWeapAnalysis.get_output_file"), after [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute"). Usage: ``` grlweap_analysis = GRLWeapAnalysis(input_file=gwt_file) grlweap_analysis.execute(timeout=10) result = grlweap_analysis.get_output_file() ``` Exceptions which can be raised during calculation: - [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information * Parameters: **input\_file** (`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – .gwt input file. - get\_output\_file(*\**, *as\_file=False*)[](#GRLWeapAnalysis.get_output_file "Link to this definition") Method can be used to retrieve the results generated by running an external analysis. Call method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute") first and [`get_output_file()`](#GRLWeapAnalysis.get_output_file "viktor.external.grlweap.GRLWeapAnalysis.get_output_file") afterwards. * Parameters: **as\_file** (`bool`) – Return as BytesIO (default) or File New in v13.5.0 * Return type: `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | `None` --- # viktor.external.idea <!-- --> <!-- --> <!-- --> ## Beam[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_Beam "Direct link to Beam") * *class *viktor.external.idea\_rcs.idea\_rcs.Beam(*rcs*, *check\_section*)[](#Beam "Link to this definition") Bases: [`Member`](#Member "viktor.external.idea_rcs.idea_rcs.Member") Do not use this \_\_init\_\_ directly, but create the object by [`Model.create_beam()`](#Model.create_beam "viktor.external.idea_rcs.idea_rcs.Model.create_beam"). <!-- --> ## CompressionMember[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_CompressionMember "Direct link to CompressionMember") * *class *viktor.external.idea\_rcs.idea\_rcs.CompressionMember(*rcs*, *check\_section*)[](#CompressionMember "Link to this definition") Bases: [`Member`](#Member "viktor.external.idea_rcs.idea_rcs.Member") Do not use this \_\_init\_\_ directly, but create the object by [`Model.create_compression_member()`](#Model.create_compression_member "viktor.external.idea_rcs.idea_rcs.Model.create_compression_member"). <!-- --> ## GeneralShape[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_GeneralShape "Direct link to GeneralShape") * *class *viktor.external.idea\_rcs.idea\_rcs.GeneralShape(*outline*, *\**, *openings=None*)[](#GeneralShape "Link to this definition") Bases: [`SectionPrototype1D`](#SectionPrototype1D "viktor.external.idea_rcs.idea_rcs.SectionPrototype1D") General cross-section, defined by a set of coordinates. * Parameters: * **outline** (`Sequence`\[`Tuple`\[`float`, `float`]]) – Vertices which define the outline of the section (y, z). A minimum of 3 vertices is required, the outline is automatically closed. * **openings** (`Sequence`\[`Sequence`\[`Tuple`\[`float`, `float`]]]) – One or multiple openings, defined by vertices (y, z). A minimum of 3 vertices per opening is required, the opening is automatically closed. <!-- --> ## IdeaRcsAnalysis[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_IdeaRcsAnalysis "Direct link to IdeaRcsAnalysis") * *class *viktor.external.idea\_rcs.idea\_rcs.IdeaRcsAnalysis(*input\_file*, *\**, *return\_result\_xml=None*, *return\_rcs\_file=None*)[](#IdeaRcsAnalysis "Link to this definition") Bases: [`ExternalProgram`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram "viktor.external.external_program.ExternalProgram") Can be used to perform an analysis using IDEA StatiCa RCS on a third-party worker. To start an analysis call the method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute"), with an appropriate timeout (in seconds). To retrieve the results call the method [`get_output_file()`](#IdeaRcsAnalysis.get_output_file "viktor.external.idea_rcs.idea_rcs.IdeaRcsAnalysis.get_output_file"), after [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute"). Usage: ``` idea_rcs_file = File.from_data("idea rcs input file content") idea_rcs_analysis = IdeaRcsAnalysis(input_file=idea_rcs_file) idea_rcs_analysis.execute(timeout=10) result = idea_rcs_analysis.get_output_file() ``` Exceptions which can be raised during calculation: > * [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information * Parameters: * **input\_file** (`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – IDEA (Open)Model input XML file. * **return\_result\_xml** (`bool`) – Result .xml file will be available if set to True (default: True). * **return\_rcs\_file** (`bool`) – Input .ideaRcs file will be available if set to True (default: False). - get\_idea\_rcs\_file(*\**, *as\_file=False*)[](#IdeaRcsAnalysis.get_idea_rcs_file "Link to this definition") Method can be used to retrieve the .ideaRcs file which is converted from the (Open)Model input XML. The file is only available when return\_rcs\_file=True. [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute") must be called first. * Return type: `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | `None` * Returns: * File, if as\_file = True * BytesIO, if as\_file = False (default) * get\_output\_file(*\**, *as\_file=False*)[](#IdeaRcsAnalysis.get_output_file "Link to this definition") Method can be used to retrieve the results generated by running an external analysis. The file is only available when return\_result\_xml=True. [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute") must be called first. * Return type: `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | `None` * Returns: * File (encoding=’utf-16’), if as\_file = True * BytesIO (encoding=’utf-16’), if as\_file = False (default) <!-- --> ## Member[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_Member "Direct link to Member") * *class *viktor.external.idea\_rcs.idea\_rcs.Member(*rcs*, *check\_section*)[](#Member "Link to this definition") Base class of all member types. * *property *bars*: List\[[ReinforcedBar](https://docs.viktor.ai/sdk/api/external/idea/.md#ReinforcedBar "viktor.external.idea_rcs.objects.ReinforcedBar")]*[](#Member.bars "Link to this definition") - create\_bar(*coordinates*, *diameter*, *material*)[](#Member.create_bar "Link to this definition") Create a reinforced bar on the reinforced cross-section. * Parameters: * **coordinates** (`Tuple`\[`float`, `float`]) – (X, Y) coordinate of the bar \[m]. * **diameter** (`float`) – Diameter of the bar \[m]. * **material** ([`MatReinforcement`](https://docs.viktor.ai/sdk/api/external/idea/.md#MatReinforcement "viktor.external.idea_rcs.objects.MatReinforcement")) – Reinforcement material (created by [`create_matreinforcement_ec2()`](#OpenModel.create_matreinforcement_ec2 "viktor.external.idea_rcs.idea_rcs.OpenModel.create_matreinforcement_ec2")). * Return type: `None` * create\_bar\_layer(*\**, *origin*, *diameter*, *material*, *number\_of\_bars*, *delta\_y=None*, *delta\_z=None*)[](#Member.create_bar_layer "Link to this definition") Create multiple reinforced bars on the reinforced cross-section, positioned on a line. * Parameters: * **origin** (`Tuple`\[`float`, `float`]) – Origin point (Y, Z) \[m]. * **diameter** (`float`) – Diameter of the bar \[m]. * **material** ([`MatReinforcement`](https://docs.viktor.ai/sdk/api/external/idea/.md#MatReinforcement "viktor.external.idea_rcs.objects.MatReinforcement")) – Reinforcement material (created by [`create_matreinforcement_ec2()`](#OpenModel.create_matreinforcement_ec2 "viktor.external.idea_rcs.idea_rcs.OpenModel.create_matreinforcement_ec2")). * **number\_of\_bars** (`int`) – Number of bars (minimum of 2). * **delta\_y** (`float`) – Distance between origin bar and the last bar in y-direction \[m]. * **delta\_z** (`float`) – Distance between origin bar and the last bar in z-direction \[m]. * Return type: `None` - create\_extreme(*\**, *description=None*, *accidental=None*, *fatigue=None*, *frequent=None*, *fundamental=None*, *characteristic=None*, *quasi\_permanent=None*)[](#Member.create_extreme "Link to this definition") Create an extreme case with corresponding internal forces on the beam for checking. * Parameters: * **description** (`str`) – Description of the extreme (default: ‘{section\_name} - E {i}’). New in v14.6.0 * **accidental** ([`LoadingULS`](https://docs.viktor.ai/sdk/api/external/idea/.md#LoadingULS "viktor.external.idea_rcs.objects.LoadingULS")) – Accidental loading. * **fatigue** ([`FatigueLoading`](https://docs.viktor.ai/sdk/api/external/idea/.md#FatigueLoading "viktor.external.idea_rcs.objects.FatigueLoading")) – Fatigue loading. * **frequent** ([`LoadingSLS`](https://docs.viktor.ai/sdk/api/external/idea/.md#LoadingSLS "viktor.external.idea_rcs.objects.LoadingSLS")) – Frequent loading. * **fundamental** ([`LoadingULS`](https://docs.viktor.ai/sdk/api/external/idea/.md#LoadingULS "viktor.external.idea_rcs.objects.LoadingULS")) – Fundamental loading. * **characteristic** ([`LoadingSLS`](https://docs.viktor.ai/sdk/api/external/idea/.md#LoadingSLS "viktor.external.idea_rcs.objects.LoadingSLS")) – Characteristic loading. * **quasi\_permanent** ([`LoadingSLS`](https://docs.viktor.ai/sdk/api/external/idea/.md#LoadingSLS "viktor.external.idea_rcs.objects.LoadingSLS")) – Quasi-Permanent loading. * Return type: `None` * create\_stirrup(*points*, *diameter*, *material*, *distance*, *shear\_check=None*, *torsion\_check=None*, *mandrel\_diameter\_factor=None*, *anchorage\_length=None*)[](#Member.create_stirrup "Link to this definition") Create a stirrup on the reinforced cross-section. * Parameters: * **points** (`Sequence`\[`Tuple`\[`float`, `float`] | `Tuple`\[`Tuple`\[`float`, `float`], `Tuple`\[`float`, `float`]]]) – Sequence of (X, Y) coordinates \[m] of the stirrup vertices, connected by straight line segments. For arc-segments use ((X\_end, Y\_end), (X\_on\_arc, Y\_on\_arc)). * **diameter** (`float`) – Diameter of the stirrup \[m]. * **material** ([`MatReinforcement`](https://docs.viktor.ai/sdk/api/external/idea/.md#MatReinforcement "viktor.external.idea_rcs.objects.MatReinforcement")) – Reinforcement material (created by [`create_matreinforcement_ec2()`](#OpenModel.create_matreinforcement_ec2 "viktor.external.idea_rcs.idea_rcs.OpenModel.create_matreinforcement_ec2")). * **distance** (`float`) – Longitudinal distance between stirrups \[m]. * **shear\_check** (`bool`) – Take stirrup into account in shear check (default: False). * **torsion\_check** (`bool`) – Take stirrup into account in torsion check (default: False). * **mandrel\_diameter\_factor** (`float`) – Inner diameter of mandrel as multiple of stirrup diameter \[-] (default: 1.0). * **anchorage\_length** (`float`) – Anchorage length \[m] (default: 0.0). * Return type: `None` - *property *extremes*: List\[[CheckSectionExtreme](https://docs.viktor.ai/sdk/api/external/idea/.md#CheckSectionExtreme "viktor.external.idea_rcs.objects.CheckSectionExtreme")]*[](#Member.extremes "Link to this definition") * *property *stirrups*: List\[[Stirrup](https://docs.viktor.ai/sdk/api/external/idea/.md#Stirrup "viktor.external.idea_rcs.objects.Stirrup")]*[](#Member.stirrups "Link to this definition") <!-- --> ## Model[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_Model "Direct link to Model") * *class *viktor.external.idea\_rcs.idea\_rcs.Model(*\**, *project\_data=None*, *code\_settings=None*)[](#Model "Link to this definition") Bases: `_Model` Can be used to construct an IDEA-RCS model and generate its corresponding input XML file. This file can in turn be used as input of [`IdeaRcsAnalysis`](#IdeaRcsAnalysis "viktor.external.idea_rcs.idea_rcs.IdeaRcsAnalysis"). For a more detailed elaboration, please see the guide. Alternatively, you can use [`OpenModel`](#OpenModel "viktor.external.idea_rcs.idea_rcs.OpenModel"). Warning Use this binding at own risk. Whether an input XML file represents a valid model is dependent on many things, e.g. on the combination of certain parameters. The Model does not give any guarantees on this. It is therefore important to always validate your model by hand thoroughly, before using it in an automated way within your app! Example usage: ``` # Initialize the model. model = Model() # empty model, or optionally pass ProjectData and/or CodeSettings # Create the desired material(s). cs_mat = model.create_concrete_material(ConcreteMaterial.C12_15) mat_reinf = model.create_reinforcement_material(ReinforcementMaterial.B_400A) # Create a beam (or other type of member) to be checked. cross_section = RectSection(0.5, 1.0) beam = model.create_beam(cross_section, cs_mat) # Create bars (and stirrups) as desired bar_locations = [(-0.101, -0.175), (0.101, -0.175), (0.101, 0.175), (-0.101, 0.175)] bar_diameters = [0.016, 0.016, 0.016, 0.016] for coords, diameter in zip(bar_locations, bar_diameters): beam.create_bar(coords, diameter, mat_reinf) # Add extreme(s) freq = LoadingSLS(ResultOfInternalForces(N=-100000, My=210000)) fund = LoadingULS(ResultOfInternalForces(N=-99999, My=200000)) beam.create_extreme(frequent=freq, fundamental=fund) # Generate the input XML file. input_xml = model.generate_xml_input() ``` * Parameters: * **project\_data** ([`ProjectData`](https://docs.viktor.ai/sdk/api/external/idea/.md#ProjectData "viktor.external.idea_rcs.objects.ProjectData")) – project\_data (default: IDEA-RCS default project\_data) * **code\_settings** ([`CodeSettings`](https://docs.viktor.ai/sdk/api/external/idea/.md#CodeSettings "viktor.external.idea_rcs.objects.CodeSettings")) – code and calculation settings (default: IDEA-RCS default settings) - project\_data[](#Model.project_data "Link to this definition") * code\_settings[](#Model.code_settings "Link to this definition") - generate\_xml\_input(*\**, *as\_file=False*)[](#Model.generate_xml_input "Link to this definition") Generates the input file XML representation of the IDEA-RCS model. Warning Whether an input XML file represents a valid model is dependent on many things, e.g. on the combination of certain parameters. The OpenModel does not give any guarantees on this. It is therefore important to always validate your model by hand thoroughly, before using it in an automated way within your app! Note This method needs to be mocked in (automated) unit and integration tests. * Parameters: **as\_file** (`bool`) – return as BytesIO (default) or File New in v13.5.0 * Return type: `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") * create\_beam(*cs*, *material*, *\**, *calculation\_control=None*, *name=None*, *rcs\_name=None*, *design\_member\_name=None*, *exposure\_classes=None*, *coeff\_kx=None*, *creep\_coefficient=None*, *relative\_humidity=None*)[](#Model.create_beam "Link to this definition") Create a beam section. * Parameters: * **cs** ([`SectionPrototype1D`](#SectionPrototype1D "viktor.external.idea_rcs.idea_rcs.SectionPrototype1D")) – Cross-section prototype. * **material** ([`MatConcrete`](https://docs.viktor.ai/sdk/api/external/idea/.md#MatConcrete "viktor.external.idea_rcs.objects.MatConcrete")) – Material for the cross-section (created by [`create_concrete_material()`](#Model.create_concrete_material "viktor.external.idea_rcs.idea_rcs.Model.create_concrete_material")). * **calculation\_control** ([`CalculationSetup`](https://docs.viktor.ai/sdk/api/external/idea/.md#CalculationSetup "viktor.external.idea_rcs.objects.CalculationSetup")) – Calculation control settings (default: Capacity N-M(-M) | Shear | Interaction | Stress Limitation | Crack width | Detailing). * **name** (`str`) – Name of the cross-section (default: ‘S{i}’). * **rcs\_name** (`str`) – Name of the reinforced cross-section (default: ‘R{i}’). * **design\_member\_name** (`str`) – Name of the design member (default: ‘M {i}’). New in v14.6.0 * **exposure\_classes** ([`ExposureClassesDataEc2`](https://docs.viktor.ai/sdk/api/external/idea/.md#ExposureClassesDataEc2 "viktor.external.idea_rcs.objects.ExposureClassesDataEc2")) – Corrosion exposure classes (default: no corrosion). * **coeff\_kx** (`float`) – (Dutch annex only) Coefficient k\_x acc. 7.3.1 (default: 1.0). * **creep\_coefficient** (`float`) – Final value of creep coefficient (default: calculated by IDEA-RCS). * **relative\_humidity** (`float`) – Percentage of relative humidity (default: 65). * Return type: [`Beam`](#Beam "viktor.external.idea_rcs.idea_rcs.Beam") - create\_compression\_member(*cs*, *material*, *\**, *calculation\_control=None*, *name=None*, *rcs\_name=None*, *design\_member\_name=None*, *exposure\_classes=None*, *coeff\_kx=None*, *creep\_coefficient=None*, *relative\_humidity=None*)[](#Model.create_compression_member "Link to this definition") Create a compression member section. * Parameters: * **cs** ([`SectionPrototype1D`](#SectionPrototype1D "viktor.external.idea_rcs.idea_rcs.SectionPrototype1D")) – Cross-section prototype. * **material** ([`MatConcrete`](https://docs.viktor.ai/sdk/api/external/idea/.md#MatConcrete "viktor.external.idea_rcs.objects.MatConcrete")) – Material for the cross-section (created by [`create_concrete_material()`](#Model.create_concrete_material "viktor.external.idea_rcs.idea_rcs.Model.create_concrete_material")). * **calculation\_control** ([`CalculationSetup`](https://docs.viktor.ai/sdk/api/external/idea/.md#CalculationSetup "viktor.external.idea_rcs.objects.CalculationSetup")) – Calculation control settings (default: Capacity N-M(-M) | Shear | Interaction | Stress Limitation | Crack width | Detailing). * **name** (`str`) – Name of the cross-section (default: ‘S{i}’). * **rcs\_name** (`str`) – Name of the reinforced cross-section (default: ‘R{i}’). * **design\_member\_name** (`str`) – Name of the design member (default: ‘M {i}’). New in v14.6.0 * **exposure\_classes** ([`ExposureClassesDataEc2`](https://docs.viktor.ai/sdk/api/external/idea/.md#ExposureClassesDataEc2 "viktor.external.idea_rcs.objects.ExposureClassesDataEc2")) – Corrosion exposure classes (default: no corrosion). * **coeff\_kx** (`float`) – (Dutch annex only) Coefficient k\_x acc. 7.3.1 (default: 1.0). * **creep\_coefficient** (`float`) – Final value of creep coefficient (default: calculated by IDEA-RCS). * **relative\_humidity** (`float`) – Percentage of relative humidity (default: 65). * Return type: [`CompressionMember`](#CompressionMember "viktor.external.idea_rcs.idea_rcs.CompressionMember") * create\_concrete\_material(*base\_material*, *name=None*, *\**, *unit\_mass=2500*, *fck=None*, *stone\_diameter=0.016*, *cement\_class=ConcCementClass.R*, *aggregate\_type=ConcAggregateType.QUARTZITE*, *diagram\_type=ConcDiagramType.PARABOLIC*, *silica\_fume=False*, *plain\_concrete\_diagram=False*, *dep\_params=None*)[](#Model.create_concrete_material "Link to this definition") Create a concrete material, to be used in [`create_beam()`](#Model.create_beam "viktor.external.idea_rcs.idea_rcs.Model.create_beam") and similar methods. * Parameters: * **base\_material** ([`ConcreteMaterial`](https://docs.viktor.ai/sdk/api/external/idea/.md#ConcreteMaterial "viktor.external.idea_rcs.objects.ConcreteMaterial")) – IDEA-RCS base material to start with. * **name** (`str`) – Name of the material (default: base\_material name). * **unit\_mass** (`float`) – Unit mass \[kg/m3] (default: 2500 kg/m3). * **fck** (`float`) – Characteristic compressive cylinder strength of concrete at 28 days \[MPa] (default: base\_material fck). * **stone\_diameter** (`float`) – Aggregate size (default: 16 mm). * **cement\_class** ([`ConcCementClass`](https://docs.viktor.ai/sdk/api/external/idea/.md#ConcCementClass "viktor.external.idea_rcs.objects.ConcCementClass")) – Cement class (default: R). * **aggregate\_type** ([`ConcAggregateType`](https://docs.viktor.ai/sdk/api/external/idea/.md#ConcAggregateType "viktor.external.idea_rcs.objects.ConcAggregateType")) – Aggregate type (default: Quartzite). * **diagram\_type** ([`ConcDiagramType`](https://docs.viktor.ai/sdk/api/external/idea/.md#ConcDiagramType "viktor.external.idea_rcs.objects.ConcDiagramType")) – Type of stress-strain diagram for ULS calculation (default: Parabolic). * **silica\_fume** (`bool`) – Contains silica fume (default: False) (EN 1992-2:2008-07 only). * **plain\_concrete\_diagram** (`bool`) – Stress strain diagram with tension part (default: False). * **dep\_params** ([`ConcDependentParams`](https://docs.viktor.ai/sdk/api/external/idea/.md#ConcDependentParams "viktor.external.idea_rcs.objects.ConcDependentParams")) – Collection of a series of dependent parameters (see ConcDependentParams for more info). If None, values will be calculated based on ‘fck’ (default: None). * Return type: [`MatConcreteEc2`](https://docs.viktor.ai/sdk/api/external/idea/.md#MatConcreteEc2 "viktor.external.idea_rcs.objects.MatConcreteEc2") - create\_one\_way\_slab(*cs*, *material*, *\**, *calculation\_control=None*, *name=None*, *rcs\_name=None*, *design\_member\_name=None*, *exposure\_classes=None*, *coeff\_kx=None*, *creep\_coefficient=None*, *relative\_humidity=None*)[](#Model.create_one_way_slab "Link to this definition") Create a one-way slab member section. * Parameters: * **cs** ([`SectionPrototype1D`](#SectionPrototype1D "viktor.external.idea_rcs.idea_rcs.SectionPrototype1D")) – Cross-section prototype. * **material** ([`MatConcrete`](https://docs.viktor.ai/sdk/api/external/idea/.md#MatConcrete "viktor.external.idea_rcs.objects.MatConcrete")) – Material for the cross-section (created by [`create_concrete_material()`](#Model.create_concrete_material "viktor.external.idea_rcs.idea_rcs.Model.create_concrete_material")). * **calculation\_control** ([`CalculationSetup`](https://docs.viktor.ai/sdk/api/external/idea/.md#CalculationSetup "viktor.external.idea_rcs.objects.CalculationSetup")) – Calculation control settings (default: Capacity N-M(-M) | Shear | Interaction | Stress Limitation | Crack width | Detailing). * **name** (`str`) – Name of the cross-section (default: ‘S{i}’). * **rcs\_name** (`str`) – Name of the reinforced cross-section (default: ‘R{i}’). * **design\_member\_name** (`str`) – Name of the design member (default: ‘M {i}’). New in v14.6.0 * **exposure\_classes** ([`ExposureClassesDataEc2`](https://docs.viktor.ai/sdk/api/external/idea/.md#ExposureClassesDataEc2 "viktor.external.idea_rcs.objects.ExposureClassesDataEc2")) – Corrosion exposure classes (default: no corrosion). * **coeff\_kx** (`float`) – (Dutch annex only) Coefficient k\_x acc. 7.3.1 (default: 1.0). * **creep\_coefficient** (`float`) – Final value of creep coefficient (default: calculated by IDEA-RCS). * **relative\_humidity** (`float`) – Percentage of relative humidity (default: 65). * Return type: [`OneWaySlab`](#OneWaySlab "viktor.external.idea_rcs.idea_rcs.OneWaySlab") * create\_reinforcement\_material(*base\_material*, *name=None*, *\**, *unit\_mass=7850*, *e\_modulus=200000*, *fyk=None*, *ftk\_by\_fyk=None*, *epsuk=None*, *type\_=ReinfType.BARS*, *bar\_surface=BarSurface.RIBBED*, *class\_=ReinfClass.B*, *fabrication=ReinfFabrication.HOT\_ROLLED*, *diagram\_type=ReinfDiagramType.BILINEAR\_INCLINED*)[](#Model.create_reinforcement_material "Link to this definition") Create a reinforcement material, to be used in `create_reinforcement_bar()`. * Parameters: * **base\_material** ([`ReinforcementMaterial`](https://docs.viktor.ai/sdk/api/external/idea/.md#ReinforcementMaterial "viktor.external.idea_rcs.objects.ReinforcementMaterial")) – IDEA-RCS base material to start with. * **name** (`str`) – Name of the material (default: base\_material name). * **unit\_mass** (`float`) – Unit mass \[kg/m3] (default: 7850 kg/m3). * **e\_modulus** (`float`) – Young’s modulus \[MPa] (default: 200000 MPa). * **fyk** (`float`) – Characteristic yield strength of reinforcement (default: base\_material fyk). * **ftk\_by\_fyk** (`float`) – factor k = ratio ftk / fyk (default: base\_material k). * **epsuk** (`float`) – Characteristic strain of reinforcement at maximum load - εuk \[x 1e-4]. * **type** – Type of reinforcement (default: Bars). * **bar\_surface** ([`BarSurface`](https://docs.viktor.ai/sdk/api/external/idea/.md#BarSurface "viktor.external.idea_rcs.objects.BarSurface")) – Bar surface (default: Ribbed). * **class** – Class of reinforcement (default: B). * **fabrication** ([`ReinfFabrication`](https://docs.viktor.ai/sdk/api/external/idea/.md#ReinfFabrication "viktor.external.idea_rcs.objects.ReinfFabrication")) – Fabrication of reinforcement (default: Hot rolled). * **diagram\_type** ([`ReinfDiagramType`](https://docs.viktor.ai/sdk/api/external/idea/.md#ReinfDiagramType "viktor.external.idea_rcs.objects.ReinfDiagramType")) – Type of material diagram (default: Bilinear with an inclined top branch). * Return type: [`MatReinforcementEc2`](https://docs.viktor.ai/sdk/api/external/idea/.md#MatReinforcementEc2 "viktor.external.idea_rcs.objects.MatReinforcementEc2") <!-- --> ## OneWaySlab[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_OneWaySlab "Direct link to OneWaySlab") * *class *viktor.external.idea\_rcs.idea\_rcs.OneWaySlab(*rcs*, *check\_section*)[](#OneWaySlab "Link to this definition") Bases: [`Member`](#Member "viktor.external.idea_rcs.idea_rcs.Member") Do not use this \_\_init\_\_ directly, but create the object by [`Model.create_one_way_slab()`](#Model.create_one_way_slab "viktor.external.idea_rcs.idea_rcs.Model.create_one_way_slab"). <!-- --> ## OpenModel[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_OpenModel "Direct link to OpenModel") * *class *viktor.external.idea\_rcs.idea\_rcs.OpenModel(*\**, *project\_data=None*, *code\_settings=None*)[](#OpenModel "Link to this definition") Bases: `_Model` Can be used to construct an IDEA-RCS model and generate its corresponding input XML file. This file can in turn be used as input of [`IdeaRcsAnalysis`](#IdeaRcsAnalysis "viktor.external.idea_rcs.idea_rcs.IdeaRcsAnalysis"). For a more elaborate example implementation, please see the guide. The OpenModel follows IDEA’s underlying API. Alternatively, you can use [`Model`](#Model "viktor.external.idea_rcs.idea_rcs.Model"). Warning Use this binding at own risk. Whether an input XML file represents a valid model is dependent on many things, e.g. on the combination of certain parameters. The OpenModel does not give any guarantees on this. It is therefore important to always validate your model by hand thoroughly, before using it in an automated way within your app! Example usage: ``` # Initialize the model. model = OpenModel() # empty model, or optionally pass ProjectData and/or CodeSettings # Create the concrete section. mat = model.create_matconcrete_ec2(ConcreteMaterial.C12_15) cs = model.create_cross_section_parameter(name='cs', cross_section_type=CrossSectionType.RECT, material=mat, Width=2.0, Height=2.0) # Create the reinforced cross-section. rcs = model.create_reinforced_cross_section(name='rcs', cross_section=cs) # Create bars (and stirrups) as desired mat_reinf = model.create_matreinforcement_ec2(ReinforcementMaterial.B_400A) bar_locations = [(-0.101, -0.175), (0.101, -0.175), (0.101, 0.175), (-0.101, 0.175)] bar_diameters = [0.016, 0.016, 0.016, 0.016] for coords, diameter in zip(bar_locations, bar_diameters): rcs.create_bar(coords, diameter, mat_reinf) # Create a CheckMember. member = model.create_check_member1d() # 'Assign' the CheckMember to a CheckSection with the previously defined reinforced section and add extremes. check_section = model.add_check_section(description='S 1', check_member=member, reinf_section=rcs) freq = LoadingSLS(ResultOfInternalForces(N=-100000, My=210000)) fund = LoadingULS(ResultOfInternalForces(N=-99999, My=200000)) check_section.create_extreme(frequent=freq, fundamental=fund) # 'Assign' the necessary additional data to the CheckMember. model.add_member_data_ec2(member, MemberType.BEAM_SLAB, TwoWaySlabType.SHELL_AS_PLATE) # Generate the input XML file. input_xml = model.generate_xml_input() ``` * Parameters: * **project\_data** ([`ProjectData`](https://docs.viktor.ai/sdk/api/external/idea/.md#ProjectData "viktor.external.idea_rcs.objects.ProjectData")) – project\_data (default: IDEA-RCS default project\_data) * **code\_settings** ([`CodeSettings`](https://docs.viktor.ai/sdk/api/external/idea/.md#CodeSettings "viktor.external.idea_rcs.objects.CodeSettings")) – code and calculation settings (default: IDEA-RCS default settings) - project\_data[](#OpenModel.project_data "Link to this definition") * code\_settings[](#OpenModel.code_settings "Link to this definition") - generate\_xml\_input(*\**, *as\_file=False*)[](#OpenModel.generate_xml_input "Link to this definition") Generates the input file XML representation of the IDEA-RCS model. Warning Whether an input XML file represents a valid model is dependent on many things, e.g. on the combination of certain parameters. The OpenModel does not give any guarantees on this. It is therefore important to always validate your model by hand thoroughly, before using it in an automated way within your app! Note This method needs to be mocked in (automated) unit and integration tests. * Parameters: **as\_file** (`bool`) – return as BytesIO (default) or File New in v13.5.0 * Return type: `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") * add\_check\_section(*check\_member*, *reinf\_section*, *description=None*)[](#OpenModel.add_check_section "Link to this definition") Adds a single section check on the given CheckMember. Note that [`add_member_data_ec2()`](#OpenModel.add_member_data_ec2 "viktor.external.idea_rcs.idea_rcs.OpenModel.add_member_data_ec2") must be called subsequently. * Parameters: * **check\_member** ([`CheckMember`](https://docs.viktor.ai/sdk/api/external/idea/.md#CheckMember "viktor.external.idea_rcs.objects.CheckMember")) – CheckMember (created by [`create_check_member1d()`](#OpenModel.create_check_member1d "viktor.external.idea_rcs.idea_rcs.OpenModel.create_check_member1d")). * **reinf\_section** ([`ReinforcedCrossSection`](https://docs.viktor.ai/sdk/api/external/idea/.md#ReinforcedCrossSection "viktor.external.idea_rcs.objects.ReinforcedCrossSection")) – Reinforcement of cross-section (created by [`create_reinforced_cross_section()`](#OpenModel.create_reinforced_cross_section "viktor.external.idea_rcs.idea_rcs.OpenModel.create_reinforced_cross_section")). * **description** (`str`) – Description/name of the section (default: ‘S{i}’). * Return type: [`CheckSection`](https://docs.viktor.ai/sdk/api/external/idea/.md#CheckSection "viktor.external.idea_rcs.objects.CheckSection") - add\_member\_data\_ec2(*member*, *member\_type*, *two\_way\_slab\_type*, *\**, *calculation\_setup=None*, *coeff\_kx\_for\_wmax=None*, *exposure\_class\_data=None*, *creep\_coefficient=None*, *relative\_humidity=None*)[](#OpenModel.add_member_data_ec2 "Link to this definition") Adds a concrete member Ec2 data to the model. * Parameters: * **member** ([`CheckMember`](https://docs.viktor.ai/sdk/api/external/idea/.md#CheckMember "viktor.external.idea_rcs.objects.CheckMember")) – CheckMember (created by [`create_check_member1d()`](#OpenModel.create_check_member1d "viktor.external.idea_rcs.idea_rcs.OpenModel.create_check_member1d")). Should be previously added to a check section via [`add_check_section()`](#OpenModel.add_check_section "viktor.external.idea_rcs.idea_rcs.OpenModel.add_check_section"). * **member\_type** ([`MemberType`](https://docs.viktor.ai/sdk/api/external/idea/.md#MemberType "viktor.external.idea_rcs.objects.MemberType")) – Structural type of member. Must be a valid type corresponding to the reinf\_section assigned to the member in [`add_check_section()`](#OpenModel.add_check_section "viktor.external.idea_rcs.idea_rcs.OpenModel.add_check_section"). * **two\_way\_slab\_type** ([`TwoWaySlabType`](https://docs.viktor.ai/sdk/api/external/idea/.md#TwoWaySlabType "viktor.external.idea_rcs.objects.TwoWaySlabType")) – Two-way slab type. Must be a valid type corresponding to the reinf\_section assigned to the member in [`add_check_section()`](#OpenModel.add_check_section "viktor.external.idea_rcs.idea_rcs.OpenModel.add_check_section"). * **calculation\_setup** ([`CalculationSetup`](https://docs.viktor.ai/sdk/api/external/idea/.md#CalculationSetup "viktor.external.idea_rcs.objects.CalculationSetup")) – Calculation control settings (default: Capacity N-M(-M) | Shear | Interaction | Stress Limitation | Crack width | Detailing). * **coeff\_kx\_for\_wmax** (`float`) – (Dutch annex only) Coefficient kx to increase limited concrete crack (default: 1.0). * **exposure\_class\_data** ([`ExposureClassesDataEc2`](https://docs.viktor.ai/sdk/api/external/idea/.md#ExposureClassesDataEc2 "viktor.external.idea_rcs.objects.ExposureClassesDataEc2")) – Exposure classes (default: no corrosion). * **creep\_coefficient** (`float`) – Final value of creep coefficient (default: calculated by IDEA-RCS). * **relative\_humidity** (`float`) – Percentage of relative humidity (default: 65). * Return type: `None` * create\_check\_member1d(*name=None*)[](#OpenModel.create_check_member1d "Link to this definition") Create a member 1D check, which can be used in [`add_check_section()`](#OpenModel.add_check_section "viktor.external.idea_rcs.idea_rcs.OpenModel.add_check_section") and [`add_member_data_ec2()`](#OpenModel.add_member_data_ec2 "viktor.external.idea_rcs.idea_rcs.OpenModel.add_member_data_ec2"). * Return type: [`CheckMember1D`](https://docs.viktor.ai/sdk/api/external/idea/.md#CheckMember1D "viktor.external.idea_rcs.objects.CheckMember1D") - create\_cross\_section\_component(*name=None*)[](#OpenModel.create_cross_section_component "Link to this definition") Create a cross-section object defined by one or multiple components and add it to the model. * Parameters: **name** (`str`) – Name of cross-section (default: ‘’). * Return type: [`CrossSectionComponent`](https://docs.viktor.ai/sdk/api/external/idea/.md#CrossSectionComponent "viktor.external.idea_rcs.objects.CrossSectionComponent") * create\_cross\_section\_parameter(*cross\_section\_type*, *material*, *name=None*, *\*\*parameters*)[](#OpenModel.create_cross_section_parameter "Link to this definition") Create a cross-section object defined by parameters and add it to the model. * Parameters: * **cross\_section\_type** ([`CrossSectionType`](https://docs.viktor.ai/sdk/api/external/idea/.md#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")) – Type of cross-section. * **material** ([`MatConcrete`](https://docs.viktor.ai/sdk/api/external/idea/.md#MatConcrete "viktor.external.idea_rcs.objects.MatConcrete")) – Material (created by [`create_matconcrete_ec2()`](#OpenModel.create_matconcrete_ec2 "viktor.external.idea_rcs.idea_rcs.OpenModel.create_matconcrete_ec2")). * **name** (`str`) – Name of cross-section (default: ‘’). * **parameters** (`Any`) – keyword naming should correspond to chosen cross\_section\_type(!). * Return type: [`CrossSectionParameter`](https://docs.viktor.ai/sdk/api/external/idea/.md#CrossSectionParameter "viktor.external.idea_rcs.objects.CrossSectionParameter") The following combinations of cross\_section\_type and parameters can be used (see the IDEA StatiCa interface for the naming convention): * [`O`](https://docs.viktor.ai/sdk/api/external/idea/.md#CrossSectionType.O "viktor.external.idea_rcs.objects.CrossSectionType.O"): D * [`RECT`](https://docs.viktor.ai/sdk/api/external/idea/.md#CrossSectionType.RECT "viktor.external.idea_rcs.objects.CrossSectionType.RECT"): Width, Height * [`TRAPEZOID`](https://docs.viktor.ai/sdk/api/external/idea/.md#CrossSectionType.TRAPEZOID "viktor.external.idea_rcs.objects.CrossSectionType.TRAPEZOID"): H, Bb, Bt * [`IGN`](https://docs.viktor.ai/sdk/api/external/idea/.md#CrossSectionType.IGN "viktor.external.idea_rcs.objects.CrossSectionType.IGN"): H, Bh, Bs, Ts, Th, Tw * [`IGH`](https://docs.viktor.ai/sdk/api/external/idea/.md#CrossSectionType.IGH "viktor.external.idea_rcs.objects.CrossSectionType.IGH"): H, Bh, Bs, Ts, Th, Tw, Bfh, Tfh * [`BEAM_SHAPE_I_HAUNCH_CHAMFER`](https://docs.viktor.ai/sdk/api/external/idea/.md#CrossSectionType.BEAM_SHAPE_I_HAUNCH_CHAMFER "viktor.external.idea_rcs.objects.CrossSectionType.BEAM_SHAPE_I_HAUNCH_CHAMFER"): Bbf, Hbf, Hbfh, Bw, H, Htfh, Htf, Btf, Bwh * [`TG`](https://docs.viktor.ai/sdk/api/external/idea/.md#CrossSectionType.TG "viktor.external.idea_rcs.objects.CrossSectionType.TG"): Height, Width, TopFlangeWidth, WallWidth * [`TTFH`](https://docs.viktor.ai/sdk/api/external/idea/.md#CrossSectionType.TTFH "viktor.external.idea_rcs.objects.CrossSectionType.TTFH"): Height, Width, TopFlangeWidth, WallWidth, TopFlangeHaunch * [`TGREV`](https://docs.viktor.ai/sdk/api/external/idea/.md#CrossSectionType.TGREV "viktor.external.idea_rcs.objects.CrossSectionType.TGREV"): Height, Width, TopFlangeWidth, WallWidth * [`TCHAMFER_1`](https://docs.viktor.ai/sdk/api/external/idea/.md#CrossSectionType.TCHAMFER_1 "viktor.external.idea_rcs.objects.CrossSectionType.TCHAMFER_1"): Height, Width, TopFlangeWidth, WallWidth, TopFlangeHaunch2, WallHaunch2 * [`TCHAMFER_2`](https://docs.viktor.ai/sdk/api/external/idea/.md#CrossSectionType.TCHAMFER_2 "viktor.external.idea_rcs.objects.CrossSectionType.TCHAMFER_2"): Height, Width, TopFlangeWidth, WallWidth, TopFlangeHaunch2, WallHaunch1, WallHaunch2 * [`TWH`](https://docs.viktor.ai/sdk/api/external/idea/.md#CrossSectionType.TWH "viktor.external.idea_rcs.objects.CrossSectionType.TWH"): Height, Width, TopFlangeWidth, WallWidth, WallHaunch * [`TTFHREV`](https://docs.viktor.ai/sdk/api/external/idea/.md#CrossSectionType.TTFHREV "viktor.external.idea_rcs.objects.CrossSectionType.TTFHREV"): Height, Width, TopFlangeWidth, WallWidth, TopFlangeHaunch * [`TWHREV`](https://docs.viktor.ai/sdk/api/external/idea/.md#CrossSectionType.TWHREV "viktor.external.idea_rcs.objects.CrossSectionType.TWHREV"): Height, Width, TopFlangeWidth, WallWidth, WallHaunch - create\_matconcrete\_ec2(*base\_material*, *name=None*, *\**, *e\_modulus=32800*, *g\_modulus=13667*, *poisson=0.2*, *unit\_mass=2500*, *specific\_heat=0.6*, *thermal\_expansion=1e-05*, *thermal\_conductivity=45*, *is\_default=False*, *order\_in\_code=1*, *thermal\_state=None*, *fck\_28=None*, *stone\_diameter=0.016*, *cement\_class=ConcCementClass.R*, *aggregate\_type=ConcAggregateType.QUARTZITE*, *diagram\_type=ConcDiagramType.PARABOLIC*, *silica\_fume=False*, *plain\_concrete\_diagram=False*, *dep\_params=None*)[](#OpenModel.create_matconcrete_ec2 "Link to this definition") Create a material concrete Ec2 object and add it to the model. * Parameters: * **base\_material** ([`ConcreteMaterial`](https://docs.viktor.ai/sdk/api/external/idea/.md#ConcreteMaterial "viktor.external.idea_rcs.objects.ConcreteMaterial")) – IDEA-RCS base material to start with. * **name** (`str`) – Name of the material (default: base\_material name). * **e\_modulus** (`float`) – Young’s modulus \[MPa] (default: 32800 MPa). * **g\_modulus** (`float`) – Shear modulus \[MPa] (default: 13667 MPa). * **poisson** (`float`) – Poisson’s ratio (default: 0.2). * **unit\_mass** (`float`) – Unit mass \[kg/m3] (default: 2500 kg/m3). * **specific\_heat** (`float`) – Specific heat capacity (default: 0.6). * **thermal\_expansion** (`float`) – Thermal expansion \[1/K] (default: 1e-05). * **thermal\_conductivity** (`float`) – Thermal conductivity (default: 45). * **is\_default** (`bool`) – True if material is default material in IDEA-RCS code (default: False). * **order\_in\_code** (`int`) – Order of this material in the IDEA-RCS code (default: 1). * **thermal\_state** ([`ThermalState`](https://docs.viktor.ai/sdk/api/external/idea/.md#ThermalState "viktor.external.idea_rcs.objects.ThermalState")) – Collection of thermal states for expansion, conductivity, specific heat, stress-strain and strain curvatures (default: ThermalState()). * **fck\_28** (`float`) – Characteristic compressive cylinder strength of concrete at 28 days \[MPa] (default: base\_material fck). * **stone\_diameter** (`float`) – Aggregate size (default: 16 mm). * **cement\_class** ([`ConcCementClass`](https://docs.viktor.ai/sdk/api/external/idea/.md#ConcCementClass "viktor.external.idea_rcs.objects.ConcCementClass")) – Cement class (default: R). * **aggregate\_type** ([`ConcAggregateType`](https://docs.viktor.ai/sdk/api/external/idea/.md#ConcAggregateType "viktor.external.idea_rcs.objects.ConcAggregateType")) – Aggregate type (default: Quartzite). * **diagram\_type** ([`ConcDiagramType`](https://docs.viktor.ai/sdk/api/external/idea/.md#ConcDiagramType "viktor.external.idea_rcs.objects.ConcDiagramType")) – Type of stress-strain diagram for ULS calculation (default: Parabolic). * **silica\_fume** (`bool`) – Contains silica fume (default: False) (EN 1992-2:2008-07 only). * **plain\_concrete\_diagram** (`bool`) – Stress strain diagram with tension part (default: False). * **dep\_params** ([`ConcDependentParams`](https://docs.viktor.ai/sdk/api/external/idea/.md#ConcDependentParams "viktor.external.idea_rcs.objects.ConcDependentParams")) – Collection of a series of dependent parameters (see ConcDependentParams for more info). If None, values will be calculated based on ‘fck’ (default: None). * Return type: [`MatConcreteEc2`](https://docs.viktor.ai/sdk/api/external/idea/.md#MatConcreteEc2 "viktor.external.idea_rcs.objects.MatConcreteEc2") * create\_matreinforcement\_ec2(*base\_material*, *name=None*, *\**, *e\_modulus=200000*, *g\_modulus=83333*, *poisson=0.2*, *unit\_mass=7850*, *specific\_heat=0.6*, *thermal\_expansion=1e-05*, *thermal\_conductivity=45*, *is\_default=False*, *order\_in\_code=1*, *thermal\_state=None*, *bar\_surface=BarSurface.RIBBED*, *fyk=None*, *ftk\_by\_fyk=None*, *epsuk=None*, *ftk=None*, *class\_=ReinfClass.B*, *type\_=ReinfType.BARS*, *fabrication=ReinfFabrication.HOT\_ROLLED*, *diagram\_type=ReinfDiagramType.BILINEAR\_INCLINED*)[](#OpenModel.create_matreinforcement_ec2 "Link to this definition") Create a material reinforcement Ec2 object and add it to the model. * Parameters: * **base\_material** ([`ReinforcementMaterial`](https://docs.viktor.ai/sdk/api/external/idea/.md#ReinforcementMaterial "viktor.external.idea_rcs.objects.ReinforcementMaterial")) – IDEA-RCS base material to start with. * **name** (`str`) – Name of the material (default: base\_material name). * **e\_modulus** (`float`) – Young’s modulus \[MPa] (default: 200000 MPa). * **g\_modulus** (`float`) – Shear modulus \[MPa] (default: 83333 MPa). * **poisson** (`float`) – Poisson’s ratio (default: 0.2). * **unit\_mass** (`float`) – Unit mass \[kg/m3] (default: 7850 kg/m3). * **specific\_heat** (`float`) – Specific heat capacity (default: 0.6). * **thermal\_expansion** (`float`) – Thermal expansion \[1/K] (default: 1e-05). * **thermal\_conductivity** (`float`) – Thermal conductivity (default: 45). * **is\_default** (`bool`) – True if material is default material in IDEA-RCS code (default: False). * **order\_in\_code** (`int`) – Order of this material in the IDEA-RCS code (default: 1). * **thermal\_state** ([`ThermalState`](https://docs.viktor.ai/sdk/api/external/idea/.md#ThermalState "viktor.external.idea_rcs.objects.ThermalState")) – Collection of thermal states for expansion, conductivity, specific heat, stress-strain and strain curvatures (default: ThermalState()). * **bar\_surface** ([`BarSurface`](https://docs.viktor.ai/sdk/api/external/idea/.md#BarSurface "viktor.external.idea_rcs.objects.BarSurface")) – Bar surface (default: Ribbed). * **fyk** (`float`) – Characteristic yield strength of reinforcement (default: base\_material fyk). * **ftk\_by\_fyk** (`float`) – factor k = ratio ftk / fyk (default: base\_material k). * **epsuk** (`float`) – Characteristic strain of reinforcement at maximum load - εuk \[x 1e-4]. * **ftk** (`float`) – Characteristic tensile strength of reinforcement (default: base\_material ftk). * **class** – Class of reinforcement (default: B). * **type** – Type of reinforcement (default: Bars). * **fabrication** ([`ReinfFabrication`](https://docs.viktor.ai/sdk/api/external/idea/.md#ReinfFabrication "viktor.external.idea_rcs.objects.ReinfFabrication")) – Fabrication of reinforcement (default: Hot rolled). * **diagram\_type** ([`ReinfDiagramType`](https://docs.viktor.ai/sdk/api/external/idea/.md#ReinfDiagramType "viktor.external.idea_rcs.objects.ReinfDiagramType")) – Type of material diagram (default: Bilinear with an inclined top branch). * Return type: [`MatReinforcementEc2`](https://docs.viktor.ai/sdk/api/external/idea/.md#MatReinforcementEc2 "viktor.external.idea_rcs.objects.MatReinforcementEc2") - create\_reinforced\_cross\_section(*cross\_section*, *name=None*)[](#OpenModel.create_reinforced_cross_section "Link to this definition") Create a reinforced cross-section object and add it to the model. * Parameters: * **cross\_section** ([`CrossSection`](https://docs.viktor.ai/sdk/api/external/idea/.md#CrossSection "viktor.external.idea_rcs.objects.CrossSection")) – Cross-section (created by [`create_cross_section_parameter()`](#OpenModel.create_cross_section_parameter "viktor.external.idea_rcs.idea_rcs.OpenModel.create_cross_section_parameter") or [`create_cross_section_component()`](#OpenModel.create_cross_section_component "viktor.external.idea_rcs.idea_rcs.OpenModel.create_cross_section_component")). * **name** (`str`) – Name of cross-section (default: ‘R{i}’). * Return type: [`ReinforcedCrossSection`](https://docs.viktor.ai/sdk/api/external/idea/.md#ReinforcedCrossSection "viktor.external.idea_rcs.objects.ReinforcedCrossSection") <!-- --> ## OutputFileParser[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_OutputFileParser "Direct link to OutputFileParser") * *class *viktor.external.idea\_rcs.idea\_rcs.OutputFileParser(*xml\_file*)[](#OutputFileParser "Link to this definition") Helper class to extract results from a IDEA-RCS output file (.xml). Note, for very large result files we advise to make use of [`RcsOutputFileParser`](#RcsOutputFileParser "viktor.external.idea_rcs.idea_rcs.RcsOutputFileParser") instead. * Parameters: **xml\_file** (`StringIO`) – valid IDEA-RCS XML output file. * Raises: [**ParsingError**](https://docs.viktor.ai/sdk/api/errors/.md#ParsingError "viktor.errors.ParsingError") – if ‘xml\_file’ can not be parsed (not a valid format). Example usage: ``` parser = OutputFileParser(xml_file) for section in parser.section_ids: capacity_results = parser.capacity_results(section) ... ``` In case you require results which are not supported, you can retrieve the raw results using the [`raw_results()`](#OutputFileParser.raw_results "viktor.external.idea_rcs.idea_rcs.OutputFileParser.raw_results") method. * capacity\_results(*section\_id*)[](#OutputFileParser.capacity_results "Link to this definition") Get the result of applied internal forces of all extremes for the section with provided ‘section\_id’. * Parameters: **section\_id** (`int`) – id of the check section. Must be present in the output file. * Raises: [**ParsingError**](https://docs.viktor.ai/sdk/api/errors/.md#ParsingError "viktor.errors.ParsingError") – if ‘section\_id’ is not present in output file. * Return type: `List`\[`Dict`\[`str`, `Any`] | `None`] See [`capacity()`](#RcsOutputFileParser.SectionResult.capacity "viktor.external.idea_rcs.idea_rcs.RcsOutputFileParser.SectionResult.capacity") for return format. - crack\_width\_results(*section\_id*)[](#OutputFileParser.crack_width_results "Link to this definition") Get the crack width (short/long) results for all extremes for the section with provided ‘section\_id’. * Parameters: **section\_id** (`int`) – id of the check section. Must be present in the output file. * Raises: [**ParsingError**](https://docs.viktor.ai/sdk/api/errors/.md#ParsingError "viktor.errors.ParsingError") – if ‘section\_id’ is not present in output file. * Return type: `List`\[`Dict`\[`str`, `Dict`\[`str`, `Any`] | `None`] | `None`] See [`crack_width()`](#RcsOutputFileParser.SectionResult.crack_width "viktor.external.idea_rcs.idea_rcs.RcsOutputFileParser.SectionResult.crack_width") for return format. * detailing\_results(*section\_id*)[](#OutputFileParser.detailing_results "Link to this definition") Get the unity checks of the longitudinal reinforcement and shear reinforcement for all extremes for the section with provided ‘section\_id’. * Parameters: **section\_id** (`int`) – id of the check section. Must be present in the output file. * Raises: [**ParsingError**](https://docs.viktor.ai/sdk/api/errors/.md#ParsingError "viktor.errors.ParsingError") – if ‘section\_id’ is not present in output file. * Return type: `List`\[`Dict`\[`str`, `float` | `None`] | `None`] See [`detailing()`](#RcsOutputFileParser.SectionResult.detailing "viktor.external.idea_rcs.idea_rcs.RcsOutputFileParser.SectionResult.detailing") for return format. - fatigue\_results(*section\_id*)[](#OutputFileParser.fatigue_results "Link to this definition") Get the fatigue results for all extremes for the provided ‘section\_id’. * Parameters: **section\_id** (`int`) – id of the check section. Must be present in the output file. * Raises: [**ParsingError**](https://docs.viktor.ai/sdk/api/errors/.md#ParsingError "viktor.errors.ParsingError") – if ‘section\_id’ is not present in output file. * Return type: `List`\[`dict` | `None`] See [`fatigue()`](#RcsOutputFileParser.SectionResult.fatigue "viktor.external.idea_rcs.idea_rcs.RcsOutputFileParser.SectionResult.fatigue") for return format. * raw\_results()[](#OutputFileParser.raw_results "Link to this definition") Get the (complete) raw results in dict form. Can be used if results need to be extracted that are not supported by the available methods. * Return type: `dict` - *property *section\_ids*: List\[int]*[](#OutputFileParser.section_ids "Link to this definition") Get all section ids for which results are present in the result file. * shear\_results(*section\_id*)[](#OutputFileParser.shear_results "Link to this definition") Get the shear resistances for all extremes for the section with provided ‘section\_id’. * Parameters: **section\_id** (`int`) – id of the check section. Must be present in the output file. * Raises: [**ParsingError**](https://docs.viktor.ai/sdk/api/errors/.md#ParsingError "viktor.errors.ParsingError") – if ‘section\_id’ is not present in output file. * Return type: `List`\[`Dict`\[`str`, `Any`] | `None`] See [`shear()`](#RcsOutputFileParser.SectionResult.shear "viktor.external.idea_rcs.idea_rcs.RcsOutputFileParser.SectionResult.shear") for return format. - stress\_limitation\_results(*section\_id*)[](#OutputFileParser.stress_limitation_results "Link to this definition") Get the short- and long-term stress limitation results for all extremes for provided ‘section\_id’. * Parameters: **section\_id** (`int`) – id of the check section. Must be present in the output file. * Raises: [**ParsingError**](https://docs.viktor.ai/sdk/api/errors/.md#ParsingError "viktor.errors.ParsingError") – if ‘section\_id’ is not present in output file. * Return type: `List`\[`Dict`\[`str`, `float` | `None`] | `None`] See [`stress_limitation()`](#RcsOutputFileParser.SectionResult.stress_limitation "viktor.external.idea_rcs.idea_rcs.RcsOutputFileParser.SectionResult.stress_limitation") for return format. <!-- --> ## RcsOutputFileParser[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_RcsOutputFileParser "Direct link to RcsOutputFileParser") * *class *viktor.external.idea\_rcs.idea\_rcs.RcsOutputFileParser(*xml\_file*)[](#RcsOutputFileParser "Link to this definition") Parser to extract results from an IDEA-RCS output file (.xml). Currently the following data can be extracted: > * [`capacity()`](#RcsOutputFileParser.SectionResult.capacity "viktor.external.idea_rcs.idea_rcs.RcsOutputFileParser.SectionResult.capacity") > > * [`shear()`](#RcsOutputFileParser.SectionResult.shear "viktor.external.idea_rcs.idea_rcs.RcsOutputFileParser.SectionResult.shear") > > * [`torsion()`](#RcsOutputFileParser.SectionResult.torsion "viktor.external.idea_rcs.idea_rcs.RcsOutputFileParser.SectionResult.torsion") (new in v13.4.0) > > * [`interaction()`](#RcsOutputFileParser.SectionResult.interaction "viktor.external.idea_rcs.idea_rcs.RcsOutputFileParser.SectionResult.interaction") (new in v13.4.0) > > * [`crack_width()`](#RcsOutputFileParser.SectionResult.crack_width "viktor.external.idea_rcs.idea_rcs.RcsOutputFileParser.SectionResult.crack_width") > > * [`detailing()`](#RcsOutputFileParser.SectionResult.detailing "viktor.external.idea_rcs.idea_rcs.RcsOutputFileParser.SectionResult.detailing") > > * [`stress_limitation()`](#RcsOutputFileParser.SectionResult.stress_limitation "viktor.external.idea_rcs.idea_rcs.RcsOutputFileParser.SectionResult.stress_limitation") > > * [`fatigue()`](#RcsOutputFileParser.SectionResult.fatigue "viktor.external.idea_rcs.idea_rcs.RcsOutputFileParser.SectionResult.fatigue") Example using [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File"): ``` xml_file = idea_rcs_analysis.get_output_file(as_file=True) with xml_file.open_binary() as f: parser = RcsOutputFileParser(f) # loop through all sections for section in parser.section_results(): capacity_results = section.capacity() shear_results = section.shear() # or get results for a single section section_4 = parser.section_result(4) ... # or loop through all extremes within a section for extreme in section_4.extremes(): capacity = extreme['capacity'] ... ``` Example using BytesIO: ``` xml_file = idea_rcs_analysis.get_output_file() parser = RcsOutputFileParser(xml_file) for section in parser.section_results(): ... ``` * Parameters: **xml\_file** (`BinaryIO`) – IDEA-RCS XML output file (.xml). - *class *SectionResult(*id\_*, *element*)[](#RcsOutputFileParser.SectionResult "Link to this definition") Parsed result section, on which specific results can be retrieved. Do not instantiate this object directly, but retrieve it through [`RcsOutputFileParser.section_results()`](#RcsOutputFileParser.section_results "viktor.external.idea_rcs.idea_rcs.RcsOutputFileParser.section_results"). * capacity()[](#RcsOutputFileParser.SectionResult.capacity "Link to this definition") Get the capacity results of all extremes for the current section. Returns a list of dictionaries (or None if not present for a certain extreme) in the following format: ``` [ { 'Fu': { 'N': <float>, 'Qy': <float>, 'Qz': <float>, 'Mx': <float>, 'My': <float>, 'Mz': <float> }, 'Fu1': { ... # see 'Fu' } | None, 'Fu2': { ... # see 'Fu' } | None, 'CheckValue': <float>, 'Result': <str> # new in v13.4.0 } | None, ... ] ``` * Return type: `List`\[`dict` | `None`] - crack\_width()[](#RcsOutputFileParser.SectionResult.crack_width "Link to this definition") Get the crack width (short/long) results for all extremes for the current section. Returns a list of dictionaries (or None if not present for a certain extreme) in the following format: ``` [ { 'short': { 'N': <float>, 'My': <float>, 'Mz': <float>, 'W': <float>, 'Wlim': <float>, 'CheckValue': <float>, 'Result': <str> # new in v13.4.0 } | None, 'long': { ... # see 'short' } | None, } | None, ... ] ``` * Return type: `List`\[`dict` | `None`] * detailing()[](#RcsOutputFileParser.SectionResult.detailing "Link to this definition") Get the unity checks of the longitudinal reinforcement and shear reinforcement for all extremes for the current section. Returns a list of dictionaries (or None if not present for a certain extreme) in the following format: ``` [ { 'longitudinal': <float> | None, 'shear': <float> | None, 'CheckValue': <float>, # new in v13.4.0 'CheckValueLongReinf': <float>, # new in v13.4.0 'CheckValueShearReinf': <float>, # new in v13.4.0 'Result': <str> # new in v13.4.0 } | None, ... ] ``` * Return type: `List`\[`dict` | `None`] - extremes()[](#RcsOutputFileParser.SectionResult.extremes "Link to this definition") Get all results combined per extreme for the current section. Returns a list of dictionaries in the following format: ``` [ { 'capacity': {...} | None, 'shear': {...} | None, 'torsion': {...} | None, # new in v13.4.0 'interaction': {...} | None, # new in v13.4.0 'crack_width': {...} | None, 'detailing': {...} | None, 'stress_limitation': {...} | None, 'fatigue': {...} | None, }, ... ] ``` * Return type: `List`\[`dict`] * fatigue()[](#RcsOutputFileParser.SectionResult.fatigue "Link to this definition") Get the fatigue results for all extremes for the current section. Returns a list of dictionaries (or None if not present for a certain extreme) in the following format: ``` [ { 'fatigue': { 'CheckValue': <float>, 'DecisionMethod': <str>, 'Result': <str> # new in v13.4.0 }, 'shear': { 'max': { 'Ved': <float>, 'Vrdc': <float>, 'Vrd': <float>, 'Vrdmax': <float>, 'Vrdr': <float>, 'Vrds': <float>, 'CheckValue': <float>, 'Result': <str> # new in v13.4.0 }, 'min': { ... # see 'max' }, } } | None, ... ] ``` * Return type: `List`\[`dict` | `None`] - *property *id\_*: int*[](#RcsOutputFileParser.SectionResult.id_ "Link to this definition") Returns the ‘SectionId’ of current section. * interaction()[](#RcsOutputFileParser.SectionResult.interaction "Link to this definition") New in v13.4.0 Get the interaction results for all extremes for the current section. Returns a list of dictionaries (or None if not present for a certain extreme) in the following format: ``` [ { 'Ned': <float>, 'Medy': <float>, 'Medz': <float>, 'Ved': <float>, 'Ted': <float>, 'CheckValue': <float>, 'CheckValueShearAndTorsion': <float>, 'CheckValueShearTorsionAndBending': <float>, 'Result': <str> } | None, ... ] ``` * Return type: `List`\[`dict` | `None`] - shear()[](#RcsOutputFileParser.SectionResult.shear "Link to this definition") Get the shear resistances for all extremes for the current section. Returns a list of dictionaries (or None if not present for a certain extreme) in the following format: ``` [ { 'Ved': <float>, 'Vrdc': <float>, 'Vrd': <float>, 'Vrdmax': <float>, 'Vrdr': <float>, 'Vrds': <float>, 'CheckValue': <float>, 'Result': <str> # new in v13.4.0 } | None, ... ] ``` * Return type: `List`\[`dict` | `None`] * stress\_limitation()[](#RcsOutputFileParser.SectionResult.stress_limitation "Link to this definition") Get the short- and long-term stress limitation results for all extremes for the current section. Returns a list of dictionaries (or None if not present for a certain extreme) in the following format: ``` [ { 'Check_7_2_2_Concrete_fck': { # new in v13.4.0 'short': { 'Stress': <float> | None, 'CheckValue': <float>, 'Result': <str> } | None, 'long': { ... # see 'short' } | None } | None, 'Check_7_2_3_Concrete_fck': { # new in v13.4.0 ... # see 'Check_7_2_2_Concrete_fck' } | None, 'Check_7_2_5_Tendons_fpk': { # new in v13.4.0 ... # see 'Check_7_2_2_Concrete_fck' } | None, 'Check_7_2_5_ReinforcementBars_fyk': { # new in v13.4.0 ... # see 'Check_7_2_2_Concrete_fck' } | None, 'Check_5_10_3_2_Tendons': { # new in v13.4.0 ... # see 'Check_7_2_2_Concrete_fck' } | None, 'Check_5_10_2_1_1_Tendons': { # new in v13.4.0 ... # see 'Check_7_2_2_Concrete_fck' } | None, 'short': { 'Check_7_2_2_Concrete_fck': <float> | None, ... # see above for all keys } | None, 'long': { 'Check_7_2_2_Concrete_fck': <float> | None, ... # see above for all keys } | None, } | None, ... ] ``` * Return type: `List`\[`dict` | `None`] - torsion()[](#RcsOutputFileParser.SectionResult.torsion "Link to this definition") New in v13.4.0 Get the torsion results for all extremes for the current section. Returns a list of dictionaries (or None if not present for a certain extreme) in the following format: ``` [ { 'Ted': <float>, 'Trdc': <float>, 'Trdmax': <float>, 'Trds': <float>, 'Trd': <float>, 'CheckValue': <float>, 'Result': <str> } | None, ... ] ``` * Return type: `List`\[`dict` | `None`] * section\_result(*id\_*)[](#RcsOutputFileParser.section_result "Link to this definition") Retrieve the section result of the provided id. * Return type: [`SectionResult`](#RcsOutputFileParser.SectionResult "viktor.external.idea_rcs.idea_rcs.RcsOutputFileParser.SectionResult") - section\_results()[](#RcsOutputFileParser.section_results "Link to this definition") Iterates through all section results. Usage: ``` for section in parser.section_results(): capacity_results = section.capacity() if section.id_ == 3: ... ``` * Return type: `Iterator`\[[`SectionResult`](#RcsOutputFileParser.SectionResult "viktor.external.idea_rcs.idea_rcs.RcsOutputFileParser.SectionResult")] <!-- --> ## RectSection[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_RectSection "Direct link to RectSection") * *class *viktor.external.idea\_rcs.idea\_rcs.RectSection(*width*, *height*)[](#RectSection "Link to this definition") Bases: [`SectionPrototype1D`](#SectionPrototype1D "viktor.external.idea_rcs.idea_rcs.SectionPrototype1D") Rectangular section. The origin is located in the centroid of this section. * Parameters: * **width** (`float`) – Width of the section. * **height** (`float`) – Height of the section. <!-- --> ## SectionPrototype1D[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_SectionPrototype1D "Direct link to SectionPrototype1D") * *class *viktor.external.idea\_rcs.idea\_rcs.SectionPrototype1D[](#SectionPrototype1D "Link to this definition") Bases: `_SectionPrototype`, `ABC` Abstract base class of all 1D (beam-like) section prototypes. <!-- --> <!-- --> ## BarSurface[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_BarSurface "Direct link to BarSurface") * *class *viktor.external.idea\_rcs.objects.BarSurface(*\*values*)[](#BarSurface "Link to this definition") Bases: `Enum` * RIBBED*: [`BarSurface`](#BarSurface "viktor.external.idea_rcs.objects.BarSurface")** = 1*[](#BarSurface.RIBBED "Link to this definition") - SMOOTH*: [`BarSurface`](#BarSurface "viktor.external.idea_rcs.objects.BarSurface")** = 0*[](#BarSurface.SMOOTH "Link to this definition") <!-- --> ## CalculationSetup[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_CalculationSetup "Direct link to CalculationSetup") * *class *viktor.external.idea\_rcs.objects.CalculationSetup(*\**, *uls\_response=None*, *uls\_diagram=None*, *uls\_shear=None*, *uls\_torsion=None*, *uls\_interaction=None*, *sls\_crack=None*, *sls\_stress\_limitation=None*, *sls\_stiffnesses=None*, *detailing=None*, *m\_n\_kappa\_diagram=None*, *fatigue=None*, *cross\_section\_characteristics=None*)[](#CalculationSetup "Link to this definition") Bases: `_OpenObject` Concrete calculation setup. * Parameters: * **uls\_response** (`bool`) – Response N-M(-M) (default: False). * **uls\_diagram** (`bool`) – Capacity N-M(-M) (default: True). * **uls\_shear** (`bool`) – Shear (default: True). * **uls\_torsion** (`bool`) – Torsion (default: True). * **uls\_interaction** (`bool`) – Interaction (default: True). * **sls\_crack** (`bool`) – Crack width (default: True). * **sls\_stress\_limitation** (`bool`) – Stress limitation (default: True). * **sls\_stiffnesses** (`bool`) – Stiffnesses (default: False). * **detailing** (`bool`) – Detailing (default: True). * **m\_n\_kappa\_diagram** (`bool`) – M-N-κ diagram (default: False). * **fatigue** (`bool`) – Fatigue (default: True). * **cross\_section\_characteristics** (`bool`) – Cross-section characteristics (default: IDEA-RCS default). <!-- --> ## CheckMember[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_CheckMember "Direct link to CheckMember") * *class *viktor.external.idea\_rcs.objects.CheckMember(*id\_*)[](#CheckMember "Link to this definition") Bases: `_OpenElementId`, `ABC` Abstract base class of all check members. <!-- --> ## CheckMember1D[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_CheckMember1D "Direct link to CheckMember1D") * *class *viktor.external.idea\_rcs.objects.CheckMember1D(*id\_*, *name*)[](#CheckMember1D "Link to this definition") Bases: [`CheckMember`](#CheckMember "viktor.external.idea_rcs.objects.CheckMember") Do not use this \_\_init\_\_ directly, but create the object by [`create_check_member1d()`](https://docs.viktor.ai/sdk/api/external/idea/.md#OpenModel.create_check_member1d "viktor.external.idea_rcs.idea_rcs.OpenModel.create_check_member1d"). <!-- --> ## CheckSection[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_CheckSection "Direct link to CheckSection") * *class *viktor.external.idea\_rcs.objects.CheckSection(*id\_*, *description*, *check\_member*, *reinf\_section*, *extremes=None*)[](#CheckSection "Link to this definition") Bases: `_OpenElementId`, `ABC` Abstract base class of all check sections. * create\_extreme(*\**, *description=None*, *accidental=None*, *fatigue=None*, *frequent=None*, *fundamental=None*, *characteristic=None*, *quasi\_permanent=None*)[](#CheckSection.create_extreme "Link to this definition") Create an extreme case with corresponding internal forces on the section for checking. * Parameters: * **description** (`str`) – Description of the extreme (default: ‘{section\_name} - E {i}’). New in v14.6.0 * **accidental** ([`LoadingULS`](#LoadingULS "viktor.external.idea_rcs.objects.LoadingULS")) – Accidental loading. * **fatigue** ([`FatigueLoading`](#FatigueLoading "viktor.external.idea_rcs.objects.FatigueLoading")) – Fatigue loading. * **frequent** ([`LoadingSLS`](#LoadingSLS "viktor.external.idea_rcs.objects.LoadingSLS")) – Frequent loading. * **fundamental** ([`LoadingULS`](#LoadingULS "viktor.external.idea_rcs.objects.LoadingULS")) – Fundamental loading. * **characteristic** ([`LoadingSLS`](#LoadingSLS "viktor.external.idea_rcs.objects.LoadingSLS")) – Characteristic loading. * **quasi\_permanent** ([`LoadingSLS`](#LoadingSLS "viktor.external.idea_rcs.objects.LoadingSLS")) – Quasi-Permanent loading. * Return type: `None` - *property *extremes*: List\[[CheckSectionExtreme](#CheckSectionExtreme "viktor.external.idea_rcs.objects.CheckSectionExtreme")]*[](#CheckSection.extremes "Link to this definition") <!-- --> ## CheckSectionExtreme[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_CheckSectionExtreme "Direct link to CheckSectionExtreme") * *class *viktor.external.idea\_rcs.objects.CheckSectionExtreme(*accidental=None*, *fatigue=None*, *frequent=None*, *fundamental=None*, *characteristic=None*, *quasi\_permanent=None*, *\**, *description*)[](#CheckSectionExtreme "Link to this definition") Bases: `_OpenObject` Abstract base class of all check section extremes. <!-- --> ## CodeSettings[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_CodeSettings "Direct link to CodeSettings") * *class *viktor.external.idea\_rcs.objects.CodeSettings(*\**, *evaluation\_interaction\_diagram=None*, *theta=None*, *theta\_min=None*, *theta\_max=None*, *n\_cycles\_fatigue=None*, *no\_resistance\_concrete\_tension\_1d=None*, *type\_sls\_calculation=None*)[](#CodeSettings "Link to this definition") Bases: `_OpenObject` Code and calculation settings. * Parameters: * **evaluation\_interaction\_diagram** ([`EvaluationInteractionDiagram`](#EvaluationInteractionDiagram "viktor.external.idea_rcs.objects.EvaluationInteractionDiagram")) – evaluation of interaction diagram (default: NuMuMu) * **theta** (`float`) – angle \[deg] between the concrete compression strut and the beam axis perpendicular to the shear force (default: set by IDEA) * **theta\_min** (`float`) – minimum angle \[deg] between the concrete compression strut and the beam axis perpendicular to the shear force (default: set by IDEA) * **theta\_max** (`float`) – maximum angle \[deg] between the concrete compression strut and the beam axis perpendicular to the shear force (default: set by IDEA) * **n\_cycles\_fatigue** (`float`) – number of fatigue cycles (\* 10⁶) (default: set by IDEA) * **no\_resistance\_concrete\_tension\_1d** ([`NoResistanceConcreteTension1d`](#NoResistanceConcreteTension1d "viktor.external.idea_rcs.objects.NoResistanceConcreteTension1d")) – no resistance of concrete in tension - members 1D (default: Extreme) * **type\_sls\_calculation** ([`TypeSLSCalculation`](#TypeSLSCalculation "viktor.external.idea_rcs.objects.TypeSLSCalculation")) – type of SLS calculation (default: Both) <!-- --> ## ConcAggregateType[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_ConcAggregateType "Direct link to ConcAggregateType") * *class *viktor.external.idea\_rcs.objects.ConcAggregateType(*\*values*)[](#ConcAggregateType "Link to this definition") Bases: `Enum` * BASALT*: [`ConcAggregateType`](#ConcAggregateType "viktor.external.idea_rcs.objects.ConcAggregateType")** = 3*[](#ConcAggregateType.BASALT "Link to this definition") - LIMESTONE*: [`ConcAggregateType`](#ConcAggregateType "viktor.external.idea_rcs.objects.ConcAggregateType")** = 1*[](#ConcAggregateType.LIMESTONE "Link to this definition") * QUARTZITE*: [`ConcAggregateType`](#ConcAggregateType "viktor.external.idea_rcs.objects.ConcAggregateType")** = 0*[](#ConcAggregateType.QUARTZITE "Link to this definition") - SANDSTONE*: [`ConcAggregateType`](#ConcAggregateType "viktor.external.idea_rcs.objects.ConcAggregateType")** = 2*[](#ConcAggregateType.SANDSTONE "Link to this definition") <!-- --> ## ConcCementClass[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_ConcCementClass "Direct link to ConcCementClass") * *class *viktor.external.idea\_rcs.objects.ConcCementClass(*\*values*)[](#ConcCementClass "Link to this definition") Bases: `Enum` * N*: [`ConcCementClass`](#ConcCementClass "viktor.external.idea_rcs.objects.ConcCementClass")** = 2*[](#ConcCementClass.N "Link to this definition") - R*: [`ConcCementClass`](#ConcCementClass "viktor.external.idea_rcs.objects.ConcCementClass")** = 1*[](#ConcCementClass.R "Link to this definition") * S*: [`ConcCementClass`](#ConcCementClass "viktor.external.idea_rcs.objects.ConcCementClass")** = 0*[](#ConcCementClass.S "Link to this definition") <!-- --> ## ConcDependentParams[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_ConcDependentParams "Direct link to ConcDependentParams") * *class *viktor.external.idea\_rcs.objects.ConcDependentParams(*E\_cm*, *eps\_c1*, *eps\_c2*, *eps\_c3*, *eps\_cu1*, *eps\_cu2*, *eps\_cu3*, *F\_ctm*, *F\_ctk\_0\_05*, *F\_ctk\_0\_95*, *n\_factor*, *F\_cm*)[](#ConcDependentParams "Link to this definition") Bases: `_OpenObject` Collection of all MatConcreteEc2 dependent parameters. * Parameters: * **E\_cm** (`float`) – Secant modulus of elasticity of concrete \[MPa] * **eps\_c1** (`float`) – Compressive strain in the concrete - εc1 \[-] * **eps\_c2** (`float`) – Compressive strain in the concrete - εc2 \[-] * **eps\_c3** (`float`) – Compressive strain in the concrete - εc3 \[-] * **eps\_cu1** (`float`) – Ultimate compressive strain in the concrete - εcu1 \[-] * **eps\_cu2** (`float`) – Ultimate compressive strain in the concrete - εcu2 \[-] * **eps\_cu3** (`float`) – Ultimate compressive strain in the concrete - εcu3 \[-] * **F\_ctm** (`float`) – Mean value of axial tensile strength of concrete \[MPa] * **F\_ctk\_0\_05** (`float`) – Characteristic axial tensile strength of concrete 5% quantile \[MPa] * **F\_ctk\_0\_95** (`float`) – Characteristic axial tensile strength of concrete 95% quantile \[MPa] * **n\_factor** (`float`) – Coefficient n-factor - necessary parabolic part of stress-strain diagram - n \[-] * **F\_cm** (`float`) – Mean value of concrete cylinder compressive strength \[MPa] <!-- --> ## ConcDiagramType[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_ConcDiagramType "Direct link to ConcDiagramType") * *class *viktor.external.idea\_rcs.objects.ConcDiagramType(*\*values*)[](#ConcDiagramType "Link to this definition") Bases: `Enum` * BILINEAR*: [`ConcDiagramType`](#ConcDiagramType "viktor.external.idea_rcs.objects.ConcDiagramType")** = 0*[](#ConcDiagramType.BILINEAR "Link to this definition") - PARABOLIC*: [`ConcDiagramType`](#ConcDiagramType "viktor.external.idea_rcs.objects.ConcDiagramType")** = 1*[](#ConcDiagramType.PARABOLIC "Link to this definition") * USER*: [`ConcDiagramType`](#ConcDiagramType "viktor.external.idea_rcs.objects.ConcDiagramType")** = 2*[](#ConcDiagramType.USER "Link to this definition") <!-- --> ## ConcreteMaterial[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_ConcreteMaterial "Direct link to ConcreteMaterial") * *class *viktor.external.idea\_rcs.objects.ConcreteMaterial(*\*values*)[](#ConcreteMaterial "Link to this definition") Bases: `Enum` * C100\_115*: [`ConcreteMaterial`](#ConcreteMaterial "viktor.external.idea_rcs.objects.ConcreteMaterial")** = 15*[](#ConcreteMaterial.C100_115 "Link to this definition") - C12\_15*: [`ConcreteMaterial`](#ConcreteMaterial "viktor.external.idea_rcs.objects.ConcreteMaterial")** = 1*[](#ConcreteMaterial.C12_15 "Link to this definition") * C16\_20*: [`ConcreteMaterial`](#ConcreteMaterial "viktor.external.idea_rcs.objects.ConcreteMaterial")** = 2*[](#ConcreteMaterial.C16_20 "Link to this definition") - C20\_25*: [`ConcreteMaterial`](#ConcreteMaterial "viktor.external.idea_rcs.objects.ConcreteMaterial")** = 3*[](#ConcreteMaterial.C20_25 "Link to this definition") * C25\_30*: [`ConcreteMaterial`](#ConcreteMaterial "viktor.external.idea_rcs.objects.ConcreteMaterial")** = 4*[](#ConcreteMaterial.C25_30 "Link to this definition") - C30\_37*: [`ConcreteMaterial`](#ConcreteMaterial "viktor.external.idea_rcs.objects.ConcreteMaterial")** = 5*[](#ConcreteMaterial.C30_37 "Link to this definition") * C35\_45*: [`ConcreteMaterial`](#ConcreteMaterial "viktor.external.idea_rcs.objects.ConcreteMaterial")** = 6*[](#ConcreteMaterial.C35_45 "Link to this definition") - C40\_50*: [`ConcreteMaterial`](#ConcreteMaterial "viktor.external.idea_rcs.objects.ConcreteMaterial")** = 7*[](#ConcreteMaterial.C40_50 "Link to this definition") * C45\_55*: [`ConcreteMaterial`](#ConcreteMaterial "viktor.external.idea_rcs.objects.ConcreteMaterial")** = 8*[](#ConcreteMaterial.C45_55 "Link to this definition") - C50\_60*: [`ConcreteMaterial`](#ConcreteMaterial "viktor.external.idea_rcs.objects.ConcreteMaterial")** = 9*[](#ConcreteMaterial.C50_60 "Link to this definition") * C55\_67*: [`ConcreteMaterial`](#ConcreteMaterial "viktor.external.idea_rcs.objects.ConcreteMaterial")** = 10*[](#ConcreteMaterial.C55_67 "Link to this definition") - C60\_75*: [`ConcreteMaterial`](#ConcreteMaterial "viktor.external.idea_rcs.objects.ConcreteMaterial")** = 11*[](#ConcreteMaterial.C60_75 "Link to this definition") * C70\_85*: [`ConcreteMaterial`](#ConcreteMaterial "viktor.external.idea_rcs.objects.ConcreteMaterial")** = 12*[](#ConcreteMaterial.C70_85 "Link to this definition") - C80\_95*: [`ConcreteMaterial`](#ConcreteMaterial "viktor.external.idea_rcs.objects.ConcreteMaterial")** = 13*[](#ConcreteMaterial.C80_95 "Link to this definition") * C90\_105*: [`ConcreteMaterial`](#ConcreteMaterial "viktor.external.idea_rcs.objects.ConcreteMaterial")** = 14*[](#ConcreteMaterial.C90_105 "Link to this definition") <!-- --> ## ConcreteMemberData[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_ConcreteMemberData "Direct link to ConcreteMemberData") * *class *viktor.external.idea\_rcs.objects.ConcreteMemberData(*element*, *member\_type*, *two\_way\_slab\_type*, *calculation\_setup=None*)[](#ConcreteMemberData "Link to this definition") Bases: `_OpenObject`, `ABC` Abstract base class of all concrete member data. <!-- --> ## ConcreteMemberDataEc2[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_ConcreteMemberDataEc2 "Direct link to ConcreteMemberDataEc2") * *class *viktor.external.idea\_rcs.objects.ConcreteMemberDataEc2(*element*, *member\_type*, *two\_way\_slab\_type*, *calculation\_setup=None*, *coeff\_kx\_for\_wmax=None*, *exposure\_class\_data=None*, *creep\_coefficient=None*, *relative\_humidity=None*)[](#ConcreteMemberDataEc2 "Link to this definition") Bases: [`ConcreteMemberData`](#ConcreteMemberData "viktor.external.idea_rcs.objects.ConcreteMemberData") Do not use this \_\_init\_\_ directly, but create the object by [`add_member_data_ec2()`](https://docs.viktor.ai/sdk/api/external/idea/.md#OpenModel.add_member_data_ec2 "viktor.external.idea_rcs.idea_rcs.OpenModel.add_member_data_ec2"). <!-- --> ## CrossSection[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_CrossSection "Direct link to CrossSection") * *class *viktor.external.idea\_rcs.objects.CrossSection(*id\_*, *name*)[](#CrossSection "Link to this definition") Bases: `_OpenElementId`, `ABC` Abstract base class of all cross-sections. <!-- --> ## CrossSectionComponent[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_CrossSectionComponent "Direct link to CrossSectionComponent") * *class *viktor.external.idea\_rcs.objects.CrossSectionComponent(*id\_*, *name*)[](#CrossSectionComponent "Link to this definition") Bases: [`CrossSection`](#CrossSection "viktor.external.idea_rcs.objects.CrossSection") Do not use this \_\_init\_\_ directly, but create the object by [`create_cross_section_component()`](https://docs.viktor.ai/sdk/api/external/idea/.md#OpenModel.create_cross_section_component "viktor.external.idea_rcs.idea_rcs.OpenModel.create_cross_section_component"). * create\_component(*outline*, *material*, *\**, *openings=None*)[](#CrossSectionComponent.create_component "Link to this definition") Create a component to build up the cross-section. * Parameters: * **outline** (`Sequence`\[`Tuple`\[`float`, `float`]]) – Vertices which define the outline of the section (y, z). A minimum of 3 vertices is required, the outline is automatically closed. * **material** ([`MatConcrete`](#MatConcrete "viktor.external.idea_rcs.objects.MatConcrete")) – Material (created by [`create_matconcrete_ec2()`](https://docs.viktor.ai/sdk/api/external/idea/.md#OpenModel.create_matconcrete_ec2 "viktor.external.idea_rcs.idea_rcs.OpenModel.create_matconcrete_ec2")). * **openings** (`Sequence`\[`Sequence`\[`Tuple`\[`float`, `float`]]]) – One or multiple openings, defined by vertices (y, z). A minimum of 3 vertices per opening is required, the opening is automatically closed. * Return type: `None` <!-- --> ## CrossSectionParameter[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_CrossSectionParameter "Direct link to CrossSectionParameter") * *class *viktor.external.idea\_rcs.objects.CrossSectionParameter(*id\_*, *name*, *cross\_section\_type*, *material*, *\*\*parameters*)[](#CrossSectionParameter "Link to this definition") Bases: [`CrossSection`](#CrossSection "viktor.external.idea_rcs.objects.CrossSection") Do not use this \_\_init\_\_ directly, but create the object by [`create_cross_section_parameter()`](https://docs.viktor.ai/sdk/api/external/idea/.md#OpenModel.create_cross_section_parameter "viktor.external.idea_rcs.idea_rcs.OpenModel.create_cross_section_parameter"). <!-- --> ## CrossSectionType[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_CrossSectionType "Direct link to CrossSectionType") * *class *viktor.external.idea\_rcs.objects.CrossSectionType(*\*values*)[](#CrossSectionType "Link to this definition") Bases: `Enum` * BEAM\_SHAPE\_BOX*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 79*[](#CrossSectionType.BEAM_SHAPE_BOX "Link to this definition") - BEAM\_SHAPE\_BOX\_1*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 80*[](#CrossSectionType.BEAM_SHAPE_BOX_1 "Link to this definition") * BEAM\_SHAPE\_IREV\_DEGEN*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 83*[](#CrossSectionType.BEAM_SHAPE_IREV_DEGEN "Link to this definition") - BEAM\_SHAPE\_IREV\_DEGEN\_ADD*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 84*[](#CrossSectionType.BEAM_SHAPE_IREV_DEGEN_ADD "Link to this definition") * BEAM\_SHAPE\_I\_HAUNCH\_CHAMFER*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 76*[](#CrossSectionType.BEAM_SHAPE_I_HAUNCH_CHAMFER "Link to this definition") - BEAM\_SHAPE\_I\_HAUNCH\_CHAMFER\_ASYM*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 77*[](#CrossSectionType.BEAM_SHAPE_I_HAUNCH_CHAMFER_ASYM "Link to this definition") * BEAM\_SHAPE\_I\_Z\_DEGEN*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 88*[](#CrossSectionType.BEAM_SHAPE_I_Z_DEGEN "Link to this definition") - BEAM\_SHAPE\_L\_DEGEN*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 89*[](#CrossSectionType.BEAM_SHAPE_L_DEGEN "Link to this definition") * BEAM\_SHAPE\_REV\_U*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 78*[](#CrossSectionType.BEAM_SHAPE_REV_U "Link to this definition") - BEAM\_SHAPE\_TREV\_CHAMFER\_HAUNCH\_D*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 82*[](#CrossSectionType.BEAM_SHAPE_TREV_CHAMFER_HAUNCH_D "Link to this definition") * BEAM\_SHAPE\_TREV\_CHAMFER\_HAUNCH\_S*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 81*[](#CrossSectionType.BEAM_SHAPE_TREV_CHAMFER_HAUNCH_S "Link to this definition") - BEAM\_SHAPE\_TREV\_DEGEN*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 85*[](#CrossSectionType.BEAM_SHAPE_TREV_DEGEN "Link to this definition") * BEAM\_SHAPE\_TREV\_DEGEN\_ADD*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 86*[](#CrossSectionType.BEAM_SHAPE_TREV_DEGEN_ADD "Link to this definition") - BEAM\_SHAPE\_Z\_DEGEN*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 87*[](#CrossSectionType.BEAM_SHAPE_Z_DEGEN "Link to this definition") * BOX\_2I*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 18*[](#CrossSectionType.BOX_2I "Link to this definition") - BOX\_2L*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 21*[](#CrossSectionType.BOX_2L "Link to this definition") * BOX\_2U*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 19*[](#CrossSectionType.BOX_2U "Link to this definition") - BOX\_2U\_2PI*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 20*[](#CrossSectionType.BOX_2U_2PI "Link to this definition") * BOX\_4L*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 22*[](#CrossSectionType.BOX_4L "Link to this definition") - BOX\_FL*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 16*[](#CrossSectionType.BOX_FL "Link to this definition") * BOX\_WEB*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 17*[](#CrossSectionType.BOX_WEB "Link to this definition") - CHS\_G*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 34*[](#CrossSectionType.CHS_G "Link to this definition") * CHS\_PAR*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 101*[](#CrossSectionType.CHS_PAR "Link to this definition") - COMPOSITE\_BEAM\_BOX*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 53*[](#CrossSectionType.COMPOSITE_BEAM_BOX "Link to this definition") * COMPOSITE\_BEAM\_BOX\_1*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 54*[](#CrossSectionType.COMPOSITE_BEAM_BOX_1 "Link to this definition") - COMPOSITE\_BEAM\_IGEN\_T*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 55*[](#CrossSectionType.COMPOSITE_BEAM_IGEN_T "Link to this definition") * COMPOSITE\_BEAM\_L\_LEFT*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 56*[](#CrossSectionType.COMPOSITE_BEAM_L_LEFT "Link to this definition") - COMPOSITE\_BEAM\_PLATE*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 57*[](#CrossSectionType.COMPOSITE_BEAM_PLATE "Link to this definition") * COMPOSITE\_BEAM\_R\_RES\_T*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 58*[](#CrossSectionType.COMPOSITE_BEAM_R_RES_T "Link to this definition") - COMPOSITE\_BEAM\_R\_RES\_T\_1*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 59*[](#CrossSectionType.COMPOSITE_BEAM_R_RES_T_1 "Link to this definition") * COMPOSITE\_BEAM\_R\_T*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 60*[](#CrossSectionType.COMPOSITE_BEAM_R_T "Link to this definition") - COMPOSITE\_BEAM\_SHAPE\_CHAMF*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 61*[](#CrossSectionType.COMPOSITE_BEAM_SHAPE_CHAMF "Link to this definition") * COMPOSITE\_BEAM\_SHAPE\_CHAMF\_ASYM*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 62*[](#CrossSectionType.COMPOSITE_BEAM_SHAPE_CHAMF_ASYM "Link to this definition") - COMPOSITE\_BEAM\_SHAPE\_IGEN*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 63*[](#CrossSectionType.COMPOSITE_BEAM_SHAPE_IGEN "Link to this definition") * COMPOSITE\_BEAM\_SHAPE\_I\_T*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 64*[](#CrossSectionType.COMPOSITE_BEAM_SHAPE_I_T "Link to this definition") - COMPOSITE\_BEAM\_SHAPE\_I\_T\_ASYM*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 65*[](#CrossSectionType.COMPOSITE_BEAM_SHAPE_I_T_ASYM "Link to this definition") * COMPOSITE\_BEAM\_SHAPE\_T\_T*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 75*[](#CrossSectionType.COMPOSITE_BEAM_SHAPE_T_T "Link to this definition") - COMPOSITE\_BEAM\_TRAPEZOID*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 67*[](#CrossSectionType.COMPOSITE_BEAM_TRAPEZOID "Link to this definition") * COMPOSITE\_BEAM\_TRES\_T*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 68*[](#CrossSectionType.COMPOSITE_BEAM_TRES_T "Link to this definition") - COMPOSITE\_BEAM\_TREV*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 69*[](#CrossSectionType.COMPOSITE_BEAM_TREV "Link to this definition") * COMPOSITE\_BEAM\_TREV\_RES\_I*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 70*[](#CrossSectionType.COMPOSITE_BEAM_TREV_RES_I "Link to this definition") - COMPOSITE\_BEAM\_TREV\_RES\_I\_1*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 71*[](#CrossSectionType.COMPOSITE_BEAM_TREV_RES_I_1 "Link to this definition") * COMPOSITE\_BEAM\_TREV\_RES\_R*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 72*[](#CrossSectionType.COMPOSITE_BEAM_TREV_RES_R "Link to this definition") - COMPOSITE\_BEAM\_TREV\_RES\_R\_1*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 73*[](#CrossSectionType.COMPOSITE_BEAM_TREV_RES_R_1 "Link to this definition") * COMPOSITE\_BEAM\_TREV\_T*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 74*[](#CrossSectionType.COMPOSITE_BEAM_TREV_T "Link to this definition") - COMPOSITE\_BEAM\_T\_LEFT*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 66*[](#CrossSectionType.COMPOSITE_BEAM_T_LEFT "Link to this definition") * GENERAL*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 38*[](#CrossSectionType.GENERAL "Link to this definition") - GENERAL\_CONCRETE*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 52*[](#CrossSectionType.GENERAL_CONCRETE "Link to this definition") * GENERAL\_STEEL*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 51*[](#CrossSectionType.GENERAL_STEEL "Link to this definition") - IGH*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 29*[](#CrossSectionType.IGH "Link to this definition") * IGN*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 28*[](#CrossSectionType.IGN "Link to this definition") - IW*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 23*[](#CrossSectionType.IW "Link to this definition") * IWN*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 24*[](#CrossSectionType.IWN "Link to this definition") - LG*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 31*[](#CrossSectionType.LG "Link to this definition") * LG\_MIRRORED*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 32*[](#CrossSectionType.LG_MIRRORED "Link to this definition") - O*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 26*[](#CrossSectionType.O "Link to this definition") * ONE\_COMPONENT\_CSS*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 0*[](#CrossSectionType.ONE_COMPONENT_CSS "Link to this definition") - OVAL*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 37*[](#CrossSectionType.OVAL "Link to this definition") * RECT*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 27*[](#CrossSectionType.RECT "Link to this definition") - RHS\_G*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 36*[](#CrossSectionType.RHS_G "Link to this definition") * ROLLED\_2I*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 39*[](#CrossSectionType.ROLLED_2I "Link to this definition") - ROLLED\_ANGLE*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 2*[](#CrossSectionType.ROLLED_ANGLE "Link to this definition") * ROLLED\_CHS*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 5*[](#CrossSectionType.ROLLED_CHS "Link to this definition") - ROLLED\_DOUBLE\_LT*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 10*[](#CrossSectionType.ROLLED_DOUBLE_LT "Link to this definition") * ROLLED\_DOUBLE\_LU*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 11*[](#CrossSectionType.ROLLED_DOUBLE_LU "Link to this definition") - ROLLED\_DOUBLE\_UC*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 8*[](#CrossSectionType.ROLLED_DOUBLE_UC "Link to this definition") * ROLLED\_DOUBLE\_UO*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 7*[](#CrossSectionType.ROLLED_DOUBLE_UO "Link to this definition") - ROLLED\_I*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 1*[](#CrossSectionType.ROLLED_I "Link to this definition") * ROLLED\_I\_PAR*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 13*[](#CrossSectionType.ROLLED_I_PAR "Link to this definition") - ROLLED\_L\_PAR*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 15*[](#CrossSectionType.ROLLED_L_PAR "Link to this definition") * ROLLED\_RHS*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 6*[](#CrossSectionType.ROLLED_RHS "Link to this definition") - ROLLED\_T*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 3*[](#CrossSectionType.ROLLED_T "Link to this definition") * ROLLED\_TI*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 12*[](#CrossSectionType.ROLLED_TI "Link to this definition") - ROLLED\_U*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 4*[](#CrossSectionType.ROLLED_U "Link to this definition") * ROLLED\_U\_PAR*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 14*[](#CrossSectionType.ROLLED_U_PAR "Link to this definition") - SG*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 50*[](#CrossSectionType.SG "Link to this definition") * TCHAMFER\_1*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 46*[](#CrossSectionType.TCHAMFER_1 "Link to this definition") - TCHAMFER\_2*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 47*[](#CrossSectionType.TCHAMFER_2 "Link to this definition") * TG*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 30*[](#CrossSectionType.TG "Link to this definition") - TGREV*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 43*[](#CrossSectionType.TGREV "Link to this definition") * TRAPEZOID*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 40*[](#CrossSectionType.TRAPEZOID "Link to this definition") - TT*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 48*[](#CrossSectionType.TT "Link to this definition") * TT1*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 49*[](#CrossSectionType.TT1 "Link to this definition") - TTFH*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 41*[](#CrossSectionType.TTFH "Link to this definition") * TTFHREV*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 44*[](#CrossSectionType.TTFHREV "Link to this definition") - TW*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 25*[](#CrossSectionType.TW "Link to this definition") * TWH*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 42*[](#CrossSectionType.TWH "Link to this definition") - TWHREV*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 45*[](#CrossSectionType.TWHREV "Link to this definition") * UG*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 33*[](#CrossSectionType.UG "Link to this definition") - UNIQUE\_NAME*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 1001*[](#CrossSectionType.UNIQUE_NAME "Link to this definition") * ZG*: [`CrossSectionType`](#CrossSectionType "viktor.external.idea_rcs.objects.CrossSectionType")** = 35*[](#CrossSectionType.ZG "Link to this definition") <!-- --> ## EvaluationInteractionDiagram[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_EvaluationInteractionDiagram "Direct link to EvaluationInteractionDiagram") * *class *viktor.external.idea\_rcs.objects.EvaluationInteractionDiagram(*\*values*)[](#EvaluationInteractionDiagram "Link to this definition") Bases: `Enum` * NU\_MU\_MU*: [`EvaluationInteractionDiagram`](#EvaluationInteractionDiagram "viktor.external.idea_rcs.objects.EvaluationInteractionDiagram")** = 0*[](#EvaluationInteractionDiagram.NU_MU_MU "Link to this definition") - NU\_M\_M*: [`EvaluationInteractionDiagram`](#EvaluationInteractionDiagram "viktor.external.idea_rcs.objects.EvaluationInteractionDiagram")** = 1*[](#EvaluationInteractionDiagram.NU_M_M "Link to this definition") * N\_MU\_MU*: [`EvaluationInteractionDiagram`](#EvaluationInteractionDiagram "viktor.external.idea_rcs.objects.EvaluationInteractionDiagram")** = 2*[](#EvaluationInteractionDiagram.N_MU_MU "Link to this definition") <!-- --> ## ExposureClassEc2Carbonation[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_ExposureClassEc2Carbonation "Direct link to ExposureClassEc2Carbonation") * *class *viktor.external.idea\_rcs.objects.ExposureClassEc2Carbonation(*\*values*)[](#ExposureClassEc2Carbonation "Link to this definition") Bases: `Enum` * XC1*: [`ExposureClassEc2Carbonation`](#ExposureClassEc2Carbonation "viktor.external.idea_rcs.objects.ExposureClassEc2Carbonation")** = 1*[](#ExposureClassEc2Carbonation.XC1 "Link to this definition") - XC2*: [`ExposureClassEc2Carbonation`](#ExposureClassEc2Carbonation "viktor.external.idea_rcs.objects.ExposureClassEc2Carbonation")** = 2*[](#ExposureClassEc2Carbonation.XC2 "Link to this definition") * XC3*: [`ExposureClassEc2Carbonation`](#ExposureClassEc2Carbonation "viktor.external.idea_rcs.objects.ExposureClassEc2Carbonation")** = 3*[](#ExposureClassEc2Carbonation.XC3 "Link to this definition") - XC4*: [`ExposureClassEc2Carbonation`](#ExposureClassEc2Carbonation "viktor.external.idea_rcs.objects.ExposureClassEc2Carbonation")** = 4*[](#ExposureClassEc2Carbonation.XC4 "Link to this definition") <!-- --> ## ExposureClassEc2ChemicalAttack[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_ExposureClassEc2ChemicalAttack "Direct link to ExposureClassEc2ChemicalAttack") * *class *viktor.external.idea\_rcs.objects.ExposureClassEc2ChemicalAttack(*\*values*)[](#ExposureClassEc2ChemicalAttack "Link to this definition") Bases: `Enum` * XA1*: [`ExposureClassEc2ChemicalAttack`](#ExposureClassEc2ChemicalAttack "viktor.external.idea_rcs.objects.ExposureClassEc2ChemicalAttack")** = 1*[](#ExposureClassEc2ChemicalAttack.XA1 "Link to this definition") - XA2*: [`ExposureClassEc2ChemicalAttack`](#ExposureClassEc2ChemicalAttack "viktor.external.idea_rcs.objects.ExposureClassEc2ChemicalAttack")** = 2*[](#ExposureClassEc2ChemicalAttack.XA2 "Link to this definition") * XA3*: [`ExposureClassEc2ChemicalAttack`](#ExposureClassEc2ChemicalAttack "viktor.external.idea_rcs.objects.ExposureClassEc2ChemicalAttack")** = 3*[](#ExposureClassEc2ChemicalAttack.XA3 "Link to this definition") <!-- --> ## ExposureClassEc2Chlorides[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_ExposureClassEc2Chlorides "Direct link to ExposureClassEc2Chlorides") * *class *viktor.external.idea\_rcs.objects.ExposureClassEc2Chlorides(*\*values*)[](#ExposureClassEc2Chlorides "Link to this definition") Bases: `Enum` * XD1*: [`ExposureClassEc2Chlorides`](#ExposureClassEc2Chlorides "viktor.external.idea_rcs.objects.ExposureClassEc2Chlorides")** = 1*[](#ExposureClassEc2Chlorides.XD1 "Link to this definition") - XD2*: [`ExposureClassEc2Chlorides`](#ExposureClassEc2Chlorides "viktor.external.idea_rcs.objects.ExposureClassEc2Chlorides")** = 2*[](#ExposureClassEc2Chlorides.XD2 "Link to this definition") * XD3*: [`ExposureClassEc2Chlorides`](#ExposureClassEc2Chlorides "viktor.external.idea_rcs.objects.ExposureClassEc2Chlorides")** = 3*[](#ExposureClassEc2Chlorides.XD3 "Link to this definition") <!-- --> ## ExposureClassEc2ChloridesFromSea[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_ExposureClassEc2ChloridesFromSea "Direct link to ExposureClassEc2ChloridesFromSea") * *class *viktor.external.idea\_rcs.objects.ExposureClassEc2ChloridesFromSea(*\*values*)[](#ExposureClassEc2ChloridesFromSea "Link to this definition") Bases: `Enum` * XS1*: [`ExposureClassEc2ChloridesFromSea`](#ExposureClassEc2ChloridesFromSea "viktor.external.idea_rcs.objects.ExposureClassEc2ChloridesFromSea")** = 1*[](#ExposureClassEc2ChloridesFromSea.XS1 "Link to this definition") - XS2*: [`ExposureClassEc2ChloridesFromSea`](#ExposureClassEc2ChloridesFromSea "viktor.external.idea_rcs.objects.ExposureClassEc2ChloridesFromSea")** = 2*[](#ExposureClassEc2ChloridesFromSea.XS2 "Link to this definition") * XS3*: [`ExposureClassEc2ChloridesFromSea`](#ExposureClassEc2ChloridesFromSea "viktor.external.idea_rcs.objects.ExposureClassEc2ChloridesFromSea")** = 3*[](#ExposureClassEc2ChloridesFromSea.XS3 "Link to this definition") <!-- --> ## ExposureClassEc2FreezeAttack[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_ExposureClassEc2FreezeAttack "Direct link to ExposureClassEc2FreezeAttack") * *class *viktor.external.idea\_rcs.objects.ExposureClassEc2FreezeAttack(*\*values*)[](#ExposureClassEc2FreezeAttack "Link to this definition") Bases: `Enum` * XF1*: [`ExposureClassEc2FreezeAttack`](#ExposureClassEc2FreezeAttack "viktor.external.idea_rcs.objects.ExposureClassEc2FreezeAttack")** = 1*[](#ExposureClassEc2FreezeAttack.XF1 "Link to this definition") - XF2*: [`ExposureClassEc2FreezeAttack`](#ExposureClassEc2FreezeAttack "viktor.external.idea_rcs.objects.ExposureClassEc2FreezeAttack")** = 2*[](#ExposureClassEc2FreezeAttack.XF2 "Link to this definition") * XF3*: [`ExposureClassEc2FreezeAttack`](#ExposureClassEc2FreezeAttack "viktor.external.idea_rcs.objects.ExposureClassEc2FreezeAttack")** = 3*[](#ExposureClassEc2FreezeAttack.XF3 "Link to this definition") - XF4*: [`ExposureClassEc2FreezeAttack`](#ExposureClassEc2FreezeAttack "viktor.external.idea_rcs.objects.ExposureClassEc2FreezeAttack")** = 4*[](#ExposureClassEc2FreezeAttack.XF4 "Link to this definition") <!-- --> ## ExposureClassesDataEc2[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_ExposureClassesDataEc2 "Direct link to ExposureClassesDataEc2") * *class *viktor.external.idea\_rcs.objects.ExposureClassesDataEc2(*\**, *carbonation=None*, *chlorides=None*, *chlorides\_from\_sea=None*, *freeze\_attack=None*, *chemical\_attack=None*)[](#ExposureClassesDataEc2 "Link to this definition") Bases: `_OpenObject` Exposure Classes Ec2. * Parameters: * **carbonation** ([`ExposureClassEc2Carbonation`](#ExposureClassEc2Carbonation "viktor.external.idea_rcs.objects.ExposureClassEc2Carbonation")) – Carbonation (default: None). * **chlorides** ([`ExposureClassEc2Chlorides`](#ExposureClassEc2Chlorides "viktor.external.idea_rcs.objects.ExposureClassEc2Chlorides")) – Chlorides (default: None). * **chlorides\_from\_sea** ([`ExposureClassEc2ChloridesFromSea`](#ExposureClassEc2ChloridesFromSea "viktor.external.idea_rcs.objects.ExposureClassEc2ChloridesFromSea")) – Chlorides from sea (default: None). * **freeze\_attack** ([`ExposureClassEc2FreezeAttack`](#ExposureClassEc2FreezeAttack "viktor.external.idea_rcs.objects.ExposureClassEc2FreezeAttack")) – Freeze/Thaw Attack (default: None). * **chemical\_attack** ([`ExposureClassEc2ChemicalAttack`](#ExposureClassEc2ChemicalAttack "viktor.external.idea_rcs.objects.ExposureClassEc2ChemicalAttack")) – Chemical Attack (default: None). <!-- --> ## FatigueLoading[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_FatigueLoading "Direct link to FatigueLoading") * *class *viktor.external.idea\_rcs.objects.FatigueLoading(*max\_loading*, *min\_loading*)[](#FatigueLoading "Link to this definition") Bases: `_OpenObject` Fatigue loading. * Parameters: * **max\_loading** ([`LoadingULS`](#LoadingULS "viktor.external.idea_rcs.objects.LoadingULS")) – Max. cyclic loading. * **min\_loading** ([`LoadingULS`](#LoadingULS "viktor.external.idea_rcs.objects.LoadingULS")) – Min. cyclic loading. <!-- --> ## LoadingSLS[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_LoadingSLS "Direct link to LoadingSLS") * *class *viktor.external.idea\_rcs.objects.LoadingSLS(*internal\_forces*, *internal\_forces\_imperfection=None*)[](#LoadingSLS "Link to this definition") Bases: `_OpenObject` Loading SLS. * Parameters: * **internal\_forces** ([`ResultOfInternalForces`](#ResultOfInternalForces "viktor.external.idea_rcs.objects.ResultOfInternalForces")) – Internal force in section. * **internal\_forces\_imperfection** ([`ResultOfInternalForces`](#ResultOfInternalForces "viktor.external.idea_rcs.objects.ResultOfInternalForces")) – Internal forces of imperfection effect. <!-- --> ## LoadingULS[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_LoadingULS "Direct link to LoadingULS") * *class *viktor.external.idea\_rcs.objects.LoadingULS(*internal\_forces*, *internal\_forces\_second\_order=None*, *internal\_forces\_begin=None*, *internal\_forces\_end=None*, *internal\_forces\_imperfection=None*)[](#LoadingULS "Link to this definition") Bases: `_OpenObject` Loading ULS. * Parameters: * **internal\_forces** ([`ResultOfInternalForces`](#ResultOfInternalForces "viktor.external.idea_rcs.objects.ResultOfInternalForces")) – Internal force in section. * **internal\_forces\_second\_order** ([`ResultOfInternalForces`](#ResultOfInternalForces "viktor.external.idea_rcs.objects.ResultOfInternalForces")) – Internal forces of 2nd order effect. * **internal\_forces\_begin** ([`ResultOfInternalForces`](#ResultOfInternalForces "viktor.external.idea_rcs.objects.ResultOfInternalForces")) – Internal forces at the beginning. * **internal\_forces\_end** ([`ResultOfInternalForces`](#ResultOfInternalForces "viktor.external.idea_rcs.objects.ResultOfInternalForces")) – Internal forces at the end. * **internal\_forces\_imperfection** ([`ResultOfInternalForces`](#ResultOfInternalForces "viktor.external.idea_rcs.objects.ResultOfInternalForces")) – Internal forces of imperfection effect. <!-- --> ## MatConcrete[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_MatConcrete "Direct link to MatConcrete") * *class *viktor.external.idea\_rcs.objects.MatConcrete(*id\_*, *name*, *e\_modulus*, *g\_modulus*, *poisson*, *unit\_mass*, *specific\_heat*, *thermal\_expansion*, *thermal\_conductivity*, *is\_default*, *order\_in\_code*, *thermal\_state*)[](#MatConcrete "Link to this definition") Bases: `_Material`, `ABC` Abstract base class of all concrete materials. <!-- --> ## MatConcreteEc2[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_MatConcreteEc2 "Direct link to MatConcreteEc2") * *class *viktor.external.idea\_rcs.objects.MatConcreteEc2(*id\_*, *name*, *e\_modulus*, *g\_modulus*, *poisson*, *unit\_mass*, *specific\_heat*, *thermal\_expansion*, *thermal\_conductivity*, *is\_default*, *order\_in\_code*, *thermal\_state*, *fck*, *stone\_diameter*, *cement\_class*, *aggregate\_type*, *diagram\_type*, *silica\_fume*, *plain\_concrete\_diagram*, *dep\_params=None*)[](#MatConcreteEc2 "Link to this definition") Bases: [`MatConcrete`](#MatConcrete "viktor.external.idea_rcs.objects.MatConcrete") Do not use this \_\_init\_\_ directly, but create the object by [`create_matconcrete_ec2()`](https://docs.viktor.ai/sdk/api/external/idea/.md#OpenModel.create_matconcrete_ec2 "viktor.external.idea_rcs.idea_rcs.OpenModel.create_matconcrete_ec2"). <!-- --> ## MatReinforcement[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_MatReinforcement "Direct link to MatReinforcement") * *class *viktor.external.idea\_rcs.objects.MatReinforcement(*id\_*, *name*, *e\_modulus*, *g\_modulus*, *poisson*, *unit\_mass*, *specific\_heat*, *thermal\_expansion*, *thermal\_conductivity*, *is\_default*, *order\_in\_code*, *thermal\_state*, *bar\_surface*)[](#MatReinforcement "Link to this definition") Bases: `_Material`, `ABC` Abstract base class of all material reinforcements. <!-- --> ## MatReinforcementEc2[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_MatReinforcementEc2 "Direct link to MatReinforcementEc2") * *class *viktor.external.idea\_rcs.objects.MatReinforcementEc2(*id\_*, *name*, *e\_modulus*, *g\_modulus*, *poisson*, *unit\_mass*, *specific\_heat*, *thermal\_expansion*, *thermal\_conductivity*, *is\_default*, *order\_in\_code*, *thermal\_state*, *bar\_surface*, *fyk*, *ftk\_by\_fyk*, *epsuk*, *ftk*, *class\_*, *type\_*, *fabrication*, *diagram\_type*)[](#MatReinforcementEc2 "Link to this definition") Bases: [`MatReinforcement`](#MatReinforcement "viktor.external.idea_rcs.objects.MatReinforcement") Do not use this \_\_init\_\_ directly, but create the object by [`create_matreinforcement_ec2()`](https://docs.viktor.ai/sdk/api/external/idea/.md#OpenModel.create_matreinforcement_ec2 "viktor.external.idea_rcs.idea_rcs.OpenModel.create_matreinforcement_ec2"). <!-- --> ## MemberType[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_MemberType "Direct link to MemberType") * *class *viktor.external.idea\_rcs.objects.MemberType(*\*values*)[](#MemberType "Link to this definition") Bases: `Enum` * BEAM*: [`MemberType`](#MemberType "viktor.external.idea_rcs.objects.MemberType")** = 1*[](#MemberType.BEAM "Link to this definition") - BEAM\_SLAB*: [`MemberType`](#MemberType "viktor.external.idea_rcs.objects.MemberType")** = 4*[](#MemberType.BEAM_SLAB "Link to this definition") * COLUMN*: [`MemberType`](#MemberType "viktor.external.idea_rcs.objects.MemberType")** = 2*[](#MemberType.COLUMN "Link to this definition") - HOLLOW\_CORE\_SLAB*: [`MemberType`](#MemberType "viktor.external.idea_rcs.objects.MemberType")** = 8*[](#MemberType.HOLLOW_CORE_SLAB "Link to this definition") * PLATE*: [`MemberType`](#MemberType "viktor.external.idea_rcs.objects.MemberType")** = 32*[](#MemberType.PLATE "Link to this definition") - TWO\_WAY\_SLAB*: [`MemberType`](#MemberType "viktor.external.idea_rcs.objects.MemberType")** = 16*[](#MemberType.TWO_WAY_SLAB "Link to this definition") * UNDEFINED*: [`MemberType`](#MemberType "viktor.external.idea_rcs.objects.MemberType")** = 0*[](#MemberType.UNDEFINED "Link to this definition") - WALL*: [`MemberType`](#MemberType "viktor.external.idea_rcs.objects.MemberType")** = 64*[](#MemberType.WALL "Link to this definition") <!-- --> ## NationalAnnex[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_NationalAnnex "Direct link to NationalAnnex") * *class *viktor.external.idea\_rcs.objects.NationalAnnex(*\*values*)[](#NationalAnnex "Link to this definition") Bases: `Enum` * BELGIUM*: [`NationalAnnex`](#NationalAnnex "viktor.external.idea_rcs.objects.NationalAnnex")** = 'Belgian'*[](#NationalAnnex.BELGIUM "Link to this definition") - DUTCH*: [`NationalAnnex`](#NationalAnnex "viktor.external.idea_rcs.objects.NationalAnnex")** = 'Dutch'*[](#NationalAnnex.DUTCH "Link to this definition") * NO\_ANNEX*: [`NationalAnnex`](#NationalAnnex "viktor.external.idea_rcs.objects.NationalAnnex")** = 'NoAnnex'*[](#NationalAnnex.NO_ANNEX "Link to this definition") <!-- --> ## NoResistanceConcreteTension1d[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_NoResistanceConcreteTension1d "Direct link to NoResistanceConcreteTension1d") * *class *viktor.external.idea\_rcs.objects.NoResistanceConcreteTension1d(*\*values*)[](#NoResistanceConcreteTension1d "Link to this definition") Bases: `Enum` * ALWAYS*: [`NoResistanceConcreteTension1d`](#NoResistanceConcreteTension1d "viktor.external.idea_rcs.objects.NoResistanceConcreteTension1d")** = 2*[](#NoResistanceConcreteTension1d.ALWAYS "Link to this definition") - EXTREME*: [`NoResistanceConcreteTension1d`](#NoResistanceConcreteTension1d "viktor.external.idea_rcs.objects.NoResistanceConcreteTension1d")** = 0*[](#NoResistanceConcreteTension1d.EXTREME "Link to this definition") * SECTION*: [`NoResistanceConcreteTension1d`](#NoResistanceConcreteTension1d "viktor.external.idea_rcs.objects.NoResistanceConcreteTension1d")** = 1*[](#NoResistanceConcreteTension1d.SECTION "Link to this definition") <!-- --> ## ProjectData[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_ProjectData "Direct link to ProjectData") * *class *viktor.external.idea\_rcs.objects.ProjectData(*\**, *national\_annex=None*, *fatigue\_check=False*, *name=None*, *number=None*, *description=None*, *author=None*, *date=None*, *design\_working\_life=None*)[](#ProjectData "Link to this definition") Bases: `_OpenObject` Project data. * Parameters: * **name** (`str`) – Project name New in v14.6.0 * **number** (`str`) – Project number New in v14.6.0 * **description** (`str`) – Project description New in v14.6.0 * **author** (`str`) – Author New in v14.6.0 * **date** (`date`) – Date (default: today) New in v14.6.0 * **national\_annex** ([`NationalAnnex`](#NationalAnnex "viktor.external.idea_rcs.objects.NationalAnnex")) – national annex (default: No national annex (EN)) * **fatigue\_check** (`bool`) – functionality - fatigue (default: false) * **design\_working\_life** (`Literal`\[`50`, `75`, `100`]) – Design working life (default: 50) New in v14.6.0 <!-- --> ## ReinfClass[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_ReinfClass "Direct link to ReinfClass") * *class *viktor.external.idea\_rcs.objects.ReinfClass(*\*values*)[](#ReinfClass "Link to this definition") Bases: `Enum` * A*: [`ReinfClass`](#ReinfClass "viktor.external.idea_rcs.objects.ReinfClass")** = 0*[](#ReinfClass.A "Link to this definition") - B*: [`ReinfClass`](#ReinfClass "viktor.external.idea_rcs.objects.ReinfClass")** = 1*[](#ReinfClass.B "Link to this definition") * C*: [`ReinfClass`](#ReinfClass "viktor.external.idea_rcs.objects.ReinfClass")** = 2*[](#ReinfClass.C "Link to this definition") <!-- --> ## ReinfDiagramType[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_ReinfDiagramType "Direct link to ReinfDiagramType") * *class *viktor.external.idea\_rcs.objects.ReinfDiagramType(*\*values*)[](#ReinfDiagramType "Link to this definition") Bases: `Enum` * BILINEAR\_INCLINED*: [`ReinfDiagramType`](#ReinfDiagramType "viktor.external.idea_rcs.objects.ReinfDiagramType")** = 0*[](#ReinfDiagramType.BILINEAR_INCLINED "Link to this definition") - BILINEAR\_NOT\_INCLINED*: [`ReinfDiagramType`](#ReinfDiagramType "viktor.external.idea_rcs.objects.ReinfDiagramType")** = 1*[](#ReinfDiagramType.BILINEAR_NOT_INCLINED "Link to this definition") * USER*: [`ReinfDiagramType`](#ReinfDiagramType "viktor.external.idea_rcs.objects.ReinfDiagramType")** = 2*[](#ReinfDiagramType.USER "Link to this definition") <!-- --> ## ReinfFabrication[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_ReinfFabrication "Direct link to ReinfFabrication") * *class *viktor.external.idea\_rcs.objects.ReinfFabrication(*\*values*)[](#ReinfFabrication "Link to this definition") Bases: `Enum` * COLD\_WORKED*: [`ReinfFabrication`](#ReinfFabrication "viktor.external.idea_rcs.objects.ReinfFabrication")** = 1*[](#ReinfFabrication.COLD_WORKED "Link to this definition") - HOT\_ROLLED*: [`ReinfFabrication`](#ReinfFabrication "viktor.external.idea_rcs.objects.ReinfFabrication")** = 0*[](#ReinfFabrication.HOT_ROLLED "Link to this definition") <!-- --> ## ReinfType[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_ReinfType "Direct link to ReinfType") * *class *viktor.external.idea\_rcs.objects.ReinfType(*\*values*)[](#ReinfType "Link to this definition") Bases: `Enum` * BARS*: [`ReinfType`](#ReinfType "viktor.external.idea_rcs.objects.ReinfType")** = 0*[](#ReinfType.BARS "Link to this definition") - DECOILED\_RODS*: [`ReinfType`](#ReinfType "viktor.external.idea_rcs.objects.ReinfType")** = 1*[](#ReinfType.DECOILED_RODS "Link to this definition") * LATTICE\_GIRDERS*: [`ReinfType`](#ReinfType "viktor.external.idea_rcs.objects.ReinfType")** = 3*[](#ReinfType.LATTICE_GIRDERS "Link to this definition") - WIRE\_FABRICS*: [`ReinfType`](#ReinfType "viktor.external.idea_rcs.objects.ReinfType")** = 2*[](#ReinfType.WIRE_FABRICS "Link to this definition") <!-- --> ## ReinforcedBar[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_ReinforcedBar "Direct link to ReinforcedBar") * *class *viktor.external.idea\_rcs.objects.ReinforcedBar(*coordinates*, *diameter*, *material*)[](#ReinforcedBar "Link to this definition") Bases: `_OpenObject` Do not use this \_\_init\_\_ directly, but create the object by [`ReinforcedCrossSection.create_bar()`](#ReinforcedCrossSection.create_bar "viktor.external.idea_rcs.objects.ReinforcedCrossSection.create_bar"). * *property *coordinates*: Tuple\[float, float]*[](#ReinforcedBar.coordinates "Link to this definition") - *property *diameter*: float*[](#ReinforcedBar.diameter "Link to this definition") * *property *material\_id*: int*[](#ReinforcedBar.material_id "Link to this definition") <!-- --> ## ReinforcedCrossSection[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_ReinforcedCrossSection "Direct link to ReinforcedCrossSection") * *class *viktor.external.idea\_rcs.objects.ReinforcedCrossSection(*id\_*, *name*, *cross\_section*, *bars=None*, *stirrups=None*)[](#ReinforcedCrossSection "Link to this definition") Bases: `_OpenElementId` Do not use this \_\_init\_\_ directly, but create the object by [`create_reinforced_cross_section()`](https://docs.viktor.ai/sdk/api/external/idea/.md#OpenModel.create_reinforced_cross_section "viktor.external.idea_rcs.idea_rcs.OpenModel.create_reinforced_cross_section"). * *property *bars*: List\[[ReinforcedBar](#ReinforcedBar "viktor.external.idea_rcs.objects.ReinforcedBar")]*[](#ReinforcedCrossSection.bars "Link to this definition") - create\_bar(*coordinates*, *diameter*, *material*)[](#ReinforcedCrossSection.create_bar "Link to this definition") Create a reinforced bar on the reinforced cross-section. * Parameters: * **coordinates** (`Tuple`\[`float`, `float`]) – (X, Y) coordinate of the bar \[m]. * **diameter** (`float`) – Diameter of the bar \[m]. * **material** ([`MatReinforcement`](#MatReinforcement "viktor.external.idea_rcs.objects.MatReinforcement")) – Reinforcement material (created by [`create_matreinforcement_ec2()`](https://docs.viktor.ai/sdk/api/external/idea/.md#OpenModel.create_matreinforcement_ec2 "viktor.external.idea_rcs.idea_rcs.OpenModel.create_matreinforcement_ec2")). * Return type: `None` * create\_bar\_layer(*\**, *origin*, *diameter*, *material*, *number\_of\_bars*, *delta\_y=None*, *delta\_z=None*)[](#ReinforcedCrossSection.create_bar_layer "Link to this definition") Create multiple reinforced bars on the reinforced cross-section, positioned on a line. * Parameters: * **origin** (`Tuple`\[`float`, `float`]) – Origin point (Y, Z) \[m]. * **diameter** (`float`) – Diameter of the bar \[m]. * **material** ([`MatReinforcement`](#MatReinforcement "viktor.external.idea_rcs.objects.MatReinforcement")) – Reinforcement material (created by [`create_matreinforcement_ec2()`](https://docs.viktor.ai/sdk/api/external/idea/.md#OpenModel.create_matreinforcement_ec2 "viktor.external.idea_rcs.idea_rcs.OpenModel.create_matreinforcement_ec2")). * **number\_of\_bars** (`int`) – Number of bars (minimum of 2). * **delta\_y** (`float`) – Distance between origin bar and the last bar in y-direction \[m]. * **delta\_z** (`float`) – Distance between origin bar and the last bar in z-direction \[m]. * Return type: `None` - create\_stirrup(*points*, *diameter*, *material*, *distance*, *shear\_check=None*, *torsion\_check=None*, *mandrel\_diameter\_factor=None*, *anchorage\_length=None*)[](#ReinforcedCrossSection.create_stirrup "Link to this definition") Create a stirrup on the reinforced cross-section. * Parameters: * **points** (`Sequence`\[`Tuple`\[`float`, `float`] | `Tuple`\[`Tuple`\[`float`, `float`], `Tuple`\[`float`, `float`]]]) – Sequence of (X, Y) coordinates \[m] of the stirrup vertices, connected by straight line segments. For arc-segments use ((X\_end, Y\_end), (X\_on\_arc, Y\_on\_arc)). * **diameter** (`float`) – Diameter of the stirrup \[m]. * **material** ([`MatReinforcement`](#MatReinforcement "viktor.external.idea_rcs.objects.MatReinforcement")) – Reinforcement material (created by [`create_matreinforcement_ec2()`](https://docs.viktor.ai/sdk/api/external/idea/.md#OpenModel.create_matreinforcement_ec2 "viktor.external.idea_rcs.idea_rcs.OpenModel.create_matreinforcement_ec2")). * **distance** (`float`) – Longitudinal distance between stirrups \[m]. * **shear\_check** (`bool`) – Take stirrup into account in shear check (default: False). * **torsion\_check** (`bool`) – Take stirrup into account in torsion check (default: False). * **mandrel\_diameter\_factor** (`float`) – Inner diameter of mandrel as multiple of stirrup diameter \[-] (default: 1.0). * **anchorage\_length** (`float`) – Anchorage length \[m] (default: 0.0). * Return type: `None` * *property *stirrups*: List\[[Stirrup](#Stirrup "viktor.external.idea_rcs.objects.Stirrup")]*[](#ReinforcedCrossSection.stirrups "Link to this definition") <!-- --> ## ReinforcementMaterial[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_ReinforcementMaterial "Direct link to ReinforcementMaterial") * *class *viktor.external.idea\_rcs.objects.ReinforcementMaterial(*\*values*)[](#ReinforcementMaterial "Link to this definition") Bases: `Enum` * B\_400A*: [`ReinforcementMaterial`](#ReinforcementMaterial "viktor.external.idea_rcs.objects.ReinforcementMaterial")** = 1*[](#ReinforcementMaterial.B_400A "Link to this definition") - B\_400B*: [`ReinforcementMaterial`](#ReinforcementMaterial "viktor.external.idea_rcs.objects.ReinforcementMaterial")** = 4*[](#ReinforcementMaterial.B_400B "Link to this definition") * B\_400C*: [`ReinforcementMaterial`](#ReinforcementMaterial "viktor.external.idea_rcs.objects.ReinforcementMaterial")** = 7*[](#ReinforcementMaterial.B_400C "Link to this definition") - B\_500A*: [`ReinforcementMaterial`](#ReinforcementMaterial "viktor.external.idea_rcs.objects.ReinforcementMaterial")** = 2*[](#ReinforcementMaterial.B_500A "Link to this definition") * B\_500B*: [`ReinforcementMaterial`](#ReinforcementMaterial "viktor.external.idea_rcs.objects.ReinforcementMaterial")** = 5*[](#ReinforcementMaterial.B_500B "Link to this definition") - B\_500C*: [`ReinforcementMaterial`](#ReinforcementMaterial "viktor.external.idea_rcs.objects.ReinforcementMaterial")** = 8*[](#ReinforcementMaterial.B_500C "Link to this definition") * B\_550A*: [`ReinforcementMaterial`](#ReinforcementMaterial "viktor.external.idea_rcs.objects.ReinforcementMaterial")** = 10*[](#ReinforcementMaterial.B_550A "Link to this definition") - B\_550B*: [`ReinforcementMaterial`](#ReinforcementMaterial "viktor.external.idea_rcs.objects.ReinforcementMaterial")** = 11*[](#ReinforcementMaterial.B_550B "Link to this definition") * B\_600A*: [`ReinforcementMaterial`](#ReinforcementMaterial "viktor.external.idea_rcs.objects.ReinforcementMaterial")** = 3*[](#ReinforcementMaterial.B_600A "Link to this definition") - B\_600B*: [`ReinforcementMaterial`](#ReinforcementMaterial "viktor.external.idea_rcs.objects.ReinforcementMaterial")** = 6*[](#ReinforcementMaterial.B_600B "Link to this definition") * B\_600C*: [`ReinforcementMaterial`](#ReinforcementMaterial "viktor.external.idea_rcs.objects.ReinforcementMaterial")** = 9*[](#ReinforcementMaterial.B_600C "Link to this definition") <!-- --> ## ResultOfInternalForces[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_ResultOfInternalForces "Direct link to ResultOfInternalForces") * *class *viktor.external.idea\_rcs.objects.ResultOfInternalForces(*N=0.0*, *Qy=0.0*, *Qz=0.0*, *Mx=0.0*, *My=0.0*, *Mz=0.0*)[](#ResultOfInternalForces "Link to this definition") Bases: `_OpenObject` Result of internal forces at a certain location. * Parameters: * **N** (`float`) – Normal force (default: 0.0). * **Qy** (`float`) – Shear force in y direction (default: 0.0). * **Qz** (`float`) – Shear force in z direction (default: 0.0). * **Mx** (`float`) – Bending moment around x-axis (default: 0.0). * **My** (`float`) – Bending moment around y-axis (default: 0.0). * **Mz** (`float`) – Bending moment around z-axis (default: 0.0). <!-- --> ## StandardCheckSection[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_StandardCheckSection "Direct link to StandardCheckSection") * *class *viktor.external.idea\_rcs.objects.StandardCheckSection(*id\_*, *description*, *check\_member*, *reinf\_section*, *extremes=None*)[](#StandardCheckSection "Link to this definition") Bases: [`CheckSection`](#CheckSection "viktor.external.idea_rcs.objects.CheckSection") Do not use this \_\_init\_\_ directly, but create the object by [`add_check_section()`](https://docs.viktor.ai/sdk/api/external/idea/.md#OpenModel.add_check_section "viktor.external.idea_rcs.idea_rcs.OpenModel.add_check_section"). <!-- --> ## StandardCheckSectionExtreme[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_StandardCheckSectionExtreme "Direct link to StandardCheckSectionExtreme") * *class *viktor.external.idea\_rcs.objects.StandardCheckSectionExtreme(*\**, *accidental=None*, *frequent=None*, *fundamental=None*, *characteristic=None*, *quasi\_permanent=None*, *fatigue=None*, *description*)[](#StandardCheckSectionExtreme "Link to this definition") Bases: [`CheckSectionExtreme`](#CheckSectionExtreme "viktor.external.idea_rcs.objects.CheckSectionExtreme") Do not use this \_\_init\_\_ directly, but create the object by [`CheckSection.create_extreme()`](#CheckSection.create_extreme "viktor.external.idea_rcs.objects.CheckSection.create_extreme"). <!-- --> ## Stirrup[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_Stirrup "Direct link to Stirrup") * *class *viktor.external.idea\_rcs.objects.Stirrup(*points*, *diameter*, *material*, *distance*, *shear\_check=None*, *torsion\_check=None*, *mandrel\_diameter\_factor=None*, *anchorage\_length=None*)[](#Stirrup "Link to this definition") Bases: `_OpenObject` Do not use this \_\_init\_\_ directly, but create the object by [`ReinforcedCrossSection.create_stirrup()`](#ReinforcedCrossSection.create_stirrup "viktor.external.idea_rcs.objects.ReinforcedCrossSection.create_stirrup"). * *property *anchorage\_length*: float*[](#Stirrup.anchorage_length "Link to this definition") - *property *mandrel\_diameter\_factor*: float*[](#Stirrup.mandrel_diameter_factor "Link to this definition") * *property *material\_id*: int*[](#Stirrup.material_id "Link to this definition") - *property *points*: Sequence\[Tuple\[float, float] | Tuple\[Tuple\[float, float], Tuple\[float, float]]]*[](#Stirrup.points "Link to this definition") * *property *shear\_check*: bool*[](#Stirrup.shear_check "Link to this definition") - *property *torsion\_check*: bool*[](#Stirrup.torsion_check "Link to this definition") <!-- --> ## ThermalState[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_ThermalState "Direct link to ThermalState") * *class *viktor.external.idea\_rcs.objects.ThermalState(*expansion=ThermalStateType.NONE*, *conductivity=ThermalStateType.NONE*, *specific\_heat=ThermalStateType.NONE*, *stress\_strain=ThermalStateType.NONE*, *strain=ThermalStateType.NONE*)[](#ThermalState "Link to this definition") Bases: `_OpenObject` Collection of thermal states for expansion, conductivity, specific heat, stress-strain and strain. * Parameters: * **expansion** ([`ThermalStateType`](#ThermalStateType "viktor.external.idea_rcs.objects.ThermalStateType")) – state of thermal expansion curvature. * **conductivity** ([`ThermalStateType`](#ThermalStateType "viktor.external.idea_rcs.objects.ThermalStateType")) – state of thermal conductivity curvature. * **specific\_heat** ([`ThermalStateType`](#ThermalStateType "viktor.external.idea_rcs.objects.ThermalStateType")) – state of thermal specific heat curvature. * **stress\_strain** ([`ThermalStateType`](#ThermalStateType "viktor.external.idea_rcs.objects.ThermalStateType")) – state of thermal specific stress-strain curvature. * **strain** ([`ThermalStateType`](#ThermalStateType "viktor.external.idea_rcs.objects.ThermalStateType")) – state of thermal strain curvature. <!-- --> ## ThermalStateType[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_ThermalStateType "Direct link to ThermalStateType") * *class *viktor.external.idea\_rcs.objects.ThermalStateType(*\*values*)[](#ThermalStateType "Link to this definition") Bases: `Enum` * CODE*: [`ThermalStateType`](#ThermalStateType "viktor.external.idea_rcs.objects.ThermalStateType")** = 1*[](#ThermalStateType.CODE "Link to this definition") - NONE*: [`ThermalStateType`](#ThermalStateType "viktor.external.idea_rcs.objects.ThermalStateType")** = 0*[](#ThermalStateType.NONE "Link to this definition") * USER*: [`ThermalStateType`](#ThermalStateType "viktor.external.idea_rcs.objects.ThermalStateType")** = 5*[](#ThermalStateType.USER "Link to this definition") <!-- --> ## TwoWaySlabType[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_TwoWaySlabType "Direct link to TwoWaySlabType") * *class *viktor.external.idea\_rcs.objects.TwoWaySlabType(*\*values*)[](#TwoWaySlabType "Link to this definition") Bases: `Enum` * DEEP\_BEAM*: [`TwoWaySlabType`](#TwoWaySlabType "viktor.external.idea_rcs.objects.TwoWaySlabType")** = 2*[](#TwoWaySlabType.DEEP_BEAM "Link to this definition") - SHELL\_AS\_PLATE*: [`TwoWaySlabType`](#TwoWaySlabType "viktor.external.idea_rcs.objects.TwoWaySlabType")** = 3*[](#TwoWaySlabType.SHELL_AS_PLATE "Link to this definition") * SHELL\_AS\_WALL*: [`TwoWaySlabType`](#TwoWaySlabType "viktor.external.idea_rcs.objects.TwoWaySlabType")** = 4*[](#TwoWaySlabType.SHELL_AS_WALL "Link to this definition") - SLAB*: [`TwoWaySlabType`](#TwoWaySlabType "viktor.external.idea_rcs.objects.TwoWaySlabType")** = 0*[](#TwoWaySlabType.SLAB "Link to this definition") * WALL*: [`TwoWaySlabType`](#TwoWaySlabType "viktor.external.idea_rcs.objects.TwoWaySlabType")** = 1*[](#TwoWaySlabType.WALL "Link to this definition") <!-- --> ## TypeSLSCalculation[​](https://docs.viktor.ai/sdk/api/external/idea/.md#_TypeSLSCalculation "Direct link to TypeSLSCalculation") * *class *viktor.external.idea\_rcs.objects.TypeSLSCalculation(*\*values*)[](#TypeSLSCalculation "Link to this definition") Bases: `Enum` * BOTH*: [`TypeSLSCalculation`](#TypeSLSCalculation "viktor.external.idea_rcs.objects.TypeSLSCalculation")** = 0*[](#TypeSLSCalculation.BOTH "Link to this definition") - LONG\_TERM*: [`TypeSLSCalculation`](#TypeSLSCalculation "viktor.external.idea_rcs.objects.TypeSLSCalculation")** = 2*[](#TypeSLSCalculation.LONG_TERM "Link to this definition") * SHORT\_TERM*: [`TypeSLSCalculation`](#TypeSLSCalculation "viktor.external.idea_rcs.objects.TypeSLSCalculation")** = 1*[](#TypeSLSCalculation.SHORT_TERM "Link to this definition") --- # viktor.external.matlab <!-- --> <!-- --> <!-- --> ## MatlabAnalysis[​](https://docs.viktor.ai/sdk/api/external/matlab/.md#_MatlabAnalysis "Direct link to MatlabAnalysis") * *class *viktor.external.matlab.MatlabAnalysis(*files=None*, *executable\_key='matlab'*, *output\_filenames=None*)[](#MatlabAnalysis "Link to this definition") Bases: [`GenericAnalysis`](https://docs.viktor.ai/sdk/api/external/generic/.md#GenericAnalysis "viktor.external.generic.GenericAnalysis") New in 14.17.0 MatlabAnalysis can be used to evaluate a matlab script on third-party infrastructure. The script is expected to be blocking, i.e. if the executable is invoked from command prompt, it should wait until the script is finished. For security purposes the executable that should be called has to be defined in the configuration file of the worker. Usage: ``` files = [ ('input1.txt', file1), ('input2.txt', file2) ] analysis = MatlabAnalysis(files=files, output_filenames=["output.txt"]) analysis.execute(timeout=60) output_file = analysis.get_output_file("output.txt") ``` Exceptions which can be raised during calculation: > * [`viktor.errors.LicenseError`](https://docs.viktor.ai/sdk/api/errors/.md#LicenseError "viktor.errors.LicenseError"): no license available > > * [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information * Parameters: * **files** (`List`\[`Tuple`\[`str`, `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]] | `None`) – Files that are transferred to the working directory on the server. Each file is a tuple containing the content and the filename which is used to save on the infrastructure. * **executable\_key** (`str`) – The key of the executable that needs to be evaluated. This key should be present in the configuration file of the worker, defaults to run\_matlab. * **output\_filenames** (`List`\[`str`]) – A list of filenames (including extension) that are to be transferred back to the SDK. This filename is relative to the working directory. * Raises: **ValueError** – when no attribute is included in call. --- # viktor.external.plaxis <!-- --> <!-- --> <!-- --> ## PlaxisAnalysis[​](https://docs.viktor.ai/sdk/api/external/plaxis/.md#_PlaxisAnalysis "Direct link to PlaxisAnalysis") * *class *viktor.external.plaxis.PlaxisAnalysis(*script=None*, *script\_key=''*, *files=None*, *output\_filenames=None*)[](#PlaxisAnalysis "Link to this definition") Bases: [`PythonAnalysis`](https://docs.viktor.ai/sdk/api/external/python/.md#PythonAnalysis "viktor.external.python.PythonAnalysis") New in 14.17.0 PlaxisAnalysis can be used to evaluate a plaxis-python script on third-party infrastructure. The script is expected to be blocking, i.e. if the script is invoked from command prompt, it should wait until the executable is finished. The default behaviour, is that the python script is defined within the app and send to the worker to be executed on third-party infrastructure. If desired (due to security considerations) the worker can be configured to only run local scripts. These scripts must be defined the in worker configuration file and can be selected through the script\_key. Usage: ``` script = vkt.File.from_path(Path(__file__).parent / "run_plaxis.py") files = [ ('input1.txt', file1), ] analysis = PlaxisAnalysis(script=script, files=files, output_filenames=["output.txt"]) analysis.execute(timeout=60) output_file = analysis.get_output_file("output.txt") ``` Exceptions which can be raised during calculation: > * [`viktor.errors.LicenseError`](https://docs.viktor.ai/sdk/api/errors/.md#LicenseError "viktor.errors.LicenseError"): no license available > > * [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information * Parameters: * **script** ([`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Script file that is transferred to the working directory on the server. * **script\_key** (`str`) – The key of the script that needs to be run. Only use this when the worker is configured to run local scripts. This key should be present in the configuration file of the worker. * **files** (`List`\[`Tuple`\[`str`, `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]]) – Additional files that are transferred to the working directory on the server. Each file is a tuple containing the content and the filename which is used to save on the infrastructure. * **output\_filenames** (`List`\[`str`]) – A list of filenames (including extension) that are to be transferred back to the app. This filename is relative to the working directory. Either one of ‘script’ or ‘script\_key’ should be defined. * Raises: **ValueError** – when neither ‘script’ or ‘script\_key’ is included OR when both are included. --- # viktor.external.python <!-- --> <!-- --> <!-- --> ## PythonAnalysis[​](https://docs.viktor.ai/sdk/api/external/python/.md#_PythonAnalysis "Direct link to PythonAnalysis") * *class *viktor.external.python.PythonAnalysis(*script=None*, *script\_key=''*, *files=None*, *output\_filenames=None*)[](#PythonAnalysis "Link to this definition") Bases: [`ExternalProgram`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram "viktor.external.external_program.ExternalProgram") New in 14.17.0 PythonAnalysis can be used to evaluate a python script on third-party infrastructure. The script is expected to be blocking, i.e. if the script is invoked from command prompt, it should wait until the executable is finished. The default behaviour, is that the python script is defined within the app and send to the worker to be executed on third-party infrastructure. If desired (due to security considerations) the worker can be configured to only run local scripts. These scripts must be defined the in worker configuration file and can be selected through the script\_key. Usage: ``` script = vkt.File.from_path(Path(__file__).parent / "my_script.py") files = [ ('input1.txt', file1), ] python_analysis = PythonAnalysis(script=script, files=files, output_filenames=["output.txt"]) python_analysis.execute(timeout=60) output_file = python_analysis.get_output_file("output.txt") ``` Exceptions which can be raised during calculation: > * [`viktor.errors.LicenseError`](https://docs.viktor.ai/sdk/api/errors/.md#LicenseError "viktor.errors.LicenseError"): no license available > > * [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information * Parameters: * **script** ([`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Script file that is transferred to the working directory on the server. * **script\_key** (`str`) – The key of the script that needs to be run. Only use this when the worker is configured to run local scripts. This key should be present in the configuration file of the worker. * **files** (`List`\[`Tuple`\[`str`, `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]]) – Additional files that are transferred to the working directory on the server. Each file is a tuple containing the content and the filename which is used to save on the infrastructure. * **output\_filenames** (`List`\[`str`]) – A list of filenames (including extension) that are to be transferred back to the app. This filename is relative to the working directory. Either one of ‘script’ or ‘script\_key’ should be defined. * Raises: **ValueError** – when neither ‘script’ or ‘script\_key’ is included OR when both are included. - get\_output\_file(*filename*)[](#PythonAnalysis.get_output_file "Link to this definition") Method can be used to retrieve the results generated by running an external analysis. Call method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute") first and [`get_output_file()`](#PythonAnalysis.get_output_file "viktor.external.python.PythonAnalysis.get_output_file") afterwards. * Parameters: **filename** (`str`) – The name of the file (including extension) that you want to get. * Return type: [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | `None` --- # viktor.external.revit <!-- --> <!-- --> <!-- --> ## RevitAnalysis[​](https://docs.viktor.ai/sdk/api/external/revit/.md#_RevitAnalysis "Direct link to RevitAnalysis") * *class *viktor.external.revit.RevitAnalysis(*script=None*, *script\_key=''*, *files=None*, *output\_filenames=None*)[](#RevitAnalysis "Link to this definition") Bases: [`PythonAnalysis`](https://docs.viktor.ai/sdk/api/external/python/.md#PythonAnalysis "viktor.external.python.PythonAnalysis") New in 14.17.0 RevitAnalysis can be used to evaluate a revit-python script on third-party infrastructure. The script is expected to be blocking, i.e. if the script is invoked from command prompt, it should wait until the executable is finished. The default behaviour, is that the python script is defined within the app and send to the worker to be executed on third-party infrastructure. If desired (due to security considerations) the worker can be configured to only run local scripts. These scripts must be defined the in worker configuration file and can be selected through the script\_key. Usage: ``` script = vkt.File.from_path(Path(__file__).parent / "run_revit.py") files = [ ('input1.txt', file1), ('input2.txt', file2) ] analysis = RevitAnalysis(script=script, files=files, output_filenames=["output.txt"]) analysis.execute(timeout=60) output_file = analysis.get_output_file("output.txt", as_file=True) ``` Exceptions which can be raised during calculation: > * [`viktor.errors.LicenseError`](https://docs.viktor.ai/sdk/api/errors/.md#LicenseError "viktor.errors.LicenseError"): no license available > > * [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information * Parameters: * **script** ([`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Script file that is transferred to the working directory on the server. * **script\_key** (`str`) – The key of the script that needs to be run. Only use this when the worker is configured to run local scripts. This key should be present in the configuration file of the worker. * **files** (`List`\[`Tuple`\[`str`, `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]]) – Additional files that are transferred to the working directory on the server. Each file is a tuple containing the content and the filename which is used to save on the infrastructure. * **output\_filenames** (`List`\[`str`]) – A list of filenames (including extension) that are to be transferred back to the app. This filename is relative to the working directory. Either one of ‘script’ or ‘script\_key’ should be defined. * Raises: **ValueError** – when neither ‘script’ or ‘script\_key’ is included OR when both are included. --- # viktor.external.rfem <!-- --> <!-- --> <!-- --> ## CopyNodalLoadAction[​](https://docs.viktor.ai/sdk/api/external/rfem/.md#_CopyNodalLoadAction "Direct link to CopyNodalLoadAction") * *class *viktor.external.rfem.CopyNodalLoadAction(*copy\_from\_to*, *loading\_type=LoadingType.LOAD\_CASE*, *\**, *factor=1.0*)[](#CopyNodalLoadAction "Link to this definition") Bases: [`RFEMAction`](#RFEMAction "viktor.external.rfem.RFEMAction") Copy the nodal load from one load case to the other, applying a factor on the magnitude. * Note: only the 1st nodal load is copied from and to each load case/combination, other loads are ignored. Make sure that at least 1 such nodal load exists in both the copy-from and copy-to load cases/combinations. - Parameters: * **copy\_from\_to** (`List`\[`Tuple`\[`int`, `int`]]) – a list of load case/combination numbers to copy (from, to) * **loading\_type** ([`LoadingType`](#LoadingType "viktor.external.rfem.LoadingType")) – defines if integers in ‘copy\_from\_to’ must be interpreted as load case (LOAD\_CASE) or load combination (LOAD\_COMBINATION) numbers (default: LOAD\_CASE) * **factor** (`float`) – factor to be applied on the nodal load magnitude (default: 1.0) <!-- --> ## EnergyOptimizationAction[​](https://docs.viktor.ai/sdk/api/external/rfem/.md#_EnergyOptimizationAction "Direct link to EnergyOptimizationAction") * *class *viktor.external.rfem.EnergyOptimizationAction(*load\_cases*, *loading\_type=LoadingType.LOAD\_CASE*, *\**, *goal*, *accuracy*)[](#EnergyOptimizationAction "Link to this definition") Bases: [`RFEMAction`](#RFEMAction "viktor.external.rfem.RFEMAction") * Performs an iterative analysis (consisting of a series of RFEM analyses) to solve for the magnitude of the 1st nodal load, such that the energy at that node (approximately) equals the ‘goal’. The iteration comes to a finish if the change in displacement at the node is lower than the specified ‘accuracy’. This is done for each of the load cases specified. - Parameters: * **load\_cases** (`List`\[`int`]) – a list of load cases/combinations to do a energy optimization calculation for. None for all load cases/combinations (default: None). * **loading\_type** ([`LoadingType`](#LoadingType "viktor.external.rfem.LoadingType")) – defines if integers in ‘load\_cases’ must be interpreted as load case (LOAD\_CASE) or load combination (LOAD\_COMBINATION) numbers (default: LOAD\_CASE) * **goal** (`float`) – energy level \[Nm] for which the calculation tries to solve the 1st nodal load. Same goal is used for all load cases/combinations. * **accuracy** (`float`) – change in displacement \[m] of the node corresponding to the 1st nodal load at which the iteration will successfully return. A lower accuracy in general means more iterations. Same accuracy is used for all load cases/combinations. <!-- --> ## LoadingType[​](https://docs.viktor.ai/sdk/api/external/rfem/.md#_LoadingType "Direct link to LoadingType") * *class *viktor.external.rfem.LoadingType(*\*values*)[](#LoadingType "Link to this definition") Bases: `Enum` * LOAD\_CASE*: [`LoadingType`](#LoadingType "viktor.external.rfem.LoadingType")** = 1*[](#LoadingType.LOAD_CASE "Link to this definition") - LOAD\_COMBINATION*: [`LoadingType`](#LoadingType "viktor.external.rfem.LoadingType")** = 2*[](#LoadingType.LOAD_COMBINATION "Link to this definition") <!-- --> ## RFEMAction[​](https://docs.viktor.ai/sdk/api/external/rfem/.md#_RFEMAction "Direct link to RFEMAction") * *class *viktor.external.rfem.RFEMAction(*id\_*)[](#RFEMAction "Link to this definition") Bases: `ABC` Abstract base class of all RFEM action objects. <!-- --> ## RFEMAnalysis[​](https://docs.viktor.ai/sdk/api/external/rfem/.md#_RFEMAnalysis "Direct link to RFEMAnalysis") * *class *viktor.external.rfem.RFEMAnalysis(*rfx\_file*, *actions*)[](#RFEMAnalysis "Link to this definition") Bases: [`ExternalProgram`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram "viktor.external.external_program.ExternalProgram") RFEMAnalysis can be used to perform an analysis with RFEM on third-party infrastructure. To start an analysis call the method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute"), with an appropriate timeout (in seconds). To retrieve the model call [`get_model()`](#RFEMAnalysis.get_model "viktor.external.rfem.RFEMAnalysis.get_model") and for results call [`get_result()`](#RFEMAnalysis.get_result "viktor.external.rfem.RFEMAnalysis.get_result") for the desired load combination (only after [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute")). Exceptions which can be raised during calculation: > * [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information Example usage: ``` # SLS sls_cases = [1, 2, 3] sls_optimization = EnergyOptimizationAction(sls_cases, goal=10000, accuracy=0.1) # goal = 10 kNm, accuracy = 10 cm # ALS als_cases = [4, 5, 6] als_optimization = EnergyOptimizationAction(als_cases, goal=15000, accuracy=0.1) # goal = 15 kNm, accuracy = 10 cm # ULS uls_cases = [7, 8, 9] uls_creation = CopyNodalLoadAction(list(zip(sls_cases, uls_cases)), factor=1.5) # ULS = SLS x 1.5 # Write action write_result_action = WriteResultsAction(sls_cases + als_cases + uls_cases) # or can be left empty = all cases actions = [sls_optimization, als_optimization, uls_creation, write_result_action] rfem_analysis = RFEMAnalysis(rfx_file=my_rfx_file, actions=actions) # my_rfx_file contains the desired load cases and nodal loads rfem_analysis.execute(timeout=300) model = rfem_analysis.get_model() result_lc1 = rfem_analysis.get_result(1) result_lc2 = rfem_analysis.get_result(2) ``` * Parameters: * **rfx\_file** (`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – RFEM input file * **actions** (`List`\[[`RFEMAction`](#RFEMAction "viktor.external.rfem.RFEMAction")]) – list of actions to be performed sequentially. Possible actions are: * [`EnergyOptimizationAction`](#EnergyOptimizationAction "viktor.external.rfem.EnergyOptimizationAction") * [`CopyNodalLoadAction`](#CopyNodalLoadAction "viktor.external.rfem.CopyNodalLoadAction") * [`WriteResultsAction`](#WriteResultsAction "viktor.external.rfem.WriteResultsAction") (required for [`get_result()`](#RFEMAnalysis.get_result "viktor.external.rfem.RFEMAnalysis.get_result")) - get\_model(*\**, *as\_file=False*)[](#RFEMAnalysis.get_model "Link to this definition") Get the model that is returned after the RFEM analysis. * Parameters: **as\_file** (`bool`) – Return as BytesIO (default) or File New in v13.5.0 * Return type: `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") * get\_result(*load\_case*, *\**, *as\_file=False*)[](#RFEMAnalysis.get_result "Link to this definition") Get the nodal deformations (X, Y, Z) \[m] and member internal forces (Location \[m], My and Mz \[Nm], Fy and Fz \[N]) for a certain load case/combination number. * Parameters: * **load\_case** (`int`) – number of the load case/combination to get the result for. A ‘WriteResultsAction’ must have been performed on the corresponding load case/combination to be available. * **as\_file** (`bool`) – Return as BytesIO (default) or File New in v13.5.0 * Return type: `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") <!-- --> ## WriteResultsAction[​](https://docs.viktor.ai/sdk/api/external/rfem/.md#_WriteResultsAction "Direct link to WriteResultsAction") * *class *viktor.external.rfem.WriteResultsAction(*load\_cases=None*, *loading\_type=LoadingType.LOAD\_CASE*)[](#WriteResultsAction "Link to this definition") Bases: [`RFEMAction`](#RFEMAction "viktor.external.rfem.RFEMAction") Write all nodal deformations (X, Y, Z) and member internal forces (Location, My, Mz, Fy, Fz) for the model in current state, for each of the load cases/combinations requested, so that it is available in [`get_result()`](#RFEMAnalysis.get_result "viktor.external.rfem.RFEMAnalysis.get_result"). * Parameters: * **load\_cases** (`List`\[`int`]) – a list of load cases/combinations to write the results for. None for all load cases/combinations (default: None). * **loading\_type** ([`LoadingType`](#LoadingType "viktor.external.rfem.LoadingType")) – defines if integers in ‘load\_cases’ must be interpreted as load case (LOAD\_CASE) or load combination (LOAD\_COMBINATION) numbers (default: LOAD\_CASE) --- # viktor.external.robot <!-- --> <!-- --> <!-- --> ## RobotAnalysis[​](https://docs.viktor.ai/sdk/api/external/robot/.md#_RobotAnalysis "Direct link to RobotAnalysis") * *class *viktor.external.robot.RobotAnalysis(*input\_file*, *\**, *return\_model=True*, *return\_results=True*, *requested\_results=None*)[](#RobotAnalysis "Link to this definition") Bases: [`ExternalProgram`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram "viktor.external.external_program.ExternalProgram") Perform an analysis using Autodesk Robot on a third-party worker. To start an analysis call the method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute"), with an appropriate timeout (in seconds). To retrieve the results call the method [`get_results()`](#RobotAnalysis.get_results "viktor.external.robot.RobotAnalysis.get_results"), after [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute"). The evaluated model file can be retrieved by calling [`get_model_file()`](#RobotAnalysis.get_model_file "viktor.external.robot.RobotAnalysis.get_model_file"). Usage: ``` robot_analysis = RobotAnalysis(input_file, return_model=True) robot_analysis.execute(timeout=10) results = robot_analysis.get_results() model_file = robot_analysis.get_model_file() ``` Exceptions which can be raised during calculation: > * [`ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information * Parameters: * **input\_file** ([`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Robot input file in STR format * **return\_results** (`bool`) – If True, an analysis will be run and the result file is returned. * **return\_model** (`bool`) – If True, the model file (.rtd) is returned. * **requested\_results** (`dict`) – (optional) Dictionary containing the requested results. If requested\_results is None and return\_results is True, the worker will return all results. For the allowed components see the Autodesk Robot SDK documentation. The dictionary should be formatted as follows: ``` { "bar_forces": List[string], "bar_displacements": List[string], "bar_stresses": List[string], "bar_deflections": List[string], "node_reactions": List[string], "node_displacements": List[string], } ``` * get\_model\_file()[](#RobotAnalysis.get_model_file "Link to this definition") Retrieve the model file (only if return\_model = True) in .rtd format. [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute") must be called first. * Return type: [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | `None` - get\_results()[](#RobotAnalysis.get_results "Link to this definition") Retrieve the results (only if return\_results = True). `execute()` must be called first. The format of the returned dictionary is: ``` { 'bar_forces': { '1': { # case id '1': { # bar id '0.000000': { # positions 'FX': 26070.462297973572 # components } } } }, 'bar_displacements': { '1': { '1': { '0.000000': { 'RX': 0 } } } }, 'bar_stresses': { '1': { '1': { '0.000000': { 'FXSX': 19750.350225737555 } } } }, 'bar_deflections': { '1': { '1': { '0.000000': { 'PosUX': 0 } } } }, 'node_reactions': { '1': { # case id '1': { # node id 'FX': -9.89530235528946e-09 # components } } }, 'node_displacements': { '1': { '1': { 'RX': 0 } } } } ``` * Return type: `dict` | `None` --- # viktor.external.sap2000 <!-- --> <!-- --> <!-- --> ## SAP2000Analysis[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_SAP2000Analysis "Direct link to SAP2000Analysis") * *class *viktor.external.sap2000.sap2000.SAP2000Analysis(*script=None*, *script\_key=''*, *files=None*, *output\_filenames=None*)[](#SAP2000Analysis "Link to this definition") Bases: [`PythonAnalysis`](https://docs.viktor.ai/sdk/api/external/python/.md#PythonAnalysis "viktor.external.python.PythonAnalysis") New in 14.17.0 SAP2000Analysis can be used to evaluate a SAP2000-python script on third-party infrastructure. The script is expected to be blocking, i.e. if the script is invoked from command prompt, it should wait until the executable is finished. The default behaviour, is that the python script is defined within the app and send to the worker to be executed on third-party infrastructure. If desired (due to security considerations) the worker can be configured to only run local scripts. These scripts must be defined the in worker configuration file and can be selected through the script\_key. Usage: ``` script = vkt.File.from_path(Path(__file__).parent / "run_sap2000.py") files = [ ('input1.txt', file1), ] analysis = SAP2000Analysis(script=script, files=files, output_filenames=["output.txt"]) analysis.execute(timeout=60) output_file = analysis.get_output_file("output.txt") ``` Exceptions which can be raised during calculation: > * [`viktor.errors.LicenseError`](https://docs.viktor.ai/sdk/api/errors/.md#LicenseError "viktor.errors.LicenseError"): no license available > > * [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information * Parameters: * **script** ([`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Script file that is transferred to the working directory on the server. * **script\_key** (`str`) – The key of the script that needs to be run. Only use this when the worker is configured to run local scripts. This key should be present in the configuration file of the worker. * **files** (`List`\[`Tuple`\[`str`, `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]]) – Additional files that are transferred to the working directory on the server. Each file is a tuple containing the content and the filename which is used to save on the infrastructure. * **output\_filenames** (`List`\[`str`]) – A list of filenames (including extension) that are to be transferred back to the app. This filename is relative to the working directory. Either one of ‘script’ or ‘script\_key’ should be defined. * Raises: **ValueError** – when neither ‘script’ or ‘script\_key’ is included OR when both are included. <!-- --> ## SAP2000Connection[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_SAP2000Connection "Direct link to SAP2000Connection") * *class *viktor.external.sap2000.sap2000.SAP2000Connection(*session*)[](#SAP2000Connection "Link to this definition") Bases: `_CSIConnection` New in 14.32.0 The `sap` object returned by [`connect()`](#connect "viktor.external.sap2000.sap2000.connect") or [`attach()`](#attach "viktor.external.sap2000.sap2000.attach"), used to control SAP2000 through the SAP2000 OAPI. Use the default OAPI calls with comtypes syntax. Each call returns the OAPI result: the status code, or `[*out_params, status]` when the call has output parameters. The SDK sends calls to the worker in chunks. A result is read when your code first uses its value: in `==`, `if`, `float()`, `int()`, `str()`, `print()` or a loop. A failed call raises [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError") at that read, with the call and your line. Two things do not read a result: passing it to a later call, and unpacking it into names. So the example below sends all three calls in one chunk. `result is None` is always `False` on an unread result; use `== None`. Pass `defer=False` to [`connect()`](#connect "viktor.external.sap2000.sap2000.connect") / [`attach()`](#attach "viktor.external.sap2000.sap2000.attach") to send each call on its own. ``` name, ret = sap.FrameObj.AddByCoord(0, 0, 0, 6, 0, 0, "", "Default", "Beam", "Global") sap.FrameObj.SetSection(name, "W12X26") ``` See [`batch()`](#SAP2000Connection.batch "viktor.external.sap2000.sap2000.SAP2000Connection.batch") when one loop makes more than a few hundred calls. Warning Do not instantiate this class directly; obtain it from [`connect()`](#connect "viktor.external.sap2000.sap2000.connect") or [`attach()`](#attach "viktor.external.sap2000.sap2000.attach"). * batch()[](#SAP2000Connection.batch "Link to this definition") New in v14.37.0 Send all calls of the block to the worker as one job when the block ends. Without the block the SDK sends calls in chunks of a few hundred, each one round trip. The gain grows with the size of the block; below a few hundred calls it changes nothing. You cannot read a result inside the block: a read raises `RuntimeError`. So do `isinstance()`, `print()`, `str()` and `repr()` on a result. Read the results after the block. The block runs as one job under the session `timeout` (300 s by default). For a very large block, increase `timeout` in [`connect()`](#connect "viktor.external.sap2000.sap2000.connect") / [`attach()`](#attach "viktor.external.sap2000.sap2000.attach"). ``` with sap.batch(): for x, y in points: # 5000 points name, ret = sap.FrameObj.AddByCoord(x, y, 0, x, y, 3, "", "W12X26") sap.FrameObj.SetGroupAssign(name, "Columns") # 10000 calls went to the worker in one job ``` Needs a deferred connection (`defer=True`). Blocks cannot be nested. Calls made before the block are sent when the block starts. * Return type: `ContextManager`\[`None`, `bool` | `None`] - *property *application*: Any*[](#SAP2000Connection.application "Link to this definition") Call OAPI members on the top-level application object rather than the SapModel. Example: ``` sap.application.Hide() version = sap.application.GetOAPIVersionNumber() ``` <!-- --> ## attach[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_attach "Direct link to attach") * viktor.external.sap2000.sap2000.attach(*timeout=300*, *defer=True*)[](#attach "Link to this definition") New in 14.33.0 Attach to the SAP2000 instance already running on the worker machine and control it through the SAP2000 OAPI, like [`connect()`](#connect "viktor.external.sap2000.sap2000.connect"), but without starting a fresh instance. Typical use: a personal worker on the engineer’s own machine, so the app acts on the model they have open on screen. Warning This is a BETA feature. Requires a worker of kind `sap2000connect`. Declare it in your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml/): ``` worker_integrations = [ "sap2000connect", ] ``` Usage: ``` import viktor as vkt with vkt.sap2000.attach(timeout=60) as sap: [pt_i, pt_j, ret] = sap.FrameObj.GetPoints("B1", "", "") # reads the model open in SAP2000 ret = sap.View.RefreshView() # changes show in the user's window ``` Closing the session detaches without exiting the instance. The app can change the attached model but not save it in place: `File.Save` requires a relative filename and writes into the session directory. Note The OAPI members you call on `sap` (e.g. `sap.FrameObj.AddByCoord`) mirror the SAP2000 OAPI and are surfaced through IDE autocomplete rather than listed here. Look them up in the SAP2000 OAPI reference: the CSI OAPI help file (`.chm`) in your SAP2000 installation directory (e.g. `C:/Program Files/Computers and Structures/SAP2000 <version>/`), or on CSI’s [developer site](https://www.csiamerica.com/developer). * Parameters: * **timeout** (`int`) – timeout in seconds for one chunk of calls; also bounds the attach itself, so keep it at or above the platform’s 30 second bind window. * **defer** (`bool`) – queue calls and send them to the worker in chunks; a result is fetched when your code first reads it (default: True). False sends every call at once and returns plain values. New in v14.37.0 * Return type: [`SAP2000Connection`](#SAP2000Connection "viktor.external.sap2000.sap2000.SAP2000Connection") Exceptions which can be raised during execution: > * [`viktor.errors.WorkerSessionAttachError`](https://docs.viktor.ai/sdk/api/errors/.md#WorkerSessionAttachError "viktor.errors.WorkerSessionAttachError"): the attach failed, e.g. no SAP2000 is running on the worker machine, or the running instance is a different product. `reason` names the cause; that set is open. > > * [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error during a call. Error message provides more information. > > * [`viktor.errors.WorkerSessionError`](https://docs.viktor.ai/sdk/api/errors/.md#WorkerSessionError "viktor.errors.WorkerSessionError"): the session was lost after attaching (e.g. the user closed the SAP2000 instance). The session cannot be resumed; start a new one to continue. > > * TimeoutError: a chunk of calls took longer than `timeout` <!-- --> ## connect[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_connect "Direct link to connect") * viktor.external.sap2000.sap2000.connect(*timeout=300*, *defer=True*)[](#connect "Link to this definition") New in 14.32.0 Connect to SAP2000 running on a connected VIKTOR worker and control it through the SAP2000 OAPI directly from your app, as shown below. Always starts a fresh, empty instance; to act on the instance already running on the worker machine instead, use [`attach()`](#attach "viktor.external.sap2000.sap2000.attach"). Warning This is a BETA feature. Requires a worker of kind `sap2000connect`. Declare it in your [viktor.config.toml](https://docs.viktor.ai/docs/create-apps/references/viktor-config-toml/): ``` worker_integrations = [ "sap2000connect", ] ``` Usage: ``` import viktor as vkt with vkt.sap2000.connect(timeout=60) as sap: ret = sap.InitializeNewModel(vkt.sap2000.eUnits.kN_m_C) # a call returns the status code [beam_name, ret] = sap.FrameObj.AddByCoord(0, 0, 0, 6, 0, 0, "", "Default", "Beam", "Global") [pt_i, pt_j, ret] = sap.FrameObj.GetPoints(beam_name, "", "") # ...or out-params, then status sap.File.Save("model.sdb") # use a relative filename, not an absolute path ``` Note The OAPI members you call on `sap` (e.g. `sap.FrameObj.AddByCoord`) mirror the SAP2000 OAPI and are surfaced through IDE autocomplete rather than listed here. Look them up in the SAP2000 OAPI reference: the CSI OAPI help file (`.chm`) in your SAP2000 installation directory (e.g. `C:/Program Files/Computers and Structures/SAP2000 <version>/`), or on CSI’s [developer site](https://www.csiamerica.com/developer). * Parameters: * **timeout** (`int`) – timeout in seconds for one chunk of calls. * **defer** (`bool`) – queue calls and send them to the worker in chunks; a result is fetched when your code first reads it (default: True). False sends every call at once and returns plain values. New in v14.37.0 * Return type: [`SAP2000Connection`](#SAP2000Connection "viktor.external.sap2000.sap2000.SAP2000Connection") Exceptions which can be raised during execution: > * [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information. A host whose SAP2000 license is not activated also fails this way: SAP2000 blocks on an interactive sign-in dialog that the worker cannot answer, so starting it up times out. > > * [`viktor.errors.WorkerSessionError`](https://docs.viktor.ai/sdk/api/errors/.md#WorkerSessionError "viktor.errors.WorkerSessionError"): the session was lost (e.g. its SAP2000 instance was torn down). The session cannot be resumed; start a new one to continue. > > * TimeoutError: a chunk of calls took longer than `timeout` <!-- --> SAP2000 enum values, generated from SAP2000 27.1.0 (Ultimate). <!-- --> ## e2DFrameType[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_e2DFrameType "Direct link to e2DFrameType") * *class *viktor.external.sap2000.enums.e2DFrameType(*\*values*)[](#e2DFrameType "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `e2DFrameType` values, mirroring the product API’s names so code reads like its docs. * ConcentricBraced* = 1*[](#e2DFrameType.ConcentricBraced "Link to this definition") - EccentricBraced* = 2*[](#e2DFrameType.EccentricBraced "Link to this definition") * PortalFrame* = 0*[](#e2DFrameType.PortalFrame "Link to this definition") <!-- --> ## e3DFrameType[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_e3DFrameType "Direct link to e3DFrameType") * *class *viktor.external.sap2000.enums.e3DFrameType(*\*values*)[](#e3DFrameType "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `e3DFrameType` values, mirroring the product API’s names so code reads like its docs. * BeamSlab* = 2*[](#e3DFrameType.BeamSlab "Link to this definition") - FlatPlate* = 3*[](#e3DFrameType.FlatPlate "Link to this definition") * OpenFrame* = 0*[](#e3DFrameType.OpenFrame "Link to this definition") - PerimeterFrame* = 1*[](#e3DFrameType.PerimeterFrame "Link to this definition") <!-- --> ## eBridgeCodeAASHTO[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eBridgeCodeAASHTO "Direct link to eBridgeCodeAASHTO") * *class *viktor.external.sap2000.enums.eBridgeCodeAASHTO(*\*values*)[](#eBridgeCodeAASHTO "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eBridgeCodeAASHTO` values, mirroring the product API’s names so code reads like its docs. * AASHTO\_LRFD\_2007* = 1*[](#eBridgeCodeAASHTO.AASHTO_LRFD_2007 "Link to this definition") - AASHTO\_LRFD\_2012* = 2*[](#eBridgeCodeAASHTO.AASHTO_LRFD_2012 "Link to this definition") * AASHTO\_LRFD\_2014* = 3*[](#eBridgeCodeAASHTO.AASHTO_LRFD_2014 "Link to this definition") - AASHTO\_LRFD\_2017* = 4*[](#eBridgeCodeAASHTO.AASHTO_LRFD_2017 "Link to this definition") * AASHTO\_LRFD\_2020* = 5*[](#eBridgeCodeAASHTO.AASHTO_LRFD_2020 "Link to this definition") - AASHTO\_STD\_2002* = 0*[](#eBridgeCodeAASHTO.AASHTO_STD_2002 "Link to this definition") <!-- --> ## eBridgeCodeInterims[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eBridgeCodeInterims "Direct link to eBridgeCodeInterims") * *class *viktor.external.sap2000.enums.eBridgeCodeInterims(*\*values*)[](#eBridgeCodeInterims "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eBridgeCodeInterims` values, mirroring the product API’s names so code reads like its docs. * Interim\_2011* = 1*[](#eBridgeCodeInterims.Interim_2011 "Link to this definition") - Interim\_2012* = 2*[](#eBridgeCodeInterims.Interim_2012 "Link to this definition") * Interim\_2013* = 3*[](#eBridgeCodeInterims.Interim_2013 "Link to this definition") - Interim\_2014* = 4*[](#eBridgeCodeInterims.Interim_2014 "Link to this definition") * Interim\_2015* = 5*[](#eBridgeCodeInterims.Interim_2015 "Link to this definition") - NoInterims* = 0*[](#eBridgeCodeInterims.NoInterims "Link to this definition") <!-- --> ## eBridgeObjectBentPart[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eBridgeObjectBentPart "Direct link to eBridgeObjectBentPart") * *class *viktor.external.sap2000.enums.eBridgeObjectBentPart(*\*values*)[](#eBridgeObjectBentPart "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eBridgeObjectBentPart` values, mirroring the product API’s names so code reads like its docs. * Bearing* = 3*[](#eBridgeObjectBentPart.Bearing "Link to this definition") - CapBeam* = 1*[](#eBridgeObjectBentPart.CapBeam "Link to this definition") * Column* = 2*[](#eBridgeObjectBentPart.Column "Link to this definition") - Wall* = 4*[](#eBridgeObjectBentPart.Wall "Link to this definition") <!-- --> ## eBridgeObjectFoundationPart[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eBridgeObjectFoundationPart "Direct link to eBridgeObjectFoundationPart") * *class *viktor.external.sap2000.enums.eBridgeObjectFoundationPart(*\*values*)[](#eBridgeObjectFoundationPart "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eBridgeObjectFoundationPart` values, mirroring the product API’s names so code reads like its docs. * Footing* = 1*[](#eBridgeObjectFoundationPart.Footing "Link to this definition") - FoundationSpring* = 4*[](#eBridgeObjectFoundationPart.FoundationSpring "Link to this definition") * Pile* = 3*[](#eBridgeObjectFoundationPart.Pile "Link to this definition") - PileCap* = 2*[](#eBridgeObjectFoundationPart.PileCap "Link to this definition") <!-- --> ## eBridgeObjectType[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eBridgeObjectType "Direct link to eBridgeObjectType") * *class *viktor.external.sap2000.enums.eBridgeObjectType(*\*values*)[](#eBridgeObjectType "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eBridgeObjectType` values, mirroring the product API’s names so code reads like its docs. * General* = 0*[](#eBridgeObjectType.General "Link to this definition") - Segmental* = 1*[](#eBridgeObjectType.Segmental "Link to this definition") <!-- --> ## eBridgeObjectUserPointType[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eBridgeObjectUserPointType "Direct link to eBridgeObjectUserPointType") * *class *viktor.external.sap2000.enums.eBridgeObjectUserPointType(*\*values*)[](#eBridgeObjectUserPointType "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eBridgeObjectUserPointType` values, mirroring the product API’s names so code reads like its docs. * General* = 0*[](#eBridgeObjectUserPointType.General "Link to this definition") - SegmentalTendon* = 1*[](#eBridgeObjectUserPointType.SegmentalTendon "Link to this definition") <!-- --> ## eBridgeResponseDesignRating[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eBridgeResponseDesignRating "Direct link to eBridgeResponseDesignRating") * *class *viktor.external.sap2000.enums.eBridgeResponseDesignRating(*\*values*)[](#eBridgeResponseDesignRating "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eBridgeResponseDesignRating` values, mirroring the product API’s names so code reads like its docs. * Design\_Crack\_Bot\_Crack\_Width* = 55*[](#eBridgeResponseDesignRating.Design_Crack_Bot_Crack_Width "Link to this definition") - Design\_Crack\_Top\_Bot\_Crack\_Widths* = 56*[](#eBridgeResponseDesignRating.Design_Crack_Top_Bot_Crack_Widths "Link to this definition") * Design\_Crack\_Top\_Crack\_Width* = 54*[](#eBridgeResponseDesignRating.Design_Crack_Top_Crack_Width "Link to this definition") - Design\_Fatigue\_Bot\_Flange\_Lateral\_Bending\_Stress\_Range* = 75*[](#eBridgeResponseDesignRating.Design_Fatigue_Bot_Flange_Lateral_Bending_Stress_Range "Link to this definition") * Design\_Fatigue\_Bot\_Flange\_Tensile\_Stress\_Range\_Without\_FLB* = 74*[](#eBridgeResponseDesignRating.Design_Fatigue_Bot_Flange_Tensile_Stress_Range_Without_FLB "Link to this definition") - Design\_Fatigue\_DC\_Ratio\_Web\_Shear* = 76*[](#eBridgeResponseDesignRating.Design_Fatigue_DC_Ratio_Web_Shear "Link to this definition") * Design\_Fatigue\_Top\_Flange\_Tensile\_Stress\_Range\_Without\_FLB* = 73*[](#eBridgeResponseDesignRating.Design_Fatigue_Top_Flange_Tensile_Stress_Range_Without_FLB "Link to this definition") - Design\_Flexure\_Moment\_About\_Horizontal\_Axis\_M3* = 64*[](#eBridgeResponseDesignRating.Design_Flexure_Moment_About_Horizontal_Axis_M3 "Link to this definition") * Design\_Principal\_Stress\_Beam\_Web\_Bot* = 61*[](#eBridgeResponseDesignRating.Design_Principal_Stress_Beam_Web_Bot "Link to this definition") - Design\_Principal\_Stress\_Beam\_Web\_Top* = 60*[](#eBridgeResponseDesignRating.Design_Principal_Stress_Beam_Web_Top "Link to this definition") * Design\_Principal\_Stress\_Envelope* = 57*[](#eBridgeResponseDesignRating.Design_Principal_Stress_Envelope "Link to this definition") - Design\_Principal\_Stress\_Neutral\_Axis* = 62*[](#eBridgeResponseDesignRating.Design_Principal_Stress_Neutral_Axis "Link to this definition") * Design\_Principal\_Stress\_Web\_Bot* = 59*[](#eBridgeResponseDesignRating.Design_Principal_Stress_Web_Bot "Link to this definition") - Design\_Principal\_Stress\_Web\_Top* = 58*[](#eBridgeResponseDesignRating.Design_Principal_Stress_Web_Top "Link to this definition") * Design\_Shear\_Controlling\_DC\_Ratio* = 43*[](#eBridgeResponseDesignRating.Design_Shear_Controlling_DC_Ratio "Link to this definition") - Design\_Shear\_Controlling\_Shear\_DC\_Ratio* = 34*[](#eBridgeResponseDesignRating.Design_Shear_Controlling_Shear_DC_Ratio "Link to this definition") * Design\_Shear\_Controlling\_Torsion\_DC\_Ratio* = 35*[](#eBridgeResponseDesignRating.Design_Shear_Controlling_Torsion_DC_Ratio "Link to this definition") - Design\_Shear\_Demand\_Concrete\_Shear\_Capacity\_Ratio* = 33*[](#eBridgeResponseDesignRating.Design_Shear_Demand_Concrete_Shear_Capacity_Ratio "Link to this definition") * Design\_Shear\_Longit\_Rebar\_Area* = 45*[](#eBridgeResponseDesignRating.Design_Shear_Longit_Rebar_Area "Link to this definition") - Design\_Shear\_Longit\_Rebar\_Area\_Beam* = 50*[](#eBridgeResponseDesignRating.Design_Shear_Longit_Rebar_Area_Beam "Link to this definition") * Design\_Shear\_Longit\_Rebar\_Area\_Bot\_Flange* = 48*[](#eBridgeResponseDesignRating.Design_Shear_Longit_Rebar_Area_Bot_Flange "Link to this definition") - Design\_Shear\_Longit\_Rebar\_Area\_Bot\_Slab* = 46*[](#eBridgeResponseDesignRating.Design_Shear_Longit_Rebar_Area_Bot_Slab "Link to this definition") * Design\_Shear\_Longit\_Rebar\_Area\_Slab* = 49*[](#eBridgeResponseDesignRating.Design_Shear_Longit_Rebar_Area_Slab "Link to this definition") - Design\_Shear\_Longit\_Rebar\_Area\_Top\_Slab* = 47*[](#eBridgeResponseDesignRating.Design_Shear_Longit_Rebar_Area_Top_Slab "Link to this definition") * Design\_Shear\_Longit\_Torsional\_Rebar\_Area\_PerL* = 51*[](#eBridgeResponseDesignRating.Design_Shear_Longit_Torsional_Rebar_Area_PerL "Link to this definition") - Design\_Shear\_Rebar\_Area\_PerL* = 44*[](#eBridgeResponseDesignRating.Design_Shear_Rebar_Area_PerL "Link to this definition") * Design\_Shear\_Required\_Extra\_Longit\_Rebar\_Area* = 37*[](#eBridgeResponseDesignRating.Design_Shear_Required_Extra_Longit_Rebar_Area "Link to this definition") - Design\_Shear\_Required\_Extra\_Longit\_Rebar\_Area\_Beam* = 42*[](#eBridgeResponseDesignRating.Design_Shear_Required_Extra_Longit_Rebar_Area_Beam "Link to this definition") * Design\_Shear\_Required\_Extra\_Longit\_Rebar\_Area\_Bot\_Slab* = 39*[](#eBridgeResponseDesignRating.Design_Shear_Required_Extra_Longit_Rebar_Area_Bot_Slab "Link to this definition") - Design\_Shear\_Required\_Extra\_Longit\_Rebar\_Area\_For\_Torsion* = 38*[](#eBridgeResponseDesignRating.Design_Shear_Required_Extra_Longit_Rebar_Area_For_Torsion "Link to this definition") * Design\_Shear\_Required\_Extra\_Longit\_Rebar\_Area\_Slab* = 41*[](#eBridgeResponseDesignRating.Design_Shear_Required_Extra_Longit_Rebar_Area_Slab "Link to this definition") - Design\_Shear\_Required\_Extra\_Longit\_Rebar\_Area\_Top\_Slab* = 40*[](#eBridgeResponseDesignRating.Design_Shear_Required_Extra_Longit_Rebar_Area_Top_Slab "Link to this definition") * Design\_Shear\_Required\_Extra\_Shear\_Rebar\_Area\_PerL* = 36*[](#eBridgeResponseDesignRating.Design_Shear_Required_Extra_Shear_Rebar_Area_PerL "Link to this definition") - Design\_Shear\_Torsion\_Plus\_Shear\_Rebar\_Area\_PerL* = 53*[](#eBridgeResponseDesignRating.Design_Shear_Torsion_Plus_Shear_Rebar_Area_PerL "Link to this definition") * Design\_Shear\_Torsion\_Rebar\_Area\_PerL* = 52*[](#eBridgeResponseDesignRating.Design_Shear_Torsion_Rebar_Area_PerL "Link to this definition") - Design\_Strength\_DC\_Ratio\_FlexureShearInteract\_Neg* = 71*[](#eBridgeResponseDesignRating.Design_Strength_DC_Ratio_FlexureShearInteract_Neg "Link to this definition") * Design\_Strength\_DC\_Ratio\_FlexureShearInteract\_Pos* = 70*[](#eBridgeResponseDesignRating.Design_Strength_DC_Ratio_FlexureShearInteract_Pos "Link to this definition") - Design\_Strength\_DC\_Ratio\_Negative\_Moment* = 66*[](#eBridgeResponseDesignRating.Design_Strength_DC_Ratio_Negative_Moment "Link to this definition") * Design\_Strength\_DC\_Ratio\_Net\_Section\_Fracture\_Neg* = 69*[](#eBridgeResponseDesignRating.Design_Strength_DC_Ratio_Net_Section_Fracture_Neg "Link to this definition") - Design\_Strength\_DC\_Ratio\_Net\_Section\_Fracture\_Pos* = 68*[](#eBridgeResponseDesignRating.Design_Strength_DC_Ratio_Net_Section_Fracture_Pos "Link to this definition") * Design\_Strength\_DC\_Ratio\_Positive\_Moment* = 65*[](#eBridgeResponseDesignRating.Design_Strength_DC_Ratio_Positive_Moment "Link to this definition") - Design\_Strength\_DC\_Ratio\_Shear* = 67*[](#eBridgeResponseDesignRating.Design_Strength_DC_Ratio_Shear "Link to this definition") * Design\_Strength\_Total\_Nominal\_Shear\_Force\_6\_10\_10\_4\_2* = 72*[](#eBridgeResponseDesignRating.Design_Strength_Total_Nominal_Shear_Force_6_10_10_4_2 "Link to this definition") - Design\_Tendon\_Stress\_Controlling\_DC\_Ratio* = 63*[](#eBridgeResponseDesignRating.Design_Tendon_Stress_Controlling_DC_Ratio "Link to this definition") * Rating\_ASM\_Rating* = 94*[](#eBridgeResponseDesignRating.Rating_ASM_Rating "Link to this definition") - Rating\_Flexure* = 81*[](#eBridgeResponseDesignRating.Rating_Flexure "Link to this definition") * Rating\_Flexure\_Factored\_Moment\_Resistance* = 82*[](#eBridgeResponseDesignRating.Rating_Flexure_Factored_Moment_Resistance "Link to this definition") - Rating\_Flexure\_Factored\_Moment\_Resistance\_UMr* = 83*[](#eBridgeResponseDesignRating.Rating_Flexure_Factored_Moment_Resistance_UMr "Link to this definition") * Rating\_Flexure\_Live\_load\_Capacity\_Factor\_F* = 84*[](#eBridgeResponseDesignRating.Rating_Flexure_Live_load_Capacity_Factor_F "Link to this definition") - Rating\_LFM\_Service\_Rating* = 96*[](#eBridgeResponseDesignRating.Rating_LFM_Service_Rating "Link to this definition") * Rating\_LFM\_Strength\_Rating* = 95*[](#eBridgeResponseDesignRating.Rating_LFM_Strength_Rating "Link to this definition") - Rating\_MinRebar\_Flexure\_Rating* = 92*[](#eBridgeResponseDesignRating.Rating_MinRebar_Flexure_Rating "Link to this definition") * Rating\_MinRebar\_Min\_Of\_Abs\_1\_2Mcr\_And\_Abs\_1\_33Mu\_For\_Neg* = 91*[](#eBridgeResponseDesignRating.Rating_MinRebar_Min_Of_Abs_1_2Mcr_And_Abs_1_33Mu_For_Neg "Link to this definition") - Rating\_MinRebar\_Min\_Of\_Abs\_1\_2Mcr\_And\_Abs\_1\_33Mu\_For\_Pos* = 90*[](#eBridgeResponseDesignRating.Rating_MinRebar_Min_Of_Abs_1_2Mcr_And_Abs_1_33Mu_For_Pos "Link to this definition") * Rating\_Service* = 93*[](#eBridgeResponseDesignRating.Rating_Service "Link to this definition") - Rating\_Service\_Flexure\_Rating* = 89*[](#eBridgeResponseDesignRating.Rating_Service_Flexure_Rating "Link to this definition") * Rating\_Shear* = 77*[](#eBridgeResponseDesignRating.Rating_Shear "Link to this definition") - Rating\_Shear\_Factored\_Shear\_Resistance* = 78*[](#eBridgeResponseDesignRating.Rating_Shear_Factored_Shear_Resistance "Link to this definition") * Rating\_Shear\_Factored\_Shear\_Resistance\_UVr* = 79*[](#eBridgeResponseDesignRating.Rating_Shear_Factored_Shear_Resistance_UVr "Link to this definition") - Rating\_Shear\_Live\_load\_Capacity\_Factor\_F* = 80*[](#eBridgeResponseDesignRating.Rating_Shear_Live_load_Capacity_Factor_F "Link to this definition") * Rating\_Strength\_Flexure\_Rating* = 86*[](#eBridgeResponseDesignRating.Rating_Strength_Flexure_Rating "Link to this definition") - Rating\_Strength\_Live\_load\_Capacity\_Factor\_F\_Moment\_M3* = 87*[](#eBridgeResponseDesignRating.Rating_Strength_Live_load_Capacity_Factor_F_Moment_M3 "Link to this definition") * Rating\_Strength\_Live\_load\_Capacity\_Factor\_F\_Shear\_V2* = 88*[](#eBridgeResponseDesignRating.Rating_Strength_Live_load_Capacity_Factor_F_Shear_V2 "Link to this definition") - Rating\_Strength\_Shear\_Rating* = 85*[](#eBridgeResponseDesignRating.Rating_Strength_Shear_Rating "Link to this definition") * S11\_Longitudinal\_Beam\_Bot\_Center* = 39*[](#eBridgeResponseDesignRating.S11_Longitudinal_Beam_Bot_Center "Link to this definition") - S11\_Longitudinal\_Beam\_Bot\_Envelope* = 32*[](#eBridgeResponseDesignRating.S11_Longitudinal_Beam_Bot_Envelope "Link to this definition") * S11\_Longitudinal\_Beam\_Bot\_Left* = 29*[](#eBridgeResponseDesignRating.S11_Longitudinal_Beam_Bot_Left "Link to this definition") - S11\_Longitudinal\_Beam\_Bot\_Right* = 31*[](#eBridgeResponseDesignRating.S11_Longitudinal_Beam_Bot_Right "Link to this definition") * S11\_Longitudinal\_Beam\_Top\_Center* = 10*[](#eBridgeResponseDesignRating.S11_Longitudinal_Beam_Top_Center "Link to this definition") - S11\_Longitudinal\_Beam\_Top\_Envelope* = 12*[](#eBridgeResponseDesignRating.S11_Longitudinal_Beam_Top_Envelope "Link to this definition") * S11\_Longitudinal\_Beam\_Top\_Left* = 9*[](#eBridgeResponseDesignRating.S11_Longitudinal_Beam_Top_Left "Link to this definition") - S11\_Longitudinal\_Beam\_Top\_Right* = 11*[](#eBridgeResponseDesignRating.S11_Longitudinal_Beam_Top_Right "Link to this definition") * S11\_Longitudinal\_Bot\_Center* = 15*[](#eBridgeResponseDesignRating.S11_Longitudinal_Bot_Center "Link to this definition") - S11\_Longitudinal\_Bot\_Envelope* = 18*[](#eBridgeResponseDesignRating.S11_Longitudinal_Bot_Envelope "Link to this definition") * S11\_Longitudinal\_Bot\_Left* = 13*[](#eBridgeResponseDesignRating.S11_Longitudinal_Bot_Left "Link to this definition") - S11\_Longitudinal\_Bot\_Left\_Corner* = 14*[](#eBridgeResponseDesignRating.S11_Longitudinal_Bot_Left_Corner "Link to this definition") * S11\_Longitudinal\_Bot\_Right* = 16*[](#eBridgeResponseDesignRating.S11_Longitudinal_Bot_Right "Link to this definition") - S11\_Longitudinal\_Bot\_Right\_Corner* = 17*[](#eBridgeResponseDesignRating.S11_Longitudinal_Bot_Right_Corner "Link to this definition") * S11\_Longitudinal\_Girder\_Bot\_Envelope* = 21*[](#eBridgeResponseDesignRating.S11_Longitudinal_Girder_Bot_Envelope "Link to this definition") - S11\_Longitudinal\_Girder\_Bot\_Left* = 19*[](#eBridgeResponseDesignRating.S11_Longitudinal_Girder_Bot_Left "Link to this definition") * S11\_Longitudinal\_Girder\_Bot\_Right* = 20*[](#eBridgeResponseDesignRating.S11_Longitudinal_Girder_Bot_Right "Link to this definition") - S11\_Longitudinal\_Slab\_Bot\_Beam\_Center* = 24*[](#eBridgeResponseDesignRating.S11_Longitudinal_Slab_Bot_Beam_Center "Link to this definition") * S11\_Longitudinal\_Slab\_Bot\_Beam\_Left* = 23*[](#eBridgeResponseDesignRating.S11_Longitudinal_Slab_Bot_Beam_Left "Link to this definition") - S11\_Longitudinal\_Slab\_Bot\_Beam\_Right* = 25*[](#eBridgeResponseDesignRating.S11_Longitudinal_Slab_Bot_Beam_Right "Link to this definition") * S11\_Longitudinal\_Slab\_Bot\_Center* = 26*[](#eBridgeResponseDesignRating.S11_Longitudinal_Slab_Bot_Center "Link to this definition") - S11\_Longitudinal\_Slab\_Bot\_Envelope* = 28*[](#eBridgeResponseDesignRating.S11_Longitudinal_Slab_Bot_Envelope "Link to this definition") * S11\_Longitudinal\_Slab\_Bot\_Left* = 22*[](#eBridgeResponseDesignRating.S11_Longitudinal_Slab_Bot_Left "Link to this definition") - S11\_Longitudinal\_Slab\_Bot\_Right* = 27*[](#eBridgeResponseDesignRating.S11_Longitudinal_Slab_Bot_Right "Link to this definition") * S11\_Longitudinal\_Slab\_Top\_Beam\_Center* = 6*[](#eBridgeResponseDesignRating.S11_Longitudinal_Slab_Top_Beam_Center "Link to this definition") - S11\_Longitudinal\_Slab\_Top\_Center* = 5*[](#eBridgeResponseDesignRating.S11_Longitudinal_Slab_Top_Center "Link to this definition") * S11\_Longitudinal\_Slab\_Top\_Envelope* = 8*[](#eBridgeResponseDesignRating.S11_Longitudinal_Slab_Top_Envelope "Link to this definition") - S11\_Longitudinal\_Slab\_Top\_Left* = 4*[](#eBridgeResponseDesignRating.S11_Longitudinal_Slab_Top_Left "Link to this definition") * S11\_Longitudinal\_Slab\_Top\_Right* = 7*[](#eBridgeResponseDesignRating.S11_Longitudinal_Slab_Top_Right "Link to this definition") - S11\_Longitudinal\_Top\_Center* = 1*[](#eBridgeResponseDesignRating.S11_Longitudinal_Top_Center "Link to this definition") * S11\_Longitudinal\_Top\_Envelope* = 3*[](#eBridgeResponseDesignRating.S11_Longitudinal_Top_Envelope "Link to this definition") - S11\_Longitudinal\_Top\_Left* = 0*[](#eBridgeResponseDesignRating.S11_Longitudinal_Top_Left "Link to this definition") * S11\_Longitudinal\_Top\_Right* = 2*[](#eBridgeResponseDesignRating.S11_Longitudinal_Top_Right "Link to this definition") <!-- --> ## eBridgeResponseDisplDOF[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eBridgeResponseDisplDOF "Direct link to eBridgeResponseDisplDOF") * *class *viktor.external.sap2000.enums.eBridgeResponseDisplDOF(*\*values*)[](#eBridgeResponseDisplDOF "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eBridgeResponseDisplDOF` values, mirroring the product API’s names so code reads like its docs. * Avg\_Longitudinal\_Rotation* = 4*[](#eBridgeResponseDisplDOF.Avg_Longitudinal_Rotation "Link to this definition") - Longitudinal\_Displacement* = 2*[](#eBridgeResponseDisplDOF.Longitudinal_Displacement "Link to this definition") * Longitudinal\_Rotation* = 3*[](#eBridgeResponseDisplDOF.Longitudinal_Rotation "Link to this definition") - Transverse\_Displacement* = 1*[](#eBridgeResponseDisplDOF.Transverse_Displacement "Link to this definition") * Vertical\_Displacement* = 0*[](#eBridgeResponseDisplDOF.Vertical_Displacement "Link to this definition") <!-- --> ## eBridgeResponseDisplLoc[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eBridgeResponseDisplLoc "Direct link to eBridgeResponseDisplLoc") * *class *viktor.external.sap2000.enums.eBridgeResponseDisplLoc(*\*values*)[](#eBridgeResponseDisplLoc "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eBridgeResponseDisplLoc` values, mirroring the product API’s names so code reads like its docs. * Left\_Web* = 5*[](#eBridgeResponseDisplLoc.Left_Web "Link to this definition") - Left\_Web\_Bottom* = 4*[](#eBridgeResponseDisplLoc.Left_Web_Bottom "Link to this definition") * Left\_Web\_Top* = 3*[](#eBridgeResponseDisplLoc.Left_Web_Top "Link to this definition") - Right\_Web* = 8*[](#eBridgeResponseDisplLoc.Right_Web "Link to this definition") * Right\_Web\_Bottom* = 7*[](#eBridgeResponseDisplLoc.Right_Web_Bottom "Link to this definition") - Right\_Web\_Top* = 6*[](#eBridgeResponseDisplLoc.Right_Web_Top "Link to this definition") * Slab\_Center* = 9*[](#eBridgeResponseDisplLoc.Slab_Center "Link to this definition") - Web* = 2*[](#eBridgeResponseDisplLoc.Web "Link to this definition") * Web\_Bottom* = 1*[](#eBridgeResponseDisplLoc.Web_Bottom "Link to this definition") - Web\_Top* = 0*[](#eBridgeResponseDisplLoc.Web_Top "Link to this definition") <!-- --> ## eBridgeResponseForce[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eBridgeResponseForce "Direct link to eBridgeResponseForce") * *class *viktor.external.sap2000.enums.eBridgeResponseForce(*\*values*)[](#eBridgeResponseForce "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eBridgeResponseForce` values, mirroring the product API’s names so code reads like its docs. * Axial\_Force\_P* = 1*[](#eBridgeResponseForce.Axial_Force_P "Link to this definition") - Moment\_About\_Horizontal\_Axis\_M3* = 6*[](#eBridgeResponseForce.Moment_About_Horizontal_Axis_M3 "Link to this definition") * Moment\_About\_Vertical\_Axis\_M2* = 5*[](#eBridgeResponseForce.Moment_About_Vertical_Axis_M2 "Link to this definition") - Shear\_Horizontal\_V3* = 3*[](#eBridgeResponseForce.Shear_Horizontal_V3 "Link to this definition") * Shear\_Vertical\_V2* = 2*[](#eBridgeResponseForce.Shear_Vertical_V2 "Link to this definition") - Torsion\_T* = 4*[](#eBridgeResponseForce.Torsion_T "Link to this definition") <!-- --> ## eBridgeResponsePart[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eBridgeResponsePart "Direct link to eBridgeResponsePart") * *class *viktor.external.sap2000.enums.eBridgeResponsePart(*\*values*)[](#eBridgeResponsePart "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eBridgeResponsePart` values, mirroring the product API’s names so code reads like its docs. * All\_Beams* = 7*[](#eBridgeResponsePart.All_Beams "Link to this definition") - All\_Girders* = 6*[](#eBridgeResponsePart.All_Girders "Link to this definition") * All\_Slabs* = 9*[](#eBridgeResponsePart.All_Slabs "Link to this definition") - All\_Webs* = 8*[](#eBridgeResponsePart.All_Webs "Link to this definition") * Beam* = 3*[](#eBridgeResponsePart.Beam "Link to this definition") - Entire\_Bridge\_Section* = 1*[](#eBridgeResponsePart.Entire_Bridge_Section "Link to this definition") * Entire\_Section\_Plus\_All\_Girders* = 10*[](#eBridgeResponsePart.Entire_Section_Plus_All_Girders "Link to this definition") - Girder* = 2*[](#eBridgeResponsePart.Girder "Link to this definition") * Slab* = 5*[](#eBridgeResponsePart.Slab "Link to this definition") - Web* = 4*[](#eBridgeResponsePart.Web "Link to this definition") <!-- --> ## eBridgeResponseStress[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eBridgeResponseStress "Direct link to eBridgeResponseStress") * *class *viktor.external.sap2000.enums.eBridgeResponseStress(*\*values*)[](#eBridgeResponseStress "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eBridgeResponseStress` values, mirroring the product API’s names so code reads like its docs. * S11\_Lateral\_Bending\_Bot* = 25*[](#eBridgeResponseStress.S11_Lateral_Bending_Bot "Link to this definition") - S11\_Lateral\_Bending\_Top* = 22*[](#eBridgeResponseStress.S11_Lateral_Bending_Top "Link to this definition") * S11\_Lateral\_Bending\_Top\_ULeft* = 23*[](#eBridgeResponseStress.S11_Lateral_Bending_Top_ULeft "Link to this definition") - S11\_Lateral\_Bending\_Top\_URight* = 24*[](#eBridgeResponseStress.S11_Lateral_Bending_Top_URight "Link to this definition") * S11\_Longitudinal\_Bot\_Beam\_Left* = 16*[](#eBridgeResponseStress.S11_Longitudinal_Bot_Beam_Left "Link to this definition") - S11\_Longitudinal\_Bot\_Beam\_Right* = 17*[](#eBridgeResponseStress.S11_Longitudinal_Bot_Beam_Right "Link to this definition") * S11\_Longitudinal\_Bot\_Center* = 14*[](#eBridgeResponseStress.S11_Longitudinal_Bot_Center "Link to this definition") - S11\_Longitudinal\_Bot\_Envelope* = 18*[](#eBridgeResponseStress.S11_Longitudinal_Bot_Envelope "Link to this definition") * S11\_Longitudinal\_Bot\_Left* = 13*[](#eBridgeResponseStress.S11_Longitudinal_Bot_Left "Link to this definition") - S11\_Longitudinal\_Bot\_Right* = 15*[](#eBridgeResponseStress.S11_Longitudinal_Bot_Right "Link to this definition") * S11\_Longitudinal\_Top\_Beam\_Center* = 3*[](#eBridgeResponseStress.S11_Longitudinal_Top_Beam_Center "Link to this definition") - S11\_Longitudinal\_Top\_Bot\_Center* = 20*[](#eBridgeResponseStress.S11_Longitudinal_Top_Bot_Center "Link to this definition") * S11\_Longitudinal\_Top\_Bot\_Left* = 19*[](#eBridgeResponseStress.S11_Longitudinal_Top_Bot_Left "Link to this definition") - S11\_Longitudinal\_Top\_Bot\_Right* = 21*[](#eBridgeResponseStress.S11_Longitudinal_Top_Bot_Right "Link to this definition") * S11\_Longitudinal\_Top\_Center* = 1*[](#eBridgeResponseStress.S11_Longitudinal_Top_Center "Link to this definition") - S11\_Longitudinal\_Top\_Envelope* = 4*[](#eBridgeResponseStress.S11_Longitudinal_Top_Envelope "Link to this definition") * S11\_Longitudinal\_Top\_Left* = 0*[](#eBridgeResponseStress.S11_Longitudinal_Top_Left "Link to this definition") - S11\_Longitudinal\_Top\_Right* = 2*[](#eBridgeResponseStress.S11_Longitudinal_Top_Right "Link to this definition") * S11\_Longitudinal\_Top\_ULeft\_Center* = 6*[](#eBridgeResponseStress.S11_Longitudinal_Top_ULeft_Center "Link to this definition") - S11\_Longitudinal\_Top\_ULeft\_Envelope* = 8*[](#eBridgeResponseStress.S11_Longitudinal_Top_ULeft_Envelope "Link to this definition") * S11\_Longitudinal\_Top\_ULeft\_Left* = 5*[](#eBridgeResponseStress.S11_Longitudinal_Top_ULeft_Left "Link to this definition") - S11\_Longitudinal\_Top\_ULeft\_Right* = 7*[](#eBridgeResponseStress.S11_Longitudinal_Top_ULeft_Right "Link to this definition") * S11\_Longitudinal\_Top\_URight\_Center* = 10*[](#eBridgeResponseStress.S11_Longitudinal_Top_URight_Center "Link to this definition") - S11\_Longitudinal\_Top\_URight\_Envelope* = 12*[](#eBridgeResponseStress.S11_Longitudinal_Top_URight_Envelope "Link to this definition") * S11\_Longitudinal\_Top\_URight\_Left* = 9*[](#eBridgeResponseStress.S11_Longitudinal_Top_URight_Left "Link to this definition") - S11\_Longitudinal\_Top\_URight\_Right* = 11*[](#eBridgeResponseStress.S11_Longitudinal_Top_URight_Right "Link to this definition") <!-- --> ## eBridgeSegmentConstructionMethod[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eBridgeSegmentConstructionMethod "Direct link to eBridgeSegmentConstructionMethod") * *class *viktor.external.sap2000.enums.eBridgeSegmentConstructionMethod(*\*values*)[](#eBridgeSegmentConstructionMethod "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eBridgeSegmentConstructionMethod` values, mirroring the product API’s names so code reads like its docs. * CastInPlace* = 1*[](#eBridgeSegmentConstructionMethod.CastInPlace "Link to this definition") - Precast* = 0*[](#eBridgeSegmentConstructionMethod.Precast "Link to this definition") <!-- --> ## eBridgeSegmentType[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eBridgeSegmentType "Direct link to eBridgeSegmentType") * *class *viktor.external.sap2000.enums.eBridgeSegmentType(*\*values*)[](#eBridgeSegmentType "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eBridgeSegmentType` values, mirroring the product API’s names so code reads like its docs. * Closure* = 3*[](#eBridgeSegmentType.Closure "Link to this definition") - PierTable* = 1*[](#eBridgeSegmentType.PierTable "Link to this definition") * Rigid* = 0*[](#eBridgeSegmentType.Rigid "Link to this definition") - Segment* = 2*[](#eBridgeSegmentType.Segment "Link to this definition") <!-- --> ## eBridgeTendonCategory[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eBridgeTendonCategory "Direct link to eBridgeTendonCategory") * *class *viktor.external.sap2000.enums.eBridgeTendonCategory(*\*values*)[](#eBridgeTendonCategory "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eBridgeTendonCategory` values, mirroring the product API’s names so code reads like its docs. * BottomSpan* = 2*[](#eBridgeTendonCategory.BottomSpan "Link to this definition") - Cantilever* = 1*[](#eBridgeTendonCategory.Cantilever "Link to this definition") * Continuity* = 4*[](#eBridgeTendonCategory.Continuity "Link to this definition") - General* = 0*[](#eBridgeTendonCategory.General "Link to this definition") * TopSpan* = 3*[](#eBridgeTendonCategory.TopSpan "Link to this definition") <!-- --> ## eCNameType[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eCNameType "Direct link to eCNameType") * *class *viktor.external.sap2000.enums.eCNameType(*\*values*)[](#eCNameType "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eCNameType` values, mirroring the product API’s names so code reads like its docs. * LoadCase* = 0*[](#eCNameType.LoadCase "Link to this definition") - LoadCombo* = 1*[](#eCNameType.LoadCombo "Link to this definition") <!-- --> ## eConstraintAxis[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eConstraintAxis "Direct link to eConstraintAxis") * *class *viktor.external.sap2000.enums.eConstraintAxis(*\*values*)[](#eConstraintAxis "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eConstraintAxis` values, mirroring the product API’s names so code reads like its docs. * AutoAxis* = 4*[](#eConstraintAxis.AutoAxis "Link to this definition") - X* = 1*[](#eConstraintAxis.X "Link to this definition") * Y* = 2*[](#eConstraintAxis.Y "Link to this definition") - Z* = 3*[](#eConstraintAxis.Z "Link to this definition") <!-- --> ## eConstraintType[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eConstraintType "Direct link to eConstraintType") * *class *viktor.external.sap2000.enums.eConstraintType(*\*values*)[](#eConstraintType "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eConstraintType` values, mirroring the product API’s names so code reads like its docs. * Beam* = 5*[](#eConstraintType.Beam "Link to this definition") - Body* = 1*[](#eConstraintType.Body "Link to this definition") * Diaphragm* = 2*[](#eConstraintType.Diaphragm "Link to this definition") - Equal* = 6*[](#eConstraintType.Equal "Link to this definition") * Line* = 13*[](#eConstraintType.Line "Link to this definition") - Local* = 7*[](#eConstraintType.Local "Link to this definition") * Plate* = 3*[](#eConstraintType.Plate "Link to this definition") - Rod* = 4*[](#eConstraintType.Rod "Link to this definition") * Weld* = 8*[](#eConstraintType.Weld "Link to this definition") <!-- --> ## eDesignActionType[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eDesignActionType "Direct link to eDesignActionType") * *class *viktor.external.sap2000.enums.eDesignActionType(*\*values*)[](#eDesignActionType "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eDesignActionType` values, mirroring the product API’s names so code reads like its docs. * LongTermComposite* = 3*[](#eDesignActionType.LongTermComposite "Link to this definition") - NonComposite* = 1*[](#eDesignActionType.NonComposite "Link to this definition") * Other* = 5*[](#eDesignActionType.Other "Link to this definition") - ShortTermComposite* = 2*[](#eDesignActionType.ShortTermComposite "Link to this definition") * Staged* = 4*[](#eDesignActionType.Staged "Link to this definition") <!-- --> ## eForce[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eForce "Direct link to eForce") * *class *viktor.external.sap2000.enums.eForce(*\*values*)[](#eForce "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eForce` values, mirroring the product API’s names so code reads like its docs. * N* = 3*[](#eForce.N "Link to this definition") - NotApplicable* = 0*[](#eForce.NotApplicable "Link to this definition") * kN* = 4*[](#eForce.kN "Link to this definition") - kgf* = 5*[](#eForce.kgf "Link to this definition") * kip* = 2*[](#eForce.kip "Link to this definition") - lb* = 1*[](#eForce.lb "Link to this definition") * tonf* = 6*[](#eForce.tonf "Link to this definition") <!-- --> ## eFramePropType[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eFramePropType "Direct link to eFramePropType") * *class *viktor.external.sap2000.enums.eFramePropType(*\*values*)[](#eFramePropType "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eFramePropType` values, mirroring the product API’s names so code reads like its docs. * Angle* = 4*[](#eFramePropType.Angle "Link to this definition") - Auto* = 12*[](#eFramePropType.Auto "Link to this definition") * Box* = 6*[](#eFramePropType.Box "Link to this definition") - Bridge* = 16*[](#eFramePropType.Bridge "Link to this definition") * BucklingRestrainedBrace* = 33*[](#eFramePropType.BucklingRestrainedBrace "Link to this definition") - BuiltupICoverplate* = 23*[](#eFramePropType.BuiltupICoverplate "Link to this definition") * BuiltupIHybrid* = 26*[](#eFramePropType.BuiltupIHybrid "Link to this definition") - BuiltupUHybrid* = 27*[](#eFramePropType.BuiltupUHybrid "Link to this definition") * Channel* = 2*[](#eFramePropType.Channel "Link to this definition") - Circle* = 9*[](#eFramePropType.Circle "Link to this definition") * Cold\_2C* = 18*[](#eFramePropType.Cold_2C "Link to this definition") - Cold\_2L* = 21*[](#eFramePropType.Cold_2L "Link to this definition") * Cold\_Box* = 42*[](#eFramePropType.Cold_Box "Link to this definition") - Cold\_C* = 17*[](#eFramePropType.Cold_C "Link to this definition") * Cold\_Hat* = 22*[](#eFramePropType.Cold_Hat "Link to this definition") - Cold\_I* = 43*[](#eFramePropType.Cold_I "Link to this definition") * Cold\_L* = 20*[](#eFramePropType.Cold_L "Link to this definition") - Cold\_Pipe* = 44*[](#eFramePropType.Cold_Pipe "Link to this definition") * Cold\_T* = 45*[](#eFramePropType.Cold_T "Link to this definition") - Cold\_Z* = 19*[](#eFramePropType.Cold_Z "Link to this definition") * ConcreteBox* = 36*[](#eFramePropType.ConcreteBox "Link to this definition") - ConcreteCross* = 38*[](#eFramePropType.ConcreteCross "Link to this definition") * ConcretePipe* = 37*[](#eFramePropType.ConcretePipe "Link to this definition") - ConcreteTee* = 35*[](#eFramePropType.ConcreteTee "Link to this definition") * Concrete\_L* = 28*[](#eFramePropType.Concrete_L "Link to this definition") - CoreBrace\_BRB* = 34*[](#eFramePropType.CoreBrace_BRB "Link to this definition") * DbChannel* = 11*[](#eFramePropType.DbChannel "Link to this definition") - DblAngle* = 5*[](#eFramePropType.DblAngle "Link to this definition") * EncasedCircle* = 32*[](#eFramePropType.EncasedCircle "Link to this definition") - EncasedRectangle* = 31*[](#eFramePropType.EncasedRectangle "Link to this definition") * FilledPipe* = 30*[](#eFramePropType.FilledPipe "Link to this definition") - FilledTube* = 29*[](#eFramePropType.FilledTube "Link to this definition") * General* = 10*[](#eFramePropType.General "Link to this definition") - I* = 1*[](#eFramePropType.I "Link to this definition") * Joist* = 15*[](#eFramePropType.Joist "Link to this definition") - PCCGirderBox* = 47*[](#eFramePropType.PCCGirderBox "Link to this definition") * PCCGirderI* = 24*[](#eFramePropType.PCCGirderI "Link to this definition") - PCCGirderSuperT* = 41*[](#eFramePropType.PCCGirderSuperT "Link to this definition") * PCCGirderU* = 25*[](#eFramePropType.PCCGirderU "Link to this definition") - Pipe* = 7*[](#eFramePropType.Pipe "Link to this definition") * Rectangular* = 8*[](#eFramePropType.Rectangular "Link to this definition") - SD* = 13*[](#eFramePropType.SD "Link to this definition") * SteelPlate* = 39*[](#eFramePropType.SteelPlate "Link to this definition") - SteelRod* = 40*[](#eFramePropType.SteelRod "Link to this definition") * T* = 3*[](#eFramePropType.T "Link to this definition") - Trapezoidal* = 46*[](#eFramePropType.Trapezoidal "Link to this definition") * Variable* = 14*[](#eFramePropType.Variable "Link to this definition") <!-- --> ## eHingeDistributionType[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eHingeDistributionType "Direct link to eHingeDistributionType") * *class *viktor.external.sap2000.enums.eHingeDistributionType(*\*values*)[](#eHingeDistributionType "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eHingeDistributionType` values, mirroring the product API’s names so code reads like its docs. * ContinuousSupport* = 4*[](#eHingeDistributionType.ContinuousSupport "Link to this definition") - DistributedPlasticity* = 2*[](#eHingeDistributionType.DistributedPlasticity "Link to this definition") * EqualSpacing* = 3*[](#eHingeDistributionType.EqualSpacing "Link to this definition") - NonlinearBeamColumn* = 1*[](#eHingeDistributionType.NonlinearBeamColumn "Link to this definition") * UserDefined* = 5*[](#eHingeDistributionType.UserDefined "Link to this definition") <!-- --> ## eHingeLengthOverwriteType[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eHingeLengthOverwriteType "Direct link to eHingeLengthOverwriteType") * *class *viktor.external.sap2000.enums.eHingeLengthOverwriteType(*\*values*)[](#eHingeLengthOverwriteType "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eHingeLengthOverwriteType` values, mirroring the product API’s names so code reads like its docs. * Absolute* = 2*[](#eHingeLengthOverwriteType.Absolute "Link to this definition") - None\_* = 1*[](#eHingeLengthOverwriteType.None_ "Link to this definition") * Relative* = 3*[](#eHingeLengthOverwriteType.Relative "Link to this definition") <!-- --> ## eHingeLocationType[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eHingeLocationType "Direct link to eHingeLocationType") * *class *viktor.external.sap2000.enums.eHingeLocationType(*\*values*)[](#eHingeLocationType "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eHingeLocationType` values, mirroring the product API’s names so code reads like its docs. * OffsetFromIEnd* = 2*[](#eHingeLocationType.OffsetFromIEnd "Link to this definition") - OffsetFromJEnd* = 3*[](#eHingeLocationType.OffsetFromJEnd "Link to this definition") * RelativeDistance* = 1*[](#eHingeLocationType.RelativeDistance "Link to this definition") <!-- --> ## eItemType[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eItemType "Direct link to eItemType") * *class *viktor.external.sap2000.enums.eItemType(*\*values*)[](#eItemType "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eItemType` values, mirroring the product API’s names so code reads like its docs. * Group* = 1*[](#eItemType.Group "Link to this definition") - Objects* = 0*[](#eItemType.Objects "Link to this definition") * SelectedObjects* = 2*[](#eItemType.SelectedObjects "Link to this definition") <!-- --> ## eItemTypeElm[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eItemTypeElm "Direct link to eItemTypeElm") * *class *viktor.external.sap2000.enums.eItemTypeElm(*\*values*)[](#eItemTypeElm "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eItemTypeElm` values, mirroring the product API’s names so code reads like its docs. * Element* = 1*[](#eItemTypeElm.Element "Link to this definition") - GroupElm* = 2*[](#eItemTypeElm.GroupElm "Link to this definition") * ObjectElm* = 0*[](#eItemTypeElm.ObjectElm "Link to this definition") - SelectionElm* = 3*[](#eItemTypeElm.SelectionElm "Link to this definition") <!-- --> ## eLength[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eLength "Direct link to eLength") * *class *viktor.external.sap2000.enums.eLength(*\*values*)[](#eLength "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eLength` values, mirroring the product API’s names so code reads like its docs. * NotApplicable* = 0*[](#eLength.NotApplicable "Link to this definition") - cm* = 5*[](#eLength.cm "Link to this definition") * ft* = 2*[](#eLength.ft "Link to this definition") - inch* = 1*[](#eLength.inch "Link to this definition") * m* = 6*[](#eLength.m "Link to this definition") - micron* = 3*[](#eLength.micron "Link to this definition") * mm* = 4*[](#eLength.mm "Link to this definition") <!-- --> ## eLinkPropType[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eLinkPropType "Direct link to eLinkPropType") * *class *viktor.external.sap2000.enums.eLinkPropType(*\*values*)[](#eLinkPropType "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eLinkPropType` values, mirroring the product API’s names so code reads like its docs. * Damper* = 2*[](#eLinkPropType.Damper "Link to this definition") - DamperBilinear* = 13*[](#eLinkPropType.DamperBilinear "Link to this definition") * DamperFrictionSpring* = 14*[](#eLinkPropType.DamperFrictionSpring "Link to this definition") - DamperLinearExponential* = 12*[](#eLinkPropType.DamperLinearExponential "Link to this definition") * Gap* = 3*[](#eLinkPropType.Gap "Link to this definition") - Hook* = 4*[](#eLinkPropType.Hook "Link to this definition") * Isolator1* = 6*[](#eLinkPropType.Isolator1 "Link to this definition") - Isolator2* = 7*[](#eLinkPropType.Isolator2 "Link to this definition") * Isolator3* = 10*[](#eLinkPropType.Isolator3 "Link to this definition") - Isolator4* = 11*[](#eLinkPropType.Isolator4 "Link to this definition") * Linear* = 1*[](#eLinkPropType.Linear "Link to this definition") - MultilinearElastic* = 8*[](#eLinkPropType.MultilinearElastic "Link to this definition") * MultilinearPlastic* = 9*[](#eLinkPropType.MultilinearPlastic "Link to this definition") - PlasticWen* = 5*[](#eLinkPropType.PlasticWen "Link to this definition") <!-- --> ## eLoadCaseType[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eLoadCaseType "Direct link to eLoadCaseType") * *class *viktor.external.sap2000.enums.eLoadCaseType(*\*values*)[](#eLoadCaseType "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eLoadCaseType` values, mirroring the product API’s names so code reads like its docs. * Buckling* = 10*[](#eLoadCaseType.Buckling "Link to this definition") - ExternalResults* = 15*[](#eLoadCaseType.ExternalResults "Link to this definition") * HyperStatic* = 14*[](#eLoadCaseType.HyperStatic "Link to this definition") - LinearDynamic* = 7*[](#eLoadCaseType.LinearDynamic "Link to this definition") * LinearHistory* = 5*[](#eLoadCaseType.LinearHistory "Link to this definition") - LinearStatic* = 1*[](#eLoadCaseType.LinearStatic "Link to this definition") * LinearStaticMultiStep* = 13*[](#eLoadCaseType.LinearStaticMultiStep "Link to this definition") - Modal* = 3*[](#eLoadCaseType.Modal "Link to this definition") * MovingLoad* = 9*[](#eLoadCaseType.MovingLoad "Link to this definition") - NonlinearDynamic* = 8*[](#eLoadCaseType.NonlinearDynamic "Link to this definition") * NonlinearHistory* = 6*[](#eLoadCaseType.NonlinearHistory "Link to this definition") - NonlinearStatic* = 2*[](#eLoadCaseType.NonlinearStatic "Link to this definition") * NonlinearStaticMultiStep* = 17*[](#eLoadCaseType.NonlinearStaticMultiStep "Link to this definition") - PowerSpectralDensity* = 12*[](#eLoadCaseType.PowerSpectralDensity "Link to this definition") * ResponseSpectrum* = 4*[](#eLoadCaseType.ResponseSpectrum "Link to this definition") - StagedConstruction* = 16*[](#eLoadCaseType.StagedConstruction "Link to this definition") * SteadyState* = 11*[](#eLoadCaseType.SteadyState "Link to this definition") <!-- --> ## eLoadPatternType[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eLoadPatternType "Direct link to eLoadPatternType") * *class *viktor.external.sap2000.enums.eLoadPatternType(*\*values*)[](#eLoadPatternType "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eLoadPatternType` values, mirroring the product API’s names so code reads like its docs. * ActiveEarthPressure* = 45*[](#eLoadPatternType.ActiveEarthPressure "Link to this definition") - Bouyancy* = 36*[](#eLoadPatternType.Bouyancy "Link to this definition") * Braking* = 15*[](#eLoadPatternType.Braking "Link to this definition") - Centrifugal* = 16*[](#eLoadPatternType.Centrifugal "Link to this definition") * Construction* = 39*[](#eLoadPatternType.Construction "Link to this definition") - Creep* = 29*[](#eLoadPatternType.Creep "Link to this definition") * Dead* = 1*[](#eLoadPatternType.Dead "Link to this definition") - DeadManufacture* = 42*[](#eLoadPatternType.DeadManufacture "Link to this definition") * DeadWater* = 41*[](#eLoadPatternType.DeadWater "Link to this definition") - DeadWearing* = 40*[](#eLoadPatternType.DeadWearing "Link to this definition") * DownDrag* = 23*[](#eLoadPatternType.DownDrag "Link to this definition") - EarthHydrostatic* = 43*[](#eLoadPatternType.EarthHydrostatic "Link to this definition") * EarthSurcharge* = 22*[](#eLoadPatternType.EarthSurcharge "Link to this definition") - EuroLm1Char* = 48*[](#eLoadPatternType.EuroLm1Char "Link to this definition") * EuroLm1Freq* = 49*[](#eLoadPatternType.EuroLm1Freq "Link to this definition") - EuroLm2* = 50*[](#eLoadPatternType.EuroLm2 "Link to this definition") * EuroLm3* = 51*[](#eLoadPatternType.EuroLm3 "Link to this definition") - EuroLm4* = 52*[](#eLoadPatternType.EuroLm4 "Link to this definition") * Friction* = 17*[](#eLoadPatternType.Friction "Link to this definition") - HorizontalEarthPressure* = 20*[](#eLoadPatternType.HorizontalEarthPressure "Link to this definition") * Hyperstatic* = 35*[](#eLoadPatternType.Hyperstatic "Link to this definition") - Ice* = 18*[](#eLoadPatternType.Ice "Link to this definition") * Impact* = 38*[](#eLoadPatternType.Impact "Link to this definition") - Live* = 3*[](#eLoadPatternType.Live "Link to this definition") * LiveLoadSurcharge* = 31*[](#eLoadPatternType.LiveLoadSurcharge "Link to this definition") - LockedInForces* = 32*[](#eLoadPatternType.LockedInForces "Link to this definition") * Move* = 9*[](#eLoadPatternType.Move "Link to this definition") - MoveDeflection* = 57*[](#eLoadPatternType.MoveDeflection "Link to this definition") * MoveFatigue* = 55*[](#eLoadPatternType.MoveFatigue "Link to this definition") - MoveFatiguePermit* = 56*[](#eLoadPatternType.MoveFatiguePermit "Link to this definition") * MoveTrain* = 58*[](#eLoadPatternType.MoveTrain "Link to this definition") - Notional* = 12*[](#eLoadPatternType.Notional "Link to this definition") * Other* = 8*[](#eLoadPatternType.Other "Link to this definition") - PassiveEarthPressure* = 44*[](#eLoadPatternType.PassiveEarthPressure "Link to this definition") * PatternAuto* = 60*[](#eLoadPatternType.PatternAuto "Link to this definition") - PatternLive* = 13*[](#eLoadPatternType.PatternLive "Link to this definition") * PedestrianLL* = 33*[](#eLoadPatternType.PedestrianLL "Link to this definition") - PedestrianLLReduced* = 46*[](#eLoadPatternType.PedestrianLLReduced "Link to this definition") * Permit* = 54*[](#eLoadPatternType.Permit "Link to this definition") - Prestress* = 34*[](#eLoadPatternType.Prestress "Link to this definition") * PrestressTransfer* = 59*[](#eLoadPatternType.PrestressTransfer "Link to this definition") - Quake* = 5*[](#eLoadPatternType.Quake "Link to this definition") * QuakeDrift* = 61*[](#eLoadPatternType.QuakeDrift "Link to this definition") - QuakeVerticalOnly* = 62*[](#eLoadPatternType.QuakeVerticalOnly "Link to this definition") * ReduceLive* = 4*[](#eLoadPatternType.ReduceLive "Link to this definition") - Rooflive* = 11*[](#eLoadPatternType.Rooflive "Link to this definition") * SeaState* = 53*[](#eLoadPatternType.SeaState "Link to this definition") - Settlement* = 27*[](#eLoadPatternType.Settlement "Link to this definition") * Shrinkage* = 28*[](#eLoadPatternType.Shrinkage "Link to this definition") - Snow* = 7*[](#eLoadPatternType.Snow "Link to this definition") * SnowHighAltitude* = 47*[](#eLoadPatternType.SnowHighAltitude "Link to this definition") - StreamFlow* = 37*[](#eLoadPatternType.StreamFlow "Link to this definition") * SuperDead* = 2*[](#eLoadPatternType.SuperDead "Link to this definition") - Temperature* = 10*[](#eLoadPatternType.Temperature "Link to this definition") * TemperatureGradient* = 26*[](#eLoadPatternType.TemperatureGradient "Link to this definition") - VehicleCollision* = 24*[](#eLoadPatternType.VehicleCollision "Link to this definition") * VerticalEarthPressure* = 21*[](#eLoadPatternType.VerticalEarthPressure "Link to this definition") - VesselCollision* = 25*[](#eLoadPatternType.VesselCollision "Link to this definition") * WaterloadPressure* = 30*[](#eLoadPatternType.WaterloadPressure "Link to this definition") - Wave* = 14*[](#eLoadPatternType.Wave "Link to this definition") * Wind* = 6*[](#eLoadPatternType.Wind "Link to this definition") - WindOnLiveLoad* = 19*[](#eLoadPatternType.WindOnLiveLoad "Link to this definition") <!-- --> ## eMatCoupledType[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eMatCoupledType "Direct link to eMatCoupledType") * *class *viktor.external.sap2000.enums.eMatCoupledType(*\*values*)[](#eMatCoupledType "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eMatCoupledType` values, mirroring the product API’s names so code reads like its docs. * FariaConcreteDamagePlasticity* = 4*[](#eMatCoupledType.FariaConcreteDamagePlasticity "Link to this definition") - ModifiedDarwinPecknoldConcrete* = 3*[](#eMatCoupledType.ModifiedDarwinPecknoldConcrete "Link to this definition") * None\_* = 1*[](#eMatCoupledType.None_ "Link to this definition") - VonMisesPlasticity* = 2*[](#eMatCoupledType.VonMisesPlasticity "Link to this definition") <!-- --> ## eMatType[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eMatType "Direct link to eMatType") * *class *viktor.external.sap2000.enums.eMatType(*\*values*)[](#eMatType "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eMatType` values, mirroring the product API’s names so code reads like its docs. * Aluminum* = 4*[](#eMatType.Aluminum "Link to this definition") - ColdFormed* = 5*[](#eMatType.ColdFormed "Link to this definition") * Concrete* = 2*[](#eMatType.Concrete "Link to this definition") - Masonry* = 8*[](#eMatType.Masonry "Link to this definition") * NoDesign* = 3*[](#eMatType.NoDesign "Link to this definition") - Rebar* = 6*[](#eMatType.Rebar "Link to this definition") * Steel* = 1*[](#eMatType.Steel "Link to this definition") - Tendon* = 7*[](#eMatType.Tendon "Link to this definition") <!-- --> ## eMatTypeAluminum[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eMatTypeAluminum "Direct link to eMatTypeAluminum") * *class *viktor.external.sap2000.enums.eMatTypeAluminum(*\*values*)[](#eMatTypeAluminum "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eMatTypeAluminum` values, mirroring the product API’s names so code reads like its docs. * SubType\_5052\_H34* = 3*[](#eMatTypeAluminum.SubType_5052_H34 "Link to this definition") - SubType\_6061\_T6* = 1*[](#eMatTypeAluminum.SubType_6061_T6 "Link to this definition") * SubType\_6063\_T6* = 2*[](#eMatTypeAluminum.SubType_6063_T6 "Link to this definition") <!-- --> ## eMatTypeColdFormed[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eMatTypeColdFormed "Direct link to eMatTypeColdFormed") * *class *viktor.external.sap2000.enums.eMatTypeColdFormed(*\*values*)[](#eMatTypeColdFormed "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eMatTypeColdFormed` values, mirroring the product API’s names so code reads like its docs. * ASTM\_A653SQGr33* = 1*[](#eMatTypeColdFormed.ASTM_A653SQGr33 "Link to this definition") - ASTM\_A653SQGr50* = 2*[](#eMatTypeColdFormed.ASTM_A653SQGr50 "Link to this definition") <!-- --> ## eMatTypeConcrete[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eMatTypeConcrete "Direct link to eMatTypeConcrete") * *class *viktor.external.sap2000.enums.eMatTypeConcrete(*\*values*)[](#eMatTypeConcrete "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eMatTypeConcrete` values, mirroring the product API’s names so code reads like its docs. * Chinese\_C20\_NormalWeight* = 9*[](#eMatTypeConcrete.Chinese_C20_NormalWeight "Link to this definition") - Chinese\_C30\_NormalWeight* = 10*[](#eMatTypeConcrete.Chinese_C30_NormalWeight "Link to this definition") * Chinese\_C40\_NormalWeight* = 11*[](#eMatTypeConcrete.Chinese_C40_NormalWeight "Link to this definition") - EN\_C12\_NormalWeight* = 22*[](#eMatTypeConcrete.EN_C12_NormalWeight "Link to this definition") * EN\_C16\_NormalWeight* = 23*[](#eMatTypeConcrete.EN_C16_NormalWeight "Link to this definition") - EN\_C20\_NormalWeight* = 24*[](#eMatTypeConcrete.EN_C20_NormalWeight "Link to this definition") * EN\_C25\_NormalWeight* = 25*[](#eMatTypeConcrete.EN_C25_NormalWeight "Link to this definition") - EN\_C30\_NormalWeight* = 26*[](#eMatTypeConcrete.EN_C30_NormalWeight "Link to this definition") * EN\_C35\_NormalWeight* = 27*[](#eMatTypeConcrete.EN_C35_NormalWeight "Link to this definition") - EN\_C40\_NormalWeight* = 28*[](#eMatTypeConcrete.EN_C40_NormalWeight "Link to this definition") * EN\_C45\_NormalWeight* = 29*[](#eMatTypeConcrete.EN_C45_NormalWeight "Link to this definition") - EN\_C50\_NormalWeight* = 30*[](#eMatTypeConcrete.EN_C50_NormalWeight "Link to this definition") * EN\_C55\_NormalWeight* = 31*[](#eMatTypeConcrete.EN_C55_NormalWeight "Link to this definition") - EN\_C60\_NormalWeight* = 32*[](#eMatTypeConcrete.EN_C60_NormalWeight "Link to this definition") * EN\_C70\_NormalWeight* = 33*[](#eMatTypeConcrete.EN_C70_NormalWeight "Link to this definition") - EN\_C80\_NormalWeight* = 34*[](#eMatTypeConcrete.EN_C80_NormalWeight "Link to this definition") * EN\_C90\_NormalWeight* = 35*[](#eMatTypeConcrete.EN_C90_NormalWeight "Link to this definition") - FC3000\_LightWeight* = 5*[](#eMatTypeConcrete.FC3000_LightWeight "Link to this definition") * FC3000\_NormalWeight* = 1*[](#eMatTypeConcrete.FC3000_NormalWeight "Link to this definition") - FC4000\_LightWeight* = 6*[](#eMatTypeConcrete.FC4000_LightWeight "Link to this definition") * FC4000\_NormalWeight* = 2*[](#eMatTypeConcrete.FC4000_NormalWeight "Link to this definition") - FC5000\_LightWeight* = 7*[](#eMatTypeConcrete.FC5000_LightWeight "Link to this definition") * FC5000\_NormalWeight* = 3*[](#eMatTypeConcrete.FC5000_NormalWeight "Link to this definition") - FC6000\_LightWeight* = 8*[](#eMatTypeConcrete.FC6000_LightWeight "Link to this definition") * FC6000\_NormalWeight* = 4*[](#eMatTypeConcrete.FC6000_NormalWeight "Link to this definition") - Indian\_M15\_NormalWeight* = 12*[](#eMatTypeConcrete.Indian_M15_NormalWeight "Link to this definition") * Indian\_M20\_NormalWeight* = 13*[](#eMatTypeConcrete.Indian_M20_NormalWeight "Link to this definition") - Indian\_M25\_NormalWeight* = 14*[](#eMatTypeConcrete.Indian_M25_NormalWeight "Link to this definition") * Indian\_M30\_NormalWeight* = 15*[](#eMatTypeConcrete.Indian_M30_NormalWeight "Link to this definition") - Indian\_M35\_NormalWeight* = 16*[](#eMatTypeConcrete.Indian_M35_NormalWeight "Link to this definition") * Indian\_M40\_NormalWeight* = 17*[](#eMatTypeConcrete.Indian_M40_NormalWeight "Link to this definition") - Indian\_M45\_NormalWeight* = 18*[](#eMatTypeConcrete.Indian_M45_NormalWeight "Link to this definition") * Indian\_M50\_NormalWeight* = 19*[](#eMatTypeConcrete.Indian_M50_NormalWeight "Link to this definition") - Indian\_M55\_NormalWeight* = 20*[](#eMatTypeConcrete.Indian_M55_NormalWeight "Link to this definition") * Indian\_M60\_NormalWeight* = 21*[](#eMatTypeConcrete.Indian_M60_NormalWeight "Link to this definition") <!-- --> ## eMatTypeRebar[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eMatTypeRebar "Direct link to eMatTypeRebar") * *class *viktor.external.sap2000.enums.eMatTypeRebar(*\*values*)[](#eMatTypeRebar "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eMatTypeRebar` values, mirroring the product API’s names so code reads like its docs. * ASTM\_A615Gr40* = 1*[](#eMatTypeRebar.ASTM_A615Gr40 "Link to this definition") - ASTM\_A615Gr60* = 2*[](#eMatTypeRebar.ASTM_A615Gr60 "Link to this definition") * ASTM\_A615Gr75* = 3*[](#eMatTypeRebar.ASTM_A615Gr75 "Link to this definition") - ASTM\_A706* = 4*[](#eMatTypeRebar.ASTM_A706 "Link to this definition") * Chinese\_HPB235* = 5*[](#eMatTypeRebar.Chinese_HPB235 "Link to this definition") - Chinese\_HRB335* = 6*[](#eMatTypeRebar.Chinese_HRB335 "Link to this definition") * Chinese\_HRB400* = 7*[](#eMatTypeRebar.Chinese_HRB400 "Link to this definition") - Indian\_HYSD415* = 9*[](#eMatTypeRebar.Indian_HYSD415 "Link to this definition") * Indian\_HYSD500* = 10*[](#eMatTypeRebar.Indian_HYSD500 "Link to this definition") - Indian\_HYSD550* = 11*[](#eMatTypeRebar.Indian_HYSD550 "Link to this definition") * Indian\_Mild250* = 8*[](#eMatTypeRebar.Indian_Mild250 "Link to this definition") <!-- --> ## eMatTypeSteel[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eMatTypeSteel "Direct link to eMatTypeSteel") * *class *viktor.external.sap2000.enums.eMatTypeSteel(*\*values*)[](#eMatTypeSteel "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eMatTypeSteel` values, mirroring the product API’s names so code reads like its docs. * ASTM\_A36* = 1*[](#eMatTypeSteel.ASTM_A36 "Link to this definition") - ASTM\_A500GrB\_Fy42* = 3*[](#eMatTypeSteel.ASTM_A500GrB_Fy42 "Link to this definition") * ASTM\_A500GrB\_Fy46* = 4*[](#eMatTypeSteel.ASTM_A500GrB_Fy46 "Link to this definition") - ASTM\_A53GrB* = 2*[](#eMatTypeSteel.ASTM_A53GrB "Link to this definition") * ASTM\_A572Gr50* = 5*[](#eMatTypeSteel.ASTM_A572Gr50 "Link to this definition") - ASTM\_A913Gr50* = 6*[](#eMatTypeSteel.ASTM_A913Gr50 "Link to this definition") * ASTM\_A992\_Fy50* = 7*[](#eMatTypeSteel.ASTM_A992_Fy50 "Link to this definition") - Chinese\_Q235* = 8*[](#eMatTypeSteel.Chinese_Q235 "Link to this definition") * Chinese\_Q345* = 9*[](#eMatTypeSteel.Chinese_Q345 "Link to this definition") - Chinese\_Q355* = 16*[](#eMatTypeSteel.Chinese_Q355 "Link to this definition") * EN100252\_S235* = 12*[](#eMatTypeSteel.EN100252_S235 "Link to this definition") - EN100252\_S275* = 13*[](#eMatTypeSteel.EN100252_S275 "Link to this definition") * EN100252\_S355* = 14*[](#eMatTypeSteel.EN100252_S355 "Link to this definition") - EN100252\_S450* = 15*[](#eMatTypeSteel.EN100252_S450 "Link to this definition") * Indian\_Fe250* = 10*[](#eMatTypeSteel.Indian_Fe250 "Link to this definition") - Indian\_Fe345* = 11*[](#eMatTypeSteel.Indian_Fe345 "Link to this definition") <!-- --> ## eMatTypeTendon[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eMatTypeTendon "Direct link to eMatTypeTendon") * *class *viktor.external.sap2000.enums.eMatTypeTendon(*\*values*)[](#eMatTypeTendon "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eMatTypeTendon` values, mirroring the product API’s names so code reads like its docs. * ASTM\_A416Gr250* = 1*[](#eMatTypeTendon.ASTM_A416Gr250 "Link to this definition") - ASTM\_A416Gr270* = 2*[](#eMatTypeTendon.ASTM_A416Gr270 "Link to this definition") <!-- --> ## eNamedSetType[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eNamedSetType "Direct link to eNamedSetType") * *class *viktor.external.sap2000.enums.eNamedSetType(*\*values*)[](#eNamedSetType "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eNamedSetType` values, mirroring the product API’s names so code reads like its docs. * All* = 0*[](#eNamedSetType.All "Link to this definition") - BridgeCalculationReport* = 17*[](#eNamedSetType.BridgeCalculationReport "Link to this definition") * BridgeCalculationReportSub* = 18*[](#eNamedSetType.BridgeCalculationReportSub "Link to this definition") - BridgeSeismicReport* = 15*[](#eNamedSetType.BridgeSeismicReport "Link to this definition") * BridgeSuperstructureResponse* = 16*[](#eNamedSetType.BridgeSuperstructureResponse "Link to this definition") - JointTHResponseSpectra* = 8*[](#eNamedSetType.JointTHResponseSpectra "Link to this definition") * NamedDisplay* = 9*[](#eNamedSetType.NamedDisplay "Link to this definition") - PlotFunctionTraces* = 10*[](#eNamedSetType.PlotFunctionTraces "Link to this definition") * PushoverCurve* = 11*[](#eNamedSetType.PushoverCurve "Link to this definition") - RunAnalysis* = 2*[](#eNamedSetType.RunAnalysis "Link to this definition") * RunBridgeDesignSeismic* = 5*[](#eNamedSetType.RunBridgeDesignSeismic "Link to this definition") - RunBridgeDesignSubstructure* = 4*[](#eNamedSetType.RunBridgeDesignSubstructure "Link to this definition") * RunBridgeDesignSuperstructure* = 3*[](#eNamedSetType.RunBridgeDesignSuperstructure "Link to this definition") - RunBridgeRatingSuperstructure* = 6*[](#eNamedSetType.RunBridgeRatingSuperstructure "Link to this definition") * RunMemberRating* = 7*[](#eNamedSetType.RunMemberRating "Link to this definition") - TableGroupSuperset* = 14*[](#eNamedSetType.TableGroupSuperset "Link to this definition") * TableSet* = 13*[](#eNamedSetType.TableSet "Link to this definition") - UpdateBridgeObject* = 1*[](#eNamedSetType.UpdateBridgeObject "Link to this definition") * VirtualWork* = 12*[](#eNamedSetType.VirtualWork "Link to this definition") <!-- --> ## eObjType[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eObjType "Direct link to eObjType") * *class *viktor.external.sap2000.enums.eObjType(*\*values*)[](#eObjType "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eObjType` values, mirroring the product API’s names so code reads like its docs. * Area* = 3*[](#eObjType.Area "Link to this definition") - Frame* = 2*[](#eObjType.Frame "Link to this definition") * Point* = 1*[](#eObjType.Point "Link to this definition") - Solid* = 6*[](#eObjType.Solid "Link to this definition") <!-- --> ## eReturnCode[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eReturnCode "Direct link to eReturnCode") * *class *viktor.external.sap2000.enums.eReturnCode(*\*values*)[](#eReturnCode "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eReturnCode` values, mirroring the product API’s names so code reads like its docs. * Deprecated* = -98*[](#eReturnCode.Deprecated "Link to this definition") - NoError* = 0*[](#eReturnCode.NoError "Link to this definition") * NotApplicable* = -100*[](#eReturnCode.NotApplicable "Link to this definition") - NotImplemented* = -99*[](#eReturnCode.NotImplemented "Link to this definition") * TableDoesNotExist* = -96*[](#eReturnCode.TableDoesNotExist "Link to this definition") - TableIsObsolete* = -97*[](#eReturnCode.TableIsObsolete "Link to this definition") * UnspecifiedError* = 1*[](#eReturnCode.UnspecifiedError "Link to this definition") <!-- --> ## eSolidPropFormulationType[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eSolidPropFormulationType "Direct link to eSolidPropFormulationType") * *class *viktor.external.sap2000.enums.eSolidPropFormulationType(*\*values*)[](#eSolidPropFormulationType "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eSolidPropFormulationType` values, mirroring the product API’s names so code reads like its docs. * LegacyQuadratic* = 1*[](#eSolidPropFormulationType.LegacyQuadratic "Link to this definition") - LegacyStandard* = 0*[](#eSolidPropFormulationType.LegacyStandard "Link to this definition") * Quadratic* = 3*[](#eSolidPropFormulationType.Quadratic "Link to this definition") - Standard* = 2*[](#eSolidPropFormulationType.Standard "Link to this definition") <!-- --> ## eSuperObjectClass[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eSuperObjectClass "Direct link to eSuperObjectClass") * *class *viktor.external.sap2000.enums.eSuperObjectClass(*\*values*)[](#eSuperObjectClass "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eSuperObjectClass` values, mirroring the product API’s names so code reads like its docs. * BridgeFoundation* = 3*[](#eSuperObjectClass.BridgeFoundation "Link to this definition") - Foundation* = 2*[](#eSuperObjectClass.Foundation "Link to this definition") * None\_* = 0*[](#eSuperObjectClass.None_ "Link to this definition") - SuperObject* = 1*[](#eSuperObjectClass.SuperObject "Link to this definition") <!-- --> ## eTemperature[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eTemperature "Direct link to eTemperature") * *class *viktor.external.sap2000.enums.eTemperature(*\*values*)[](#eTemperature "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eTemperature` values, mirroring the product API’s names so code reads like its docs. * C* = 2*[](#eTemperature.C "Link to this definition") - F* = 1*[](#eTemperature.F "Link to this definition") * NotApplicable* = 0*[](#eTemperature.NotApplicable "Link to this definition") <!-- --> ## eTemplateType[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eTemplateType "Direct link to eTemplateType") * *class *viktor.external.sap2000.enums.eTemplateType(*\*values*)[](#eTemplateType "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eTemplateType` values, mirroring the product API’s names so code reads like its docs. * Advanced* = 17*[](#eTemplateType.Advanced "Link to this definition") - Barrel* = 12*[](#eTemplateType.Barrel "Link to this definition") * Beam* = 2*[](#eTemplateType.Beam "Link to this definition") - BracedFrame* = 7*[](#eTemplateType.BracedFrame "Link to this definition") * Bridge* = 11*[](#eTemplateType.Bridge "Link to this definition") - BridgeWizard* = 23*[](#eTemplateType.BridgeWizard "Link to this definition") * CableBridges* = 29*[](#eTemplateType.CableBridges "Link to this definition") - Clear* = 1*[](#eTemplateType.Clear "Link to this definition") * Cylinder* = 13*[](#eTemplateType.Cylinder "Link to this definition") - Dome* = 14*[](#eTemplateType.Dome "Link to this definition") * EccentricFrame* = 8*[](#eTemplateType.EccentricFrame "Link to this definition") - Floor* = 16*[](#eTemplateType.Floor "Link to this definition") * Frame2D* = 21*[](#eTemplateType.Frame2D "Link to this definition") - Frame3D* = 22*[](#eTemplateType.Frame3D "Link to this definition") * Grid* = 0*[](#eTemplateType.Grid "Link to this definition") - PerimeterFrame* = 9*[](#eTemplateType.PerimeterFrame "Link to this definition") * PipesAndPlates* = 24*[](#eTemplateType.PipesAndPlates "Link to this definition") - PortalFrame* = 6*[](#eTemplateType.PortalFrame "Link to this definition") * ShearWall* = 15*[](#eTemplateType.ShearWall "Link to this definition") - Shells* = 25*[](#eTemplateType.Shells "Link to this definition") * SlopedTruss* = 3*[](#eTemplateType.SlopedTruss "Link to this definition") - SolidModels* = 26*[](#eTemplateType.SolidModels "Link to this definition") * SpaceFrame* = 10*[](#eTemplateType.SpaceFrame "Link to this definition") - SpaceTruss* = 5*[](#eTemplateType.SpaceTruss "Link to this definition") * Staircases* = 28*[](#eTemplateType.Staircases "Link to this definition") - StorageStructures* = 27*[](#eTemplateType.StorageStructures "Link to this definition") * Truss2D* = 19*[](#eTemplateType.Truss2D "Link to this definition") - Truss3D* = 20*[](#eTemplateType.Truss3D "Link to this definition") * UndergoundConcrete* = 18*[](#eTemplateType.UndergoundConcrete "Link to this definition") - VerticalTruss* = 4*[](#eTemplateType.VerticalTruss "Link to this definition") <!-- --> ## eUnits[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eUnits "Direct link to eUnits") * *class *viktor.external.sap2000.enums.eUnits(*\*values*)[](#eUnits "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eUnits` values, mirroring the product API’s names so code reads like its docs. * N\_cm\_C* = 15*[](#eUnits.N_cm_C "Link to this definition") - N\_m\_C* = 10*[](#eUnits.N_m_C "Link to this definition") * N\_mm\_C* = 9*[](#eUnits.N_mm_C "Link to this definition") - Ton\_cm\_C* = 16*[](#eUnits.Ton_cm_C "Link to this definition") * Ton\_m\_C* = 12*[](#eUnits.Ton_m_C "Link to this definition") - Ton\_mm\_C* = 11*[](#eUnits.Ton_mm_C "Link to this definition") * kN\_cm\_C* = 13*[](#eUnits.kN_cm_C "Link to this definition") - kN\_m\_C* = 6*[](#eUnits.kN_m_C "Link to this definition") * kN\_mm\_C* = 5*[](#eUnits.kN_mm_C "Link to this definition") - kgf\_cm\_C* = 14*[](#eUnits.kgf_cm_C "Link to this definition") * kgf\_m\_C* = 8*[](#eUnits.kgf_m_C "Link to this definition") - kgf\_mm\_C* = 7*[](#eUnits.kgf_mm_C "Link to this definition") * kip\_ft\_F* = 4*[](#eUnits.kip_ft_F "Link to this definition") - kip\_in\_F* = 3*[](#eUnits.kip_in_F "Link to this definition") * lb\_ft\_F* = 2*[](#eUnits.lb_ft_F "Link to this definition") - lb\_in\_F* = 1*[](#eUnits.lb_in_F "Link to this definition") <!-- --> ## eWallPierRebarLayerType[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eWallPierRebarLayerType "Direct link to eWallPierRebarLayerType") * *class *viktor.external.sap2000.enums.eWallPierRebarLayerType(*\*values*)[](#eWallPierRebarLayerType "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eWallPierRebarLayerType` values, mirroring the product API’s names so code reads like its docs. * Confinement\_EndZoneI* = 5*[](#eWallPierRebarLayerType.Confinement_EndZoneI "Link to this definition") - Confinement\_EndZoneJ* = 6*[](#eWallPierRebarLayerType.Confinement_EndZoneJ "Link to this definition") * Diagonal\_Each* = 7*[](#eWallPierRebarLayerType.Diagonal_Each "Link to this definition") - Horizontal\_Distributed\_MiddleZone\_Eachface* = 2*[](#eWallPierRebarLayerType.Horizontal_Distributed_MiddleZone_Eachface "Link to this definition") * Vertical\_Distributed\_EndZoneI\_Total* = 3*[](#eWallPierRebarLayerType.Vertical_Distributed_EndZoneI_Total "Link to this definition") - Vertical\_Distributed\_EndZoneJ\_Total* = 4*[](#eWallPierRebarLayerType.Vertical_Distributed_EndZoneJ_Total "Link to this definition") * Vertical\_Distributed\_MiddleZone\_Eachface* = 1*[](#eWallPierRebarLayerType.Vertical_Distributed_MiddleZone_Eachface "Link to this definition") <!-- --> ## eWallSpandrelRebarLayerType[​](https://docs.viktor.ai/sdk/api/external/sap2000/.md#_eWallSpandrelRebarLayerType "Direct link to eWallSpandrelRebarLayerType") * *class *viktor.external.sap2000.enums.eWallSpandrelRebarLayerType(*\*values*)[](#eWallSpandrelRebarLayerType "Link to this definition") Bases: `IntEnum` New in 14.32.0 SAP2000 `eWallSpandrelRebarLayerType` values, mirroring the product API’s names so code reads like its docs. * Diagonal\_Each* = 5*[](#eWallSpandrelRebarLayerType.Diagonal_Each "Link to this definition") - Horizontal\_Bottom\_Total* = 2*[](#eWallSpandrelRebarLayerType.Horizontal_Bottom_Total "Link to this definition") * Horizontal\_Distributed\_Eachface* = 3*[](#eWallSpandrelRebarLayerType.Horizontal_Distributed_Eachface "Link to this definition") - Horizontal\_Top\_Total* = 1*[](#eWallSpandrelRebarLayerType.Horizontal_Top_Total "Link to this definition") * Vertical\_Ties\_Distributed* = 4*[](#eWallSpandrelRebarLayerType.Vertical_Ties_Distributed "Link to this definition") --- # viktor.external.scia <!-- --> <!-- --> <!-- --> ## CalcSetting[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_CalcSetting "Direct link to CalcSetting") * *class *viktor.external.scia.scia.CalcSetting(*\*values*)[](#CalcSetting "Link to this definition") Bases: `Enum` Enumeration of calculation settings: * CSS*: [`CalcSetting`](#CalcSetting "viktor.external.scia.scia.CalcSetting")** = 'CSS'*[](#CalcSetting.CSS "Link to this definition") - EIG*: [`CalcSetting`](#CalcSetting "viktor.external.scia.scia.CalcSetting")** = 'EIG'*[](#CalcSetting.EIG "Link to this definition") * INF*: [`CalcSetting`](#CalcSetting "viktor.external.scia.scia.CalcSetting")** = 'INF'*[](#CalcSetting.INF "Link to this definition") - LIN*: [`CalcSetting`](#CalcSetting "viktor.external.scia.scia.CalcSetting")** = 'LIN'*[](#CalcSetting.LIN "Link to this definition") * MOB*: [`CalcSetting`](#CalcSetting "viktor.external.scia.scia.CalcSetting")** = 'MOB'*[](#CalcSetting.MOB "Link to this definition") - NEL*: [`CalcSetting`](#CalcSetting "viktor.external.scia.scia.CalcSetting")** = 'NEL'*[](#CalcSetting.NEL "Link to this definition") * NOC*: [`CalcSetting`](#CalcSetting "viktor.external.scia.scia.CalcSetting")** = 'NOC'*[](#CalcSetting.NOC "Link to this definition") - NONE*: [`CalcSetting`](#CalcSetting "viktor.external.scia.scia.CalcSetting")** = 'NONE'*[](#CalcSetting.NONE "Link to this definition") * NPH*: [`CalcSetting`](#CalcSetting "viktor.external.scia.scia.CalcSetting")** = 'NPH'*[](#CalcSetting.NPH "Link to this definition") - NST*: [`CalcSetting`](#CalcSetting "viktor.external.scia.scia.CalcSetting")** = 'NST'*[](#CalcSetting.NST "Link to this definition") * PHA*: [`CalcSetting`](#CalcSetting "viktor.external.scia.scia.CalcSetting")** = 'PHA'*[](#CalcSetting.PHA "Link to this definition") - SLN*: [`CalcSetting`](#CalcSetting "viktor.external.scia.scia.CalcSetting")** = 'SLN'*[](#CalcSetting.SLN "Link to this definition") * STB*: [`CalcSetting`](#CalcSetting "viktor.external.scia.scia.CalcSetting")** = 'STB'*[](#CalcSetting.STB "Link to this definition") - TDA*: [`CalcSetting`](#CalcSetting "viktor.external.scia.scia.CalcSetting")** = 'TDA'*[](#CalcSetting.TDA "Link to this definition") * TID*: [`CalcSetting`](#CalcSetting "viktor.external.scia.scia.CalcSetting")** = 'TID'*[](#CalcSetting.TID "Link to this definition") <!-- --> ## Model[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_Model "Direct link to Model") * *class *viktor.external.scia.scia.Model(*\**, *mesh\_setup=None*, *solver\_setup=None*, *project\_data=None*)[](#Model "Link to this definition") This Model can be used to construct a SCIA model and generate its corresponding input XML file. This file can in turn be used as input of [`SciaAnalysis`](#SciaAnalysis "viktor.external.scia.scia.SciaAnalysis"). For a more detailed elaboration, please see the tutorial. Example usage: ``` # Initialize the model model = Model() # Construct the geometry n1 = model.create_node('K:1', 0, 0, 0) n2 = model.create_node('K:2', 1, 0, 0) css = model.create_circular_cross_section('css', Material(123, 'some_material'), 100) beam = model.create_beam(n1, n2, css) #Construct the boundary conditions freedom = (PointSupport.Freedom.RIGID, PointSupport.Freedom.RIGID, PointSupport.Freedom.RIGID, PointSupport.Freedom.RIGID, PointSupport.Freedom.RIGID, PointSupport.Freedom.RIGID) model.create_point_support('Sn1', n1, PointSupport.Type.STANDARD, freedom, (0, 0, 0, 0, 0, 0), PointSupport.CSys.GLOBAL) # Construct a load combination load_group = model.create_load_group('LG1', LoadGroup.LoadOption.VARIABLE, LoadGroup.RelationOption.STANDARD, LoadGroup.LoadTypeOption.CAT_A) load_case = model.create_variable_load_case('LC1', 'My first load case', load_group, LoadCase.VariableLoadType.STATIC, LoadCase.Specification.STANDARD, LoadCase.Duration.SHORT) model.create_load_combination('C1', LoadCombination.Type.ENVELOPE_ULTIMATE, {load_case: 1}) # Generate the input XML file input_xml = model.generate_xml_input() ``` * Parameters: * **mesh\_setup** ([`MeshSetup`](https://docs.viktor.ai/sdk/api/external/scia/.md#MeshSetup "viktor.external.scia.object.MeshSetup")) – Optional mesh settings. * **solver\_setup** ([`SolverSetup`](https://docs.viktor.ai/sdk/api/external/scia/.md#SolverSetup "viktor.external.scia.object.SolverSetup")) – Optional solver settings New in v13.1.0 . * **project\_data** ([`ProjectData`](https://docs.viktor.ai/sdk/api/external/scia/.md#ProjectData "viktor.external.scia.object.ProjectData")) – Optional project settings New in v13.1.0 . - *property *arbitrary\_profiles*: Tuple\[[ArbitraryProfile](https://docs.viktor.ai/sdk/api/external/scia/.md#ArbitraryProfile "viktor.external.scia.object.ArbitraryProfile"), ...]*[](#Model.arbitrary_profiles "Link to this definition") * *property *averaging\_strips*: Tuple\[[AveragingStrip](https://docs.viktor.ai/sdk/api/external/scia/.md#AveragingStrip "viktor.external.scia.object.AveragingStrip"), ...]*[](#Model.averaging_strips "Link to this definition") - *property *beams*: Tuple\[[Beam](https://docs.viktor.ai/sdk/api/external/scia/.md#Beam "viktor.external.scia.object.Beam"), ...]*[](#Model.beams "Link to this definition") * *property *concrete\_materials*: Tuple\[[Concrete](https://docs.viktor.ai/sdk/api/external/scia/.md#Concrete "viktor.external.scia.object.Concrete"), ...]*[](#Model.concrete_materials "Link to this definition") - create\_arbitrary\_profile(*name*, *beam*, *c\_def*, *cross\_section*, *spans*)[](#Model.create_arbitrary_profile "Link to this definition") Method to construct an arbitrary profile. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **beam** ([`Beam`](https://docs.viktor.ai/sdk/api/external/scia/.md#Beam "viktor.external.scia.object.Beam")) – beam object ([`create_beam()`](#Model.create_beam "viktor.external.scia.scia.Model.create_beam")). * **c\_def** ([`CDef`](https://docs.viktor.ai/sdk/api/external/scia/.md#ArbitraryProfile.CDef "viktor.external.scia.object.ArbitraryProfile.CDef")) – enumeration of coordinate definition types * **cross\_section** ([`CrossSection`](https://docs.viktor.ai/sdk/api/external/scia/.md#CrossSection "viktor.external.scia.object.CrossSection")) – previously created cross-section object * **spans** (`List`\[[`ArbitraryProfileSpan`](https://docs.viktor.ai/sdk/api/external/scia/.md#ArbitraryProfileSpan "viktor.external.scia.object.ArbitraryProfileSpan")]) – list of arbitrary profile span objects ([`create_arbitrary_profile_span()`](#Model.create_arbitrary_profile_span "viktor.external.scia.scia.Model.create_arbitrary_profile_span")). * Return type: [`ArbitraryProfile`](https://docs.viktor.ai/sdk/api/external/scia/.md#ArbitraryProfile "viktor.external.scia.object.ArbitraryProfile") * create\_arbitrary\_profile\_span(*length*, *type\_of\_css*, *cross\_section\_start*, *cross\_section\_end*, *alignment*)[](#Model.create_arbitrary_profile_span "Link to this definition") Method to construct an arbitrary profile span, which is necessary to construct an arbitrary profile. * Parameters: * **length** (`float`) – length of the span * **type\_of\_css** ([`TypeOfCss`](https://docs.viktor.ai/sdk/api/external/scia/.md#ArbitraryProfileSpan.TypeOfCss "viktor.external.scia.object.ArbitraryProfileSpan.TypeOfCss")) – enumeration of cross-section types * **cross\_section\_start** ([`CrossSection`](https://docs.viktor.ai/sdk/api/external/scia/.md#CrossSection "viktor.external.scia.object.CrossSection")) – previously created cross-section object at the start point * **cross\_section\_end** ([`CrossSection`](https://docs.viktor.ai/sdk/api/external/scia/.md#CrossSection "viktor.external.scia.object.CrossSection")) – previously created cross-section object at the end point * **alignment** ([`Alignment`](https://docs.viktor.ai/sdk/api/external/scia/.md#ArbitraryProfileSpan.Alignment "viktor.external.scia.object.ArbitraryProfileSpan.Alignment")) – enumeration of alignment types * Return type: [`ArbitraryProfileSpan`](https://docs.viktor.ai/sdk/api/external/scia/.md#ArbitraryProfileSpan "viktor.external.scia.object.ArbitraryProfileSpan") - create\_averaging\_strip(*plane*, *\**, *strip\_type*, *point\_1*, *width*, *length*, *angle*, *direction*, *name=None*)[](#Model.create_averaging_strip "Link to this definition") New in v14.3.0 Method to construct an averaging strip, which can be used for the automatic averaging of peak results. * Parameters: * **plane** ([`Plane`](https://docs.viktor.ai/sdk/api/external/scia/.md#Plane "viktor.external.scia.object.Plane")) – plane object ([`create_plane()`](#Model.create_plane "viktor.external.scia.scia.Model.create_plane")). * **strip\_type** ([`Type`](https://docs.viktor.ai/sdk/api/external/scia/.md#AveragingStrip.Type "viktor.external.scia.object.AveragingStrip.Type")) – Currently only Point type is supported * **point\_1** (`Tuple`\[`float`, `float`, `float`]) – tuple of coordinates (x, y, z) of the center position in \[m] * **width** (`float`) – width of the strip in \[m] * **length** (`float`) – length of the strip in \[m] * **angle** (`float`) – defines the direction of the strip \[deg] * **direction** ([`Direction`](https://docs.viktor.ai/sdk/api/external/scia/.md#AveragingStrip.Direction "viktor.external.scia.object.AveragingStrip.Direction")) – direction in which the averaging is to be calculated * **name** (`str`) – name which will be shown in SCIA (default: ‘RS{i}’) * Return type: [`AveragingStrip`](https://docs.viktor.ai/sdk/api/external/scia/.md#AveragingStrip "viktor.external.scia.object.AveragingStrip") * create\_beam(*begin\_node*, *end\_node*, *cross\_section*, *\**, *name=None*, *ez=None*, *lcs\_rotation=None*, *layer=None*)[](#Model.create_beam "Link to this definition") Method to construct a beam. * Parameters: * **begin\_node** ([`Node`](https://docs.viktor.ai/sdk/api/external/scia/.md#Node "viktor.external.scia.object.Node")) – node object ([`create_node()`](#Model.create_node "viktor.external.scia.scia.Model.create_node")) at the start of the beam. * **end\_node** ([`Node`](https://docs.viktor.ai/sdk/api/external/scia/.md#Node "viktor.external.scia.object.Node")) – node object ([`create_node()`](#Model.create_node "viktor.external.scia.scia.Model.create_node")) at the end of the beam. * **cross\_section** ([`CrossSection`](https://docs.viktor.ai/sdk/api/external/scia/.md#CrossSection "viktor.external.scia.object.CrossSection")) – previously created cross-section object * **name** (`str`) – name which will be shown in SCIA (default: ‘B{i}’) * **ez** (`float`) – eccentricity in Z-direction w\.r.t. the beam’s center line in \[m] (default: 0) * **lcs\_rotation** (`float`) – rotation of local coordinate system \[deg] (default: 0) * **layer** ([`Layer`](https://docs.viktor.ai/sdk/api/external/scia/.md#Layer "viktor.external.scia.object.Layer")) – layer object ([`create_layer()`](#Model.create_layer "viktor.external.scia.scia.Model.create_layer")) to which the beam will be added * Return type: [`Beam`](https://docs.viktor.ai/sdk/api/external/scia/.md#Beam "viktor.external.scia.object.Beam") - create\_circular\_composed\_cross\_section(*name*, *material*, *material\_2*, *diameter*, *thickness*)[](#Model.create_circular_composed_cross_section "Link to this definition") Method to construct a circular cross-section, composed of two materials. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **material** ([`Material`](https://docs.viktor.ai/sdk/api/external/scia/.md#Material "viktor.external.scia.object.Material")) – outer material of the cross-section * **material\_2** ([`Material`](https://docs.viktor.ai/sdk/api/external/scia/.md#Material "viktor.external.scia.object.Material")) – inner material of the cross-section * **diameter** (`float`) – diameter of the cross-section in \[m] * **thickness** (`float`) – thickness in \[m] * Return type: [`CircularComposedCrossSection`](https://docs.viktor.ai/sdk/api/external/scia/.md#CircularComposedCrossSection "viktor.external.scia.object.CircularComposedCrossSection") * create\_circular\_cross\_section(*name*, *material*, *diameter*)[](#Model.create_circular_cross_section "Link to this definition") Method to construct a circular cross-section. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **material** ([`Material`](https://docs.viktor.ai/sdk/api/external/scia/.md#Material "viktor.external.scia.object.Material")) – material of the cross-section * **diameter** (`float`) – diameter of the cross-section in \[m] * Return type: [`CircularCrossSection`](https://docs.viktor.ai/sdk/api/external/scia/.md#CircularCrossSection "viktor.external.scia.object.CircularCrossSection") - create\_circular\_hollow\_cross\_section(*name*, *material*, *diameter*, *thickness*)[](#Model.create_circular_hollow_cross_section "Link to this definition") Method to construct a circular hollow cross-section. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **material** ([`Material`](https://docs.viktor.ai/sdk/api/external/scia/.md#Material "viktor.external.scia.object.Material")) – material of the cross-section * **diameter** (`float`) – diameter of the cross-section in \[m] * **thickness** (`float`) – thickness in \[m] * Return type: [`CircularHollowCrossSection`](https://docs.viktor.ai/sdk/api/external/scia/.md#CircularHollowCrossSection "viktor.external.scia.object.CircularHollowCrossSection") * create\_circular\_plane(*center\_node*, *diameter*, *thickness*, *\**, *material*, *axis=None*, *name=None*, *plane\_type=None*, *layer=None*, *internal\_nodes=None*, *swap\_orientation=None*, *lcs\_rotation=None*, *fem\_model=None*, *orthotropy=None*)[](#Model.create_circular_plane "Link to this definition") Method to construct a circular 2D member. * Parameters: * **center\_node** ([`Node`](https://docs.viktor.ai/sdk/api/external/scia/.md#Node "viktor.external.scia.object.Node")) – node object ([`create_node()`](#Model.create_node "viktor.external.scia.scia.Model.create_node")) located at the center of the plane * **diameter** (`float`) – diameter of the plane \[m] * **thickness** (`float`) – thickness of the plane \[m] * **material** ([`Material`](https://docs.viktor.ai/sdk/api/external/scia/.md#Material "viktor.external.scia.object.Material")) – `Material` of the plane * **axis** ([`Vector`](https://docs.viktor.ai/sdk/api/geometry/.md#Vector "viktor.geometry.Vector") | `Tuple`\[`float`, `float`, `float`]) – axis direction (default: (0, 0, 1)) * **name** (`str`) – name which will be shown in SCIA (default: ‘S{i}’) * **plane\_type** ([`Type`](https://docs.viktor.ai/sdk/api/external/scia/.md#Plane.Type "viktor.external.scia.object.Plane.Type")) – enumeration of plane types (default: PLATE) * **layer** ([`Layer`](https://docs.viktor.ai/sdk/api/external/scia/.md#Layer "viktor.external.scia.object.Layer")) – layer object ([`create_layer()`](#Model.create_layer "viktor.external.scia.scia.Model.create_layer")) to which the plane will be added * **internal\_nodes** (`List`\[[`Node`](https://docs.viktor.ai/sdk/api/external/scia/.md#Node "viktor.external.scia.object.Node")]) – list of internal node objects (default: None) * **swap\_orientation** (`bool`) – whereas to swap the plate orientation (default: False) * **lcs\_rotation** (`float`) – rotation of the local coordinate system \[deg] (default: 0.0) * **fem\_model** ([`FEMModel`](https://docs.viktor.ai/sdk/api/external/scia/.md#Plane.FEMModel "viktor.external.scia.object.Plane.FEMModel")) – FEM model to be used in the calculation (default: isotropic) * **orthotropy** ([`Orthotropy`](https://docs.viktor.ai/sdk/api/external/scia/.md#Orthotropy "viktor.external.scia.object.Orthotropy")) – type of orthotropy (only for fem\_model = ORTHOTROPIC) * Return type: [`Plane`](https://docs.viktor.ai/sdk/api/external/scia/.md#Plane "viktor.external.scia.object.Plane") - create\_cross\_link(*beam\_1*, *beam\_2*, *\**, *name=None*)[](#Model.create_cross_link "Link to this definition") New in v13.1.0 Method to construct a cross-link, connecting two beams. * Parameters: * **beam\_1** ([`Beam`](https://docs.viktor.ai/sdk/api/external/scia/.md#Beam "viktor.external.scia.object.Beam")) – first beam ([`create_beam()`](#Model.create_beam "viktor.external.scia.scia.Model.create_beam")) * **beam\_2** ([`Beam`](https://docs.viktor.ai/sdk/api/external/scia/.md#Beam "viktor.external.scia.object.Beam")) – second beam ([`create_beam()`](#Model.create_beam "viktor.external.scia.scia.Model.create_beam")) * **name** (`str`) – name which will be shown in SCIA (default: ‘CL{i}’) * Return type: [`CrossLink`](https://docs.viktor.ai/sdk/api/external/scia/.md#CrossLink "viktor.external.scia.object.CrossLink") * create\_free\_line\_load(*name*, *load\_case*, *point\_1*, *point\_2*, *direction*, *magnitude\_1*, *magnitude\_2*)[](#Model.create_free_line_load "Link to this definition") Method to construct a free line load. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **load\_case** ([`LoadCase`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCase "viktor.external.scia.object.LoadCase")) – previously created load case object in which the load should be placed * **point\_1** (`Tuple`\[`float`, `float`]) – XY coordinate of the first point * **point\_2** (`Tuple`\[`float`, `float`]) – XY coordinate of the second point * **direction** ([`Direction`](https://docs.viktor.ai/sdk/api/external/scia/.md#FreeLoad.Direction "viktor.external.scia.object.FreeLoad.Direction")) – enumeration of direction options * **magnitude\_1** (`float`) – magnitude of the load in point\_1 in \[N] * **magnitude\_2** (`float`) – magnitude of the load in point\_2 in \[N] * Return type: [`FreeLineLoad`](https://docs.viktor.ai/sdk/api/external/scia/.md#FreeLineLoad "viktor.external.scia.object.FreeLineLoad") - create\_free\_point\_load(*name*, *load\_case*, *direction*, *magnitude*, *position*)[](#Model.create_free_point_load "Link to this definition") Method to construct a free point load. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **load\_case** ([`LoadCase`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCase "viktor.external.scia.object.LoadCase")) – previously created load case object in which the load should be placed * **direction** ([`Direction`](https://docs.viktor.ai/sdk/api/external/scia/.md#FreeLoad.Direction "viktor.external.scia.object.FreeLoad.Direction")) – enumeration of direction options * **magnitude** (`float`) – magnitude of the load in \[N] * **position** (`Tuple`\[`float`, `float`]) – XY coordinate of the load * Return type: [`FreePointLoad`](https://docs.viktor.ai/sdk/api/external/scia/.md#FreePointLoad "viktor.external.scia.object.FreePointLoad") * create\_free\_surface\_load(*name*, *load\_case*, *direction*, *q1*, *q2=None*, *q3=None*, *points=None*, *\**, *distribution=None*, *selection=None*)[](#Model.create_free_surface_load "Link to this definition") Method to construct a free surface load. Note: can only be defined in XY-plane. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **load\_case** ([`LoadCase`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCase "viktor.external.scia.object.LoadCase")) – previously created load case object in which the load should be placed * **direction** ([`Direction`](https://docs.viktor.ai/sdk/api/external/scia/.md#FreeLoad.Direction "viktor.external.scia.object.FreeLoad.Direction")) – direction of the load * **q1** (`float`) – magnitude of the load in the first point in \[N] * **q2** (`float`) – magnitude of the load in the second point in \[N] (distribution = DIR\_X | DIR\_Y | POINTS only) * **q3** (`float`) – magnitude of the load in the third point in \[N] (distribution = POINTS only) * **points** (`List`\[`Tuple`\[`float`, `float`]]) – list of XY coordinates (at least 3). If distribution = DIR\_X | DIR\_Y: q1 and q2 are applied to points\[0] and points\[1] respectively. If distribution = POINTS: q1, q2 and q3 are applied to points\[0], points\[1] and points\[2] respectively. * **distribution** ([`Distribution`](https://docs.viktor.ai/sdk/api/external/scia/.md#FreeSurfaceLoad.Distribution "viktor.external.scia.object.FreeSurfaceLoad.Distribution")) – distribution of the load (default: POINTS) * **selection** (`List`\[[`Plane`](https://docs.viktor.ai/sdk/api/external/scia/.md#Plane "viktor.external.scia.object.Plane")]) – selection of 1 or more planes ([`create_plane()`](#Model.create_plane "viktor.external.scia.scia.Model.create_plane")) to generate the load on (default: select = auto) * Return type: [`FreeSurfaceLoad`](https://docs.viktor.ai/sdk/api/external/scia/.md#FreeSurfaceLoad "viktor.external.scia.object.FreeSurfaceLoad") - create\_general\_cross\_section(*elements*, *\**, *name=None*)[](#Model.create_general_cross_section "Link to this definition") New in v14.7.0 Construct a general cross-section. * Parameters: * **name** (`str`) – name of the cross-section (default: ‘CS{i}’) * **elements** (`Sequence`\[[`GeneralCrossSectionElement`](https://docs.viktor.ai/sdk/api/external/scia/.md#GeneralCrossSectionElement "viktor.external.scia.object.GeneralCrossSectionElement")]) – elements (polygon + openings) that build up the cross-section * Return type: [`GeneralCrossSection`](https://docs.viktor.ai/sdk/api/external/scia/.md#GeneralCrossSection "viktor.external.scia.object.GeneralCrossSection") * create\_general\_cross\_section\_element(*name*, *element\_type*, *points*, *\**, *material=None*)[](#Model.create_general_cross_section_element "Link to this definition") New in v14.7.0 Construct a general cross-section element, which is necessary to construct a general cross-section. * Parameters: * **name** (`str`) – name of the element * **element\_type** ([`Type`](https://docs.viktor.ai/sdk/api/external/scia/.md#GeneralCrossSectionElement.Type "viktor.external.scia.object.GeneralCrossSectionElement.Type")) – element type * **points** (`Sequence`\[`Tuple`\[`float`, `float`]]) – outline of the element * **material** ([`Material`](https://docs.viktor.ai/sdk/api/external/scia/.md#Material "viktor.external.scia.object.Material")) – material of the element * Return type: [`GeneralCrossSectionElement`](https://docs.viktor.ai/sdk/api/external/scia/.md#GeneralCrossSectionElement "viktor.external.scia.object.GeneralCrossSectionElement") - create\_hinge\_on\_beam(*beam*, *position*, *\**, *name=None*, *freedom\_ux=Freedom.RIGID*, *freedom\_uy=Freedom.RIGID*, *freedom\_uz=Freedom.RIGID*, *freedom\_fix=Freedom.RIGID*, *freedom\_fiy=Freedom.FREE*, *freedom\_fiz=Freedom.RIGID*, *stiffness\_ux=0*, *stiffness\_uy=0*, *stiffness\_uz=0*, *stiffness\_fix=0*, *stiffness\_fiy=0*, *stiffness\_fiz=0*)[](#Model.create_hinge_on_beam "Link to this definition") Create a hinge on a beam. * Parameters: * **beam** ([`Beam`](https://docs.viktor.ai/sdk/api/external/scia/.md#Beam "viktor.external.scia.object.Beam")) – Beam of appliance ([`create_beam()`](#Model.create_beam "viktor.external.scia.scia.Model.create_beam")). * **position** ([`Position`](https://docs.viktor.ai/sdk/api/external/scia/.md#HingeOnBeam.Position "viktor.external.scia.object.HingeOnBeam.Position")) – Position of appliance. * **name** (`str`) – Name of the hinge (default: ‘H{i}’). * **freedom\_ux** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#HingeOnBeam.Freedom "viktor.external.scia.object.HingeOnBeam.Freedom")) – Freedom in ux (default: rigid). * **freedom\_uy** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#HingeOnBeam.Freedom "viktor.external.scia.object.HingeOnBeam.Freedom")) – Freedom in uy (default: rigid). * **freedom\_uz** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#HingeOnBeam.Freedom "viktor.external.scia.object.HingeOnBeam.Freedom")) – Freedom in uz (default: rigid). * **freedom\_fix** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#HingeOnBeam.Freedom "viktor.external.scia.object.HingeOnBeam.Freedom")) – Freedom in fix (default: rigid). * **freedom\_fiy** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#HingeOnBeam.Freedom "viktor.external.scia.object.HingeOnBeam.Freedom")) – Freedom in fiy (default: free). * **freedom\_fiz** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#HingeOnBeam.Freedom "viktor.external.scia.object.HingeOnBeam.Freedom")) – Freedom in fiz (default: rigid). * **stiffness\_ux** (`float`) – Stiffness in ux \[N/m], only used if freedom in ux = flexible (default: 0.0). * **stiffness\_uy** (`float`) – Stiffness in uy \[N/m], only used if freedom in uy = flexible (default: 0.0). * **stiffness\_uz** (`float`) – Stiffness in uz \[N/m], only used if freedom in uz = flexible (default: 0.0). * **stiffness\_fix** (`float`) – Stiffness in fix \[Nm/rad], only used if freedom in fix = flexible (default: 0.0). * **stiffness\_fiy** (`float`) – Stiffness in fiy \[Nm/rad], only used if freedom in fiy = flexible (default: 0.0). * **stiffness\_fiz** (`float`) – Stiffness in fiz \[Nm/rad], only used if freedom in fiz = flexible (default: 0.0). * Return type: [`HingeOnBeam`](https://docs.viktor.ai/sdk/api/external/scia/.md#HingeOnBeam "viktor.external.scia.object.HingeOnBeam") * create\_hinge\_on\_plane(*edge*, *\**, *name=None*, *ux=None*, *stiffness\_ux=None*, *uy=None*, *stiffness\_uy=None*, *uz=None*, *stiffness\_uz=None*, *fix=None*, *stiffness\_fix=None*, *c\_def=None*, *position\_x1=None*, *position\_x2=None*, *origin=None*)[](#Model.create_hinge_on_plane "Link to this definition") Method to construct a hinge on a plane edge. * Parameters: * **edge** (`Tuple`\[[`Plane`](https://docs.viktor.ai/sdk/api/external/scia/.md#Plane "viktor.external.scia.object.Plane"), `int`] | [`InternalEdge`](https://docs.viktor.ai/sdk/api/external/scia/.md#InternalEdge "viktor.external.scia.object.InternalEdge")) – tuple of a plane object ([`create_plane()`](#Model.create_plane "viktor.external.scia.scia.Model.create_plane")) and edge number to which the hinge will be attached (1 = between plane.corner\_nodes\[0] and plane.corner\_nodes\[1], etc.), or InternalEdge ([`create_internal_edge()`](#Model.create_internal_edge "viktor.external.scia.scia.Model.create_internal_edge")) * **name** (`str`) – name which will be shown in SCIA (default: ‘L{i}’) * **ux** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#HingeOnPlane.Freedom "viktor.external.scia.object.HingeOnPlane.Freedom")) – Freedom in ux (default: RIGID). * **stiffness\_ux** (`float`) – Stiffness in ux \[N/m2], only used if freedom in ux = flexible (default: 0.0). * **uy** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#HingeOnPlane.Freedom "viktor.external.scia.object.HingeOnPlane.Freedom")) – Freedom in uy (default: RIGID). * **stiffness\_uy** (`float`) – Stiffness in uy \[N/m2], only used if freedom in uy = flexible (default: 0.0). * **uz** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#HingeOnPlane.Freedom "viktor.external.scia.object.HingeOnPlane.Freedom")) – Freedom in uz (default: RIGID). * **stiffness\_uz** (`float`) – Stiffness in uz \[N/m2], only used if freedom in uz = flexible (default: 0.0). * **fix** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#HingeOnPlane.Freedom "viktor.external.scia.object.HingeOnPlane.Freedom")) – Freedom in fix (default: FREE). * **stiffness\_fix** (`float`) – Stiffness in fix \[Nm/m/rad], only used if freedom in fix = flexible (default: 0.0). * **c\_def** ([`CDef`](https://docs.viktor.ai/sdk/api/external/scia/.md#HingeOnPlane.CDef "viktor.external.scia.object.HingeOnPlane.CDef")) – coordinate definition (default: RELATIVE) * **position\_x1** (`float`) – position of p1 along the edge with respect to origin (\[m] if c\_def = ABSOLUTE, else \[-]) (default: 0.0) * **position\_x2** (`float`) – position of p2 along the edge with respect to origin (\[m] if c\_def = ABSOLUTE, else \[-]) (default: 1.0) * **origin** ([`Origin`](https://docs.viktor.ai/sdk/api/external/scia/.md#HingeOnPlane.Origin "viktor.external.scia.object.HingeOnPlane.Origin")) – reference for position\_x1 and position\_x2 (default: FROM\_START) * Return type: [`HingeOnPlane`](https://docs.viktor.ai/sdk/api/external/scia/.md#HingeOnPlane "viktor.external.scia.object.HingeOnPlane") - create\_integration\_strip(*plane*, *point\_1*, *point\_2*, *width*)[](#Model.create_integration_strip "Link to this definition") Method to construct an integration strip, which can be used to receive calculation results on its position. * Parameters: * **plane** ([`Plane`](https://docs.viktor.ai/sdk/api/external/scia/.md#Plane "viktor.external.scia.object.Plane")) – plane object ([`create_plane()`](#Model.create_plane "viktor.external.scia.scia.Model.create_plane")). * **point\_1** (`Tuple`\[`float`, `float`, `float`]) – tuple of coordinates (x, y, z) of the start position in \[m] * **point\_2** (`Tuple`\[`float`, `float`, `float`]) – tuple of coordinates (x, y, z) of the end position in \[m] * **width** (`float`) – width of the strip in \[m] * Return type: [`IntegrationStrip`](https://docs.viktor.ai/sdk/api/external/scia/.md#IntegrationStrip "viktor.external.scia.object.IntegrationStrip") * create\_internal\_edge(*plane*, *node\_1*, *node\_2*, *\**, *name=None*)[](#Model.create_internal_edge "Link to this definition") Method to construct an internal edge in a 2D member. * Parameters: * **plane** ([`Plane`](https://docs.viktor.ai/sdk/api/external/scia/.md#Plane "viktor.external.scia.object.Plane")) – plane object ([`create_plane()`](#Model.create_plane "viktor.external.scia.scia.Model.create_plane")) * **node\_1** ([`Node`](https://docs.viktor.ai/sdk/api/external/scia/.md#Node "viktor.external.scia.object.Node")) – node object ([`create_node()`](#Model.create_node "viktor.external.scia.scia.Model.create_node")) at the start of the edge * **node\_2** ([`Node`](https://docs.viktor.ai/sdk/api/external/scia/.md#Node "viktor.external.scia.object.Node")) – node object ([`create_node()`](#Model.create_node "viktor.external.scia.scia.Model.create_node")) at the end of the edge * **name** (`str`) – name which will be shown in SCIA (default: ‘ES{i}’) * Return type: [`InternalEdge`](https://docs.viktor.ai/sdk/api/external/scia/.md#InternalEdge "viktor.external.scia.object.InternalEdge") - create\_layer(*name=None*, *\**, *comment=None*, *structural\_model\_only=None*, *current\_used\_activity=None*)[](#Model.create_layer "Link to this definition") Method to construct a layer. Duplicate layer names are not allowed. * Parameters: * **name** (`str`) – name of the layer (default: ‘Layer{i}’) * **comment** (`str`) – optional comment * **structural\_model\_only** (`bool`) – when ‘True’, the layer is NOT taken into account for the calculation (default: False) * **current\_used\_activity** (`bool`) – defines if the layer is visible or not on the screen (default: True) * Return type: [`Layer`](https://docs.viktor.ai/sdk/api/external/scia/.md#Layer "viktor.external.scia.object.Layer") * create\_library\_cross\_section(*section*, *profile*, *material*, *\**, *name=None*)[](#Model.create_library_cross_section "Link to this definition") New in v13.1.0 Method to construct a cross-section that is part of the cross-section library. * Parameters: * **section** ([`Section`](https://docs.viktor.ai/sdk/api/external/scia/.md#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")) – section type (e.g. LibraryCrossSection.Section.I) * **profile** (`str`) – profile name including dimensions (e.g. “SHS30/30/2.0”) * **material** ([`Material`](https://docs.viktor.ai/sdk/api/external/scia/.md#Material "viktor.external.scia.object.Material")) – material of the cross-section * **name** (`str`) – name of the cross-section (default: ‘CS{i}’) * Return type: [`LibraryCrossSection`](https://docs.viktor.ai/sdk/api/external/scia/.md#LibraryCrossSection "viktor.external.scia.object.LibraryCrossSection") - create\_line\_load(*name*, *load\_case*, *beam*, *load\_type*, *distribution*, *load\_start*, *load\_end*, *direction*, *position\_start*, *position\_end*, *c\_def*, *c\_sys*, *origin*, *ey*, *ez*)[](#Model.create_line_load "Link to this definition") Method to construct a line load on a beam. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **load\_case** ([`LoadCase`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCase "viktor.external.scia.object.LoadCase")) – previously created load case object in which the load should be placed * **beam** ([`Beam`](https://docs.viktor.ai/sdk/api/external/scia/.md#Beam "viktor.external.scia.object.Beam")) – beam object ([`create_beam()`](#Model.create_beam "viktor.external.scia.scia.Model.create_beam")) to which the load should be applied * **load\_type** ([`Type`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineLoad.Type "viktor.external.scia.object.LineLoad.Type")) – enumeration of load types * **distribution** ([`Distribution`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineLoad.Distribution "viktor.external.scia.object.LineLoad.Distribution")) – enumeration of distribution options * **load\_start** (`float`) – magnitude of the load at the start point in \[N] * **load\_end** (`float`) – magnitude of the load at the end point in \[N] * **direction** ([`Direction`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineLoad.Direction "viktor.external.scia.object.LineLoad.Direction")) – enumeration of directions * **position\_start** (`float`) – position of the start point on the beam in \[m] * **position\_end** (`float`) – position of the end point on the beam in \[m] * **c\_def** ([`CDef`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineLoad.CDef "viktor.external.scia.object.LineLoad.CDef")) – enumeration of coordinate definition types * **c\_sys** ([`CSys`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineLoad.CSys "viktor.external.scia.object.LineLoad.CSys")) – enumeration of coordinate system types * **origin** ([`Origin`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineLoad.Origin "viktor.external.scia.object.LineLoad.Origin")) – enumeration of origin types * **ey** (`float`) – eccentricity in Y-direction w\.r.t. the beam’s center line in \[m] * **ez** (`float`) – eccentricity in Z-direction w\.r.t. the beam’s center line in \[m] * Return type: [`LineLoad`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineLoad "viktor.external.scia.object.LineLoad") * create\_line\_load\_on\_plane(*edge*, *p1*, *p2=None*, *\**, *load\_case*, *direction=None*, *name=None*, *location=None*, *c\_sys=None*, *c\_def=None*, *position\_x1=None*, *position\_x2=None*, *origin=None*)[](#Model.create_line_load_on_plane "Link to this definition") Method to construct a line load on a plane edge. * Parameters: * **edge** (`Tuple`\[[`Plane`](https://docs.viktor.ai/sdk/api/external/scia/.md#Plane "viktor.external.scia.object.Plane"), `int`] | [`InternalEdge`](https://docs.viktor.ai/sdk/api/external/scia/.md#InternalEdge "viktor.external.scia.object.InternalEdge")) – tuple of a plane object ([`create_plane()`](#Model.create_plane "viktor.external.scia.scia.Model.create_plane")) and edge number to which the load will be applied (1 = between plane.corner\_nodes\[0] and plane.corner\_nodes\[1], etc.), or InternalEdge ([`create_internal_edge()`](#Model.create_internal_edge "viktor.external.scia.scia.Model.create_internal_edge")) * **p1** (`float`) – magnitude of the load \[N/m] on point 1 * **p2** (`float`) – magnitude of the load \[N/m] on point 2. None for uniform load (with magnitude p1) (default: None) * **load\_case** ([`LoadCase`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCase "viktor.external.scia.object.LoadCase")) – previously created load case object in which the load should be applied * **direction** ([`Direction`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineForceSurface.Direction "viktor.external.scia.object.LineForceSurface.Direction")) – direction of the load (default: Z) * **name** (`str`) – name which will be shown in SCIA (default: ‘LFS{i}’) * **location** ([`Location`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineForceSurface.Location "viktor.external.scia.object.LineForceSurface.Location")) – location type (default: LENGTH) * **c\_sys** ([`CSys`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineForceSurface.CSys "viktor.external.scia.object.LineForceSurface.CSys")) – coordinate system (default: LOCAL) * **c\_def** ([`CDef`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineForceSurface.CDef "viktor.external.scia.object.LineForceSurface.CDef")) – coordinate definition (default: RELATIVE) * **position\_x1** (`float`) – position of p1 along the edge with respect to origin (\[m] if c\_def = ABSOLUTE, else \[-]) (default: 0.0) * **position\_x2** (`float`) – position of p2 along the edge with respect to origin (\[m] if c\_def = ABSOLUTE, else \[-]) (default: 1.0) * **origin** ([`Origin`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineForceSurface.Origin "viktor.external.scia.object.LineForceSurface.Origin")) – reference for position\_x1 and position\_x2 (default: FROM\_START) * Return type: [`LineForceSurface`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineForceSurface "viktor.external.scia.object.LineForceSurface") - create\_line\_moment\_on\_beam(*beam*, *load\_case*, *m1*, *m2=None*, *\**, *name=None*, *direction=None*, *c\_def=None*, *position\_x1=None*, *position\_x2=None*, *origin=None*)[](#Model.create_line_moment_on_beam "Link to this definition") Method to construct a line moment on a beam. * Parameters: * **beam** ([`Beam`](https://docs.viktor.ai/sdk/api/external/scia/.md#Beam "viktor.external.scia.object.Beam")) – beam object ([`create_beam()`](#Model.create_beam "viktor.external.scia.scia.Model.create_beam")) to which the load should be applied * **load\_case** ([`LoadCase`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCase "viktor.external.scia.object.LoadCase")) – previously created load case object in which the load should be applied * **m1** (`float`) – magnitude of the moment \[Nm/m] on point 1 * **m2** (`float`) – magnitude of the moment \[Nm/m] on point 2. None for uniform load (with magnitude m1) (default: None) * **name** (`str`) – name which will be shown in SCIA (default: ‘LM{i}’) * **direction** ([`Direction`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineMomentOnBeam.Direction "viktor.external.scia.object.LineMomentOnBeam.Direction")) – direction of the moment (default: Z) * **c\_def** ([`CDef`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineMomentOnBeam.CDef "viktor.external.scia.object.LineMomentOnBeam.CDef")) – coordinate definition (default: RELATIVE) * **position\_x1** (`float`) – position of p1 along the beam with respect to origin (\[m] if c\_def = ABSOLUTE, else \[-]) (default: 0.0) * **position\_x2** (`float`) – position of p2 along the beam with respect to origin (\[m] if c\_def = ABSOLUTE, else \[-]) (default: 1.0) * **origin** ([`Origin`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineMomentOnBeam.Origin "viktor.external.scia.object.LineMomentOnBeam.Origin")) – reference for position\_x1 and position\_x2 (default: FROM\_START) * Return type: [`LineMomentOnBeam`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineMomentOnBeam "viktor.external.scia.object.LineMomentOnBeam") * create\_line\_moment\_on\_plane(*edge*, *m1*, *m2=None*, *\**, *load\_case*, *name=None*, *direction=None*, *c\_def=None*, *position\_x1=None*, *position\_x2=None*, *origin=None*)[](#Model.create_line_moment_on_plane "Link to this definition") Method to construct a line moment on a plane edge. * Parameters: * **edge** (`Tuple`\[[`Plane`](https://docs.viktor.ai/sdk/api/external/scia/.md#Plane "viktor.external.scia.object.Plane"), `int`] | [`InternalEdge`](https://docs.viktor.ai/sdk/api/external/scia/.md#InternalEdge "viktor.external.scia.object.InternalEdge")) – tuple of the plane object ([`create_plane()`](#Model.create_plane "viktor.external.scia.scia.Model.create_plane")) and edge number to which the load should be applied (1 = between plane.corner\_nodes\[0] and plane.corner\_nodes\[1], etc.), or InternalEdge ([`create_internal_edge()`](#Model.create_internal_edge "viktor.external.scia.scia.Model.create_internal_edge")) * **m1** (`float`) – magnitude of the moment \[Nm/m] on point 1 * **m2** (`float`) – magnitude of the moment \[Nm/m] on point 2. None for uniform load (with magnitude m1) (default: None) * **load\_case** ([`LoadCase`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCase "viktor.external.scia.object.LoadCase")) – previously created load case object in which the load should be applied * **name** (`str`) – name which will be shown in SCIA (default: ‘LMS{i}’) * **direction** ([`Direction`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineMomentOnPlane.Direction "viktor.external.scia.object.LineMomentOnPlane.Direction")) – direction of the moment (default: Z) * **c\_def** ([`CDef`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineMomentOnPlane.CDef "viktor.external.scia.object.LineMomentOnPlane.CDef")) – coordinate definition (default: RELATIVE) * **position\_x1** (`float`) – position of p1 along the edge with respect to origin (\[m] if c\_def = ABSOLUTE, else \[-]) (default: 0.0) * **position\_x2** (`float`) – position of p2 along the edge with respect to origin (\[m] if c\_def = ABSOLUTE, else \[-]) (default: 1.0) * **origin** ([`Origin`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineMomentOnPlane.Origin "viktor.external.scia.object.LineMomentOnPlane.Origin")) – reference for position\_x1 and position\_x2 (default: FROM\_START) * Return type: [`LineMomentOnPlane`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineMomentOnPlane "viktor.external.scia.object.LineMomentOnPlane") - create\_line\_support\_on\_beam(*beam*, *\**, *name=None*, *x=None*, *stiffness\_x=None*, *function\_x=None*, *y=None*, *stiffness\_y=None*, *function\_y=None*, *z=None*, *stiffness\_z=None*, *function\_z=None*, *rx=None*, *stiffness\_rx=None*, *function\_rx=None*, *ry=None*, *stiffness\_ry=None*, *function\_ry=None*, *rz=None*, *stiffness\_rz=None*, *function\_rz=None*, *c\_sys=None*, *extent=None*, *c\_def=None*, *position\_x1=None*, *position\_x2=None*, *origin=None*)[](#Model.create_line_support_on_beam "Link to this definition") Method to construct a line support on a beam. * Parameters: * **beam** ([`Beam`](https://docs.viktor.ai/sdk/api/external/scia/.md#Beam "viktor.external.scia.object.Beam")) – beam object ([`create_beam()`](#Model.create_beam "viktor.external.scia.scia.Model.create_beam")) to which the line support will be applied * **name** (`str`) – name which will be shown in SCIA (default: ‘Slb{i}’) * **x** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom")) – constraint type in X-direction (default: RIGID) * **stiffness\_x** (`float`) – stiffness in X-direction \[N/m2] (only for x = FLEXIBLE | FLEXIBLE\_PRESS\_ONLY | FLEXIBLE\_TENSION\_ONLY | NONLINEAR) * **function\_x** ([`NonLinearFunction`](https://docs.viktor.ai/sdk/api/external/scia/.md#NonLinearFunction "viktor.external.scia.object.NonLinearFunction")) – non-linear function in X-direction (only for x = NONLINEAR) * **y** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom")) – constraint type in Y-direction (default: RIGID) * **stiffness\_y** (`float`) – stiffness in Y-direction \[N/m2] (only for y = FLEXIBLE | FLEXIBLE\_PRESS\_ONLY | FLEXIBLE\_TENSION\_ONLY | NONLINEAR) * **function\_y** ([`NonLinearFunction`](https://docs.viktor.ai/sdk/api/external/scia/.md#NonLinearFunction "viktor.external.scia.object.NonLinearFunction")) – non-linear function in Y-direction (only for y = NONLINEAR) * **z** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom")) – constraint type in Z-direction (default: RIGID) * **stiffness\_z** (`float`) – stiffness in Z-direction \[N/m2] (only for z = FLEXIBLE | FLEXIBLE\_PRESS\_ONLY | FLEXIBLE\_TENSION\_ONLY | NONLINEAR) * **function\_z** ([`NonLinearFunction`](https://docs.viktor.ai/sdk/api/external/scia/.md#NonLinearFunction "viktor.external.scia.object.NonLinearFunction")) – non-linear function in Z-direction (only for z = NONLINEAR) * **rx** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom")) – constraint type in X-rotation (default: RIGID) * **stiffness\_rx** (`float`) – stiffness in X-rotation \[Nm/m/rad] (only for rx = FLEXIBLE | NONLINEAR) * **function\_rx** ([`NonLinearFunction`](https://docs.viktor.ai/sdk/api/external/scia/.md#NonLinearFunction "viktor.external.scia.object.NonLinearFunction")) – non-linear function in X-rotation (only for rx = NONLINEAR) * **ry** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom")) – constraint type in Y-rotation (default: RIGID) * **stiffness\_ry** (`float`) – stiffness in Y-rotation \[Nm/m/rad] (only for ry = FLEXIBLE | NONLINEAR) * **function\_ry** ([`NonLinearFunction`](https://docs.viktor.ai/sdk/api/external/scia/.md#NonLinearFunction "viktor.external.scia.object.NonLinearFunction")) – non-linear function in Y-rotation (only for ry = NONLINEAR) * **rz** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom")) – constraint type in Z-rotation (default: RIGID) * **stiffness\_rz** (`float`) – stiffness in Z-rotation \[Nm/m/rad] (only for rz = FLEXIBLE | NONLINEAR) * **function\_rz** ([`NonLinearFunction`](https://docs.viktor.ai/sdk/api/external/scia/.md#NonLinearFunction "viktor.external.scia.object.NonLinearFunction")) – non-linear function in Z-rotation (only for rz = NONLINEAR) * **c\_sys** ([`CSys`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineSupport.CSys "viktor.external.scia.object.LineSupport.CSys")) – coordinate system (default: LOCAL) * **extent** ([`Extent`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineSupport.Extent "viktor.external.scia.object.LineSupport.Extent")) – extension of support (default: FULL) * **c\_def** ([`CDef`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineSupport.CDef "viktor.external.scia.object.LineSupport.CDef")) – coordinate definition (default: RELATIVE) * **position\_x1** (`float`) – start of support along the edge with respect to origin (\[m] if c\_def = ABSOLUTE, else \[-]) (default: 0.0) * **position\_x2** (`float`) – end of support along the edge with respect to origin (\[m] if c\_def = ABSOLUTE, else \[-]) (default: 1.0) * **origin** ([`Origin`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineSupport.Origin "viktor.external.scia.object.LineSupport.Origin")) – reference for position\_x1 and position\_x2 (default: FROM\_START) * Return type: [`LineSupportLine`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineSupportLine "viktor.external.scia.object.LineSupportLine") * create\_line\_support\_on\_plane(*edge*, *\**, *name=None*, *x=None*, *stiffness\_x=None*, *y=None*, *stiffness\_y=None*, *z=None*, *stiffness\_z=None*, *rx=None*, *stiffness\_rx=None*, *ry=None*, *stiffness\_ry=None*, *rz=None*, *stiffness\_rz=None*, *c\_sys=None*, *c\_def=None*, *position\_x1=None*, *position\_x2=None*, *origin=None*)[](#Model.create_line_support_on_plane "Link to this definition") Method to construct a line support on a plane edge. * Parameters: * **edge** (`Tuple`\[[`Plane`](https://docs.viktor.ai/sdk/api/external/scia/.md#Plane "viktor.external.scia.object.Plane"), `int`] | [`InternalEdge`](https://docs.viktor.ai/sdk/api/external/scia/.md#InternalEdge "viktor.external.scia.object.InternalEdge")) – tuple of the plane object ([`create_plane()`](#Model.create_plane "viktor.external.scia.scia.Model.create_plane")) and edge number to which the load should be applied (1 = between plane.corner\_nodes\[0] and plane.corner\_nodes\[1], etc.), or InternalEdge ([`create_internal_edge()`](#Model.create_internal_edge "viktor.external.scia.scia.Model.create_internal_edge")) * **name** (`str`) – name which will be shown in SCIA (default: ‘Sle{i}’) * **x** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom")) – constraint type in X-direction (default: FREE) * **stiffness\_x** (`float`) – stiffness in X-direction \[N/m2] (only for x = FLEXIBLE) * **y** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom")) – constraint type in Y-direction (default: FREE) * **stiffness\_y** (`float`) – stiffness in Y-direction \[N/m2] (only for y = FLEXIBLE) * **z** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom")) – constraint type in Z-direction (default: FREE) * **stiffness\_z** (`float`) – stiffness in Z-direction \[N/m2] (only for z = FLEXIBLE) * **rx** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom")) – constraint type in X-rotation (default: FREE) * **stiffness\_rx** (`float`) – stiffness in X-rotation \[Nm/m/rad] (only for rx = FLEXIBLE) * **ry** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom")) – constraint type in Y-rotation (default: FREE) * **stiffness\_ry** (`float`) – stiffness in Y-rotation \[Nm/m/rad] (only for ry = FLEXIBLE) * **rz** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom")) – constraint type in Z-rotation (default: FREE) * **stiffness\_rz** (`float`) – stiffness in Z-rotation \[Nm/m/rad] (only for rz = FLEXIBLE) * **c\_sys** ([`CSys`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineSupport.CSys "viktor.external.scia.object.LineSupport.CSys")) – coordinate system (default: GLOBAL) * **c\_def** ([`CDef`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineSupport.CDef "viktor.external.scia.object.LineSupport.CDef")) – coordinate definition (default: RELATIVE) * **position\_x1** (`float`) – start of support along the edge with respect to origin (\[m] if c\_def = ABSOLUTE, else \[-]) (default: 0.0) * **position\_x2** (`float`) – end of support along the edge with respect to origin (\[m] if c\_def = ABSOLUTE, else \[-]) (default: 1.0) * **origin** ([`Origin`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineSupport.Origin "viktor.external.scia.object.LineSupport.Origin")) – reference for position\_x1 and position\_x2 (default: FROM\_START) * Return type: [`LineSupportSurface`](https://docs.viktor.ai/sdk/api/external/scia/.md#LineSupportSurface "viktor.external.scia.object.LineSupportSurface") - create\_load\_combination(*name*, *load\_type*, *load\_cases*, *\**, *description=None*)[](#Model.create_load_combination "Link to this definition") Method to construct a load combination. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **load\_type** ([`Type`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCombination.Type "viktor.external.scia.object.LoadCombination.Type")) – enumeration of load types * **load\_cases** (`Dict`\[[`LoadCase`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCase "viktor.external.scia.object.LoadCase"), `float`]) – dictionary of previously created load case object(s) with corresponding coefficient * **description** (`str`) – description of the load combination New in v13.1.0 * Return type: [`LoadCombination`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCombination "viktor.external.scia.object.LoadCombination") * create\_load\_group(*name*, *load\_option*, *relation=None*, *load\_type=None*)[](#Model.create_load_group "Link to this definition") Method to construct a load group. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **load\_option** ([`LoadOption`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadGroup.LoadOption "viktor.external.scia.object.LoadGroup.LoadOption")) – enumeration of load option types * **relation** ([`RelationOption`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadGroup.RelationOption "viktor.external.scia.object.LoadGroup.RelationOption")) – enumeration of relation types * **load\_type** ([`LoadTypeOption`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadGroup.LoadTypeOption "viktor.external.scia.object.LoadGroup.LoadTypeOption")) – enumeration of load types * Return type: [`LoadGroup`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadGroup "viktor.external.scia.object.LoadGroup") - create\_node(*name*, *x*, *y*, *z*)[](#Model.create_node "Link to this definition") Method to construct a node. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **x** (`float`) – X-coordinate in \[m] * **y** (`float`) – Y-coordinate in \[m] * **z** (`float`) – Z-coordinate in \[m] * Return type: [`Node`](https://docs.viktor.ai/sdk/api/external/scia/.md#Node "viktor.external.scia.object.Node") * create\_nonlinear\_function(*name*, *function\_type*, *positive\_end*, *negative\_end*, *impulse*)[](#Model.create_nonlinear_function "Link to this definition") Method to construct a non-linear function. * Parameters: * **name** (`str`) – name of the function * **function\_type** ([`Type`](https://docs.viktor.ai/sdk/api/external/scia/.md#NonLinearFunction.Type "viktor.external.scia.object.NonLinearFunction.Type")) – type of function * **positive\_end** ([`Support`](https://docs.viktor.ai/sdk/api/external/scia/.md#NonLinearFunction.Support "viktor.external.scia.object.NonLinearFunction.Support")) – type of support at positive end * **negative\_end** ([`Support`](https://docs.viktor.ai/sdk/api/external/scia/.md#NonLinearFunction.Support "viktor.external.scia.object.NonLinearFunction.Support")) – type of support at negative end * **impulse** (`List`\[`Tuple`\[`float`, `float`]]) – impulse function X-Y values in \[m, N] (if function\_type = TRANSLATION), \[rad, Nm] (if function\_type = ROTATION), or \[m, Pa] (if function\_type = NONLINEAR\_SUBSOIL) * Return type: [`NonLinearFunction`](https://docs.viktor.ai/sdk/api/external/scia/.md#NonLinearFunction "viktor.external.scia.object.NonLinearFunction") - create\_nonlinear\_load\_combination(*load\_type*, *load\_cases*, *\**, *name=None*, *description=None*)[](#Model.create_nonlinear_load_combination "Link to this definition") Create a non-linear load combination. * Parameters: * **load\_type** ([`Type`](https://docs.viktor.ai/sdk/api/external/scia/.md#NonLinearLoadCombination.Type "viktor.external.scia.object.NonLinearLoadCombination.Type")) – type of combination * **load\_cases** (`Dict`\[[`LoadCase`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCase "viktor.external.scia.object.LoadCase"), `float`]) – dictionary of previously created load case object(s) with corresponding coefficient * **name** (`str`) – name which will be shown in SCIA (default: ‘NC{i}’) * **description** (`str`) – description of the load combination New in v13.1.0 * Return type: [`NonLinearLoadCombination`](https://docs.viktor.ai/sdk/api/external/scia/.md#NonLinearLoadCombination "viktor.external.scia.object.NonLinearLoadCombination") * create\_numerical\_cross\_section(*name*, *material*, *\**, *A=None*, *Ay=None*, *Az=None*, *AL=None*, *AD=None*, *cYUCS=None*, *cZUCS=None*, *alpha=None*, *Iy=None*, *Iz=None*, *Wely=None*, *Welz=None*, *Wply=None*, *Wplz=None*, *Mply\_plus=None*, *Mply\_min=None*, *Mplz\_plus=None*, *Mplz\_min=None*, *dy=None*, *dz=None*, *It=None*, *Iw=None*, *beta\_y=None*, *beta\_z=None*)[](#Model.create_numerical_cross_section "Link to this definition") Method to construct a numerical cross-section. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **material** ([`Material`](https://docs.viktor.ai/sdk/api/external/scia/.md#Material "viktor.external.scia.object.Material")) – material of the cross-section * **A** (`float`) – cross-sectional area \[m²] * **Ay** (`float`) – shear area in y-direction \[m²] * **Az** (`float`) – shear area in z-direction \[m²] * **AL** (`float`) – circumference per unit length \[m²/m] * **AD** (`float`) – drying surface per unit length \[m²/m] * **cYUCS** (`float`) – centroid in y-direction of input axis system \[mm] * **cZUCS** (`float`) – centroid in z-direction of input axis system \[mm] * **alpha** (`float`) – rotation angle of axis system \[deg] * **Iy** (`float`) – moment of inertia about the y-axis \[m⁴] * **Iz** (`float`) – moment of inertia about the z-axis \[m⁴] * **Wely** (`float`) – elastic section modulus about the y-axis \[m³] * **Welz** (`float`) – elastic section modulus about the z-axis \[m³] * **Wply** (`float`) – plastic section modulus about the y-axis \[m³] * **Wplz** (`float`) – plastic section modulus about the z-axis \[m³] * **Mply\_plus** (`float`) – plastic moment about the y-axis for positive My moment \[Nm] * **Mply\_min** (`float`) – plastic moment about the y-axis for negative My moment \[Nm] * **Mplz\_plus** (`float`) – plastic moment about the z-axis for positive My moment \[Nm] * **Mplz\_min** (`float`) – plastic moment about the z-axis for negative My moment \[Nm] * **dy** (`float`) – shear center coordinate in y-axis, measured from centroid \[mm] * **dz** (`float`) – shear center coordinate in z-axis, measured from centroid \[mm] * **It** (`float`) – torsional constant \[m⁴] * **Iw** (`float`) – warping constant \[m⁶] * **beta\_y** (`float`) – mono-symmetry constant about the y-axis \[mm] * **beta\_z** (`float`) – mono-symmetry constant about the z-axis \[mm] * Return type: [`NumericalCrossSection`](https://docs.viktor.ai/sdk/api/external/scia/.md#NumericalCrossSection "viktor.external.scia.object.NumericalCrossSection") - create\_open\_slab(*name*, *plane*, *corner\_nodes*)[](#Model.create_open_slab "Link to this definition") Method to construct an open slab in a 2D member. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **plane** ([`Plane`](https://docs.viktor.ai/sdk/api/external/scia/.md#Plane "viktor.external.scia.object.Plane")) – plane object ([`create_plane()`](#Model.create_plane "viktor.external.scia.scia.Model.create_plane")). * **corner\_nodes** (`List`\[[`Node`](https://docs.viktor.ai/sdk/api/external/scia/.md#Node "viktor.external.scia.object.Node")]) – list of node objects located at the corners * Return type: [`OpenSlab`](https://docs.viktor.ai/sdk/api/external/scia/.md#OpenSlab "viktor.external.scia.object.OpenSlab") * create\_orthotropy(*name*, *material*, *thickness*, *D11=None*, *D22=None*, *D12=None*, *D33=None*, *D44=None*, *D55=None*, *d11=None*, *d22=None*, *d12=None*, *d33=None*, *kxy=None*, *kyx=None*)[](#Model.create_orthotropy "Link to this definition") Method to construct a type of orthotropy. * Parameters: * **name** (`str`) – name of the orthotropy * **material** ([`Material`](https://docs.viktor.ai/sdk/api/external/scia/.md#Material "viktor.external.scia.object.Material")) – material * **thickness** (`float`) – thickness of the plate / wall \[m] * **D11** (`float`) – (plate) stiffness matrix parameter \[Nm] * **D22** (`float`) – (plate) stiffness matrix parameter \[Nm] * **D12** (`float`) – (plate) stiffness matrix parameter \[Nm] * **D33** (`float`) – (plate) stiffness matrix parameter \[Nm] * **D44** (`float`) – (plate) stiffness matrix parameter \[N/m] * **D55** (`float`) – (plate) stiffness matrix parameter \[N/m] * **d11** (`float`) – (membrane) stiffness matrix parameter \[N/m] * **d22** (`float`) – (membrane) stiffness matrix parameter \[N/m] * **d12** (`float`) – (membrane) stiffness matrix parameter \[N/m] * **d33** (`float`) – (membrane) stiffness matrix parameter \[N/m] * **kxy** (`float`) – stiffness coefficient \[N/m] * **kyx** (`float`) – stiffness coefficient \[N/m] * Return type: [`Orthotropy`](https://docs.viktor.ai/sdk/api/external/scia/.md#Orthotropy "viktor.external.scia.object.Orthotropy") - create\_permanent\_load\_case(*name*, *description*, *load\_group*, *load\_type*, *direction=None*, *primary\_effect=None*)[](#Model.create_permanent_load_case "Link to this definition") Method to construct a permanent load case. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **description** (`str`) – description which will be shown in SCIA * **load\_group** ([`LoadGroup`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadGroup "viktor.external.scia.object.LoadGroup")) – load group object ([`create_load_group()`](#Model.create_load_group "viktor.external.scia.scia.Model.create_load_group")) in which the load case should be placed. * **load\_type** ([`PermanentLoadType`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCase.PermanentLoadType "viktor.external.scia.object.LoadCase.PermanentLoadType")) – permanent load types * **direction** ([`Direction`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCase.Direction "viktor.external.scia.object.LoadCase.Direction")) – load direction in case of a *SELF\_WEIGHT* load type (default: NEG\_Z) * **primary\_effect** ([`LoadCase`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCase "viktor.external.scia.object.LoadCase")) – previously created load case object in case the selected load type is *PRIMARY\_EFFECT* * Return type: [`PermanentLoadCase`](https://docs.viktor.ai/sdk/api/external/scia/.md#PermanentLoadCase "viktor.external.scia.object.PermanentLoadCase") * create\_plane(*corner\_nodes*, *thickness*, *\**, *material*, *name=None*, *plane\_type=None*, *layer=None*, *internal\_nodes=None*, *swap\_orientation=None*, *lcs\_rotation=None*, *fem\_model=None*, *orthotropy=None*)[](#Model.create_plane "Link to this definition") Method to construct a 2D member. * Parameters: * **corner\_nodes** (`List`\[[`Node`](https://docs.viktor.ai/sdk/api/external/scia/.md#Node "viktor.external.scia.object.Node")]) – list of node objects located at the corners * **thickness** (`float`) – thickness of the plane in \[m] * **material** ([`Material`](https://docs.viktor.ai/sdk/api/external/scia/.md#Material "viktor.external.scia.object.Material")) – `Material` of the plane * **name** (`str`) – name which will be shown in SCIA (default: ‘S{i}’) * **plane\_type** ([`Type`](https://docs.viktor.ai/sdk/api/external/scia/.md#Plane.Type "viktor.external.scia.object.Plane.Type")) – enumeration of plane types (default: PLATE) * **layer** ([`Layer`](https://docs.viktor.ai/sdk/api/external/scia/.md#Layer "viktor.external.scia.object.Layer")) – layer object ([`create_layer()`](#Model.create_layer "viktor.external.scia.scia.Model.create_layer")) to which the plane will be added * **internal\_nodes** (`List`\[[`Node`](https://docs.viktor.ai/sdk/api/external/scia/.md#Node "viktor.external.scia.object.Node")]) – list of internal node objects (default: None) * **swap\_orientation** (`bool`) – whereas to swap the plate orientation (default: False) * **lcs\_rotation** (`float`) – rotation of the local coordinate system \[deg] (default: 0.0) * **fem\_model** ([`FEMModel`](https://docs.viktor.ai/sdk/api/external/scia/.md#Plane.FEMModel "viktor.external.scia.object.Plane.FEMModel")) – FEM model to be used in the calculation (default: isotropic) * **orthotropy** ([`Orthotropy`](https://docs.viktor.ai/sdk/api/external/scia/.md#Orthotropy "viktor.external.scia.object.Orthotropy")) – type of orthotropy (only for fem\_model = ORTHOTROPIC) * Return type: [`Plane`](https://docs.viktor.ai/sdk/api/external/scia/.md#Plane "viktor.external.scia.object.Plane") - create\_point\_load(*name*, *load\_case*, *beam*, *direction*, *load\_type*, *load\_value*, *c\_sys=None*, *c\_def=None*, *position\_x=None*, *origin=None*, *repeat=None*, *ey=None*, *ez=None*, *\**, *angle=None*)[](#Model.create_point_load "Link to this definition") Method to construct a point load on a beam. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **load\_case** ([`LoadCase`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCase "viktor.external.scia.object.LoadCase")) – previously created load case object in which the load should be placed * **beam** ([`Beam`](https://docs.viktor.ai/sdk/api/external/scia/.md#Beam "viktor.external.scia.object.Beam")) – beam object ([`create_beam()`](#Model.create_beam "viktor.external.scia.scia.Model.create_beam")) to which the load should be applied * **direction** ([`Direction`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointLoad.Direction "viktor.external.scia.object.PointLoad.Direction")) – enumeration of directions * **load\_type** ([`Type`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointLoad.Type "viktor.external.scia.object.PointLoad.Type")) – enumeration of load types * **load\_value** (`float`) – magnitude of the load in \[N] * **c\_sys** ([`CSys`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointLoad.CSys "viktor.external.scia.object.PointLoad.CSys")) – enumeration of coordinate system types (default: global) * **c\_def** ([`CDef`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointLoad.CDef "viktor.external.scia.object.PointLoad.CDef")) – enumeration of coordinate definition types (default: relative) * **position\_x** (`float`) – position of the load (default: 0) * **origin** ([`Origin`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointLoad.Origin "viktor.external.scia.object.PointLoad.Origin")) – enumeration of origin types (default: from start) * **repeat** (`int`) – number of loads acting on the beam, distributed uniformly (default: 1) * **ey** (`float`) – eccentricity in Y-direction w\.r.t. the beam’s center line in \[m] (default: 0) * **ez** (`float`) – eccentricity in Z-direction w\.r.t. the beam’s center line in \[m] (default: 0) * **angle** (`Tuple`\[`float`, `float`, `float`]) – angle (Rx, Ry, Rz) \[deg] of the load around the respective X-, Y- and Z-axis (default: 0) * Return type: [`PointLoad`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointLoad "viktor.external.scia.object.PointLoad") * create\_point\_load\_node(*node*, *load\_case*, *load*, *\**, *name=None*, *direction=None*, *c\_sys=None*, *angle=None*)[](#Model.create_point_load_node "Link to this definition") Method to construct a point load in a node. * Parameters: * **node** ([`Node`](https://docs.viktor.ai/sdk/api/external/scia/.md#Node "viktor.external.scia.object.Node")) – node object ([`create_node()`](#Model.create_node "viktor.external.scia.scia.Model.create_node")) on which the load should be applied * **load\_case** ([`LoadCase`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCase "viktor.external.scia.object.LoadCase")) – previously created load case object in which the load should be placed * **load** (`float`) – magnitude of the load in \[N] * **name** (`str`) – name which will be shown in SCIA (default: ‘F{i}’) * **direction** ([`Direction`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointLoadNode.Direction "viktor.external.scia.object.PointLoadNode.Direction")) – direction of the load (default: Z) * **c\_sys** ([`CSys`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointLoadNode.CSys "viktor.external.scia.object.PointLoadNode.CSys")) – coordinate system (default: global) * **angle** (`Tuple`\[`float`, `float`, `float`]) – angle (Rx, Ry, Rz) \[deg] of the load around the respective global X-, Y- and Z-axis * Return type: [`PointLoadNode`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointLoadNode "viktor.external.scia.object.PointLoadNode") - create\_point\_moment\_node(*node*, *load\_case*, *load*, *direction*, *name=None*, *c\_sys=CSys.GLOBAL*)[](#Model.create_point_moment_node "Link to this definition") Create a point moment on an existing node. * Parameters: * **node** ([`Node`](https://docs.viktor.ai/sdk/api/external/scia/.md#Node "viktor.external.scia.object.Node")) – Node of appliance ([`create_node()`](#Model.create_node "viktor.external.scia.scia.Model.create_node")). * **load\_case** ([`LoadCase`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCase "viktor.external.scia.object.LoadCase")) – Previously created load case of appliance. * **load** (`float`) – Magnitude of the load \[Nm]. * **direction** ([`Direction`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointMomentNode.Direction "viktor.external.scia.object.PointMomentNode.Direction")) – Direction of the load. * **name** (`str`) – Name of the load in SCIA (default: ‘M{i}’). * **c\_sys** ([`CSys`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointMomentNode.CSys "viktor.external.scia.object.PointMomentNode.CSys")) – Coordinate system (default: global). * Return type: [`PointMomentNode`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointMomentNode "viktor.external.scia.object.PointMomentNode") * create\_point\_support(*name*, *node*, *spring\_type*, *freedom*, *stiffness*, *c\_sys*, *default\_size=0.2*, *\**, *angle=None*)[](#Model.create_point_support "Link to this definition") Method to construct a point support. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **node** ([`Node`](https://docs.viktor.ai/sdk/api/external/scia/.md#Node "viktor.external.scia.object.Node")) – node object ([`create_node()`](#Model.create_node "viktor.external.scia.scia.Model.create_node")) to which the support will be attached. * **spring\_type** ([`Type`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointSupport.Type "viktor.external.scia.object.PointSupport.Type")) – enumeration of spring types * **freedom** (`Tuple`\[[`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointSupport.Freedom "viktor.external.scia.object.PointSupport.Freedom"), [`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointSupport.Freedom "viktor.external.scia.object.PointSupport.Freedom"), [`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointSupport.Freedom "viktor.external.scia.object.PointSupport.Freedom"), [`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointSupport.Freedom "viktor.external.scia.object.PointSupport.Freedom"), [`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointSupport.Freedom "viktor.external.scia.object.PointSupport.Freedom"), [`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointSupport.Freedom "viktor.external.scia.object.PointSupport.Freedom")]) – tuple of component constraints in the order (X, Y, Z, Rx, Ry, Rz) * **stiffness** (`Tuple`\[`float`, `float`, `float`, `float`, `float`, `float`]) – tuple of component stiffness in the order (X, Y, Z, Rx, Ry, Rz) in \[N/m] * **c\_sys** ([`CSys`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointSupport.CSys "viktor.external.scia.object.PointSupport.CSys")) – enumeration of coordinate system types * **default\_size** (`float`) – default size in \[m] * **angle** (`Tuple`\[`float`, `float`, `float`]) – angle (Rx, Ry, Rz) \[deg] of the support around the respective global X-, Y- and Z-axis * Return type: [`PointSupport`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointSupport "viktor.external.scia.object.PointSupport") - create\_point\_support\_on\_beam(*beam*, *\**, *name=None*, *x=None*, *stiffness\_x=None*, *y=None*, *stiffness\_y=None*, *z=None*, *stiffness\_z=None*, *rx=None*, *stiffness\_rx=None*, *ry=None*, *stiffness\_ry=None*, *rz=None*, *stiffness\_rz=None*, *default\_size=None*, *c\_sys=None*, *c\_def=None*, *position\_x=None*, *origin=None*, *repeat=None*, *delta\_x=None*)[](#Model.create_point_support_on_beam "Link to this definition") Method to construct a point support on a beam. * Parameters: * **beam** ([`Beam`](https://docs.viktor.ai/sdk/api/external/scia/.md#Beam "viktor.external.scia.object.Beam")) – beam object ([`create_beam()`](#Model.create_beam "viktor.external.scia.scia.Model.create_beam")) to which the line support will be applied * **name** (`str`) – name which will be shown in SCIA (default: ‘Sb{i}’) * **x** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointSupportLine.Freedom "viktor.external.scia.object.PointSupportLine.Freedom")) – constraint type in X-direction (default: RIGID) * **stiffness\_x** (`float`) – stiffness in X-direction \[N/m] (only for x = FLEXIBLE) * **y** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointSupportLine.Freedom "viktor.external.scia.object.PointSupportLine.Freedom")) – constraint type in Y-direction (default: RIGID) * **stiffness\_y** (`float`) – stiffness in Y-direction \[N/m] (only for y = FLEXIBLE) * **z** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointSupportLine.Freedom "viktor.external.scia.object.PointSupportLine.Freedom")) – constraint type in Z-direction (default: RIGID) * **stiffness\_z** (`float`) – stiffness in Z-direction \[N/m] (only for z = FLEXIBLE) * **rx** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointSupportLine.Freedom "viktor.external.scia.object.PointSupportLine.Freedom")) – constraint type in X-rotation (default: RIGID) * **stiffness\_rx** (`float`) – stiffness in X-rotation \[Nm/rad] (only for rx = FLEXIBLE) * **ry** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointSupportLine.Freedom "viktor.external.scia.object.PointSupportLine.Freedom")) – constraint type in Y-rotation (default: RIGID) * **stiffness\_ry** (`float`) – stiffness in Y-rotation \[Nm/rad] (only for ry = FLEXIBLE) * **rz** ([`Freedom`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointSupportLine.Freedom "viktor.external.scia.object.PointSupportLine.Freedom")) – constraint type in Z-rotation (default: RIGID) * **stiffness\_rz** (`float`) – stiffness in Z-rotation \[Nm/rad] (only for rz = FLEXIBLE) * **default\_size** (`float`) – size of the support \[m] (default: 0.2) * **c\_sys** ([`CSys`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointSupportLine.CSys "viktor.external.scia.object.PointSupportLine.CSys")) – coordinate system (default: GLOBAL) * **c\_def** ([`CDef`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointSupportLine.CDef "viktor.external.scia.object.PointSupportLine.CDef")) – c\_def: coordinate definition (default: RELATIVE) * **position\_x** (`float`) – position of the load (\[m] if c\_def = ABSOLUTE, else \[-]) (default: 0) * **origin** ([`Origin`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointSupportLine.Origin "viktor.external.scia.object.PointSupportLine.Origin")) – reference for position\_x (default: FROM\_START) * **repeat** (`int`) – number of uniformly distributed supports (default: 1) * **delta\_x** (`float`) – distance between supports (\[m] if c\_def = ABSOLUTE, else \[-]) (only for repeat > 1) * Return type: [`PointSupportLine`](https://docs.viktor.ai/sdk/api/external/scia/.md#PointSupportLine "viktor.external.scia.object.PointSupportLine") * create\_rectangular\_cross\_section(*name*, *material*, *width*, *height*)[](#Model.create_rectangular_cross_section "Link to this definition") Method to construct a rectangular cross-section. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **material** ([`Material`](https://docs.viktor.ai/sdk/api/external/scia/.md#Material "viktor.external.scia.object.Material")) – material of the cross-section * **width** (`float`) – width of the cross-section in \[m] * **height** (`float`) – height of the cross-section in \[m] * Return type: [`RectangularCrossSection`](https://docs.viktor.ai/sdk/api/external/scia/.md#RectangularCrossSection "viktor.external.scia.object.RectangularCrossSection") - create\_result\_class(*name*, *combinations=None*, *nonlinear\_combinations=None*)[](#Model.create_result_class "Link to this definition") Method to construct a result class. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **combinations** (`List`\[[`LoadCombination`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCombination "viktor.external.scia.object.LoadCombination")]) – list of load combination objects ([`create_load_combination()`](#Model.create_load_combination "viktor.external.scia.scia.Model.create_load_combination")) * **nonlinear\_combinations** (`List`\[[`NonLinearLoadCombination`](https://docs.viktor.ai/sdk/api/external/scia/.md#NonLinearLoadCombination "viktor.external.scia.object.NonLinearLoadCombination")]) – list of nonlinear load combination objects ([`create_nonlinear_load_combination()`](#Model.create_nonlinear_load_combination "viktor.external.scia.scia.Model.create_nonlinear_load_combination")) * Return type: [`ResultClass`](https://docs.viktor.ai/sdk/api/external/scia/.md#ResultClass "viktor.external.scia.object.ResultClass") * create\_rigid\_arm(*name*, *master\_node*, *slave\_node*, *hinge\_on\_master*, *hinge\_on\_slave*)[](#Model.create_rigid_arm "Link to this definition") Method to construct a rigid arm. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **master\_node** ([`Node`](https://docs.viktor.ai/sdk/api/external/scia/.md#Node "viktor.external.scia.object.Node")) – node object ([`create_node()`](#Model.create_node "viktor.external.scia.scia.Model.create_node")). * **slave\_node** ([`Node`](https://docs.viktor.ai/sdk/api/external/scia/.md#Node "viktor.external.scia.object.Node")) – node object ([`create_node()`](#Model.create_node "viktor.external.scia.scia.Model.create_node")). * **hinge\_on\_master** (`bool`) – True to insert a hinge on the master node * **hinge\_on\_slave** (`bool`) – True to insert a hinge on the slave node * Return type: [`RigidArm`](https://docs.viktor.ai/sdk/api/external/scia/.md#RigidArm "viktor.external.scia.object.RigidArm") - create\_section\_on\_beam(*name*, *beam*, *c\_def*, *position\_x*, *origin*, *repeat*, *delta\_x*)[](#Model.create_section_on_beam "Link to this definition") Method to construct a section on a beam, which can be used to receive calculation results on its position. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **beam** ([`Beam`](https://docs.viktor.ai/sdk/api/external/scia/.md#Beam "viktor.external.scia.object.Beam")) – beam object ([`create_beam()`](#Model.create_beam "viktor.external.scia.scia.Model.create_beam")). * **c\_def** ([`CDef`](https://docs.viktor.ai/sdk/api/external/scia/.md#SectionOnBeam.CDef "viktor.external.scia.object.SectionOnBeam.CDef")) – enumeration of coordinate definition types * **position\_x** (`float`) – position of the section on the beam * **origin** ([`Origin`](https://docs.viktor.ai/sdk/api/external/scia/.md#SectionOnBeam.Origin "viktor.external.scia.object.SectionOnBeam.Origin")) – enumeration of origin types * **repeat** (`int`) – number of section defined at the same time * **delta\_x** (`float`) – if repeat is greater than 1, this value defines the distance between individual sections * Return type: [`SectionOnBeam`](https://docs.viktor.ai/sdk/api/external/scia/.md#SectionOnBeam "viktor.external.scia.object.SectionOnBeam") * create\_section\_on\_plane(*point\_1*, *point\_2*, *\**, *name*, *draw=None*, *direction\_of\_cut=None*)[](#Model.create_section_on_plane "Link to this definition") Method to construct a section on a plane, which can be used to receive calculation results on its position. * Parameters: * **point\_1** (`Tuple`\[`float`, `float`, `float`]) – tuple of coordinates (x, y, z) of the start position in \[m] * **point\_2** (`Tuple`\[`float`, `float`, `float`]) – tuple of coordinates (x, y, z) of the end position in \[m] * **name** (`str`) – name which will be shown in SCIA (default: SE{i}) * **draw** ([`Draw`](https://docs.viktor.ai/sdk/api/external/scia/.md#SectionOnPlane.Draw "viktor.external.scia.object.SectionOnPlane.Draw")) – defines the plane in which the section is drawn (default: Z\_DIRECTION) * **direction\_of\_cut** (`Tuple`\[`float`, `float`, `float`]) – in-plane vector (x, y, z) which defines the direction of cut in \[m] (default: (0, 0, 1)) * Return type: [`SectionOnPlane`](https://docs.viktor.ai/sdk/api/external/scia/.md#SectionOnPlane "viktor.external.scia.object.SectionOnPlane") - create\_selection(*name*, *objects*)[](#Model.create_selection "Link to this definition") New in v14.1.0 Method to construct a named selection. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **objects** (`List`\[[`SciaObject`](https://docs.viktor.ai/sdk/api/external/scia/.md#SciaObject "viktor.external.scia.object.SciaObject")]) – object(s) created within this model * Return type: [`Selection`](https://docs.viktor.ai/sdk/api/external/scia/.md#Selection "viktor.external.scia.object.Selection") * create\_subsoil(*name*, *\**, *stiffness*, *c1x=None*, *c1y=None*, *c1z=None*, *nonlinear\_function=None*, *c2x=None*, *c2y=None*, *is\_drained=None*, *water\_air\_in\_clay\_subgrade=None*, *specific\_weight=None*, *fi=None*, *sigma\_oc=None*, *c=None*, *cu=None*)[](#Model.create_subsoil "Link to this definition") Method to construct a subsoil. * Parameters: * **name** (`str`) – name of the subsoil * **stiffness** (`float`) – stiffness c1z \[N/m3] * **c1x** (`float`) – stiffness c1x \[N/m3] (default: 50000000) * **c1y** (`float`) – stiffness c1y \[N/m3] (default: 50000000) * **c1z** ([`C1z`](https://docs.viktor.ai/sdk/api/external/scia/.md#Subsoil.C1z "viktor.external.scia.object.Subsoil.C1z")) – type for c1z (default: FLEXIBLE) * **nonlinear\_function** ([`NonLinearFunction`](https://docs.viktor.ai/sdk/api/external/scia/.md#NonLinearFunction "viktor.external.scia.object.NonLinearFunction")) – nonlinear function ([`create_nonlinear_function()`](#Model.create_nonlinear_function "viktor.external.scia.scia.Model.create_nonlinear_function")) (c1z = NONLINEAR\_FUNCTION only) * **c2x** (`float`) – \[N/m] * **c2y** (`float`) – \[N/m] * **is\_drained** (`bool`) – True for ‘drained’, False for ‘undrained’ (default: False) * **water\_air\_in\_clay\_subgrade** (`bool`) – (default: False) * **specific\_weight** (`float`) – specific weight \[kg/m3] (default: 0.0) * **fi** (`float`) – fi’ \[deg] (default: 0.0) * **sigma\_oc** (`float`) – sigma oc \[Pa] (default: 0.0) * **c** (`float`) – c’ \[Pa] (default: 0.0) * **cu** (`float`) – \[Pa] (default: 0.0) * Return type: [`Subsoil`](https://docs.viktor.ai/sdk/api/external/scia/.md#Subsoil "viktor.external.scia.object.Subsoil") - create\_surface\_load(*name*, *load\_case*, *plane*, *direction*, *load\_type*, *load\_value*, *c\_sys*, *location*)[](#Model.create_surface_load "Link to this definition") Method to construct a surface load on a plane. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **load\_case** ([`LoadCase`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCase "viktor.external.scia.object.LoadCase")) – previously created load case object in which the load should be placed * **plane** ([`Plane`](https://docs.viktor.ai/sdk/api/external/scia/.md#Plane "viktor.external.scia.object.Plane")) – plane object ([`create_plane()`](#Model.create_plane "viktor.external.scia.scia.Model.create_plane")) to which the load should be applied * **direction** ([`Direction`](https://docs.viktor.ai/sdk/api/external/scia/.md#SurfaceLoad.Direction "viktor.external.scia.object.SurfaceLoad.Direction")) – enumeration of directions * **load\_type** ([`Type`](https://docs.viktor.ai/sdk/api/external/scia/.md#SurfaceLoad.Type "viktor.external.scia.object.SurfaceLoad.Type")) – enumeration of load types * **load\_value** (`float`) – magnitude of the load in \[N] * **c\_sys** ([`CSys`](https://docs.viktor.ai/sdk/api/external/scia/.md#SurfaceLoad.CSys "viktor.external.scia.object.SurfaceLoad.CSys")) – enumeration of coordinate system types * **location** ([`Location`](https://docs.viktor.ai/sdk/api/external/scia/.md#SurfaceLoad.Location "viktor.external.scia.object.SurfaceLoad.Location")) – enumeration of location options * Return type: [`SurfaceLoad`](https://docs.viktor.ai/sdk/api/external/scia/.md#SurfaceLoad "viktor.external.scia.object.SurfaceLoad") * create\_surface\_support(*plane*, *subsoil*, *\**, *name=None*)[](#Model.create_surface_support "Link to this definition") Method to construct a surface support. * Parameters: * **plane** ([`Plane`](https://docs.viktor.ai/sdk/api/external/scia/.md#Plane "viktor.external.scia.object.Plane")) – plane object ([`create_plane()`](#Model.create_plane "viktor.external.scia.scia.Model.create_plane")) to which the support will be attached * **subsoil** ([`Subsoil`](https://docs.viktor.ai/sdk/api/external/scia/.md#Subsoil "viktor.external.scia.object.Subsoil")) – subsoil object ([`create_subsoil()`](#Model.create_subsoil "viktor.external.scia.scia.Model.create_subsoil")) representing the support * **name** (`str`) – name which will be shown in SCIA * Return type: [`SurfaceSupportSurface`](https://docs.viktor.ai/sdk/api/external/scia/.md#SurfaceSupportSurface "viktor.external.scia.object.SurfaceSupportSurface") - create\_thermal\_load(*name*, *load\_case*, *beam*, *distribution*, *delta*, *left\_delta*, *right\_delta*, *top\_delta*, *bottom\_delta*, *position\_start*, *position\_end*, *c\_def*, *origin*)[](#Model.create_thermal_load "Link to this definition") Method to construct a temperature load on a beam. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **load\_case** ([`LoadCase`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCase "viktor.external.scia.object.LoadCase")) – previously created load case object in which the load should be placed * **beam** ([`Beam`](https://docs.viktor.ai/sdk/api/external/scia/.md#Beam "viktor.external.scia.object.Beam")) – beam object ([`create_beam()`](#Model.create_beam "viktor.external.scia.scia.Model.create_beam")) to which the load should be applied * **distribution** ([`Distribution`](https://docs.viktor.ai/sdk/api/external/scia/.md#ThermalLoad.Distribution "viktor.external.scia.object.ThermalLoad.Distribution")) – enumeration of distribution options * **delta** (`float`) – temperature difference in case of a *CONSTANT* distribution * **left\_delta** (`float`) – temperature difference in +Y direction * **right\_delta** (`float`) – temperature difference in -Y direction * **top\_delta** (`float`) – temperature difference in +Z direction * **bottom\_delta** (`float`) – temperature difference in -Z direction * **position\_start** (`float`) – position of the start point on the beam in \[m] * **position\_end** (`float`) – position of the end point on the beam in \[m] * **c\_def** ([`CDef`](https://docs.viktor.ai/sdk/api/external/scia/.md#ThermalLoad.CDef "viktor.external.scia.object.ThermalLoad.CDef")) – enumeration of coordinate definition types * **origin** ([`Origin`](https://docs.viktor.ai/sdk/api/external/scia/.md#ThermalLoad.Origin "viktor.external.scia.object.ThermalLoad.Origin")) – enumeration of origin types * Return type: [`ThermalLoad`](https://docs.viktor.ai/sdk/api/external/scia/.md#ThermalLoad "viktor.external.scia.object.ThermalLoad") * create\_thermal\_surface\_load(*name*, *load\_case*, *plane*, *delta=None*, *top\_delta=None*, *bottom\_delta=None*)[](#Model.create_thermal_surface_load "Link to this definition") Method to construct a temperature load on a plane. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **load\_case** ([`LoadCase`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCase "viktor.external.scia.object.LoadCase")) – previously created load case object in which the load should be placed * **plane** ([`Plane`](https://docs.viktor.ai/sdk/api/external/scia/.md#Plane "viktor.external.scia.object.Plane")) – plane object ([`create_plane()`](#Model.create_plane "viktor.external.scia.scia.Model.create_plane")) to which the load should be applied * **delta** (`float`) – temperature difference in case of a constant distribution * **top\_delta** (`float`) – temperature difference in +Z direction * **bottom\_delta** (`float`) – temperature difference in -Z direction * Return type: [`ThermalSurfaceLoad`](https://docs.viktor.ai/sdk/api/external/scia/.md#ThermalSurfaceLoad "viktor.external.scia.object.ThermalSurfaceLoad") - create\_variable\_load\_case(*name*, *description*, *load\_group*, *load\_type*, *specification=None*, *duration=None*, *primary\_effect=None*)[](#Model.create_variable_load_case "Link to this definition") Method to construct a variable load case. * Parameters: * **name** (`str`) – name which will be shown in SCIA * **description** (`str`) – description which will be shown in SCIA * **load\_group** ([`LoadGroup`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadGroup "viktor.external.scia.object.LoadGroup")) – load group object ([`create_load_group()`](#Model.create_load_group "viktor.external.scia.scia.Model.create_load_group")) in which the load case should be placed. * **load\_type** ([`VariableLoadType`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCase.VariableLoadType "viktor.external.scia.object.LoadCase.VariableLoadType")) – enumeration of variable load types * **specification** ([`Specification`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCase.Specification "viktor.external.scia.object.LoadCase.Specification")) – enumeration of specification types * **duration** ([`Duration`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCase.Duration "viktor.external.scia.object.LoadCase.Duration")) – enumeration of duration types * **primary\_effect** ([`LoadCase`](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCase "viktor.external.scia.object.LoadCase")) – previously created load case object in case the selected load type is *PRIMARY\_EFFECT* * Return type: [`VariableLoadCase`](https://docs.viktor.ai/sdk/api/external/scia/.md#VariableLoadCase "viktor.external.scia.object.VariableLoadCase") * *property *cross\_links*: Tuple\[[CrossLink](https://docs.viktor.ai/sdk/api/external/scia/.md#CrossLink "viktor.external.scia.object.CrossLink"), ...]*[](#Model.cross_links "Link to this definition") New in v13.1.0 - *property *cross\_sections*: Tuple\[[CrossSection](https://docs.viktor.ai/sdk/api/external/scia/.md#CrossSection "viktor.external.scia.object.CrossSection"), ...]*[](#Model.cross_sections "Link to this definition") * *property *free\_line\_loads*: Tuple\[[FreeLineLoad](https://docs.viktor.ai/sdk/api/external/scia/.md#FreeLineLoad "viktor.external.scia.object.FreeLineLoad"), ...]*[](#Model.free_line_loads "Link to this definition") - *property *free\_point\_loads*: Tuple\[[FreePointLoad](https://docs.viktor.ai/sdk/api/external/scia/.md#FreePointLoad "viktor.external.scia.object.FreePointLoad"), ...]*[](#Model.free_point_loads "Link to this definition") * *property *free\_surface\_loads*: Tuple\[[FreeSurfaceLoad](https://docs.viktor.ai/sdk/api/external/scia/.md#FreeSurfaceLoad "viktor.external.scia.object.FreeSurfaceLoad"), ...]*[](#Model.free_surface_loads "Link to this definition") - generate\_xml\_input(*as\_file=False*)[](#Model.generate_xml_input "Link to this definition") Returns the input file XML representation of the SCIA model and corresponding .def file. Note This method needs to be mocked in (automated) unit and integration tests. * Return type: `Tuple`\[`BytesIO`, `BytesIO`] | `Tuple`\[[`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File"), [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] * Returns: * File if as\_file = True * BytesIO if as\_file = False (default) * *property *hinges\_on\_beam*: Tuple\[[HingeOnBeam](https://docs.viktor.ai/sdk/api/external/scia/.md#HingeOnBeam "viktor.external.scia.object.HingeOnBeam"), ...]*[](#Model.hinges_on_beam "Link to this definition") - *property *hinges\_on\_plane*: Tuple\[[HingeOnPlane](https://docs.viktor.ai/sdk/api/external/scia/.md#HingeOnPlane "viktor.external.scia.object.HingeOnPlane"), ...]*[](#Model.hinges_on_plane "Link to this definition") * *property *integration\_strips*: Tuple\[[IntegrationStrip](https://docs.viktor.ai/sdk/api/external/scia/.md#IntegrationStrip "viktor.external.scia.object.IntegrationStrip"), ...]*[](#Model.integration_strips "Link to this definition") - *property *internal\_edges*: Tuple\[[InternalEdge](https://docs.viktor.ai/sdk/api/external/scia/.md#InternalEdge "viktor.external.scia.object.InternalEdge"), ...]*[](#Model.internal_edges "Link to this definition") * *property *layers*: Tuple\[[Layer](https://docs.viktor.ai/sdk/api/external/scia/.md#Layer "viktor.external.scia.object.Layer"), ...]*[](#Model.layers "Link to this definition") - *property *line\_force\_surface\_list*: Tuple\[[LineForceSurface](https://docs.viktor.ai/sdk/api/external/scia/.md#LineForceSurface "viktor.external.scia.object.LineForceSurface"), ...]*[](#Model.line_force_surface_list "Link to this definition") * *property *line\_loads*: Tuple\[[LineLoad](https://docs.viktor.ai/sdk/api/external/scia/.md#LineLoad "viktor.external.scia.object.LineLoad"), ...]*[](#Model.line_loads "Link to this definition") - *property *line\_moments\_on\_beam*: Tuple\[[LineMomentOnBeam](https://docs.viktor.ai/sdk/api/external/scia/.md#LineMomentOnBeam "viktor.external.scia.object.LineMomentOnBeam"), ...]*[](#Model.line_moments_on_beam "Link to this definition") * *property *line\_moments\_on\_plane*: Tuple\[[LineMomentOnPlane](https://docs.viktor.ai/sdk/api/external/scia/.md#LineMomentOnPlane "viktor.external.scia.object.LineMomentOnPlane"), ...]*[](#Model.line_moments_on_plane "Link to this definition") - *property *line\_supports\_line*: Tuple\[[LineSupportLine](https://docs.viktor.ai/sdk/api/external/scia/.md#LineSupportLine "viktor.external.scia.object.LineSupportLine"), ...]*[](#Model.line_supports_line "Link to this definition") * *property *line\_supports\_surface*: Tuple\[[LineSupportSurface](https://docs.viktor.ai/sdk/api/external/scia/.md#LineSupportSurface "viktor.external.scia.object.LineSupportSurface"), ...]*[](#Model.line_supports_surface "Link to this definition") - *property *load\_cases*: Tuple\[[LoadCase](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCase "viktor.external.scia.object.LoadCase"), ...]*[](#Model.load_cases "Link to this definition") * *property *load\_combinations*: Tuple\[[LoadCombination](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadCombination "viktor.external.scia.object.LoadCombination"), ...]*[](#Model.load_combinations "Link to this definition") - *property *load\_groups*: Tuple\[[LoadGroup](https://docs.viktor.ai/sdk/api/external/scia/.md#LoadGroup "viktor.external.scia.object.LoadGroup"), ...]*[](#Model.load_groups "Link to this definition") * *property *mesh\_setup*: [MeshSetup](https://docs.viktor.ai/sdk/api/external/scia/.md#MeshSetup "viktor.external.scia.object.MeshSetup")*[](#Model.mesh_setup "Link to this definition") - *property *nodes*: Tuple\[[Node](https://docs.viktor.ai/sdk/api/external/scia/.md#Node "viktor.external.scia.object.Node"), ...]*[](#Model.nodes "Link to this definition") * *property *nonlinear\_functions*: Tuple\[[NonLinearFunction](https://docs.viktor.ai/sdk/api/external/scia/.md#NonLinearFunction "viktor.external.scia.object.NonLinearFunction"), ...]*[](#Model.nonlinear_functions "Link to this definition") - *property *nonlinear\_load\_combinations*: Tuple\[[NonLinearLoadCombination](https://docs.viktor.ai/sdk/api/external/scia/.md#NonLinearLoadCombination "viktor.external.scia.object.NonLinearLoadCombination"), ...]*[](#Model.nonlinear_load_combinations "Link to this definition") * *property *open\_slabs*: Tuple\[[OpenSlab](https://docs.viktor.ai/sdk/api/external/scia/.md#OpenSlab "viktor.external.scia.object.OpenSlab"), ...]*[](#Model.open_slabs "Link to this definition") - *property *orthotropy\_objects*: Tuple\[[Orthotropy](https://docs.viktor.ai/sdk/api/external/scia/.md#Orthotropy "viktor.external.scia.object.Orthotropy"), ...]*[](#Model.orthotropy_objects "Link to this definition") * *property *planes*: Tuple\[[Plane](https://docs.viktor.ai/sdk/api/external/scia/.md#Plane "viktor.external.scia.object.Plane"), ...]*[](#Model.planes "Link to this definition") - *property *point\_loads*: Tuple\[[PointLoad](https://docs.viktor.ai/sdk/api/external/scia/.md#PointLoad "viktor.external.scia.object.PointLoad"), ...]*[](#Model.point_loads "Link to this definition") * *property *point\_loads\_node*: Tuple\[[PointLoadNode](https://docs.viktor.ai/sdk/api/external/scia/.md#PointLoadNode "viktor.external.scia.object.PointLoadNode"), ...]*[](#Model.point_loads_node "Link to this definition") - *property *point\_moments\_node*: Tuple\[[PointMomentNode](https://docs.viktor.ai/sdk/api/external/scia/.md#PointMomentNode "viktor.external.scia.object.PointMomentNode"), ...]*[](#Model.point_moments_node "Link to this definition") * *property *point\_supports*: Tuple\[[PointSupport](https://docs.viktor.ai/sdk/api/external/scia/.md#PointSupport "viktor.external.scia.object.PointSupport"), ...]*[](#Model.point_supports "Link to this definition") - *property *point\_supports\_line*: Tuple\[[PointSupportLine](https://docs.viktor.ai/sdk/api/external/scia/.md#PointSupportLine "viktor.external.scia.object.PointSupportLine"), ...]*[](#Model.point_supports_line "Link to this definition") * *property *project\_data*: [ProjectData](https://docs.viktor.ai/sdk/api/external/scia/.md#ProjectData "viktor.external.scia.object.ProjectData")*[](#Model.project_data "Link to this definition") New in v13.1.0 - *property *result\_classes*: Tuple\[[ResultClass](https://docs.viktor.ai/sdk/api/external/scia/.md#ResultClass "viktor.external.scia.object.ResultClass"), ...]*[](#Model.result_classes "Link to this definition") * *property *rigid\_arms*: Tuple\[[RigidArm](https://docs.viktor.ai/sdk/api/external/scia/.md#RigidArm "viktor.external.scia.object.RigidArm"), ...]*[](#Model.rigid_arms "Link to this definition") - *property *sections\_on\_beam*: Tuple\[[SectionOnBeam](https://docs.viktor.ai/sdk/api/external/scia/.md#SectionOnBeam "viktor.external.scia.object.SectionOnBeam"), ...]*[](#Model.sections_on_beam "Link to this definition") * *property *sections\_on\_plane*: Tuple\[[SectionOnPlane](https://docs.viktor.ai/sdk/api/external/scia/.md#SectionOnPlane "viktor.external.scia.object.SectionOnPlane"), ...]*[](#Model.sections_on_plane "Link to this definition") - *property *selections*: Tuple\[[Selection](https://docs.viktor.ai/sdk/api/external/scia/.md#Selection "viktor.external.scia.object.Selection"), ...]*[](#Model.selections "Link to this definition") * *property *solver\_setup*: [SolverSetup](https://docs.viktor.ai/sdk/api/external/scia/.md#SolverSetup "viktor.external.scia.object.SolverSetup")*[](#Model.solver_setup "Link to this definition") New in v13.1.0 - *property *subsoils*: Tuple\[[Subsoil](https://docs.viktor.ai/sdk/api/external/scia/.md#Subsoil "viktor.external.scia.object.Subsoil"), ...]*[](#Model.subsoils "Link to this definition") * *property *surface\_loads*: Tuple\[[SurfaceLoad](https://docs.viktor.ai/sdk/api/external/scia/.md#SurfaceLoad "viktor.external.scia.object.SurfaceLoad"), ...]*[](#Model.surface_loads "Link to this definition") - *property *surface\_supports*: Tuple\[[SurfaceSupportSurface](https://docs.viktor.ai/sdk/api/external/scia/.md#SurfaceSupportSurface "viktor.external.scia.object.SurfaceSupportSurface"), ...]*[](#Model.surface_supports "Link to this definition") * *property *thermal\_loads*: Tuple\[[ThermalLoad](https://docs.viktor.ai/sdk/api/external/scia/.md#ThermalLoad "viktor.external.scia.object.ThermalLoad"), ...]*[](#Model.thermal_loads "Link to this definition") - *property *thermal\_surface\_loads*: Tuple\[[ThermalSurfaceLoad](https://docs.viktor.ai/sdk/api/external/scia/.md#ThermalSurfaceLoad "viktor.external.scia.object.ThermalSurfaceLoad"), ...]*[](#Model.thermal_surface_loads "Link to this definition") * update\_concrete\_material(*object\_id*, *name*, *part*, *thermal\_expansion=None*, *unit\_mass=None*, *wet\_density=None*, *e\_modulus=None*, *poisson=None*, *g\_modulus=None*, *log\_decrement=None*, *specific\_heat=None*, *thermal\_conductivity=None*, *\**, *fck=None*)[](#Model.update_concrete_material "Link to this definition") This method can update specific properties of an already existing concrete material in the \*.esa model. * Parameters: * **object\_id** (`int`) – id of the material in SCIA * **name** (`str`) – name which will be shown in SCIA * **part** ([`ECPart`](https://docs.viktor.ai/sdk/api/external/scia/.md#Concrete.ECPart "viktor.external.scia.object.Concrete.ECPart")) – enumeration of concrete types * **thermal\_expansion** (`float`) – thermal expansion in \[m/mK] * **unit\_mass** (`float`) – density in \[kg/m3] * **wet\_density** (`float`) – wet density in \[kg/m3] * **e\_modulus** (`float`) – Young’s modulus in \[Pa] * **poisson** (`float`) – Poisson ratio * **g\_modulus** (`float`) – shear modulus in \[Pa] * **log\_decrement** (`float`) – log. decrement * **specific\_heat** (`float`) – specific heat in \[J/kgK] * **thermal\_conductivity** (`float`) – thermal conductivity in \[W/mK] * **fck** (`float`) – characteristic compressive cylinder strength \[Pa] * Return type: [`Concrete`](https://docs.viktor.ai/sdk/api/external/scia/.md#Concrete "viktor.external.scia.object.Concrete") <!-- --> ## OutputFileParser[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_OutputFileParser "Direct link to OutputFileParser") * *class *viktor.external.scia.scia.OutputFileParser[](#OutputFileParser "Link to this definition") Helper class to extract results from a SCIA output file (.xml). Example using BytesIO: ``` xml_output_file = scia_analysis.get_xml_output_file() result_table = OutputFileParser.get_result(xml_output_file, 'Reactions') another_result_table = OutputFileParser.get_result(xml_output_file, '2D internal forces') ``` Example using [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File"): ``` xml_output_file = scia_analysis.get_xml_output_file(as_file=True) with xml_output_file.open_binary() as f: result_table = OutputFileParser.get_result(f, 'Reactions') another_result_table = OutputFileParser.get_result(f, '2D internal forces') ``` * *classmethod *get\_result(*file*, *table\_name*, *\**, *parent=None*)[](#OutputFileParser.get_result "Link to this definition") Retrieve the results of an output XML by ‘table\_name’. This corresponds to the ‘name’ attribute that is found in the XML table, e.g. “Result classes - UGT” in the example below: ``` <container id="..." t="..."> <table id="..." t="..." name="Result classes - UGT"> ``` In case indenting has been used in the SCIA I/O doc, multiple tables with the name ‘table\_name’ will be found. A parent name can be specified as input to account for this indenting (up to 1 indent level). If indenting is used but no parent name is specified, this method will return the first ‘table\_name’ table it can find. * Parameters: * **file** (`BinaryIO`) – SCIA output file (.xml). * **table\_name** (`str`) – Name of the result table to be extracted from the output XML. * **parent** (`str`) – Name of the parent, e.g. a result class. * Return type: `Dict`\[`str`, `dict`] - :raises [`viktor.errors.SciaParsingError`](https://docs.viktor.ai/sdk/api/errors/.md#SciaParsingError "viktor.errors.SciaParsingError"): * if table ‘table\_name’ could not be found in the provided output file * if no results were found in the XML table ‘table\_name’ <!-- --> ## ResultType[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_ResultType "Direct link to ResultType") * *class *viktor.external.scia.scia.ResultType(*\*values*)[](#ResultType "Link to this definition") Bases: `Enum` Enumeration of result types: * ENGINEERING\_REPORT*: [`ResultType`](#ResultType "viktor.external.scia.scia.ResultType")** = 'ENGINEERING\_REPORT'*[](#ResultType.ENGINEERING_REPORT "Link to this definition") - MODEL*: [`ResultType`](#ResultType "viktor.external.scia.scia.ResultType")** = 'MODEL'*[](#ResultType.MODEL "Link to this definition") * NONE*: [`ResultType`](#ResultType "viktor.external.scia.scia.ResultType")** = 'XML'*[](#ResultType.NONE "Link to this definition") <!-- --> ## SciaAnalysis[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_SciaAnalysis "Direct link to SciaAnalysis") * *class *viktor.external.scia.scia.SciaAnalysis(*input\_file*, *xml\_def\_file*, *scia\_model*, *calculation\_setting=CalcSetting.LIN*, *xml\_doc\_name='output'*, *\**, *result\_type=ResultType.MODEL*, *output\_document=''*)[](#SciaAnalysis "Link to this definition") Bases: [`ExternalProgram`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram "viktor.external.external_program.ExternalProgram") SciaAnalysis can be used to perform an analysis using SCIA on a third-party worker. To start an analysis call the method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute"), with an appropriate timeout (in seconds). To retrieve the output file call the method [`get_xml_output_file()`](#SciaAnalysis.get_xml_output_file "viktor.external.scia.scia.SciaAnalysis.get_xml_output_file") after [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute"). Usage: ``` input_file = BytesIO("scia input file content".encode()) xml_def_file = BytesIO("scia xml def file content".encode()) scia_model = BytesIO("scia model content".encode()) scia_analysis = SciaAnalysis(input_file=input_file, xml_def_file=xml_def_file, scia_model=scia_model) scia_analysis.execute(timeout=600) xml_output_file = scia_analysis.get_xml_output_file() ``` Besides the output XML file, you can also retrieve the updated SCIA model. This is achieved using the result\_type: ``` scia_analysis = SciaAnalysis(input_file=input_file, xml_def_file=xml_def_file, scia_model=scia_model, result_type=ResultType.MODEL) scia_analysis.execute(timeout=600) updated_esa_file = scia_analysis.get_updated_esa_model() ``` or the Engineering Report: ``` scia_analysis = SciaAnalysis(input_file=input_file, xml_def_file=xml_def_file, scia_model=scia_model, result_type=ResultType.ENGINEERING_REPORT, output_document='report1') scia_analysis.execute(timeout=600) engineering_report = scia_analysis.get_engineering_report() ``` Exceptions which can be raised during calculation: > * [`viktor.errors.LicenseError`](https://docs.viktor.ai/sdk/api/errors/.md#LicenseError "viktor.errors.LicenseError"): no license available > > * [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information * Parameters: * **input\_file** (`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – SCIA input .xml file. * **xml\_def\_file** (`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – SCIA input .def file. * **scia\_model** (`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – SCIA .esa model. * **calculation\_setting** ([`CalcSetting`](#CalcSetting "viktor.external.scia.scia.CalcSetting")) – Available calculation settings according to the documentation of ESA\_XML.exe: * NONE = without any recalculations * NOC = No calculation * LIN = Linear calculation (Delete all calculated results when exists) * NEL = Nonlinear calculation * CON = Nonlinear concrete calculation * EIG = Eigen frequencies calculation * STB = Stability calculation * INF = Influence lines calculation * MOB = Mobile loads calculation * TDA = TDA calculation * SLN = Soilin calculation * PHA = Phases calculation * NPH = Nonlinear phases * CSS = Recalculation of cross sections * NST = Nonlinear stability * TID = Test of input data - solver link only * **xml\_doc\_name** (`str`) – Name of XML IO document for export. * **result\_type** ([`ResultType`](#ResultType "viktor.external.scia.scia.ResultType")) – Type of output which should be returned besides the output.xml: * ResultType.NONE returns nothing * ResultType.MODEL returns the updated SCIA model (.esa) after calculation * ResultType.ENGINEERING\_REPORT returns the specified engineering report * **output\_document** (`str`) – Document name of the report which should be returned. This name should match the exact name of the report as defined in the .esa model. * Raises: **ValueError** – if Engineering Report is selected as result\_type, but no output\_document is specified. - get\_engineering\_report(*as\_file=False*)[](#SciaAnalysis.get_engineering_report "Link to this definition") Method can be used to retrieve the Engineering Report (.pdf). Make sure to call method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute") first and [`get_engineering_report()`](#SciaAnalysis.get_engineering_report "viktor.external.scia.scia.SciaAnalysis.get_engineering_report") afterwards. * Return type: `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | `None` * Returns: * File, if as\_file = True * BytesIO, if as\_file = False (default) * get\_updated\_esa\_model(*as\_file=False*)[](#SciaAnalysis.get_updated_esa_model "Link to this definition") Method can be used to retrieve the updated SCIA model file (.esa), which contains the data that is read into the model while calling ESA\_XML.exe. Make sure to call method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute") first and [`get_updated_esa_model()`](#SciaAnalysis.get_updated_esa_model "viktor.external.scia.scia.SciaAnalysis.get_updated_esa_model") afterwards. * Return type: `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | `None` * Returns: * File, if as\_file = True * BytesIO, if as\_file = False (default) - *static *get\_xml\_def\_name(*input\_file*)[](#SciaAnalysis.get_xml_def_name "Link to this definition") * Return type: `str` * get\_xml\_output\_file(*as\_file=False*)[](#SciaAnalysis.get_xml_output_file "Link to this definition") Method can be used to retrieve the results generated by running an external analysis. This method returns the output XML file that is generated by SCIA. Make sure to call method [`execute()`](https://docs.viktor.ai/sdk/api/external/external-program/.md#ExternalProgram.execute "viktor.external.external_program.ExternalProgram.execute") first and [`get_xml_output_file()`](#SciaAnalysis.get_xml_output_file "viktor.external.scia.scia.SciaAnalysis.get_xml_output_file") afterwards. * Return type: `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | `None` * Returns: * File, if as\_file = True * BytesIO, if as\_file = False (default) <!-- --> <!-- --> ## ArbitraryProfile[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_ArbitraryProfile "Direct link to ArbitraryProfile") * *class *viktor.external.scia.object.ArbitraryProfile(*object\_id*, *name*, *beam*, *c\_def*, *cross\_section*, *spans*)[](#ArbitraryProfile "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_arbitrary_profile()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_arbitrary_profile "viktor.external.scia.scia.Model.create_arbitrary_profile") * *class *CDef(*\*values*)[](#ArbitraryProfile.CDef "Link to this definition") Bases: `Enum` * **ABSOLUTE** - absolute * **RELATIVE** - relative - ABSOLUTE*: [`CDef`](#ArbitraryProfile.CDef "viktor.external.scia.object.ArbitraryProfile.CDef")** = 0*[](#ArbitraryProfile.CDef.ABSOLUTE "Link to this definition") * RELATIVE*: [`CDef`](#ArbitraryProfile.CDef "viktor.external.scia.object.ArbitraryProfile.CDef")** = 1*[](#ArbitraryProfile.CDef.RELATIVE "Link to this definition") - *property *beam*: [Beam](#Beam "viktor.external.scia.object.Beam")*[](#ArbitraryProfile.beam "Link to this definition") * *property *cross\_section*: [CrossSection](#CrossSection "viktor.external.scia.object.CrossSection")*[](#ArbitraryProfile.cross_section "Link to this definition") - *property *spans*: List\[[ArbitraryProfileSpan](#ArbitraryProfileSpan "viktor.external.scia.object.ArbitraryProfileSpan")]*[](#ArbitraryProfile.spans "Link to this definition") <!-- --> ## ArbitraryProfileSpan[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_ArbitraryProfileSpan "Direct link to ArbitraryProfileSpan") * *class *viktor.external.scia.object.ArbitraryProfileSpan(*length*, *type\_of\_css*, *cross\_section\_start*, *cross\_section\_end*, *alignment*)[](#ArbitraryProfileSpan "Link to this definition") Do not use this \_\_init\_\_ directly, but create the object by [`create_arbitrary_profile_span()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_arbitrary_profile_span "viktor.external.scia.scia.Model.create_arbitrary_profile_span") * *class *Alignment(*\*values*)[](#ArbitraryProfileSpan.Alignment "Link to this definition") Bases: `Enum` * **DEFAULT** - see “Default” at <https://help.scia.net/18.1/en/rb/modelling/haunch_beam.htm#Haunch_Alignment> * **CENTER\_LINE** - see “Centre line” at <https://help.scia.net/18.1/en/rb/modelling/haunch_beam.htm#Haunch_Alignment> * **TOP\_SURFACE** - see “Top surface” at <https://help.scia.net/18.1/en/rb/modelling/haunch_beam.htm#Haunch_Alignment> * **BOTTOM\_SURFACE** - see “Bottom surface” at <https://help.scia.net/18.1/en/rb/modelling/haunch_beam.htm#Haunch_Alignment> * **LEFT\_SURFACE** - see “Left surface” at <https://help.scia.net/18.1/en/rb/modelling/haunch_beam.htm#Haunch_Alignment> * **RIGHT\_SURFACE** - see “Right surface” at <https://help.scia.net/18.1/en/rb/modelling/haunch_beam.htm#Haunch_Alignment> * **TOP\_LEFT** - * **TOP\_RIGHT** - * **BOTTOM\_LEFT** - * **BOTTOM\_RIGHT** - - BOTTOM\_LEFT*: [`Alignment`](#ArbitraryProfileSpan.Alignment "viktor.external.scia.object.ArbitraryProfileSpan.Alignment")** = 8*[](#ArbitraryProfileSpan.Alignment.BOTTOM_LEFT "Link to this definition") * BOTTOM\_RIGHT*: [`Alignment`](#ArbitraryProfileSpan.Alignment "viktor.external.scia.object.ArbitraryProfileSpan.Alignment")** = 9*[](#ArbitraryProfileSpan.Alignment.BOTTOM_RIGHT "Link to this definition") - BOTTOM\_SURFACE*: [`Alignment`](#ArbitraryProfileSpan.Alignment "viktor.external.scia.object.ArbitraryProfileSpan.Alignment")** = 3*[](#ArbitraryProfileSpan.Alignment.BOTTOM_SURFACE "Link to this definition") * CENTER\_LINE*: [`Alignment`](#ArbitraryProfileSpan.Alignment "viktor.external.scia.object.ArbitraryProfileSpan.Alignment")** = 1*[](#ArbitraryProfileSpan.Alignment.CENTER_LINE "Link to this definition") - DEFAULT*: [`Alignment`](#ArbitraryProfileSpan.Alignment "viktor.external.scia.object.ArbitraryProfileSpan.Alignment")** = 0*[](#ArbitraryProfileSpan.Alignment.DEFAULT "Link to this definition") * LEFT\_SURFACE*: [`Alignment`](#ArbitraryProfileSpan.Alignment "viktor.external.scia.object.ArbitraryProfileSpan.Alignment")** = 4*[](#ArbitraryProfileSpan.Alignment.LEFT_SURFACE "Link to this definition") - RIGHT\_SURFACE*: [`Alignment`](#ArbitraryProfileSpan.Alignment "viktor.external.scia.object.ArbitraryProfileSpan.Alignment")** = 5*[](#ArbitraryProfileSpan.Alignment.RIGHT_SURFACE "Link to this definition") * TOP\_LEFT*: [`Alignment`](#ArbitraryProfileSpan.Alignment "viktor.external.scia.object.ArbitraryProfileSpan.Alignment")** = 6*[](#ArbitraryProfileSpan.Alignment.TOP_LEFT "Link to this definition") - TOP\_RIGHT*: [`Alignment`](#ArbitraryProfileSpan.Alignment "viktor.external.scia.object.ArbitraryProfileSpan.Alignment")** = 7*[](#ArbitraryProfileSpan.Alignment.TOP_RIGHT "Link to this definition") * TOP\_SURFACE*: [`Alignment`](#ArbitraryProfileSpan.Alignment "viktor.external.scia.object.ArbitraryProfileSpan.Alignment")** = 2*[](#ArbitraryProfileSpan.Alignment.TOP_SURFACE "Link to this definition") - *class *TypeOfCss(*\*values*)[](#ArbitraryProfileSpan.TypeOfCss "Link to this definition") Bases: `Enum` * **PRISMATIC** - The cross-section of the span is constant. * **PARAM\_HAUNCH** - A standard haunch is inserted into the span. * **TWO\_CSS** - Two cross-sections corresponding to the two end-points of the span are defined. The cross-section varies over the span from one section to the other. - PARAM\_HAUNCH*: [`TypeOfCss`](#ArbitraryProfileSpan.TypeOfCss "viktor.external.scia.object.ArbitraryProfileSpan.TypeOfCss")** = 1*[](#ArbitraryProfileSpan.TypeOfCss.PARAM_HAUNCH "Link to this definition") * PRISMATIC*: [`TypeOfCss`](#ArbitraryProfileSpan.TypeOfCss "viktor.external.scia.object.ArbitraryProfileSpan.TypeOfCss")** = 0*[](#ArbitraryProfileSpan.TypeOfCss.PRISMATIC "Link to this definition") - TWO\_CSS*: [`TypeOfCss`](#ArbitraryProfileSpan.TypeOfCss "viktor.external.scia.object.ArbitraryProfileSpan.TypeOfCss")** = 2*[](#ArbitraryProfileSpan.TypeOfCss.TWO_CSS "Link to this definition") * *property *cross\_section\_end*: [CrossSection](#CrossSection "viktor.external.scia.object.CrossSection")*[](#ArbitraryProfileSpan.cross_section_end "Link to this definition") - *property *cross\_section\_start*: [CrossSection](#CrossSection "viktor.external.scia.object.CrossSection")*[](#ArbitraryProfileSpan.cross_section_start "Link to this definition") <!-- --> ## AveragingStrip[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_AveragingStrip "Direct link to AveragingStrip") * *class *viktor.external.scia.object.AveragingStrip(*object\_id*, *name*, *plane*, *strip\_type*, *point\_1*, *width*, *length*, *angle*, *direction*)[](#AveragingStrip "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_averaging_strip()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_averaging_strip "viktor.external.scia.scia.Model.create_averaging_strip") * *class *Direction(*\*values*)[](#AveragingStrip.Direction "Link to this definition") Bases: `Enum` * BOTH*: [`Direction`](#AveragingStrip.Direction "viktor.external.scia.object.AveragingStrip.Direction")** = 2*[](#AveragingStrip.Direction.BOTH "Link to this definition") - LONGITUDINAL*: [`Direction`](#AveragingStrip.Direction "viktor.external.scia.object.AveragingStrip.Direction")** = 0*[](#AveragingStrip.Direction.LONGITUDINAL "Link to this definition") * NONE*: [`Direction`](#AveragingStrip.Direction "viktor.external.scia.object.AveragingStrip.Direction")** = 3*[](#AveragingStrip.Direction.NONE "Link to this definition") - PERPENDICULAR*: [`Direction`](#AveragingStrip.Direction "viktor.external.scia.object.AveragingStrip.Direction")** = 1*[](#AveragingStrip.Direction.PERPENDICULAR "Link to this definition") - *class *Type(*\*values*)[](#AveragingStrip.Type "Link to this definition") Bases: `Enum` * POINT*: AveragingStrip.POINT** = 1*[](#AveragingStrip.Type.POINT "Link to this definition") * *property *plane*: [Plane](#Plane "viktor.external.scia.object.Plane")*[](#AveragingStrip.plane "Link to this definition") <!-- --> ## Beam[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_Beam "Direct link to Beam") * *class *viktor.external.scia.object.Beam(*object\_id*, *name*, *begin\_node*, *end\_node*, *cross\_section*, *ez=None*, *lcs\_rotation=None*, *layer=None*)[](#Beam "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_beam()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_beam "viktor.external.scia.scia.Model.create_beam") * *property *begin\_node*: [Node](#Node "viktor.external.scia.object.Node")*[](#Beam.begin_node "Link to this definition") - *property *cross\_section*: [CrossSection](#CrossSection "viktor.external.scia.object.CrossSection")*[](#Beam.cross_section "Link to this definition") * *property *end\_node*: [Node](#Node "viktor.external.scia.object.Node")*[](#Beam.end_node "Link to this definition") - *property *ez*: float*[](#Beam.ez "Link to this definition") <!-- --> ## CircularComposedCrossSection[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_CircularComposedCrossSection "Direct link to CircularComposedCrossSection") * *class *viktor.external.scia.object.CircularComposedCrossSection(*object\_id*, *name*, *material*, *material\_2*, *diameter*, *thickness*)[](#CircularComposedCrossSection "Link to this definition") Bases: [`ComposedCrossSection`](#ComposedCrossSection "viktor.external.scia.object.ComposedCrossSection") Do not use this \_\_init\_\_ directly, but create the object by [`create_circular_composed_cross_section()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_circular_composed_cross_section "viktor.external.scia.scia.Model.create_circular_composed_cross_section") <!-- --> ## CircularCrossSection[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_CircularCrossSection "Direct link to CircularCrossSection") * *class *viktor.external.scia.object.CircularCrossSection(*object\_id*, *name*, *material*, *diameter*)[](#CircularCrossSection "Link to this definition") Bases: [`CrossSection`](#CrossSection "viktor.external.scia.object.CrossSection") Do not use this \_\_init\_\_ directly, but create the object by [`create_circular_cross_section()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_circular_cross_section "viktor.external.scia.scia.Model.create_circular_cross_section") <!-- --> ## CircularHollowCrossSection[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_CircularHollowCrossSection "Direct link to CircularHollowCrossSection") * *class *viktor.external.scia.object.CircularHollowCrossSection(*object\_id*, *name*, *material*, *diameter*, *thickness*)[](#CircularHollowCrossSection "Link to this definition") Bases: [`CrossSection`](#CrossSection "viktor.external.scia.object.CrossSection") Do not use this \_\_init\_\_ directly, but create the object by [`create_circular_hollow_cross_section()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_circular_hollow_cross_section "viktor.external.scia.scia.Model.create_circular_hollow_cross_section") <!-- --> ## ComposedCrossSection[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_ComposedCrossSection "Direct link to ComposedCrossSection") * *class *viktor.external.scia.object.ComposedCrossSection(*object\_id*, *name*, *material*, *material\_2*)[](#ComposedCrossSection "Link to this definition") Bases: [`CrossSection`](#CrossSection "viktor.external.scia.object.CrossSection") Abstract base class of all cross sections, composed of two materials. <!-- --> ## Concrete[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_Concrete "Direct link to Concrete") * *class *viktor.external.scia.object.Concrete(*object\_id*, *name*, *part*, *thermal\_expansion=None*, *unit\_mass=None*, *wet\_density=None*, *e\_modulus=None*, *poisson=None*, *g\_modulus=None*, *log\_decrement=None*, *specific\_heat=None*, *thermal\_conductivity=None*, *\**, *fck=None*)[](#Concrete "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`update_concrete_material()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.update_concrete_material "viktor.external.scia.scia.Model.update_concrete_material") * *class *ECPart(*\*values*)[](#Concrete.ECPart "Link to this definition") Bases: `Enum` * **GENERAL** - concrete EN 1992-1-1 * **BRIDGES** - concrete EN 1992-2 - BRIDGES*: [`ECPart`](#Concrete.ECPart "viktor.external.scia.object.Concrete.ECPart")** = 1*[](#Concrete.ECPart.BRIDGES "Link to this definition") * GENERAL*: [`ECPart`](#Concrete.ECPart "viktor.external.scia.object.Concrete.ECPart")** = 0*[](#Concrete.ECPart.GENERAL "Link to this definition") - *property *ec\_part*: [ECPart](#Concrete.ECPart "viktor.external.scia.object.Concrete.ECPart")*[](#Concrete.ec_part "Link to this definition") <!-- --> ## CrossLink[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_CrossLink "Direct link to CrossLink") * *class *viktor.external.scia.object.CrossLink(*object\_id*, *name*, *beam\_1*, *beam\_2*)[](#CrossLink "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_cross_link()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_cross_link "viktor.external.scia.scia.Model.create_cross_link") <!-- --> ## CrossSection[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_CrossSection "Direct link to CrossSection") * *class *viktor.external.scia.object.CrossSection(*object\_id*, *name*, *material*)[](#CrossSection "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Abstract base class of all cross sections. <!-- --> ## FreeLineLoad[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_FreeLineLoad "Direct link to FreeLineLoad") * *class *viktor.external.scia.object.FreeLineLoad(*object\_id*, *name*, *load\_case*, *point\_1*, *point\_2*, *direction*, *magnitude\_1*, *magnitude\_2*, *distribution=Distribution.TRAPEZOIDAL*, *validity=Validity.ALL*, *load\_type=Type.FORCE*, *select=Select.AUTO*, *system=CSys.GLOBAL*, *location=Location.LENGTH*)[](#FreeLineLoad "Link to this definition") Bases: [`FreeLoad`](#FreeLoad "viktor.external.scia.object.FreeLoad") Do not use this \_\_init\_\_ directly, but create the object by [`create_free_line_load()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_free_line_load "viktor.external.scia.scia.Model.create_free_line_load") * *class *Distribution(*\*values*)[](#FreeLineLoad.Distribution "Link to this definition") Bases: `Enum` * TRAPEZOIDAL*: [`Distribution`](#FreeLineLoad.Distribution "viktor.external.scia.object.FreeLineLoad.Distribution")** = 1*[](#FreeLineLoad.Distribution.TRAPEZOIDAL "Link to this definition") - UNIFORM*: [`Distribution`](#FreeLineLoad.Distribution "viktor.external.scia.object.FreeLineLoad.Distribution")** = 0*[](#FreeLineLoad.Distribution.UNIFORM "Link to this definition") <!-- --> ## FreeLoad[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_FreeLoad "Direct link to FreeLoad") * *class *viktor.external.scia.object.FreeLoad(*object\_id*, *name*, *load\_case*, *direction*, *select*, *validity=None*, *load\_type=None*, *c\_sys=None*)[](#FreeLoad "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Abstract base class of all free loads. * Do not use this \_\_init\_\_ directly, but create the object by [`create_free_point_load()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_free_point_load "viktor.external.scia.scia.Model.create_free_point_load"), [`create_free_line_load()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_free_line_load "viktor.external.scia.scia.Model.create_free_line_load") or [`create_free_surface_load()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_free_surface_load "viktor.external.scia.scia.Model.create_free_surface_load") - *class *CSys(*\*values*)[](#FreeLoad.CSys "Link to this definition") Bases: `Enum` * GLOBAL*: [`CSys`](#FreeLoad.CSys "viktor.external.scia.object.FreeLoad.CSys")** = 0*[](#FreeLoad.CSys.GLOBAL "Link to this definition") - LOAD\_LCS*: [`CSys`](#FreeLoad.CSys "viktor.external.scia.object.FreeLoad.CSys")** = 2*[](#FreeLoad.CSys.LOAD_LCS "Link to this definition") * MEMBER\_LCS*: [`CSys`](#FreeLoad.CSys "viktor.external.scia.object.FreeLoad.CSys")** = 1*[](#FreeLoad.CSys.MEMBER_LCS "Link to this definition") * *class *Direction(*\*values*)[](#FreeLoad.Direction "Link to this definition") Bases: `Enum` * X*: [`Direction`](#FreeLoad.Direction "viktor.external.scia.object.FreeLoad.Direction")** = 0*[](#FreeLoad.Direction.X "Link to this definition") - Y*: [`Direction`](#FreeLoad.Direction "viktor.external.scia.object.FreeLoad.Direction")** = 1*[](#FreeLoad.Direction.Y "Link to this definition") * Z*: [`Direction`](#FreeLoad.Direction "viktor.external.scia.object.FreeLoad.Direction")** = 2*[](#FreeLoad.Direction.Z "Link to this definition") - *class *Location(*\*values*)[](#FreeLoad.Location "Link to this definition") Bases: `Enum` * LENGTH*: [`Location`](#FreeLoad.Location "viktor.external.scia.object.FreeLoad.Location")** = 0*[](#FreeLoad.Location.LENGTH "Link to this definition") - PROJECTION*: [`Location`](#FreeLoad.Location "viktor.external.scia.object.FreeLoad.Location")** = 1*[](#FreeLoad.Location.PROJECTION "Link to this definition") * *class *Select(*\*values*)[](#FreeLoad.Select "Link to this definition") Bases: `Enum` * AUTO*: [`Select`](#FreeLoad.Select "viktor.external.scia.object.FreeLoad.Select")** = 0*[](#FreeLoad.Select.AUTO "Link to this definition") - SELECT*: [`Select`](#FreeLoad.Select "viktor.external.scia.object.FreeLoad.Select")** = 1*[](#FreeLoad.Select.SELECT "Link to this definition") - *class *Type(*\*values*)[](#FreeLoad.Type "Link to this definition") Bases: `Enum` * FORCE*: [`Type`](#FreeLoad.Type "viktor.external.scia.object.FreeLoad.Type")** = 0*[](#FreeLoad.Type.FORCE "Link to this definition") * *class *Validity(*\*values*)[](#FreeLoad.Validity "Link to this definition") Bases: `Enum` * ALL*: [`Validity`](#FreeLoad.Validity "viktor.external.scia.object.FreeLoad.Validity")** = 0*[](#FreeLoad.Validity.ALL "Link to this definition") - FROM\_TO*: [`Validity`](#FreeLoad.Validity "viktor.external.scia.object.FreeLoad.Validity")** = 3*[](#FreeLoad.Validity.FROM_TO "Link to this definition") * NEG\_Z*: [`Validity`](#FreeLoad.Validity "viktor.external.scia.object.FreeLoad.Validity")** = 1*[](#FreeLoad.Validity.NEG_Z "Link to this definition") - NEG\_Z\_INCL\_ZERO*: [`Validity`](#FreeLoad.Validity "viktor.external.scia.object.FreeLoad.Validity")** = 5*[](#FreeLoad.Validity.NEG_Z_INCL_ZERO "Link to this definition") * POS\_Z*: [`Validity`](#FreeLoad.Validity "viktor.external.scia.object.FreeLoad.Validity")** = 2*[](#FreeLoad.Validity.POS_Z "Link to this definition") - POS\_Z\_INCL\_ZERO*: [`Validity`](#FreeLoad.Validity "viktor.external.scia.object.FreeLoad.Validity")** = 6*[](#FreeLoad.Validity.POS_Z_INCL_ZERO "Link to this definition") * ZERO\_Z*: [`Validity`](#FreeLoad.Validity "viktor.external.scia.object.FreeLoad.Validity")** = 4*[](#FreeLoad.Validity.ZERO_Z "Link to this definition") - *property *load\_case*: [LoadCase](#LoadCase "viktor.external.scia.object.LoadCase")*[](#FreeLoad.load_case "Link to this definition") <!-- --> ## FreePointLoad[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_FreePointLoad "Direct link to FreePointLoad") * *class *viktor.external.scia.object.FreePointLoad(*object\_id*, *name*, *load\_case*, *direction*, *magnitude*, *position*, *load\_type=Type.FORCE*, *validity=Validity.ALL*, *select=Select.AUTO*, *system=CSys.GLOBAL*)[](#FreePointLoad "Link to this definition") Bases: [`FreeLoad`](#FreeLoad "viktor.external.scia.object.FreeLoad") Do not use this \_\_init\_\_ directly, but create the object by [`create_free_point_load()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_free_point_load "viktor.external.scia.scia.Model.create_free_point_load") <!-- --> ## FreeSurfaceLoad[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_FreeSurfaceLoad "Direct link to FreeSurfaceLoad") * *class *viktor.external.scia.object.FreeSurfaceLoad(*object\_id*, *name*, *load\_case*, *direction*, *q1*, *q2=None*, *q3=None*, *points=None*, *distribution=None*, *load\_type=None*, *validity=None*, *system=None*, *location=None*, *selection=None*)[](#FreeSurfaceLoad "Link to this definition") Bases: [`FreeLoad`](#FreeLoad "viktor.external.scia.object.FreeLoad") Do not use this \_\_init\_\_ directly, but create the object by [`create_free_surface_load()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_free_surface_load "viktor.external.scia.scia.Model.create_free_surface_load") * *class *Distribution(*\*values*)[](#FreeSurfaceLoad.Distribution "Link to this definition") Bases: `Enum` * DIR\_X*: [`Distribution`](#FreeSurfaceLoad.Distribution "viktor.external.scia.object.FreeSurfaceLoad.Distribution")** = 1*[](#FreeSurfaceLoad.Distribution.DIR_X "Link to this definition") - DIR\_Y*: [`Distribution`](#FreeSurfaceLoad.Distribution "viktor.external.scia.object.FreeSurfaceLoad.Distribution")** = 2*[](#FreeSurfaceLoad.Distribution.DIR_Y "Link to this definition") * POINTS*: [`Distribution`](#FreeSurfaceLoad.Distribution "viktor.external.scia.object.FreeSurfaceLoad.Distribution")** = 3*[](#FreeSurfaceLoad.Distribution.POINTS "Link to this definition") - UNIFORM*: [`Distribution`](#FreeSurfaceLoad.Distribution "viktor.external.scia.object.FreeSurfaceLoad.Distribution")** = 0*[](#FreeSurfaceLoad.Distribution.UNIFORM "Link to this definition") - *property *distribution*: [Distribution](#FreeSurfaceLoad.Distribution "viktor.external.scia.object.FreeSurfaceLoad.Distribution")*[](#FreeSurfaceLoad.distribution "Link to this definition") * *property *points*: List\[Tuple\[float, float]] | None*[](#FreeSurfaceLoad.points "Link to this definition") - *property *q2*: float | None*[](#FreeSurfaceLoad.q2 "Link to this definition") * *property *q3*: float | None*[](#FreeSurfaceLoad.q3 "Link to this definition") - *property *selection*: List\[[Plane](#Plane "viktor.external.scia.object.Plane")] | None*[](#FreeSurfaceLoad.selection "Link to this definition") <!-- --> ## GeneralCrossSection[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_GeneralCrossSection "Direct link to GeneralCrossSection") * *class *viktor.external.scia.object.GeneralCrossSection(*object\_id*, *name*, *material*, *elements*)[](#GeneralCrossSection "Link to this definition") Bases: [`CrossSection`](#CrossSection "viktor.external.scia.object.CrossSection") Do not use this \_\_init\_\_ directly, but create the object by [`create_general_cross_section()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_general_cross_section "viktor.external.scia.scia.Model.create_general_cross_section") <!-- --> ## GeneralCrossSectionElement[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_GeneralCrossSectionElement "Direct link to GeneralCrossSectionElement") * *class *viktor.external.scia.object.GeneralCrossSectionElement(*name*, *element\_type*, *points*, *\**, *material=None*)[](#GeneralCrossSectionElement "Link to this definition") Do not use this \_\_init\_\_ directly, but create the object by [`create_general_cross_section_element()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_general_cross_section_element "viktor.external.scia.scia.Model.create_general_cross_section_element") * *class *Type(*\*values*)[](#GeneralCrossSectionElement.Type "Link to this definition") Bases: `Enum` * OPENING*: [`Type`](#GeneralCrossSectionElement.Type "viktor.external.scia.object.GeneralCrossSectionElement.Type")** = 1*[](#GeneralCrossSectionElement.Type.OPENING "Link to this definition") - POLYGON*: [`Type`](#GeneralCrossSectionElement.Type "viktor.external.scia.object.GeneralCrossSectionElement.Type")** = 0*[](#GeneralCrossSectionElement.Type.POLYGON "Link to this definition") <!-- --> ## HingeOnBeam[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_HingeOnBeam "Direct link to HingeOnBeam") * *class *viktor.external.scia.object.HingeOnBeam(*object\_id*, *name*, *beam*, *position*, *freedom\_ux=Freedom.FREE*, *freedom\_uy=Freedom.FREE*, *freedom\_uz=Freedom.FREE*, *freedom\_fix=Freedom.FREE*, *freedom\_fiy=Freedom.FREE*, *freedom\_fiz=Freedom.FREE*, *stiffness\_ux=0*, *stiffness\_uy=0*, *stiffness\_uz=0*, *stiffness\_fix=0*, *stiffness\_fiy=0*, *stiffness\_fiz=0*)[](#HingeOnBeam "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_hinge_on_beam()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_hinge_on_beam "viktor.external.scia.scia.Model.create_hinge_on_beam"). * *class *Freedom(*\*values*)[](#HingeOnBeam.Freedom "Link to this definition") Bases: `Enum` * **FREE** - The support is free in the specified direction. That is it imposes no constraint in the direction. * **RIGID** - The support in fully rigid in the specified direction. * **FLEXIBLE** - The support is flexible (elastic) in the specified direction. The user has to define the required stiffness of the support. - FLEXIBLE*: [`Freedom`](#HingeOnBeam.Freedom "viktor.external.scia.object.HingeOnBeam.Freedom")** = 2*[](#HingeOnBeam.Freedom.FLEXIBLE "Link to this definition") * FREE*: [`Freedom`](#HingeOnBeam.Freedom "viktor.external.scia.object.HingeOnBeam.Freedom")** = 0*[](#HingeOnBeam.Freedom.FREE "Link to this definition") - RIGID*: [`Freedom`](#HingeOnBeam.Freedom "viktor.external.scia.object.HingeOnBeam.Freedom")** = 1*[](#HingeOnBeam.Freedom.RIGID "Link to this definition") - *class *Position(*\*values*)[](#HingeOnBeam.Position "Link to this definition") Bases: `Enum` * BEGIN*: [`Position`](#HingeOnBeam.Position "viktor.external.scia.object.HingeOnBeam.Position")** = 0*[](#HingeOnBeam.Position.BEGIN "Link to this definition") - BOTH*: [`Position`](#HingeOnBeam.Position "viktor.external.scia.object.HingeOnBeam.Position")** = 2*[](#HingeOnBeam.Position.BOTH "Link to this definition") * END*: [`Position`](#HingeOnBeam.Position "viktor.external.scia.object.HingeOnBeam.Position")** = 1*[](#HingeOnBeam.Position.END "Link to this definition") * *property *beam*: [Beam](#Beam "viktor.external.scia.object.Beam")*[](#HingeOnBeam.beam "Link to this definition") - *property *freedom*: Tuple\[[Freedom](#HingeOnBeam.Freedom "viktor.external.scia.object.HingeOnBeam.Freedom"), [Freedom](#HingeOnBeam.Freedom "viktor.external.scia.object.HingeOnBeam.Freedom"), [Freedom](#HingeOnBeam.Freedom "viktor.external.scia.object.HingeOnBeam.Freedom"), [Freedom](#HingeOnBeam.Freedom "viktor.external.scia.object.HingeOnBeam.Freedom"), [Freedom](#HingeOnBeam.Freedom "viktor.external.scia.object.HingeOnBeam.Freedom"), [Freedom](#HingeOnBeam.Freedom "viktor.external.scia.object.HingeOnBeam.Freedom")]*[](#HingeOnBeam.freedom "Link to this definition") ux, uy, uz, fix, fiy, fiz * *property *stiffness*: Tuple\[float, float, float, float, float, float]*[](#HingeOnBeam.stiffness "Link to this definition") ux, uy, uz, fix, fiy, fiz <!-- --> ## HingeOnPlane[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_HingeOnPlane "Direct link to HingeOnPlane") * *class *viktor.external.scia.object.HingeOnPlane(*object\_id*, *name*, *edge*, *ux=None*, *stiffness\_ux=None*, *uy=None*, *stiffness\_uy=None*, *uz=None*, *stiffness\_uz=None*, *fix=None*, *stiffness\_fix=None*, *c\_def=None*, *position\_x1=None*, *position\_x2=None*, *origin=None*)[](#HingeOnPlane "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_hinge_on_plane()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_hinge_on_plane "viktor.external.scia.scia.Model.create_hinge_on_plane"). * *class *CDef(*\*values*)[](#HingeOnPlane.CDef "Link to this definition") Bases: `Enum` * **ABSOLUTE** - absolute, where the coordinate must lie between 0 and the length of the plane edge * **RELATIVE** - relative, where the coordinate must lie between 0 and 1 - ABSOLUTE*: [`CDef`](#HingeOnPlane.CDef "viktor.external.scia.object.HingeOnPlane.CDef")** = 0*[](#HingeOnPlane.CDef.ABSOLUTE "Link to this definition") * RELATIVE*: [`CDef`](#HingeOnPlane.CDef "viktor.external.scia.object.HingeOnPlane.CDef")** = 1*[](#HingeOnPlane.CDef.RELATIVE "Link to this definition") - *class *Freedom(*\*values*)[](#HingeOnPlane.Freedom "Link to this definition") Bases: `Enum` * **FREE** - The support is free in the specified direction. That is it imposes no constraint in the direction. * **RIGID** - The support in fully rigid in the specified direction. * **FLEXIBLE** - The support is flexible (elastic) in the specified direction. The user has to define the required stiffness of the support. - FLEXIBLE*: [`Freedom`](#HingeOnPlane.Freedom "viktor.external.scia.object.HingeOnPlane.Freedom")** = 2*[](#HingeOnPlane.Freedom.FLEXIBLE "Link to this definition") * FREE*: [`Freedom`](#HingeOnPlane.Freedom "viktor.external.scia.object.HingeOnPlane.Freedom")** = 0*[](#HingeOnPlane.Freedom.FREE "Link to this definition") - RIGID*: [`Freedom`](#HingeOnPlane.Freedom "viktor.external.scia.object.HingeOnPlane.Freedom")** = 1*[](#HingeOnPlane.Freedom.RIGID "Link to this definition") * *class *Origin(*\*values*)[](#HingeOnPlane.Origin "Link to this definition") Bases: `Enum` * **FROM\_START** - position is measured from the beginning of the plane edge * **FROM\_END** - position is measured from the end of the plane edge - FROM\_END*: [`Origin`](#HingeOnPlane.Origin "viktor.external.scia.object.HingeOnPlane.Origin")** = 1*[](#HingeOnPlane.Origin.FROM_END "Link to this definition") * FROM\_START*: [`Origin`](#HingeOnPlane.Origin "viktor.external.scia.object.HingeOnPlane.Origin")** = 0*[](#HingeOnPlane.Origin.FROM_START "Link to this definition") - *property *plane*: [Plane](#Plane "viktor.external.scia.object.Plane")*[](#HingeOnPlane.plane "Link to this definition") <!-- --> ## IntegrationStrip[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_IntegrationStrip "Direct link to IntegrationStrip") * *class *viktor.external.scia.object.IntegrationStrip(*object\_id*, *name*, *plane*, *point\_1*, *point\_2*, *width*, *effective\_width\_geometry=\_EffectiveWidthGeometry.CONSTANT\_SYMMETRIC*, *effective\_width\_definition=\_EffectiveWidthDefinition.WIDTH*)[](#IntegrationStrip "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_integration_strip()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_integration_strip "viktor.external.scia.scia.Model.create_integration_strip") * *property *plane*: [Plane](#Plane "viktor.external.scia.object.Plane")*[](#IntegrationStrip.plane "Link to this definition") <!-- --> ## InternalEdge[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_InternalEdge "Direct link to InternalEdge") * *class *viktor.external.scia.object.InternalEdge(*object\_id*, *name*, *plane*, *node\_1*, *node\_2*)[](#InternalEdge "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_internal_edge()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_internal_edge "viktor.external.scia.scia.Model.create_internal_edge") * *property *node\_1*: [Node](#Node "viktor.external.scia.object.Node")*[](#InternalEdge.node_1 "Link to this definition") - *property *node\_2*: [Node](#Node "viktor.external.scia.object.Node")*[](#InternalEdge.node_2 "Link to this definition") * *property *plane*: [Plane](#Plane "viktor.external.scia.object.Plane")*[](#InternalEdge.plane "Link to this definition") <!-- --> ## Layer[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_Layer "Direct link to Layer") * *class *viktor.external.scia.object.Layer(*object\_id*, *name*, *comment=None*, *structural\_model\_only=None*, *current\_used\_activity=None*)[](#Layer "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_layer()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_layer "viktor.external.scia.scia.Model.create_layer") <!-- --> ## LibraryCrossSection[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_LibraryCrossSection "Direct link to LibraryCrossSection") * *class *viktor.external.scia.object.LibraryCrossSection(*object\_id*, *name*, *material*, *section*, *profile*)[](#LibraryCrossSection "Link to this definition") Bases: [`CrossSection`](#CrossSection "viktor.external.scia.object.CrossSection") Do not use this \_\_init\_\_ directly, but create the object by [`create_library_cross_section()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_library_cross_section "viktor.external.scia.scia.Model.create_library_cross_section") * *class *Section(*\*values*)[](#LibraryCrossSection.Section "Link to this definition") Bases: `Enum` * ASYMMETRIC\_I*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 101*[](#LibraryCrossSection.Section.ASYMMETRIC_I "Link to this definition") - CHANNEL*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 5*[](#LibraryCrossSection.Section.CHANNEL "Link to this definition") * CIRCULAR\_HOLLOW*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 3*[](#LibraryCrossSection.Section.CIRCULAR_HOLLOW "Link to this definition") - COLD\_FORMED\_2C*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 130*[](#LibraryCrossSection.Section.COLD_FORMED_2C "Link to this definition") * COLD\_FORMED\_ANGLE*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 111*[](#LibraryCrossSection.Section.COLD_FORMED_ANGLE "Link to this definition") - COLD\_FORMED\_C*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 114*[](#LibraryCrossSection.Section.COLD_FORMED_C "Link to this definition") * COLD\_FORMED\_CHANNEL*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 112*[](#LibraryCrossSection.Section.COLD_FORMED_CHANNEL "Link to this definition") - COLD\_FORMED\_C\_EAVES\_BEAM*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 116*[](#LibraryCrossSection.Section.COLD_FORMED_C_EAVES_BEAM "Link to this definition") * COLD\_FORMED\_C\_PLUS*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 117*[](#LibraryCrossSection.Section.COLD_FORMED_C_PLUS "Link to this definition") - COLD\_FORMED\_IS\_PLUS*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 128*[](#LibraryCrossSection.Section.COLD_FORMED_IS_PLUS "Link to this definition") * COLD\_FORMED\_I\_PLUS*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 127*[](#LibraryCrossSection.Section.COLD_FORMED_I_PLUS "Link to this definition") - COLD\_FORMED\_OMEGA*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 115*[](#LibraryCrossSection.Section.COLD_FORMED_OMEGA "Link to this definition") * COLD\_FORMED\_SIGMA*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 121*[](#LibraryCrossSection.Section.COLD_FORMED_SIGMA "Link to this definition") - COLD\_FORMED\_SIGMA\_ASYMMETRIC*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 129*[](#LibraryCrossSection.Section.COLD_FORMED_SIGMA_ASYMMETRIC "Link to this definition") * COLD\_FORMED\_SIGMA\_EAVES\_BEAM*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 124*[](#LibraryCrossSection.Section.COLD_FORMED_SIGMA_EAVES_BEAM "Link to this definition") - COLD\_FORMED\_SIGMA\_PLUS*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 123*[](#LibraryCrossSection.Section.COLD_FORMED_SIGMA_PLUS "Link to this definition") * COLD\_FORMED\_SIGMA\_PLUS\_EAVES\_BEAM*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 125*[](#LibraryCrossSection.Section.COLD_FORMED_SIGMA_PLUS_EAVES_BEAM "Link to this definition") - COLD\_FORMED\_SIGMA\_STIFFENED*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 122*[](#LibraryCrossSection.Section.COLD_FORMED_SIGMA_STIFFENED "Link to this definition") * COLD\_FORMED\_Z*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 113*[](#LibraryCrossSection.Section.COLD_FORMED_Z "Link to this definition") - COLD\_FORMED\_ZED*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 118*[](#LibraryCrossSection.Section.COLD_FORMED_ZED "Link to this definition") * COLD\_FORMED\_ZED\_ASYMMETRIC\_LIPS*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 119*[](#LibraryCrossSection.Section.COLD_FORMED_ZED_ASYMMETRIC_LIPS "Link to this definition") - COLD\_FORMED\_ZED\_BOTH\_LIPS\_INCLINED*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 126*[](#LibraryCrossSection.Section.COLD_FORMED_ZED_BOTH_LIPS_INCLINED "Link to this definition") * COLD\_FORMED\_ZED\_INCLINED\_LIP*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 120*[](#LibraryCrossSection.Section.COLD_FORMED_ZED_INCLINED_LIP "Link to this definition") - FULL\_CIRCULAR*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 11*[](#LibraryCrossSection.Section.FULL_CIRCULAR "Link to this definition") * FULL\_RECTANGULAR*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 7*[](#LibraryCrossSection.Section.FULL_RECTANGULAR "Link to this definition") - GENERAL\_COLD\_FORMED*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 110*[](#LibraryCrossSection.Section.GENERAL_COLD_FORMED "Link to this definition") * I*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 1*[](#LibraryCrossSection.Section.I "Link to this definition") - IFBA*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 154*[](#LibraryCrossSection.Section.IFBA "Link to this definition") * IFBB*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 155*[](#LibraryCrossSection.Section.IFBB "Link to this definition") - L*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 4*[](#LibraryCrossSection.Section.L "Link to this definition") * MINUS\_L*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 1002*[](#LibraryCrossSection.Section.MINUS_L "Link to this definition") - RAIL\_TYPE\_KA*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 150*[](#LibraryCrossSection.Section.RAIL_TYPE_KA "Link to this definition") * RAIL\_TYPE\_KF*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 151*[](#LibraryCrossSection.Section.RAIL_TYPE_KF "Link to this definition") - RAIL\_TYPE\_KG*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 152*[](#LibraryCrossSection.Section.RAIL_TYPE_KG "Link to this definition") * RECTANGULAR\_HOLLOW*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 2*[](#LibraryCrossSection.Section.RECTANGULAR_HOLLOW "Link to this definition") - ROLLED\_Z*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 102*[](#LibraryCrossSection.Section.ROLLED_Z "Link to this definition") * SFB*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 153*[](#LibraryCrossSection.Section.SFB "Link to this definition") - T*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 6*[](#LibraryCrossSection.Section.T "Link to this definition") * THQ*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 156*[](#LibraryCrossSection.Section.THQ "Link to this definition") - VIRTUAL\_JOIST*: [`Section`](#LibraryCrossSection.Section "viktor.external.scia.object.LibraryCrossSection.Section")** = 160*[](#LibraryCrossSection.Section.VIRTUAL_JOIST "Link to this definition") <!-- --> ## LineForceSurface[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_LineForceSurface "Direct link to LineForceSurface") * *class *viktor.external.scia.object.LineForceSurface(*object\_id*, *name*, *edge*, *load\_case*, *p1*, *p2=None*, *direction=None*, *location=None*, *c\_sys=None*, *c\_def=None*, *position\_x1=None*, *position\_x2=None*, *origin=None*)[](#LineForceSurface "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_line_load_on_plane()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_line_load_on_plane "viktor.external.scia.scia.Model.create_line_load_on_plane") * *class *CDef(*\*values*)[](#LineForceSurface.CDef "Link to this definition") Bases: `Enum` * **ABSOLUTE** - absolute, where the coordinate must lie between 0 and the length of the plane edge * **RELATIVE** - relative, where the coordinate must lie between 0 and 1 - ABSOLUTE*: [`CDef`](#LineForceSurface.CDef "viktor.external.scia.object.LineForceSurface.CDef")** = 0*[](#LineForceSurface.CDef.ABSOLUTE "Link to this definition") * RELATIVE*: [`CDef`](#LineForceSurface.CDef "viktor.external.scia.object.LineForceSurface.CDef")** = 1*[](#LineForceSurface.CDef.RELATIVE "Link to this definition") - *class *CSys(*\*values*)[](#LineForceSurface.CSys "Link to this definition") Bases: `Enum` * GLOBAL*: [`CSys`](#LineForceSurface.CSys "viktor.external.scia.object.LineForceSurface.CSys")** = 0*[](#LineForceSurface.CSys.GLOBAL "Link to this definition") - LOCAL*: [`CSys`](#LineForceSurface.CSys "viktor.external.scia.object.LineForceSurface.CSys")** = 1*[](#LineForceSurface.CSys.LOCAL "Link to this definition") * *class *Direction(*\*values*)[](#LineForceSurface.Direction "Link to this definition") Bases: `Enum` * X*: [`Direction`](#LineForceSurface.Direction "viktor.external.scia.object.LineForceSurface.Direction")** = 0*[](#LineForceSurface.Direction.X "Link to this definition") - Y*: [`Direction`](#LineForceSurface.Direction "viktor.external.scia.object.LineForceSurface.Direction")** = 1*[](#LineForceSurface.Direction.Y "Link to this definition") * Z*: [`Direction`](#LineForceSurface.Direction "viktor.external.scia.object.LineForceSurface.Direction")** = 2*[](#LineForceSurface.Direction.Z "Link to this definition") - *class *Distribution(*\*values*)[](#LineForceSurface.Distribution "Link to this definition") Bases: `Enum` * TRAPEZOIDAL*: [`Distribution`](#LineForceSurface.Distribution "viktor.external.scia.object.LineForceSurface.Distribution")** = 1*[](#LineForceSurface.Distribution.TRAPEZOIDAL "Link to this definition") - UNIFORM*: [`Distribution`](#LineForceSurface.Distribution "viktor.external.scia.object.LineForceSurface.Distribution")** = 0*[](#LineForceSurface.Distribution.UNIFORM "Link to this definition") * *class *Location(*\*values*)[](#LineForceSurface.Location "Link to this definition") Bases: `Enum` * LENGTH*: [`Location`](#LineForceSurface.Location "viktor.external.scia.object.LineForceSurface.Location")** = 0*[](#LineForceSurface.Location.LENGTH "Link to this definition") - PROJECTION*: [`Location`](#LineForceSurface.Location "viktor.external.scia.object.LineForceSurface.Location")** = 1*[](#LineForceSurface.Location.PROJECTION "Link to this definition") - *class *Origin(*\*values*)[](#LineForceSurface.Origin "Link to this definition") Bases: `Enum` * **FROM\_START** - position is measured from the beginning of the plane edge * **FROM\_END** - position is measured from the end of the plane edge - FROM\_END*: [`Origin`](#LineForceSurface.Origin "viktor.external.scia.object.LineForceSurface.Origin")** = 1*[](#LineForceSurface.Origin.FROM_END "Link to this definition") * FROM\_START*: [`Origin`](#LineForceSurface.Origin "viktor.external.scia.object.LineForceSurface.Origin")** = 0*[](#LineForceSurface.Origin.FROM_START "Link to this definition") * *property *c\_def*: [CDef](#LineForceSurface.CDef "viktor.external.scia.object.LineForceSurface.CDef")*[](#LineForceSurface.c_def "Link to this definition") - *property *c\_sys*: [CSys](#LineForceSurface.CSys "viktor.external.scia.object.LineForceSurface.CSys")*[](#LineForceSurface.c_sys "Link to this definition") * *property *distribution*: [Distribution](#LineForceSurface.Distribution "viktor.external.scia.object.LineForceSurface.Distribution")*[](#LineForceSurface.distribution "Link to this definition") - *property *load\_case*: [LoadCase](#LoadCase "viktor.external.scia.object.LoadCase")*[](#LineForceSurface.load_case "Link to this definition") * *property *location*: [Location](#LineForceSurface.Location "viktor.external.scia.object.LineForceSurface.Location")*[](#LineForceSurface.location "Link to this definition") - *property *origin*: [Origin](#LineForceSurface.Origin "viktor.external.scia.object.LineForceSurface.Origin")*[](#LineForceSurface.origin "Link to this definition") * *property *plane*: [Plane](#Plane "viktor.external.scia.object.Plane")*[](#LineForceSurface.plane "Link to this definition") - *property *position\_x1*: float | None*[](#LineForceSurface.position_x1 "Link to this definition") * *property *position\_x2*: float | None*[](#LineForceSurface.position_x2 "Link to this definition") <!-- --> ## LineLoad[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_LineLoad "Direct link to LineLoad") * *class *viktor.external.scia.object.LineLoad(*object\_id*, *name*, *load\_case*, *beam*, *load\_type*, *distribution*, *load\_start*, *load\_end*, *direction*, *c\_sys*, *position\_start*, *position\_end*, *c\_def*, *origin*, *ey*, *ez*)[](#LineLoad "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_line_load()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_line_load "viktor.external.scia.scia.Model.create_line_load") * *class *CDef(*\*values*)[](#LineLoad.CDef "Link to this definition") Bases: `Enum` * **ABSOLUTE** - absolute, where the coordinate must lie between 0 and the length of the beam * **RELATIVE** - relative, where the coordinate must lie between 0 and 1 - ABSOLUTE*: [`CDef`](#LineLoad.CDef "viktor.external.scia.object.LineLoad.CDef")** = 0*[](#LineLoad.CDef.ABSOLUTE "Link to this definition") * RELATIVE*: [`CDef`](#LineLoad.CDef "viktor.external.scia.object.LineLoad.CDef")** = 1*[](#LineLoad.CDef.RELATIVE "Link to this definition") - *class *CSys(*\*values*)[](#LineLoad.CSys "Link to this definition") Bases: `Enum` * GLOBAL*: [`CSys`](#LineLoad.CSys "viktor.external.scia.object.LineLoad.CSys")** = 0*[](#LineLoad.CSys.GLOBAL "Link to this definition") - LOCAL*: [`CSys`](#LineLoad.CSys "viktor.external.scia.object.LineLoad.CSys")** = 1*[](#LineLoad.CSys.LOCAL "Link to this definition") * *class *Direction(*\*values*)[](#LineLoad.Direction "Link to this definition") Bases: `Enum` * X*: [`Direction`](#LineLoad.Direction "viktor.external.scia.object.LineLoad.Direction")** = 0*[](#LineLoad.Direction.X "Link to this definition") - Y*: [`Direction`](#LineLoad.Direction "viktor.external.scia.object.LineLoad.Direction")** = 1*[](#LineLoad.Direction.Y "Link to this definition") * Z*: [`Direction`](#LineLoad.Direction "viktor.external.scia.object.LineLoad.Direction")** = 2*[](#LineLoad.Direction.Z "Link to this definition") - *class *Distribution(*\*values*)[](#LineLoad.Distribution "Link to this definition") Bases: `Enum` * TRAPEZOIDAL*: [`Distribution`](#LineLoad.Distribution "viktor.external.scia.object.LineLoad.Distribution")** = 1*[](#LineLoad.Distribution.TRAPEZOIDAL "Link to this definition") - UNIFORM*: [`Distribution`](#LineLoad.Distribution "viktor.external.scia.object.LineLoad.Distribution")** = 0*[](#LineLoad.Distribution.UNIFORM "Link to this definition") * *class *Origin(*\*values*)[](#LineLoad.Origin "Link to this definition") Bases: `Enum` * **FROM\_START** - position is measured from the beginning of the beam * **FROM\_END** - position is measured from the end of the beam - FROM\_END*: [`Origin`](#LineLoad.Origin "viktor.external.scia.object.LineLoad.Origin")** = 1*[](#LineLoad.Origin.FROM_END "Link to this definition") * FROM\_START*: [`Origin`](#LineLoad.Origin "viktor.external.scia.object.LineLoad.Origin")** = 0*[](#LineLoad.Origin.FROM_START "Link to this definition") - *class *Type(*\*values*)[](#LineLoad.Type "Link to this definition") Bases: `Enum` * FORCE*: [`Type`](#LineLoad.Type "viktor.external.scia.object.LineLoad.Type")** = 0*[](#LineLoad.Type.FORCE "Link to this definition") - SELF\_WEIGHT*: [`Type`](#LineLoad.Type "viktor.external.scia.object.LineLoad.Type")** = 1*[](#LineLoad.Type.SELF_WEIGHT "Link to this definition") * *property *beam*: [Beam](#Beam "viktor.external.scia.object.Beam")*[](#LineLoad.beam "Link to this definition") - *property *load\_case*: [LoadCase](#LoadCase "viktor.external.scia.object.LoadCase")*[](#LineLoad.load_case "Link to this definition") <!-- --> ## LineMomentOnBeam[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_LineMomentOnBeam "Direct link to LineMomentOnBeam") * *class *viktor.external.scia.object.LineMomentOnBeam(*object\_id*, *name*, *beam*, *load\_case*, *m1*, *m2=None*, *direction=None*, *c\_def=None*, *position\_x1=None*, *position\_x2=None*, *origin=None*)[](#LineMomentOnBeam "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_line_moment_on_beam()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_line_moment_on_beam "viktor.external.scia.scia.Model.create_line_moment_on_beam"). * *class *CDef(*\*values*)[](#LineMomentOnBeam.CDef "Link to this definition") Bases: `Enum` * **ABSOLUTE** - absolute, where the coordinate must lie between 0 and the length of the beam * **RELATIVE** - relative, where the coordinate must lie between 0 and 1 - ABSOLUTE*: [`CDef`](#LineMomentOnBeam.CDef "viktor.external.scia.object.LineMomentOnBeam.CDef")** = 0*[](#LineMomentOnBeam.CDef.ABSOLUTE "Link to this definition") * RELATIVE*: [`CDef`](#LineMomentOnBeam.CDef "viktor.external.scia.object.LineMomentOnBeam.CDef")** = 1*[](#LineMomentOnBeam.CDef.RELATIVE "Link to this definition") - *class *Direction(*\*values*)[](#LineMomentOnBeam.Direction "Link to this definition") Bases: `Enum` * X*: [`Direction`](#LineMomentOnBeam.Direction "viktor.external.scia.object.LineMomentOnBeam.Direction")** = 0*[](#LineMomentOnBeam.Direction.X "Link to this definition") - Y*: [`Direction`](#LineMomentOnBeam.Direction "viktor.external.scia.object.LineMomentOnBeam.Direction")** = 1*[](#LineMomentOnBeam.Direction.Y "Link to this definition") * Z*: [`Direction`](#LineMomentOnBeam.Direction "viktor.external.scia.object.LineMomentOnBeam.Direction")** = 2*[](#LineMomentOnBeam.Direction.Z "Link to this definition") * *class *Origin(*\*values*)[](#LineMomentOnBeam.Origin "Link to this definition") Bases: `Enum` * **FROM\_START** - position is measured from the beginning of the beam * **FROM\_END** - position is measured from the end of the beam - FROM\_END*: [`Origin`](#LineMomentOnBeam.Origin "viktor.external.scia.object.LineMomentOnBeam.Origin")** = 1*[](#LineMomentOnBeam.Origin.FROM_END "Link to this definition") * FROM\_START*: [`Origin`](#LineMomentOnBeam.Origin "viktor.external.scia.object.LineMomentOnBeam.Origin")** = 0*[](#LineMomentOnBeam.Origin.FROM_START "Link to this definition") <!-- --> ## LineMomentOnPlane[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_LineMomentOnPlane "Direct link to LineMomentOnPlane") * *class *viktor.external.scia.object.LineMomentOnPlane(*object\_id*, *name*, *edge*, *load\_case*, *m1*, *m2=None*, *direction=None*, *c\_def=None*, *position\_x1=None*, *position\_x2=None*, *origin=None*)[](#LineMomentOnPlane "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_line_moment_on_plane()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_line_moment_on_plane "viktor.external.scia.scia.Model.create_line_moment_on_plane"). * *class *CDef(*\*values*)[](#LineMomentOnPlane.CDef "Link to this definition") Bases: `Enum` * **ABSOLUTE** - absolute, where the coordinate must lie between 0 and the length of the plane edge * **RELATIVE** - relative, where the coordinate must lie between 0 and 1 - ABSOLUTE*: [`CDef`](#LineMomentOnPlane.CDef "viktor.external.scia.object.LineMomentOnPlane.CDef")** = 0*[](#LineMomentOnPlane.CDef.ABSOLUTE "Link to this definition") * RELATIVE*: [`CDef`](#LineMomentOnPlane.CDef "viktor.external.scia.object.LineMomentOnPlane.CDef")** = 1*[](#LineMomentOnPlane.CDef.RELATIVE "Link to this definition") - *class *Direction(*\*values*)[](#LineMomentOnPlane.Direction "Link to this definition") Bases: `Enum` * X*: [`Direction`](#LineMomentOnPlane.Direction "viktor.external.scia.object.LineMomentOnPlane.Direction")** = 0*[](#LineMomentOnPlane.Direction.X "Link to this definition") - Y*: [`Direction`](#LineMomentOnPlane.Direction "viktor.external.scia.object.LineMomentOnPlane.Direction")** = 1*[](#LineMomentOnPlane.Direction.Y "Link to this definition") * Z*: [`Direction`](#LineMomentOnPlane.Direction "viktor.external.scia.object.LineMomentOnPlane.Direction")** = 2*[](#LineMomentOnPlane.Direction.Z "Link to this definition") * *class *Origin(*\*values*)[](#LineMomentOnPlane.Origin "Link to this definition") Bases: `Enum` * **FROM\_START** - position is measured from the beginning of the plane edge * **FROM\_END** - position is measured from the end of the plane edge - FROM\_END*: [`Origin`](#LineMomentOnPlane.Origin "viktor.external.scia.object.LineMomentOnPlane.Origin")** = 1*[](#LineMomentOnPlane.Origin.FROM_END "Link to this definition") * FROM\_START*: [`Origin`](#LineMomentOnPlane.Origin "viktor.external.scia.object.LineMomentOnPlane.Origin")** = 0*[](#LineMomentOnPlane.Origin.FROM_START "Link to this definition") - *property *plane*: [Plane](#Plane "viktor.external.scia.object.Plane")*[](#LineMomentOnPlane.plane "Link to this definition") <!-- --> ## LineSupport[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_LineSupport "Direct link to LineSupport") * *class *viktor.external.scia.object.LineSupport(*object\_id*, *name*, *x=None*, *stiffness\_x=None*, *function\_x=None*, *y=None*, *stiffness\_y=None*, *function\_y=None*, *z=None*, *stiffness\_z=None*, *function\_z=None*, *rx=None*, *stiffness\_rx=None*, *function\_rx=None*, *ry=None*, *stiffness\_ry=None*, *function\_ry=None*, *rz=None*, *stiffness\_rz=None*, *function\_rz=None*, *c\_sys=None*, *c\_def=None*, *position\_x1=None*, *position\_x2=None*, *origin=None*)[](#LineSupport "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Abstract base class of all line supports. * *class *CDef(*\*values*)[](#LineSupport.CDef "Link to this definition") Bases: `Enum` * **ABSOLUTE** - absolute, where the coordinate must lie between 0 and the length of the beam * **RELATIVE** - relative, where the coordinate must lie between 0 and 1 - ABSOLUTE*: [`CDef`](#LineSupport.CDef "viktor.external.scia.object.LineSupport.CDef")** = 0*[](#LineSupport.CDef.ABSOLUTE "Link to this definition") * RELATIVE*: [`CDef`](#LineSupport.CDef "viktor.external.scia.object.LineSupport.CDef")** = 1*[](#LineSupport.CDef.RELATIVE "Link to this definition") - *class *CSys(*\*values*)[](#LineSupport.CSys "Link to this definition") Bases: `Enum` * GLOBAL*: [`CSys`](#LineSupport.CSys "viktor.external.scia.object.LineSupport.CSys")** = 0*[](#LineSupport.CSys.GLOBAL "Link to this definition") - LOCAL*: [`CSys`](#LineSupport.CSys "viktor.external.scia.object.LineSupport.CSys")** = 1*[](#LineSupport.CSys.LOCAL "Link to this definition") * *class *Constraint(*\*values*)[](#LineSupport.Constraint "Link to this definition") Bases: `Enum` * CUSTOM*: [`Constraint`](#LineSupport.Constraint "viktor.external.scia.object.LineSupport.Constraint")** = 3*[](#LineSupport.Constraint.CUSTOM "Link to this definition") - FIXED*: [`Constraint`](#LineSupport.Constraint "viktor.external.scia.object.LineSupport.Constraint")** = 0*[](#LineSupport.Constraint.FIXED "Link to this definition") * HINGED*: [`Constraint`](#LineSupport.Constraint "viktor.external.scia.object.LineSupport.Constraint")** = 1*[](#LineSupport.Constraint.HINGED "Link to this definition") - SLIDING*: [`Constraint`](#LineSupport.Constraint "viktor.external.scia.object.LineSupport.Constraint")** = 2*[](#LineSupport.Constraint.SLIDING "Link to this definition") - *class *Extent(*\*values*)[](#LineSupport.Extent "Link to this definition") Bases: `Enum` * **FULL** - support across the full length * **SPAN** - support across a span - FULL*: [`Extent`](#LineSupport.Extent "viktor.external.scia.object.LineSupport.Extent")** = 0*[](#LineSupport.Extent.FULL "Link to this definition") * SPAN*: [`Extent`](#LineSupport.Extent "viktor.external.scia.object.LineSupport.Extent")** = 1*[](#LineSupport.Extent.SPAN "Link to this definition") * *class *Freedom(*\*values*)[](#LineSupport.Freedom "Link to this definition") Bases: `Enum` * FLEXIBLE*: [`Freedom`](#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom")** = 2*[](#LineSupport.Freedom.FLEXIBLE "Link to this definition") - FLEXIBLE\_PRESS\_ONLY*: [`Freedom`](#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom")** = 5*[](#LineSupport.Freedom.FLEXIBLE_PRESS_ONLY "Link to this definition") * FLEXIBLE\_TENSION\_ONLY*: [`Freedom`](#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom")** = 6*[](#LineSupport.Freedom.FLEXIBLE_TENSION_ONLY "Link to this definition") - FREE*: [`Freedom`](#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom")** = 0*[](#LineSupport.Freedom.FREE "Link to this definition") * NONLINEAR*: [`Freedom`](#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom")** = 7*[](#LineSupport.Freedom.NONLINEAR "Link to this definition") - RIGID*: [`Freedom`](#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom")** = 1*[](#LineSupport.Freedom.RIGID "Link to this definition") * RIGID\_PRESS\_ONLY*: [`Freedom`](#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom")** = 3*[](#LineSupport.Freedom.RIGID_PRESS_ONLY "Link to this definition") - RIGID\_TENSION\_ONLY*: [`Freedom`](#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom")** = 4*[](#LineSupport.Freedom.RIGID_TENSION_ONLY "Link to this definition") - *class *Origin(*\*values*)[](#LineSupport.Origin "Link to this definition") Bases: `Enum` * **FROM\_START** - position is measured from the beginning of the beam * **FROM\_END** - position is measured from the end of the beam - FROM\_END*: [`Origin`](#LineSupport.Origin "viktor.external.scia.object.LineSupport.Origin")** = 1*[](#LineSupport.Origin.FROM_END "Link to this definition") * FROM\_START*: [`Origin`](#LineSupport.Origin "viktor.external.scia.object.LineSupport.Origin")** = 0*[](#LineSupport.Origin.FROM_START "Link to this definition") * *class *Type(*\*values*)[](#LineSupport.Type "Link to this definition") Bases: `Enum` * FOUNDATION\_STRIP*: [`Type`](#LineSupport.Type "viktor.external.scia.object.LineSupport.Type")** = 1*[](#LineSupport.Type.FOUNDATION_STRIP "Link to this definition") - LINE*: [`Type`](#LineSupport.Type "viktor.external.scia.object.LineSupport.Type")** = 0*[](#LineSupport.Type.LINE "Link to this definition") * WALL*: [`Type`](#LineSupport.Type "viktor.external.scia.object.LineSupport.Type")** = 2*[](#LineSupport.Type.WALL "Link to this definition") - *property *constraint*: [Constraint](#LineSupport.Constraint "viktor.external.scia.object.LineSupport.Constraint")*[](#LineSupport.constraint "Link to this definition") * *property *freedom*: Tuple\[[Freedom](#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom"), [Freedom](#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom"), [Freedom](#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom"), [Freedom](#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom"), [Freedom](#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom"), [Freedom](#LineSupport.Freedom "viktor.external.scia.object.LineSupport.Freedom")]*[](#LineSupport.freedom "Link to this definition") - *property *function\_rx*: [NonLinearFunction](#NonLinearFunction "viktor.external.scia.object.NonLinearFunction") | None*[](#LineSupport.function_rx "Link to this definition") * *property *function\_ry*: [NonLinearFunction](#NonLinearFunction "viktor.external.scia.object.NonLinearFunction") | None*[](#LineSupport.function_ry "Link to this definition") - *property *function\_rz*: [NonLinearFunction](#NonLinearFunction "viktor.external.scia.object.NonLinearFunction") | None*[](#LineSupport.function_rz "Link to this definition") * *property *function\_x*: [NonLinearFunction](#NonLinearFunction "viktor.external.scia.object.NonLinearFunction") | None*[](#LineSupport.function_x "Link to this definition") - *property *function\_y*: [NonLinearFunction](#NonLinearFunction "viktor.external.scia.object.NonLinearFunction") | None*[](#LineSupport.function_y "Link to this definition") * *property *function\_z*: [NonLinearFunction](#NonLinearFunction "viktor.external.scia.object.NonLinearFunction") | None*[](#LineSupport.function_z "Link to this definition") - *property *stiffness*: Tuple\[float | None, float | None, float | None, float | None, float | None, float | None]*[](#LineSupport.stiffness "Link to this definition") <!-- --> ## LineSupportLine[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_LineSupportLine "Direct link to LineSupportLine") * *class *viktor.external.scia.object.LineSupportLine(*object\_id*, *name*, *beam*, *x=None*, *stiffness\_x=None*, *function\_x=None*, *y=None*, *stiffness\_y=None*, *function\_y=None*, *z=None*, *stiffness\_z=None*, *function\_z=None*, *rx=None*, *stiffness\_rx=None*, *function\_rx=None*, *ry=None*, *stiffness\_ry=None*, *function\_ry=None*, *rz=None*, *stiffness\_rz=None*, *function\_rz=None*, *c\_sys=None*, *extent=None*, *c\_def=None*, *position\_x1=None*, *position\_x2=None*, *origin=None*)[](#LineSupportLine "Link to this definition") Bases: [`LineSupport`](#LineSupport "viktor.external.scia.object.LineSupport") Do not use this \_\_init\_\_ directly, but create the object by [`create_line_support_on_beam()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_line_support_on_beam "viktor.external.scia.scia.Model.create_line_support_on_beam") * *property *beam*: [Beam](#Beam "viktor.external.scia.object.Beam")*[](#LineSupportLine.beam "Link to this definition") - *property *spring\_type*: [Type](#LineSupport.Type "viktor.external.scia.object.LineSupport.Type")*[](#LineSupportLine.spring_type "Link to this definition") <!-- --> ## LineSupportSurface[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_LineSupportSurface "Direct link to LineSupportSurface") * *class *viktor.external.scia.object.LineSupportSurface(*object\_id*, *name*, *edge*, *x=None*, *stiffness\_x=None*, *y=None*, *stiffness\_y=None*, *z=None*, *stiffness\_z=None*, *rx=None*, *stiffness\_rx=None*, *ry=None*, *stiffness\_ry=None*, *rz=None*, *stiffness\_rz=None*, *c\_sys=None*, *c\_def=None*, *position\_x1=None*, *position\_x2=None*, *origin=None*)[](#LineSupportSurface "Link to this definition") Bases: [`LineSupport`](#LineSupport "viktor.external.scia.object.LineSupport") Do not use this \_\_init\_\_ directly, but create the object by [`create_line_support_on_plane()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_line_support_on_plane "viktor.external.scia.scia.Model.create_line_support_on_plane") * *property *plane*: [Plane](#Plane "viktor.external.scia.object.Plane")*[](#LineSupportSurface.plane "Link to this definition") <!-- --> ## LoadCase[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_LoadCase "Direct link to LoadCase") * *class *viktor.external.scia.object.LoadCase(*object\_id*, *name*, *description*, *action\_type*, *load\_group*)[](#LoadCase "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Abstract base class of all load cases. * *class *ActionType(*\*values*)[](#LoadCase.ActionType "Link to this definition") Bases: `Enum` * PERMANENT*: [`ActionType`](#LoadCase.ActionType "viktor.external.scia.object.LoadCase.ActionType")** = 0*[](#LoadCase.ActionType.PERMANENT "Link to this definition") - VARIABLE*: [`ActionType`](#LoadCase.ActionType "viktor.external.scia.object.LoadCase.ActionType")** = 1*[](#LoadCase.ActionType.VARIABLE "Link to this definition") - *class *Direction(*\*values*)[](#LoadCase.Direction "Link to this definition") Bases: `Enum` * **NEG\_Z** - -Z * **POS\_Z** - +Z * **NEG\_Y** - -Y * **POS\_Y** - +Y * **NEG\_X** - -X * **POS\_X** - +X - NEG\_X*: [`Direction`](#LoadCase.Direction "viktor.external.scia.object.LoadCase.Direction")** = 4*[](#LoadCase.Direction.NEG_X "Link to this definition") * NEG\_Y*: [`Direction`](#LoadCase.Direction "viktor.external.scia.object.LoadCase.Direction")** = 2*[](#LoadCase.Direction.NEG_Y "Link to this definition") - NEG\_Z*: [`Direction`](#LoadCase.Direction "viktor.external.scia.object.LoadCase.Direction")** = 0*[](#LoadCase.Direction.NEG_Z "Link to this definition") * POS\_X*: [`Direction`](#LoadCase.Direction "viktor.external.scia.object.LoadCase.Direction")** = 5*[](#LoadCase.Direction.POS_X "Link to this definition") - POS\_Y*: [`Direction`](#LoadCase.Direction "viktor.external.scia.object.LoadCase.Direction")** = 3*[](#LoadCase.Direction.POS_Y "Link to this definition") * POS\_Z*: [`Direction`](#LoadCase.Direction "viktor.external.scia.object.LoadCase.Direction")** = 1*[](#LoadCase.Direction.POS_Z "Link to this definition") * *class *Duration(*\*values*)[](#LoadCase.Duration "Link to this definition") Bases: `Enum` * INSTANTANEOUS*: [`Duration`](#LoadCase.Duration "viktor.external.scia.object.LoadCase.Duration")** = 3*[](#LoadCase.Duration.INSTANTANEOUS "Link to this definition") - LONG*: [`Duration`](#LoadCase.Duration "viktor.external.scia.object.LoadCase.Duration")** = 0*[](#LoadCase.Duration.LONG "Link to this definition") * MEDIUM*: [`Duration`](#LoadCase.Duration "viktor.external.scia.object.LoadCase.Duration")** = 1*[](#LoadCase.Duration.MEDIUM "Link to this definition") - SHORT*: [`Duration`](#LoadCase.Duration "viktor.external.scia.object.LoadCase.Duration")** = 2*[](#LoadCase.Duration.SHORT "Link to this definition") - *class *PermanentLoadType(*\*values*)[](#LoadCase.PermanentLoadType "Link to this definition") Bases: `Enum` * PRIMARY\_EFFECT*: [`PermanentLoadType`](#LoadCase.PermanentLoadType "viktor.external.scia.object.LoadCase.PermanentLoadType")** = 2*[](#LoadCase.PermanentLoadType.PRIMARY_EFFECT "Link to this definition") - SELF\_WEIGHT*: [`PermanentLoadType`](#LoadCase.PermanentLoadType "viktor.external.scia.object.LoadCase.PermanentLoadType")** = 0*[](#LoadCase.PermanentLoadType.SELF_WEIGHT "Link to this definition") * STANDARD*: [`PermanentLoadType`](#LoadCase.PermanentLoadType "viktor.external.scia.object.LoadCase.PermanentLoadType")** = 1*[](#LoadCase.PermanentLoadType.STANDARD "Link to this definition") * *class *Specification(*\*values*)[](#LoadCase.Specification "Link to this definition") Bases: `Enum` * EARTHQUAKE*: [`Specification`](#LoadCase.Specification "viktor.external.scia.object.LoadCase.Specification")** = 103*[](#LoadCase.Specification.EARTHQUAKE "Link to this definition") - SNOW*: [`Specification`](#LoadCase.Specification "viktor.external.scia.object.LoadCase.Specification")** = 104*[](#LoadCase.Specification.SNOW "Link to this definition") * STANDARD*: [`Specification`](#LoadCase.Specification "viktor.external.scia.object.LoadCase.Specification")** = 100*[](#LoadCase.Specification.STANDARD "Link to this definition") - STATIC\_WIND*: [`Specification`](#LoadCase.Specification "viktor.external.scia.object.LoadCase.Specification")** = 102*[](#LoadCase.Specification.STATIC_WIND "Link to this definition") * TEMPERATURE*: [`Specification`](#LoadCase.Specification "viktor.external.scia.object.LoadCase.Specification")** = 101*[](#LoadCase.Specification.TEMPERATURE "Link to this definition") - *class *VariableLoadType(*\*values*)[](#LoadCase.VariableLoadType "Link to this definition") Bases: `Enum` * PRIMARY\_EFFECT*: [`VariableLoadType`](#LoadCase.VariableLoadType "viktor.external.scia.object.LoadCase.VariableLoadType")** = 1*[](#LoadCase.VariableLoadType.PRIMARY_EFFECT "Link to this definition") - STATIC*: [`VariableLoadType`](#LoadCase.VariableLoadType "viktor.external.scia.object.LoadCase.VariableLoadType")** = 0*[](#LoadCase.VariableLoadType.STATIC "Link to this definition") * *abstract property *direction*: [Direction](#LoadCase.Direction "viktor.external.scia.object.LoadCase.Direction") | None*[](#LoadCase.direction "Link to this definition") - *abstract property *duration*: [Duration](#LoadCase.Duration "viktor.external.scia.object.LoadCase.Duration") | None*[](#LoadCase.duration "Link to this definition") * *property *load\_group*: [LoadGroup](#LoadGroup "viktor.external.scia.object.LoadGroup")*[](#LoadCase.load_group "Link to this definition") - *abstract property *load\_type*: [PermanentLoadType](#LoadCase.PermanentLoadType "viktor.external.scia.object.LoadCase.PermanentLoadType") | [VariableLoadType](#LoadCase.VariableLoadType "viktor.external.scia.object.LoadCase.VariableLoadType")*[](#LoadCase.load_type "Link to this definition") * *abstract property *master*: str | None*[](#LoadCase.master "Link to this definition") - *abstract property *primary\_effect*: [LoadCase](#LoadCase "viktor.external.scia.object.LoadCase") | None*[](#LoadCase.primary_effect "Link to this definition") * *abstract property *specification*: [Specification](#LoadCase.Specification "viktor.external.scia.object.LoadCase.Specification") | None*[](#LoadCase.specification "Link to this definition") <!-- --> ## LoadCombination[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_LoadCombination "Direct link to LoadCombination") * *class *viktor.external.scia.object.LoadCombination(*object\_id*, *name*, *combination\_type*, *load\_cases*, *\**, *description=None*)[](#LoadCombination "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_load_combination()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_load_combination "viktor.external.scia.scia.Model.create_load_combination") * *class *Type(*\*values*)[](#LoadCombination.Type "Link to this definition") Bases: `Enum` * **ENVELOPE\_ULTIMATE** - Envelope - ultimate * **ENVELOPE\_SERVICEABILITY** - Envelope - serviceability * **LINEAR\_ULTIMATE** - Linear - ultimate * **LINEAR\_SERVICEABILITY** - Linear - serviceability * **EN\_ULS\_SET\_B** - EN-ULS (STR/GEO) Set B * **EN\_ACC\_ONE** - EN-Accidental 1 * **EN\_ACC\_TWO** - EN-Accidental 2 * **EN\_SEISMIC** - EN-Seismic * **EN\_SLS\_CHAR** - EN-SLS Characteristic * **EN\_SLS\_FREQ** - EN-SLS Frequent * **EN\_SLS\_QUASI** - EN-SLS Quasi-permanent * **EN\_ULS\_SET\_C** - EN-ULS (STR/GEO) Set C - ENVELOPE\_SERVICEABILITY*: [`Type`](#LoadCombination.Type "viktor.external.scia.object.LoadCombination.Type")** = 1*[](#LoadCombination.Type.ENVELOPE_SERVICEABILITY "Link to this definition") * ENVELOPE\_ULTIMATE*: [`Type`](#LoadCombination.Type "viktor.external.scia.object.LoadCombination.Type")** = 0*[](#LoadCombination.Type.ENVELOPE_ULTIMATE "Link to this definition") - EN\_ACC\_ONE*: [`Type`](#LoadCombination.Type "viktor.external.scia.object.LoadCombination.Type")** = 5*[](#LoadCombination.Type.EN_ACC_ONE "Link to this definition") * EN\_ACC\_TWO*: [`Type`](#LoadCombination.Type "viktor.external.scia.object.LoadCombination.Type")** = 6*[](#LoadCombination.Type.EN_ACC_TWO "Link to this definition") - EN\_SEISMIC*: [`Type`](#LoadCombination.Type "viktor.external.scia.object.LoadCombination.Type")** = 7*[](#LoadCombination.Type.EN_SEISMIC "Link to this definition") * EN\_SLS\_CHAR*: [`Type`](#LoadCombination.Type "viktor.external.scia.object.LoadCombination.Type")** = 8*[](#LoadCombination.Type.EN_SLS_CHAR "Link to this definition") - EN\_SLS\_FREQ*: [`Type`](#LoadCombination.Type "viktor.external.scia.object.LoadCombination.Type")** = 9*[](#LoadCombination.Type.EN_SLS_FREQ "Link to this definition") * EN\_SLS\_QUASI*: [`Type`](#LoadCombination.Type "viktor.external.scia.object.LoadCombination.Type")** = 10*[](#LoadCombination.Type.EN_SLS_QUASI "Link to this definition") - EN\_ULS\_SET\_B*: [`Type`](#LoadCombination.Type "viktor.external.scia.object.LoadCombination.Type")** = 4*[](#LoadCombination.Type.EN_ULS_SET_B "Link to this definition") * EN\_ULS\_SET\_C*: [`Type`](#LoadCombination.Type "viktor.external.scia.object.LoadCombination.Type")** = 11*[](#LoadCombination.Type.EN_ULS_SET_C "Link to this definition") - LINEAR\_SERVICEABILITY*: [`Type`](#LoadCombination.Type "viktor.external.scia.object.LoadCombination.Type")** = 3*[](#LoadCombination.Type.LINEAR_SERVICEABILITY "Link to this definition") * LINEAR\_ULTIMATE*: [`Type`](#LoadCombination.Type "viktor.external.scia.object.LoadCombination.Type")** = 2*[](#LoadCombination.Type.LINEAR_ULTIMATE "Link to this definition") - *property *load\_cases*: Dict\[[LoadCase](#LoadCase "viktor.external.scia.object.LoadCase"), float]*[](#LoadCombination.load_cases "Link to this definition") <!-- --> ## LoadGroup[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_LoadGroup "Direct link to LoadGroup") * *class *viktor.external.scia.object.LoadGroup(*object\_id*, *name*, *load\_option*, *relation=None*, *load\_type=None*)[](#LoadGroup "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_load_group()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_load_group "viktor.external.scia.scia.Model.create_load_group") * *class *LoadOption(*\*values*)[](#LoadGroup.LoadOption "Link to this definition") Bases: `Enum` * ACCIDENTAL*: [`LoadOption`](#LoadGroup.LoadOption "viktor.external.scia.object.LoadGroup.LoadOption")** = 2*[](#LoadGroup.LoadOption.ACCIDENTAL "Link to this definition") - PERMANENT*: [`LoadOption`](#LoadGroup.LoadOption "viktor.external.scia.object.LoadGroup.LoadOption")** = 0*[](#LoadGroup.LoadOption.PERMANENT "Link to this definition") * SEISMIC*: [`LoadOption`](#LoadGroup.LoadOption "viktor.external.scia.object.LoadGroup.LoadOption")** = 3*[](#LoadGroup.LoadOption.SEISMIC "Link to this definition") - VARIABLE*: [`LoadOption`](#LoadGroup.LoadOption "viktor.external.scia.object.LoadGroup.LoadOption")** = 1*[](#LoadGroup.LoadOption.VARIABLE "Link to this definition") - *class *LoadTypeOption(*\*values*)[](#LoadGroup.LoadTypeOption "Link to this definition") Bases: `Enum` * **CAT\_A** - Domestic * **CAT\_B** - Offices * **CAT\_C** - Congregation * **CAT\_D** - Shopping * **CAT\_E** - Storage * **CAT\_F** - Vehicle <30kN * **CAT\_G** - Vehicle >30kN * **CAT\_H** - Roofs * **SNOW** - Snow * **WIND** - Wind * **TEMPERATURE** - Temperature * **RAIN\_WATER** - Rain water * **CONSTRUCTION\_LOADS** - Construction loads - CAT\_A*: [`LoadTypeOption`](#LoadGroup.LoadTypeOption "viktor.external.scia.object.LoadGroup.LoadTypeOption")** = 0*[](#LoadGroup.LoadTypeOption.CAT_A "Link to this definition") * CAT\_B*: [`LoadTypeOption`](#LoadGroup.LoadTypeOption "viktor.external.scia.object.LoadGroup.LoadTypeOption")** = 1*[](#LoadGroup.LoadTypeOption.CAT_B "Link to this definition") - CAT\_C*: [`LoadTypeOption`](#LoadGroup.LoadTypeOption "viktor.external.scia.object.LoadGroup.LoadTypeOption")** = 2*[](#LoadGroup.LoadTypeOption.CAT_C "Link to this definition") * CAT\_D*: [`LoadTypeOption`](#LoadGroup.LoadTypeOption "viktor.external.scia.object.LoadGroup.LoadTypeOption")** = 3*[](#LoadGroup.LoadTypeOption.CAT_D "Link to this definition") - CAT\_E*: [`LoadTypeOption`](#LoadGroup.LoadTypeOption "viktor.external.scia.object.LoadGroup.LoadTypeOption")** = 4*[](#LoadGroup.LoadTypeOption.CAT_E "Link to this definition") * CAT\_F*: [`LoadTypeOption`](#LoadGroup.LoadTypeOption "viktor.external.scia.object.LoadGroup.LoadTypeOption")** = 5*[](#LoadGroup.LoadTypeOption.CAT_F "Link to this definition") - CAT\_G*: [`LoadTypeOption`](#LoadGroup.LoadTypeOption "viktor.external.scia.object.LoadGroup.LoadTypeOption")** = 6*[](#LoadGroup.LoadTypeOption.CAT_G "Link to this definition") * CAT\_H*: [`LoadTypeOption`](#LoadGroup.LoadTypeOption "viktor.external.scia.object.LoadGroup.LoadTypeOption")** = 7*[](#LoadGroup.LoadTypeOption.CAT_H "Link to this definition") - CONSTRUCTION\_LOADS*: [`LoadTypeOption`](#LoadGroup.LoadTypeOption "viktor.external.scia.object.LoadGroup.LoadTypeOption")** = 21*[](#LoadGroup.LoadTypeOption.CONSTRUCTION_LOADS "Link to this definition") * RAIN\_WATER*: [`LoadTypeOption`](#LoadGroup.LoadTypeOption "viktor.external.scia.object.LoadGroup.LoadTypeOption")** = 20*[](#LoadGroup.LoadTypeOption.RAIN_WATER "Link to this definition") - SNOW*: [`LoadTypeOption`](#LoadGroup.LoadTypeOption "viktor.external.scia.object.LoadGroup.LoadTypeOption")** = 8*[](#LoadGroup.LoadTypeOption.SNOW "Link to this definition") * TEMPERATURE*: [`LoadTypeOption`](#LoadGroup.LoadTypeOption "viktor.external.scia.object.LoadGroup.LoadTypeOption")** = 12*[](#LoadGroup.LoadTypeOption.TEMPERATURE "Link to this definition") - WIND*: [`LoadTypeOption`](#LoadGroup.LoadTypeOption "viktor.external.scia.object.LoadGroup.LoadTypeOption")** = 11*[](#LoadGroup.LoadTypeOption.WIND "Link to this definition") * *class *RelationOption(*\*values*)[](#LoadGroup.RelationOption "Link to this definition") Bases: `Enum` * EXCLUSIVE*: [`RelationOption`](#LoadGroup.RelationOption "viktor.external.scia.object.LoadGroup.RelationOption")** = 1*[](#LoadGroup.RelationOption.EXCLUSIVE "Link to this definition") - STANDARD*: [`RelationOption`](#LoadGroup.RelationOption "viktor.external.scia.object.LoadGroup.RelationOption")** = 0*[](#LoadGroup.RelationOption.STANDARD "Link to this definition") * TOGETHER*: [`RelationOption`](#LoadGroup.RelationOption "viktor.external.scia.object.LoadGroup.RelationOption")** = 2*[](#LoadGroup.RelationOption.TOGETHER "Link to this definition") - *property *load\_type*: [LoadTypeOption](#LoadGroup.LoadTypeOption "viktor.external.scia.object.LoadGroup.LoadTypeOption") | None*[](#LoadGroup.load_type "Link to this definition") * *property *relation*: [RelationOption](#LoadGroup.RelationOption "viktor.external.scia.object.LoadGroup.RelationOption") | None*[](#LoadGroup.relation "Link to this definition") <!-- --> ## Material[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_Material "Direct link to Material") * *class *viktor.external.scia.object.Material(*object\_id*, *name*)[](#Material "Link to this definition") Reference to an existing material in the .esa template file in which the xml input file will be loaded. * Parameters: * **object\_id** (`int`) – ID of the existing material. * **name** (`str`) – name of the existing material. <!-- --> ## MeshSetup[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_MeshSetup "Direct link to MeshSetup") * *class *viktor.external.scia.object.MeshSetup(*\**, *average\_1d=1.0*, *average\_2d=1.0*, *division\_2d\_1d=50*)[](#MeshSetup "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Mesh settings parameters. * Parameters: * **average\_1d** (`float`) – Average size of cables, tendons, elements on subsoil, nonlinear soil spring \[m] (default: 1.0). * **average\_2d** (`float`) – Average size of 2d element/curved element \[m] (default: 1.0). * **division\_2d\_1d** (`int`) – Division for 2D-1D upgrade (default: 50). <!-- --> ## Node[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_Node "Direct link to Node") * *class *viktor.external.scia.object.Node(*object\_id*, *name*, *x*, *y*, *z*)[](#Node "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_node()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_node "viktor.external.scia.scia.Model.create_node") <!-- --> ## NonLinearFunction[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_NonLinearFunction "Direct link to NonLinearFunction") * *class *viktor.external.scia.object.NonLinearFunction(*object\_id*, *name*, *function\_type*, *positive\_end*, *negative\_end*, *impulse*)[](#NonLinearFunction "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_nonlinear_function()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_nonlinear_function "viktor.external.scia.scia.Model.create_nonlinear_function") * *class *Support(*\*values*)[](#NonLinearFunction.Support "Link to this definition") Bases: `Enum` * FLEXIBLE*: [`Support`](#NonLinearFunction.Support "viktor.external.scia.object.NonLinearFunction.Support")** = 2*[](#NonLinearFunction.Support.FLEXIBLE "Link to this definition") - FREE*: [`Support`](#NonLinearFunction.Support "viktor.external.scia.object.NonLinearFunction.Support")** = 1*[](#NonLinearFunction.Support.FREE "Link to this definition") * RIGID*: [`Support`](#NonLinearFunction.Support "viktor.external.scia.object.NonLinearFunction.Support")** = 0*[](#NonLinearFunction.Support.RIGID "Link to this definition") - *class *Type(*\*values*)[](#NonLinearFunction.Type "Link to this definition") Bases: `Enum` * NONLINEAR\_SUBSOIL*: [`Type`](#NonLinearFunction.Type "viktor.external.scia.object.NonLinearFunction.Type")** = 2*[](#NonLinearFunction.Type.NONLINEAR_SUBSOIL "Link to this definition") - ROTATION*: [`Type`](#NonLinearFunction.Type "viktor.external.scia.object.NonLinearFunction.Type")** = 1*[](#NonLinearFunction.Type.ROTATION "Link to this definition") * TRANSLATION*: [`Type`](#NonLinearFunction.Type "viktor.external.scia.object.NonLinearFunction.Type")** = 0*[](#NonLinearFunction.Type.TRANSLATION "Link to this definition") * *property *impulse*: List\[Tuple\[float, float]]*[](#NonLinearFunction.impulse "Link to this definition") <!-- --> ## NonLinearLoadCombination[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_NonLinearLoadCombination "Direct link to NonLinearLoadCombination") * *class *viktor.external.scia.object.NonLinearLoadCombination(*object\_id*, *name*, *combination\_type*, *load\_cases*, *\**, *description=None*)[](#NonLinearLoadCombination "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") * Do not use this \_\_init\_\_ directly, but create the object by [`create_nonlinear_load_combination()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_nonlinear_load_combination "viktor.external.scia.scia.Model.create_nonlinear_load_combination") - *class *Type(*\*values*)[](#NonLinearLoadCombination.Type "Link to this definition") Bases: `Enum` * SERVICEABILITY*: [`Type`](#NonLinearLoadCombination.Type "viktor.external.scia.object.NonLinearLoadCombination.Type")** = 1*[](#NonLinearLoadCombination.Type.SERVICEABILITY "Link to this definition") - ULTIMATE*: [`Type`](#NonLinearLoadCombination.Type "viktor.external.scia.object.NonLinearLoadCombination.Type")** = 0*[](#NonLinearLoadCombination.Type.ULTIMATE "Link to this definition") * *property *load\_cases*: Dict\[[LoadCase](#LoadCase "viktor.external.scia.object.LoadCase"), float]*[](#NonLinearLoadCombination.load_cases "Link to this definition") <!-- --> ## NumericalCrossSection[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_NumericalCrossSection "Direct link to NumericalCrossSection") * *class *viktor.external.scia.object.NumericalCrossSection(*object\_id*, *name*, *material*, *\**, *A=None*, *Ay=None*, *Az=None*, *AL=None*, *AD=None*, *cYUCS=None*, *cZUCS=None*, *alpha=None*, *Iy=None*, *Iz=None*, *Wely=None*, *Welz=None*, *Wply=None*, *Wplz=None*, *Mply\_plus=None*, *Mply\_min=None*, *Mplz\_plus=None*, *Mplz\_min=None*, *dy=None*, *dz=None*, *It=None*, *Iw=None*, *beta\_y=None*, *beta\_z=None*)[](#NumericalCrossSection "Link to this definition") Bases: [`CrossSection`](#CrossSection "viktor.external.scia.object.CrossSection") Do not use this \_\_init\_\_ directly, but create the object by [`create_numerical_cross_section()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_numerical_cross_section "viktor.external.scia.scia.Model.create_numerical_cross_section") <!-- --> ## OpenSlab[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_OpenSlab "Direct link to OpenSlab") * *class *viktor.external.scia.object.OpenSlab(*object\_id*, *name*, *plane*, *corner\_nodes*)[](#OpenSlab "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_open_slab()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_open_slab "viktor.external.scia.scia.Model.create_open_slab") * *property *corner\_nodes*: List\[[Node](#Node "viktor.external.scia.object.Node")]*[](#OpenSlab.corner_nodes "Link to this definition") - *property *plane*: [Plane](#Plane "viktor.external.scia.object.Plane")*[](#OpenSlab.plane "Link to this definition") <!-- --> ## Orthotropy[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_Orthotropy "Direct link to Orthotropy") * *class *viktor.external.scia.object.Orthotropy(*object\_id*, *name*, *material*, *thickness*, *D11=None*, *D22=None*, *D12=None*, *D33=None*, *D44=None*, *D55=None*, *d11=None*, *d22=None*, *d12=None*, *d33=None*, *kxy=None*, *kyx=None*)[](#Orthotropy "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_orthotropy()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_orthotropy "viktor.external.scia.scia.Model.create_orthotropy") <!-- --> ## PermanentLoadCase[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_PermanentLoadCase "Direct link to PermanentLoadCase") * *class *viktor.external.scia.object.PermanentLoadCase(*object\_id*, *name*, *description*, *load\_group*, *load\_type*, *direction=None*, *primary\_effect=None*)[](#PermanentLoadCase "Link to this definition") Bases: [`LoadCase`](#LoadCase "viktor.external.scia.object.LoadCase") Do not use this \_\_init\_\_ directly, but create the object by [`create_permanent_load_case()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_permanent_load_case "viktor.external.scia.scia.Model.create_permanent_load_case") * *property *direction*: [Direction](#LoadCase.Direction "viktor.external.scia.object.LoadCase.Direction") | None*[](#PermanentLoadCase.direction "Link to this definition") - *property *duration*: None*[](#PermanentLoadCase.duration "Link to this definition") * *property *load\_type*: [PermanentLoadType](#LoadCase.PermanentLoadType "viktor.external.scia.object.LoadCase.PermanentLoadType")*[](#PermanentLoadCase.load_type "Link to this definition") - *property *master*: None*[](#PermanentLoadCase.master "Link to this definition") * *property *primary\_effect*: [LoadCase](#LoadCase "viktor.external.scia.object.LoadCase") | None*[](#PermanentLoadCase.primary_effect "Link to this definition") - *property *specification*: None*[](#PermanentLoadCase.specification "Link to this definition") <!-- --> ## Plane[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_Plane "Direct link to Plane") * *class *viktor.external.scia.object.Plane(*object\_id*, *name*, *thickness*, *material*, *\**, *plane\_type=None*, *layer=None*, *corner\_nodes=None*, *internal\_nodes=None*, *swap\_orientation=None*, *lcs\_rotation=None*, *fem\_model=None*, *orthotropy=None*, *center\_node=None*, *vertex\_node=None*, *axis=None*)[](#Plane "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_plane()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_plane "viktor.external.scia.scia.Model.create_plane") or [`create_circular_plane()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_circular_plane "viktor.external.scia.scia.Model.create_circular_plane") * *class *FEMModel(*\*values*)[](#Plane.FEMModel "Link to this definition") Bases: `Enum` * ISOTROPIC*: [`FEMModel`](#Plane.FEMModel "viktor.external.scia.object.Plane.FEMModel")** = 0*[](#Plane.FEMModel.ISOTROPIC "Link to this definition") - ORTHOTROPIC*: [`FEMModel`](#Plane.FEMModel "viktor.external.scia.object.Plane.FEMModel")** = 1*[](#Plane.FEMModel.ORTHOTROPIC "Link to this definition") - *class *Type(*\*values*)[](#Plane.Type "Link to this definition") Bases: `Enum` * **PLATE** - A standard plate is a planar 2D member with an arbitrary number of edges that may be straight or curved. * **WALL** - A wall is a vertical 2D member whose base is either straight or curved. * **SHELL** - Shells are defined by border lines (i.e. border curves). The shape of the shell can be defined by four, three or two curves / straight lines. - PLATE*: [`Type`](#Plane.Type "viktor.external.scia.object.Plane.Type")** = 0*[](#Plane.Type.PLATE "Link to this definition") * SHELL*: [`Type`](#Plane.Type "viktor.external.scia.object.Plane.Type")** = 2*[](#Plane.Type.SHELL "Link to this definition") - WALL*: [`Type`](#Plane.Type "viktor.external.scia.object.Plane.Type")** = 1*[](#Plane.Type.WALL "Link to this definition") * *property *corner\_nodes*: List\[[Node](#Node "viktor.external.scia.object.Node")]*[](#Plane.corner_nodes "Link to this definition") - *property *internal\_nodes*: List\[[Node](#Node "viktor.external.scia.object.Node")]*[](#Plane.internal_nodes "Link to this definition") * *property *lcs\_rotation*: float*[](#Plane.lcs_rotation "Link to this definition") - *property *swap\_orientation*: bool*[](#Plane.swap_orientation "Link to this definition") <!-- --> ## PointLoad[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_PointLoad "Direct link to PointLoad") * *class *viktor.external.scia.object.PointLoad(*object\_id*, *name*, *load\_case*, *beam*, *direction*, *load\_type*, *load\_value*, *c\_sys=None*, *c\_def=None*, *position\_x=None*, *origin=None*, *repeat=None*, *ey=None*, *ez=None*, *\**, *angle=None*)[](#PointLoad "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_point_load()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_point_load "viktor.external.scia.scia.Model.create_point_load") * *class *CDef(*\*values*)[](#PointLoad.CDef "Link to this definition") Bases: `Enum` * **ABSOLUTE** - absolute, where the coordinate must lie between 0 and the length of the beam * **RELATIVE** - relative, where the coordinate must lie between 0 and 1 - ABSOLUTE*: [`CDef`](#PointLoad.CDef "viktor.external.scia.object.PointLoad.CDef")** = 0*[](#PointLoad.CDef.ABSOLUTE "Link to this definition") * RELATIVE*: [`CDef`](#PointLoad.CDef "viktor.external.scia.object.PointLoad.CDef")** = 1*[](#PointLoad.CDef.RELATIVE "Link to this definition") - *class *CSys(*\*values*)[](#PointLoad.CSys "Link to this definition") Bases: `Enum` * GLOBAL*: [`CSys`](#PointLoad.CSys "viktor.external.scia.object.PointLoad.CSys")** = 0*[](#PointLoad.CSys.GLOBAL "Link to this definition") - LOCAL*: [`CSys`](#PointLoad.CSys "viktor.external.scia.object.PointLoad.CSys")** = 1*[](#PointLoad.CSys.LOCAL "Link to this definition") * *class *Direction(*\*values*)[](#PointLoad.Direction "Link to this definition") Bases: `Enum` * X*: [`Direction`](#PointLoad.Direction "viktor.external.scia.object.PointLoad.Direction")** = 0*[](#PointLoad.Direction.X "Link to this definition") - Y*: [`Direction`](#PointLoad.Direction "viktor.external.scia.object.PointLoad.Direction")** = 1*[](#PointLoad.Direction.Y "Link to this definition") * Z*: [`Direction`](#PointLoad.Direction "viktor.external.scia.object.PointLoad.Direction")** = 2*[](#PointLoad.Direction.Z "Link to this definition") - *class *Distribution(*\*values*)[](#PointLoad.Distribution "Link to this definition") Bases: `Enum` * TRAPEZOIDAL*: [`Distribution`](#PointLoad.Distribution "viktor.external.scia.object.PointLoad.Distribution")** = 1*[](#PointLoad.Distribution.TRAPEZOIDAL "Link to this definition") - UNIFORM*: [`Distribution`](#PointLoad.Distribution "viktor.external.scia.object.PointLoad.Distribution")** = 0*[](#PointLoad.Distribution.UNIFORM "Link to this definition") * *class *Origin(*\*values*)[](#PointLoad.Origin "Link to this definition") Bases: `Enum` * **FROM\_START** - position is measured from the beginning of the beam * **FROM\_END** - position is measured from the end of the beam - FROM\_END*: [`Origin`](#PointLoad.Origin "viktor.external.scia.object.PointLoad.Origin")** = 1*[](#PointLoad.Origin.FROM_END "Link to this definition") * FROM\_START*: [`Origin`](#PointLoad.Origin "viktor.external.scia.object.PointLoad.Origin")** = 0*[](#PointLoad.Origin.FROM_START "Link to this definition") - *class *Type(*\*values*)[](#PointLoad.Type "Link to this definition") Bases: `Enum` * FORCE*: [`Type`](#PointLoad.Type "viktor.external.scia.object.PointLoad.Type")** = 0*[](#PointLoad.Type.FORCE "Link to this definition") * *property *beam*: [Beam](#Beam "viktor.external.scia.object.Beam")*[](#PointLoad.beam "Link to this definition") - *property *load\_case*: [LoadCase](#LoadCase "viktor.external.scia.object.LoadCase")*[](#PointLoad.load_case "Link to this definition") <!-- --> ## PointLoadNode[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_PointLoadNode "Direct link to PointLoadNode") * *class *viktor.external.scia.object.PointLoadNode(*object\_id*, *name*, *node*, *load\_case*, *load*, *direction=None*, *c\_sys=None*, *angle=None*)[](#PointLoadNode "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_point_load_node()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_point_load_node "viktor.external.scia.scia.Model.create_point_load_node") * *class *CSys(*\*values*)[](#PointLoadNode.CSys "Link to this definition") Bases: `Enum` * GLOBAL*: [`CSys`](#PointLoadNode.CSys "viktor.external.scia.object.PointLoadNode.CSys")** = 0*[](#PointLoadNode.CSys.GLOBAL "Link to this definition") - LOCAL*: [`CSys`](#PointLoadNode.CSys "viktor.external.scia.object.PointLoadNode.CSys")** = 1*[](#PointLoadNode.CSys.LOCAL "Link to this definition") - *class *Direction(*\*values*)[](#PointLoadNode.Direction "Link to this definition") Bases: `Enum` * X*: [`Direction`](#PointLoadNode.Direction "viktor.external.scia.object.PointLoadNode.Direction")** = 0*[](#PointLoadNode.Direction.X "Link to this definition") - Y*: [`Direction`](#PointLoadNode.Direction "viktor.external.scia.object.PointLoadNode.Direction")** = 1*[](#PointLoadNode.Direction.Y "Link to this definition") * Z*: [`Direction`](#PointLoadNode.Direction "viktor.external.scia.object.PointLoadNode.Direction")** = 2*[](#PointLoadNode.Direction.Z "Link to this definition") * *property *load\_case*: [LoadCase](#LoadCase "viktor.external.scia.object.LoadCase")*[](#PointLoadNode.load_case "Link to this definition") - *property *node*: [Node](#Node "viktor.external.scia.object.Node")*[](#PointLoadNode.node "Link to this definition") <!-- --> ## PointMomentNode[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_PointMomentNode "Direct link to PointMomentNode") * *class *viktor.external.scia.object.PointMomentNode(*object\_id*, *name*, *node*, *load\_case*, *load*, *direction*, *c\_sys*)[](#PointMomentNode "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_point_moment_node()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_point_moment_node "viktor.external.scia.scia.Model.create_point_moment_node"). * *class *CSys(*\*values*)[](#PointMomentNode.CSys "Link to this definition") Bases: `Enum` * GLOBAL*: [`CSys`](#PointMomentNode.CSys "viktor.external.scia.object.PointMomentNode.CSys")** = 0*[](#PointMomentNode.CSys.GLOBAL "Link to this definition") - LOCAL*: [`CSys`](#PointMomentNode.CSys "viktor.external.scia.object.PointMomentNode.CSys")** = 1*[](#PointMomentNode.CSys.LOCAL "Link to this definition") - *class *Direction(*\*values*)[](#PointMomentNode.Direction "Link to this definition") Bases: `Enum` * X*: [`Direction`](#PointMomentNode.Direction "viktor.external.scia.object.PointMomentNode.Direction")** = 0*[](#PointMomentNode.Direction.X "Link to this definition") - Y*: [`Direction`](#PointMomentNode.Direction "viktor.external.scia.object.PointMomentNode.Direction")** = 1*[](#PointMomentNode.Direction.Y "Link to this definition") * Z*: [`Direction`](#PointMomentNode.Direction "viktor.external.scia.object.PointMomentNode.Direction")** = 2*[](#PointMomentNode.Direction.Z "Link to this definition") * *property *load\_case*: [LoadCase](#LoadCase "viktor.external.scia.object.LoadCase")*[](#PointMomentNode.load_case "Link to this definition") - *property *node*: [Node](#Node "viktor.external.scia.object.Node")*[](#PointMomentNode.node "Link to this definition") <!-- --> ## PointSupport[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_PointSupport "Direct link to PointSupport") * *class *viktor.external.scia.object.PointSupport(*object\_id*, *name*, *node*, *spring\_type*, *freedom*, *stiffness*, *c\_sys*, *default\_size=0.2*, *angle=None*)[](#PointSupport "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_point_support()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_point_support "viktor.external.scia.scia.Model.create_point_support") * *class *CSys(*\*values*)[](#PointSupport.CSys "Link to this definition") Bases: `Enum` * GLOBAL*: [`CSys`](#PointSupport.CSys "viktor.external.scia.object.PointSupport.CSys")** = 0*[](#PointSupport.CSys.GLOBAL "Link to this definition") - LOCAL*: [`CSys`](#PointSupport.CSys "viktor.external.scia.object.PointSupport.CSys")** = 1*[](#PointSupport.CSys.LOCAL "Link to this definition") - *class *Constraint(*\*values*)[](#PointSupport.Constraint "Link to this definition") Bases: `Enum` * CUSTOM*: [`Constraint`](#PointSupport.Constraint "viktor.external.scia.object.PointSupport.Constraint")** = 3*[](#PointSupport.Constraint.CUSTOM "Link to this definition") - FIXED*: [`Constraint`](#PointSupport.Constraint "viktor.external.scia.object.PointSupport.Constraint")** = 0*[](#PointSupport.Constraint.FIXED "Link to this definition") * HINGED*: [`Constraint`](#PointSupport.Constraint "viktor.external.scia.object.PointSupport.Constraint")** = 1*[](#PointSupport.Constraint.HINGED "Link to this definition") - SLIDING*: [`Constraint`](#PointSupport.Constraint "viktor.external.scia.object.PointSupport.Constraint")** = 2*[](#PointSupport.Constraint.SLIDING "Link to this definition") * *class *Freedom(*\*values*)[](#PointSupport.Freedom "Link to this definition") Bases: `Enum` * **FREE** - The support is free in the specified direction. That is it imposes no constraint in the direction. * **RIGID** - The support in fully rigid in the specified direction. * **FLEXIBLE** - The support is flexible (elastic) in the specified direction. The user has to define the required stiffness of the support. - FLEXIBLE*: [`Freedom`](#PointSupport.Freedom "viktor.external.scia.object.PointSupport.Freedom")** = 2*[](#PointSupport.Freedom.FLEXIBLE "Link to this definition") * FREE*: [`Freedom`](#PointSupport.Freedom "viktor.external.scia.object.PointSupport.Freedom")** = 0*[](#PointSupport.Freedom.FREE "Link to this definition") - RIGID*: [`Freedom`](#PointSupport.Freedom "viktor.external.scia.object.PointSupport.Freedom")** = 1*[](#PointSupport.Freedom.RIGID "Link to this definition") - *class *Type(*\*values*)[](#PointSupport.Type "Link to this definition") Bases: `Enum` * COLUMN*: [`Type`](#PointSupport.Type "viktor.external.scia.object.PointSupport.Type")** = 2*[](#PointSupport.Type.COLUMN "Link to this definition") - PAD\_FOUNDATION*: [`Type`](#PointSupport.Type "viktor.external.scia.object.PointSupport.Type")** = 1*[](#PointSupport.Type.PAD_FOUNDATION "Link to this definition") * STANDARD*: [`Type`](#PointSupport.Type "viktor.external.scia.object.PointSupport.Type")** = 0*[](#PointSupport.Type.STANDARD "Link to this definition") * *property *constraint*: [Constraint](#PointSupport.Constraint "viktor.external.scia.object.PointSupport.Constraint")*[](#PointSupport.constraint "Link to this definition") - *property *node*: [Node](#Node "viktor.external.scia.object.Node")*[](#PointSupport.node "Link to this definition") <!-- --> ## PointSupportLine[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_PointSupportLine "Direct link to PointSupportLine") * *class *viktor.external.scia.object.PointSupportLine(*object\_id*, *name*, *beam*, *x=None*, *stiffness\_x=None*, *y=None*, *stiffness\_y=None*, *z=None*, *stiffness\_z=None*, *rx=None*, *stiffness\_rx=None*, *ry=None*, *stiffness\_ry=None*, *rz=None*, *stiffness\_rz=None*, *default\_size=None*, *c\_sys=None*, *c\_def=None*, *position\_x=None*, *origin=None*, *repeat=None*, *delta\_x=None*)[](#PointSupportLine "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_point_support_on_beam()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_point_support_on_beam "viktor.external.scia.scia.Model.create_point_support_on_beam") * *class *CDef(*\*values*)[](#PointSupportLine.CDef "Link to this definition") Bases: `Enum` * **ABSOLUTE** - absolute, where the coordinate must lie between 0 and the length of the beam * **RELATIVE** - relative, where the coordinate must lie between 0 and 1 - ABSOLUTE*: [`CDef`](#PointSupportLine.CDef "viktor.external.scia.object.PointSupportLine.CDef")** = 0*[](#PointSupportLine.CDef.ABSOLUTE "Link to this definition") * RELATIVE*: [`CDef`](#PointSupportLine.CDef "viktor.external.scia.object.PointSupportLine.CDef")** = 1*[](#PointSupportLine.CDef.RELATIVE "Link to this definition") - *class *CSys(*\*values*)[](#PointSupportLine.CSys "Link to this definition") Bases: `Enum` * GLOBAL*: [`CSys`](#PointSupportLine.CSys "viktor.external.scia.object.PointSupportLine.CSys")** = 0*[](#PointSupportLine.CSys.GLOBAL "Link to this definition") - LOCAL*: [`CSys`](#PointSupportLine.CSys "viktor.external.scia.object.PointSupportLine.CSys")** = 1*[](#PointSupportLine.CSys.LOCAL "Link to this definition") * *class *Freedom(*\*values*)[](#PointSupportLine.Freedom "Link to this definition") Bases: `Enum` * **FREE** - The support is free in the specified direction. That is it imposes no constraint in the direction. * **RIGID** - The support in fully rigid in the specified direction. * **FLEXIBLE** - The support is flexible (elastic) in the specified direction. The user has to define the required stiffness of the support. - FLEXIBLE*: [`Freedom`](#PointSupportLine.Freedom "viktor.external.scia.object.PointSupportLine.Freedom")** = 2*[](#PointSupportLine.Freedom.FLEXIBLE "Link to this definition") * FREE*: [`Freedom`](#PointSupportLine.Freedom "viktor.external.scia.object.PointSupportLine.Freedom")** = 0*[](#PointSupportLine.Freedom.FREE "Link to this definition") - RIGID*: [`Freedom`](#PointSupportLine.Freedom "viktor.external.scia.object.PointSupportLine.Freedom")** = 1*[](#PointSupportLine.Freedom.RIGID "Link to this definition") - *class *Origin(*\*values*)[](#PointSupportLine.Origin "Link to this definition") Bases: `Enum` * **FROM\_START** - position is measured from the beginning of the beam * **FROM\_END** - position is measured from the end of the beam - FROM\_END*: [`Origin`](#PointSupportLine.Origin "viktor.external.scia.object.PointSupportLine.Origin")** = 1*[](#PointSupportLine.Origin.FROM_END "Link to this definition") * FROM\_START*: [`Origin`](#PointSupportLine.Origin "viktor.external.scia.object.PointSupportLine.Origin")** = 0*[](#PointSupportLine.Origin.FROM_START "Link to this definition") <!-- --> ## ProjectData[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_ProjectData "Direct link to ProjectData") * *class *viktor.external.scia.object.ProjectData(*\**, *name=None*, *part=None*, *description=None*, *author=None*, *date=None*)[](#ProjectData "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") New in v13.1.0 Basic project data. * Parameters: * **name** (`str`) – Project name (default: as defined in ESA model) * **part** (`str`) – Project part name (default: as defined in ESA model) * **description** (`str`) – Project description (default: as defined in ESA model) * **author** (`str`) – Name of the author (default: as defined in ESA model) * **date** (`str`) – Date of the last modification (default: as defined in ESA model) <!-- --> ## RectangularCrossSection[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_RectangularCrossSection "Direct link to RectangularCrossSection") * *class *viktor.external.scia.object.RectangularCrossSection(*object\_id*, *name*, *material*, *width*, *height*)[](#RectangularCrossSection "Link to this definition") Bases: [`CrossSection`](#CrossSection "viktor.external.scia.object.CrossSection") Do not use this \_\_init\_\_ directly, but create the object by [`create_rectangular_cross_section()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_rectangular_cross_section "viktor.external.scia.scia.Model.create_rectangular_cross_section") <!-- --> ## ResultClass[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_ResultClass "Direct link to ResultClass") * *class *viktor.external.scia.object.ResultClass(*object\_id*, *name*, *combinations*, *nonlinear\_combinations*)[](#ResultClass "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_result_class()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_result_class "viktor.external.scia.scia.Model.create_result_class") * *property *combinations*: List\[[LoadCombination](#LoadCombination "viktor.external.scia.object.LoadCombination")]*[](#ResultClass.combinations "Link to this definition") - *property *nonlinear\_combinations*: List\[[NonLinearLoadCombination](#NonLinearLoadCombination "viktor.external.scia.object.NonLinearLoadCombination")]*[](#ResultClass.nonlinear_combinations "Link to this definition") <!-- --> ## RigidArm[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_RigidArm "Direct link to RigidArm") * *class *viktor.external.scia.object.RigidArm(*object\_id*, *name*, *master\_node*, *slave\_node*, *hinge\_on\_master*, *hinge\_on\_slave*)[](#RigidArm "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_rigid_arm()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_rigid_arm "viktor.external.scia.scia.Model.create_rigid_arm") * *property *master\_node*: [Node](#Node "viktor.external.scia.object.Node")*[](#RigidArm.master_node "Link to this definition") - *property *slave\_node*: [Node](#Node "viktor.external.scia.object.Node")*[](#RigidArm.slave_node "Link to this definition") <!-- --> ## SciaObject[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_SciaObject "Direct link to SciaObject") * *class *viktor.external.scia.object.SciaObject(*object\_id*, *name*)[](#SciaObject "Link to this definition") Bases: `ABC` * *property *name*: str*[](#SciaObject.name "Link to this definition") Name of the object in SCIA. - *property *object\_id*: int*[](#SciaObject.object_id "Link to this definition") ID of the object in SCIA. <!-- --> ## SectionOnBeam[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_SectionOnBeam "Direct link to SectionOnBeam") * *class *viktor.external.scia.object.SectionOnBeam(*object\_id*, *name*, *beam*, *c\_def*, *position\_x*, *origin*, *repeat*, *delta\_x*)[](#SectionOnBeam "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_section_on_beam()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_section_on_beam "viktor.external.scia.scia.Model.create_section_on_beam") * *class *CDef(*\*values*)[](#SectionOnBeam.CDef "Link to this definition") Bases: `Enum` * **ABSOLUTE** - absolute, where the coordinate must lie between 0 and the length of the beam * **RELATIVE** - relative, where the coordinate must lie between 0 and 1 - ABSOLUTE*: [`CDef`](#SectionOnBeam.CDef "viktor.external.scia.object.SectionOnBeam.CDef")** = 0*[](#SectionOnBeam.CDef.ABSOLUTE "Link to this definition") * RELATIVE*: [`CDef`](#SectionOnBeam.CDef "viktor.external.scia.object.SectionOnBeam.CDef")** = 1*[](#SectionOnBeam.CDef.RELATIVE "Link to this definition") - *class *Origin(*\*values*)[](#SectionOnBeam.Origin "Link to this definition") Bases: `Enum` * **FROM\_START** - position is measured from the beginning of the beam * **FROM\_END** - position is measured from the end of the beam - FROM\_END*: [`Origin`](#SectionOnBeam.Origin "viktor.external.scia.object.SectionOnBeam.Origin")** = 1*[](#SectionOnBeam.Origin.FROM_END "Link to this definition") * FROM\_START*: [`Origin`](#SectionOnBeam.Origin "viktor.external.scia.object.SectionOnBeam.Origin")** = 0*[](#SectionOnBeam.Origin.FROM_START "Link to this definition") * *property *beam*: [Beam](#Beam "viktor.external.scia.object.Beam")*[](#SectionOnBeam.beam "Link to this definition") <!-- --> ## SectionOnPlane[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_SectionOnPlane "Direct link to SectionOnPlane") * *class *viktor.external.scia.object.SectionOnPlane(*object\_id*, *name*, *point\_1*, *point\_2*, *draw=None*, *direction\_of\_cut=None*)[](#SectionOnPlane "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_section_on_plane()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_section_on_plane "viktor.external.scia.scia.Model.create_section_on_plane") * *class *Draw(*\*values*)[](#SectionOnPlane.Draw "Link to this definition") Bases: `Enum` * ELEMENT\_PLANE*: [`Draw`](#SectionOnPlane.Draw "viktor.external.scia.object.SectionOnPlane.Draw")** = 1*[](#SectionOnPlane.Draw.ELEMENT_PLANE "Link to this definition") - UPRIGHT\_TO\_ELEMENT*: [`Draw`](#SectionOnPlane.Draw "viktor.external.scia.object.SectionOnPlane.Draw")** = 0*[](#SectionOnPlane.Draw.UPRIGHT_TO_ELEMENT "Link to this definition") * X\_DIRECTION*: [`Draw`](#SectionOnPlane.Draw "viktor.external.scia.object.SectionOnPlane.Draw")** = 2*[](#SectionOnPlane.Draw.X_DIRECTION "Link to this definition") - Y\_DIRECTION*: [`Draw`](#SectionOnPlane.Draw "viktor.external.scia.object.SectionOnPlane.Draw")** = 3*[](#SectionOnPlane.Draw.Y_DIRECTION "Link to this definition") * Z\_DIRECTION*: [`Draw`](#SectionOnPlane.Draw "viktor.external.scia.object.SectionOnPlane.Draw")** = 4*[](#SectionOnPlane.Draw.Z_DIRECTION "Link to this definition") <!-- --> ## Selection[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_Selection "Direct link to Selection") * *class *viktor.external.scia.object.Selection(*object\_id*, *name*, *objects*)[](#Selection "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_selection()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_selection "viktor.external.scia.scia.Model.create_selection") <!-- --> ## SolverSetup[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_SolverSetup "Direct link to SolverSetup") * *class *viktor.external.scia.object.SolverSetup(*\**, *neglect\_shear\_force\_deformation=None*, *bending\_theory=None*, *solver\_type=None*, *number\_of\_sections=None*, *reinforcement\_coefficient=None*)[](#SolverSetup "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") New in v13.1.0 Solver setup. * Parameters: * **neglect\_shear\_force\_deformation** (`bool`) – Neglect shear force deformation (default: as defined in ESA model) * **bending\_theory** (`str`) – Bending theory of plate/shell analysis (‘mindlin’ | ‘kirchhoff’) (default: as defined in ESA model) * **solver\_type** (`str`) – Type of solver (‘direct’ | ‘iterative’) (default: as defined in ESA model) * **number\_of\_sections** (`float`) – Number of sections on average member (default: as defined in ESA model) * **reinforcement\_coefficient** (`float`) – Coefficient for reinforcement (default: as defined in ESA model) <!-- --> ## Subsoil[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_Subsoil "Direct link to Subsoil") * *class *viktor.external.scia.object.Subsoil(*object\_id*, *name*, *stiffness*, *c1x=None*, *c1y=None*, *c1z=None*, *nonlinear\_function=None*, *c2x=None*, *c2y=None*, *is\_drained=None*, *water\_air\_in\_clay\_subgrade=None*, *specific\_weight=None*, *fi=None*, *sigma\_oc=None*, *c=None*, *cu=None*)[](#Subsoil "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_subsoil()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_subsoil "viktor.external.scia.scia.Model.create_subsoil") * *class *C1z(*\*values*)[](#Subsoil.C1z "Link to this definition") Bases: `Enum` * FLEXIBLE*: [`C1z`](#Subsoil.C1z "viktor.external.scia.object.Subsoil.C1z")** = 0*[](#Subsoil.C1z.FLEXIBLE "Link to this definition") - NONLINEAR\_FUNCTION*: [`C1z`](#Subsoil.C1z "viktor.external.scia.object.Subsoil.C1z")** = 1*[](#Subsoil.C1z.NONLINEAR_FUNCTION "Link to this definition") - *property *nonlinear\_function*: [NonLinearFunction](#NonLinearFunction "viktor.external.scia.object.NonLinearFunction") | None*[](#Subsoil.nonlinear_function "Link to this definition") <!-- --> ## SurfaceLoad[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_SurfaceLoad "Direct link to SurfaceLoad") * *class *viktor.external.scia.object.SurfaceLoad(*object\_id*, *name*, *load\_case*, *plane*, *direction*, *load\_type*, *load\_value*, *c\_sys*, *location*)[](#SurfaceLoad "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_surface_load()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_surface_load "viktor.external.scia.scia.Model.create_surface_load") * *class *CSys(*\*values*)[](#SurfaceLoad.CSys "Link to this definition") Bases: `Enum` * GLOBAL*: [`CSys`](#SurfaceLoad.CSys "viktor.external.scia.object.SurfaceLoad.CSys")** = 0*[](#SurfaceLoad.CSys.GLOBAL "Link to this definition") - LOCAL*: [`CSys`](#SurfaceLoad.CSys "viktor.external.scia.object.SurfaceLoad.CSys")** = 1*[](#SurfaceLoad.CSys.LOCAL "Link to this definition") - *class *Direction(*\*values*)[](#SurfaceLoad.Direction "Link to this definition") Bases: `Enum` * X*: [`Direction`](#SurfaceLoad.Direction "viktor.external.scia.object.SurfaceLoad.Direction")** = 0*[](#SurfaceLoad.Direction.X "Link to this definition") - Y*: [`Direction`](#SurfaceLoad.Direction "viktor.external.scia.object.SurfaceLoad.Direction")** = 1*[](#SurfaceLoad.Direction.Y "Link to this definition") * Z*: [`Direction`](#SurfaceLoad.Direction "viktor.external.scia.object.SurfaceLoad.Direction")** = 2*[](#SurfaceLoad.Direction.Z "Link to this definition") * *class *Location(*\*values*)[](#SurfaceLoad.Location "Link to this definition") Bases: `Enum` * LENGTH*: [`Location`](#SurfaceLoad.Location "viktor.external.scia.object.SurfaceLoad.Location")** = 0*[](#SurfaceLoad.Location.LENGTH "Link to this definition") - PROJECTION*: [`Location`](#SurfaceLoad.Location "viktor.external.scia.object.SurfaceLoad.Location")** = 1*[](#SurfaceLoad.Location.PROJECTION "Link to this definition") - *class *Type(*\*values*)[](#SurfaceLoad.Type "Link to this definition") Bases: `Enum` * FORCE*: [`Type`](#SurfaceLoad.Type "viktor.external.scia.object.SurfaceLoad.Type")** = 0*[](#SurfaceLoad.Type.FORCE "Link to this definition") - SELF\_WEIGHT*: [`Type`](#SurfaceLoad.Type "viktor.external.scia.object.SurfaceLoad.Type")** = 1*[](#SurfaceLoad.Type.SELF_WEIGHT "Link to this definition") * *property *load\_case*: [LoadCase](#LoadCase "viktor.external.scia.object.LoadCase")*[](#SurfaceLoad.load_case "Link to this definition") - *property *plane*: [Plane](#Plane "viktor.external.scia.object.Plane")*[](#SurfaceLoad.plane "Link to this definition") <!-- --> ## SurfaceSupportSurface[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_SurfaceSupportSurface "Direct link to SurfaceSupportSurface") * *class *viktor.external.scia.object.SurfaceSupportSurface(*object\_id*, *name*, *plane*, *subsoil*)[](#SurfaceSupportSurface "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_surface_support()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_surface_support "viktor.external.scia.scia.Model.create_surface_support") * *property *plane*: [Plane](#Plane "viktor.external.scia.object.Plane")*[](#SurfaceSupportSurface.plane "Link to this definition") - *property *subsoil*: [Subsoil](#Subsoil "viktor.external.scia.object.Subsoil")*[](#SurfaceSupportSurface.subsoil "Link to this definition") <!-- --> ## ThermalLoad[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_ThermalLoad "Direct link to ThermalLoad") * *class *viktor.external.scia.object.ThermalLoad(*object\_id*, *name*, *load\_case*, *beam*, *distribution*, *delta*, *left\_delta*, *right\_delta*, *top\_delta*, *bottom\_delta*, *position\_start*, *position\_end*, *c\_def*, *origin*)[](#ThermalLoad "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_thermal_load()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_thermal_load "viktor.external.scia.scia.Model.create_thermal_load") * *class *CDef(*\*values*)[](#ThermalLoad.CDef "Link to this definition") Bases: `Enum` * **ABSOLUTE** - absolute, where the coordinate must lie between 0 and the length of the beam * **RELATIVE** - relative, where the coordinate must lie between 0 and 1 - ABSOLUTE*: [`CDef`](#ThermalLoad.CDef "viktor.external.scia.object.ThermalLoad.CDef")** = 0*[](#ThermalLoad.CDef.ABSOLUTE "Link to this definition") * RELATIVE*: [`CDef`](#ThermalLoad.CDef "viktor.external.scia.object.ThermalLoad.CDef")** = 1*[](#ThermalLoad.CDef.RELATIVE "Link to this definition") - *class *Distribution(*\*values*)[](#ThermalLoad.Distribution "Link to this definition") Bases: `Enum` * CONSTANT*: [`Distribution`](#ThermalLoad.Distribution "viktor.external.scia.object.ThermalLoad.Distribution")** = 0*[](#ThermalLoad.Distribution.CONSTANT "Link to this definition") - LINEAR*: [`Distribution`](#ThermalLoad.Distribution "viktor.external.scia.object.ThermalLoad.Distribution")** = 1*[](#ThermalLoad.Distribution.LINEAR "Link to this definition") * *class *Origin(*\*values*)[](#ThermalLoad.Origin "Link to this definition") Bases: `Enum` * **FROM\_START** - position is measured from the beginning of the beam * **FROM\_END** - position is measured from the end of the beam - FROM\_END*: [`Origin`](#ThermalLoad.Origin "viktor.external.scia.object.ThermalLoad.Origin")** = 1*[](#ThermalLoad.Origin.FROM_END "Link to this definition") * FROM\_START*: [`Origin`](#ThermalLoad.Origin "viktor.external.scia.object.ThermalLoad.Origin")** = 0*[](#ThermalLoad.Origin.FROM_START "Link to this definition") - *property *beam*: [Beam](#Beam "viktor.external.scia.object.Beam")*[](#ThermalLoad.beam "Link to this definition") * *property *load\_case*: [LoadCase](#LoadCase "viktor.external.scia.object.LoadCase")*[](#ThermalLoad.load_case "Link to this definition") <!-- --> ## ThermalSurfaceLoad[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_ThermalSurfaceLoad "Direct link to ThermalSurfaceLoad") * *class *viktor.external.scia.object.ThermalSurfaceLoad(*object\_id*, *name*, *load\_case*, *plane*, *delta=None*, *top\_delta=None*, *bottom\_delta=None*)[](#ThermalSurfaceLoad "Link to this definition") Bases: [`SciaObject`](#SciaObject "viktor.external.scia.object.SciaObject") Do not use this \_\_init\_\_ directly, but create the object by [`create_thermal_surface_load()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_thermal_surface_load "viktor.external.scia.scia.Model.create_thermal_surface_load") * *class *Distribution(*\*values*)[](#ThermalSurfaceLoad.Distribution "Link to this definition") Bases: `Enum` * CONSTANT*: [`Distribution`](#ThermalSurfaceLoad.Distribution "viktor.external.scia.object.ThermalSurfaceLoad.Distribution")** = 0*[](#ThermalSurfaceLoad.Distribution.CONSTANT "Link to this definition") - LINEAR*: [`Distribution`](#ThermalSurfaceLoad.Distribution "viktor.external.scia.object.ThermalSurfaceLoad.Distribution")** = 1*[](#ThermalSurfaceLoad.Distribution.LINEAR "Link to this definition") <!-- --> ## VariableLoadCase[​](https://docs.viktor.ai/sdk/api/external/scia/.md#_VariableLoadCase "Direct link to VariableLoadCase") * *class *viktor.external.scia.object.VariableLoadCase(*object\_id*, *name*, *description*, *load\_group*, *load\_type*, *specification=None*, *duration=None*, *primary\_effect=None*, *master=None*)[](#VariableLoadCase "Link to this definition") Bases: [`LoadCase`](#LoadCase "viktor.external.scia.object.LoadCase") Do not use this \_\_init\_\_ directly, but create the object by [`create_variable_load_case()`](https://docs.viktor.ai/sdk/api/external/scia/.md#Model.create_variable_load_case "viktor.external.scia.scia.Model.create_variable_load_case") * *property *direction*: None*[](#VariableLoadCase.direction "Link to this definition") - *property *duration*: [Duration](#LoadCase.Duration "viktor.external.scia.object.LoadCase.Duration") | None*[](#VariableLoadCase.duration "Link to this definition") * *property *load\_type*: [VariableLoadType](#LoadCase.VariableLoadType "viktor.external.scia.object.LoadCase.VariableLoadType")*[](#VariableLoadCase.load_type "Link to this definition") - *property *master*: str | None*[](#VariableLoadCase.master "Link to this definition") * *property *primary\_effect*: [LoadCase](#LoadCase "viktor.external.scia.object.LoadCase") | None*[](#VariableLoadCase.primary_effect "Link to this definition") - *property *specification*: [Specification](#LoadCase.Specification "viktor.external.scia.object.LoadCase.Specification") | None*[](#VariableLoadCase.specification "Link to this definition") --- # viktor.external.spreadsheet <!-- --> <!-- --> <!-- --> ## DirectInputCell[​](https://docs.viktor.ai/sdk/api/external/spreadsheet/.md#_DirectInputCell "Direct link to DirectInputCell") * *class *viktor.external.spreadsheet.DirectInputCell(*sheet\_name*, *column*, *row*, *value*)[](#DirectInputCell "Link to this definition") Bases: `_DirectCellBaseClass` Class for defining a direct cell in which a value must be inserted If a rectangular block of data has to be inserted, use [`InputCellRange`](#InputCellRange "viktor.external.spreadsheet.InputCellRange") for more efficiency. * Parameters: * **sheet\_name** (`str`) – name of the sheet in which the cell is present. * **column** (`str`) – target column. * **row** (`int`) – target row. * **value** (`bool` | `int` | `str` | `float`) – value to be placed in the cell. - serialize(*convert\_value\_to\_str=False*)[](#DirectInputCell.serialize "Link to this definition") * Parameters: **convert\_value\_to\_str** (`bool`) – convert value to str. Necessary when DirectInputCell is used in coupled Excel program (only old workers). * Return type: `dict` <!-- --> ## DirectOutputCell[​](https://docs.viktor.ai/sdk/api/external/spreadsheet/.md#_DirectOutputCell "Direct link to DirectOutputCell") * *class *viktor.external.spreadsheet.DirectOutputCell(*sheet\_name*, *column*, *row*)[](#DirectOutputCell "Link to this definition") Bases: `_DirectCellBaseClass` Class for defining a direct cell of which an output is desired. Example usage: ``` direct_cell = DirectOutputCell('sheet_name', 'G', 3) excel = Excel(template, direct_output_cells=[direct_cell]) excel.execute() my_desired_value = direct_cell.result ``` * equals(*direct\_cell\_result*)[](#DirectOutputCell.equals "Link to this definition") * Return type: `bool` - *property *result*: Any*[](#DirectOutputCell.result "Link to this definition") * serialize()[](#DirectOutputCell.serialize "Link to this definition") * Return type: `dict` <!-- --> ## InputCellRange[​](https://docs.viktor.ai/sdk/api/external/spreadsheet/.md#_InputCellRange "Direct link to InputCellRange") * *class *viktor.external.spreadsheet.InputCellRange(*sheet\_name*, *left\_column*, *top\_row*, *data*)[](#InputCellRange "Link to this definition") Convenience object to define a range of cells in row- and/or column direction. For single cells, use [`DirectInputCell`](#DirectInputCell "viktor.external.spreadsheet.DirectInputCell") Example: ``` data = [ [1, 2, 3], [4, 5, 6], ['a', 'b', 'c'], ] cell_range = InputCellRange('Sheet1', left_column='B', top_row=3, data=data) ``` This produces the following sheet: > | | | | | | | > | - | - | - | - | - | - | > | | A | B | C | D | E | > | 1 | | | | | | > | 2 | | | | | | > | 3 | | 1 | 2 | 3 | | > | 4 | | 4 | 5 | 6 | | > | 5 | | a | b | c | | > | 6 | | | | | | * Parameters: * **sheet\_name** (`str`) – name of the sheet in which the data is inserted * **left\_column** (`str`) – column letter of the top left target of the data * **top\_row** (`int`) – row number of the top left target of the data * **data** (`List`\[`List`\[`float` | `str`]]) – content which is filled in the cell range. the nested list structure should be rectangular (each list should have the same length) and not empty. - serialize()[](#InputCellRange.serialize "Link to this definition") * Return type: `dict` <!-- --> ## NamedInputCell[​](https://docs.viktor.ai/sdk/api/external/spreadsheet/.md#_NamedInputCell "Direct link to NamedInputCell") * *class *viktor.external.spreadsheet.NamedInputCell(*name*, *value*)[](#NamedInputCell "Link to this definition") Bases: `_NamedCellBaseClass` Class for defining a named cell in which a value must be inserted. * Parameters: * **name** (`str`) – name of the cell. * **value** (`bool` | `int` | `str` | `float`) – value to be placed in the cell. - serialize(*convert\_value\_to\_str=False*)[](#NamedInputCell.serialize "Link to this definition") * Parameters: **convert\_value\_to\_str** (`bool`) – convert value to str. Necessary when NamedInputCell is used in coupled Excel program (only old workers). * Return type: `dict` * serialize\_for\_fill\_spreadsheet()[](#NamedInputCell.serialize_for_fill_spreadsheet "Link to this definition") * Return type: `dict` <!-- --> ## NamedOutputCell[​](https://docs.viktor.ai/sdk/api/external/spreadsheet/.md#_NamedOutputCell "Direct link to NamedOutputCell") * *class *viktor.external.spreadsheet.NamedOutputCell(*name*)[](#NamedOutputCell "Link to this definition") Bases: `_NamedCellBaseClass` Class for defining named cells of which the output is desired. Example usage: ``` named_cell = NamedOutputCell('my_name') excel = Excel(template, named_output_cells=[named_cell]) excel.execute() my_desired_value = named_cell.result ``` * equals(*named\_cell\_result*)[](#NamedOutputCell.equals "Link to this definition") * Return type: `bool` - *property *result*: Any*[](#NamedOutputCell.result "Link to this definition") Property that returns the result of this cell. May be called after Excel has been executed. * Returns: the result of this cell after excel execution * serialize()[](#NamedOutputCell.serialize "Link to this definition") * Return type: `dict` <!-- --> ## SpreadsheetCalculation[​](https://docs.viktor.ai/sdk/api/external/spreadsheet/.md#_SpreadsheetCalculation "Direct link to SpreadsheetCalculation") * *class *viktor.external.spreadsheet.SpreadsheetCalculation(*file*, *inputs*)[](#SpreadsheetCalculation "Link to this definition") Using a spreadsheet for calculations, inserting inputs and reading outputs. This spreadsheet should not contain macros. See the excel module for spreadsheet calculations with macros. Example usage: ``` inputs = [ SpreadsheetCalculationInput('x', 1), SpreadsheetCalculationInput('y', 2), ] spreadsheet = SpreadsheetCalculation(spreadsheet, inputs) result = spreadsheet.evaluate(include_filled_file=False) values = result.values ``` * Parameters: **file** (`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – spreadsheet file - evaluate(*include\_filled\_file=False*)[](#SpreadsheetCalculation.evaluate "Link to this definition") This function enters the values provided into the input tab of the sheet. The sheet evaluates the input and returns a dictionary containing key value pairs of the result parameters Note This method needs to be mocked in (automated) unit and integration tests. * Parameters: **include\_filled\_file** (`bool`) – when True, the SpreadsheetResult will contain the filled in spreadsheet. * Return type: [`SpreadsheetResult`](#SpreadsheetResult "viktor.external.spreadsheet.SpreadsheetResult") * *property *file*: [File](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")*[](#SpreadsheetCalculation.file "Link to this definition") New in v14.14.0 Returns a File object of the to-be-calculated spreadsheet. - *classmethod *from\_path(*file\_path*, *inputs*)[](#SpreadsheetCalculation.from_path "Link to this definition") * Parameters: * **file\_path** (`str` | `bytes` | `PathLike`) – Complete path including extension * **inputs** (`List`\[[`SpreadsheetCalculationInput`](#SpreadsheetCalculationInput "viktor.external.spreadsheet.SpreadsheetCalculationInput")]) * Return type: [`SpreadsheetCalculation`](#SpreadsheetCalculation "viktor.external.spreadsheet.SpreadsheetCalculation") * *property *result*: [SpreadsheetResult](#SpreadsheetResult "viktor.external.spreadsheet.SpreadsheetResult")*[](#SpreadsheetCalculation.result "Link to this definition") <!-- --> ## SpreadsheetCalculationInput[​](https://docs.viktor.ai/sdk/api/external/spreadsheet/.md#_SpreadsheetCalculationInput "Direct link to SpreadsheetCalculationInput") * *class *viktor.external.spreadsheet.SpreadsheetCalculationInput(*name*, *value*)[](#SpreadsheetCalculationInput "Link to this definition") Bases: [`NamedInputCell`](#NamedInputCell "viktor.external.spreadsheet.NamedInputCell") This class is subclassed from NamedInputCell because the same functionality is needed. * Parameters: * **name** (`str`) – name of the cell. * **value** (`bool` | `int` | `str` | `float`) – value to be placed in the cell. <!-- --> ## SpreadsheetResult[​](https://docs.viktor.ai/sdk/api/external/spreadsheet/.md#_SpreadsheetResult "Direct link to SpreadsheetResult") * *class *viktor.external.spreadsheet.SpreadsheetResult(*\**, *values=None*, *file=None*)[](#SpreadsheetResult "Link to this definition") Wrapper around results obtained from spreadsheet services. Warning Do not instantiate this class directly, it is created by the spreadsheet service. * *property *file*: [File](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")*[](#SpreadsheetResult.file "Link to this definition") New in v14.14.0 Returns a File object of the resulting filled-in spreadsheet. - *property *file\_content*: bytes*[](#SpreadsheetResult.file_content "Link to this definition") * get\_value(*name*)[](#SpreadsheetResult.get_value "Link to this definition") * Return type: `Any` - *property *values*: dict*[](#SpreadsheetResult.values "Link to this definition") <!-- --> ## SpreadsheetTemplate[​](https://docs.viktor.ai/sdk/api/external/spreadsheet/.md#_SpreadsheetTemplate "Direct link to SpreadsheetTemplate") * *class *viktor.external.spreadsheet.SpreadsheetTemplate(*file*, *input\_cells*)[](#SpreadsheetTemplate "Link to this definition") Note Prefer to use the function [`render_spreadsheet()`](#render_spreadsheet "viktor.external.spreadsheet.render_spreadsheet") instead. Fill spreadsheet with values/text. This can be done both with direct cells (e.g. A2), or named cells. Example usage: ``` cells = [ DirectInputCell('sheet1', 'A', 1, 5), NamedInputCell('named_cell_1', 'text_to_be_placed'), ] template = SpreadsheetTemplate(template, cells) result = template.render() filled_template = result.file_content ``` * Parameters: * **file** (`BytesIO`) – BytesIO object of the spreadsheet * **input\_cells** (`List`\[[`DirectInputCell`](#DirectInputCell "viktor.external.spreadsheet.DirectInputCell") | [`NamedInputCell`](#NamedInputCell "viktor.external.spreadsheet.NamedInputCell") | [`InputCellRange`](#InputCellRange "viktor.external.spreadsheet.InputCellRange")]) – The cells to fill the file with. - *classmethod *from\_path(*file\_path*, *input\_cells*)[](#SpreadsheetTemplate.from_path "Link to this definition") * Parameters: * **file\_path** (`str` | `bytes` | `PathLike`) – Complete path including extension * **input\_cells** (`List`\[[`DirectInputCell`](#DirectInputCell "viktor.external.spreadsheet.DirectInputCell") | [`NamedInputCell`](#NamedInputCell "viktor.external.spreadsheet.NamedInputCell") | [`InputCellRange`](#InputCellRange "viktor.external.spreadsheet.InputCellRange")]) – The cells to fill the file with * Return type: [`SpreadsheetTemplate`](#SpreadsheetTemplate "viktor.external.spreadsheet.SpreadsheetTemplate") * render()[](#SpreadsheetTemplate.render "Link to this definition") This function renders the SpreadsheetTemplate with cells. It returns a SpreadsheetResult object of the filled template. * Return type: [`SpreadsheetResult`](#SpreadsheetResult "viktor.external.spreadsheet.SpreadsheetResult") * Returns: a SpreadsheetResult object containing the filled template - *property *result*: [SpreadsheetResult](#SpreadsheetResult "viktor.external.spreadsheet.SpreadsheetResult")*[](#SpreadsheetTemplate.result "Link to this definition") <!-- --> ## render\_spreadsheet[​](https://docs.viktor.ai/sdk/api/external/spreadsheet/.md#_render_spreadsheet "Direct link to render_spreadsheet") * viktor.external.spreadsheet.render\_spreadsheet(*template*, *cells*)[](#render_spreadsheet "Link to this definition") Fill spreadsheet with values/text. This can be done both with direct cells (e.g. A2), or named cells. Example usage: ``` cells = [ DirectInputCell('sheet1', 'A', 1, 5), NamedInputCell('named_cell_1', 'text_to_be_placed'), ] template_path = Path(__file__).parent / 'my' / 'relative' / 'path' / 'template.xlsx' with open(template_path, 'rb') as template: filled_spreadsheet = render_spreadsheet(template, cells) ``` * Parameters: * **template** (`BinaryIO`) – spreadsheet template file * **cells** (`List`\[[`DirectInputCell`](#DirectInputCell "viktor.external.spreadsheet.DirectInputCell") | [`NamedInputCell`](#NamedInputCell "viktor.external.spreadsheet.NamedInputCell") | [`InputCellRange`](#InputCellRange "viktor.external.spreadsheet.InputCellRange")]) – cells to fill the template with * Return type: [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") * Returns: File object containing the rendered spreadsheet <!-- --> ## stringify\_value[​](https://docs.viktor.ai/sdk/api/external/spreadsheet/.md#_stringify_value "Direct link to stringify_value") * viktor.external.spreadsheet.stringify\_value(*value*)[](#stringify_value "Link to this definition") Function that will create the correct string representation of python data types, in order for ‘value’ to be inserted in Excel correctly. * Parameters: **value** (`bool` | `int` | `str` | `float`) – the value to be stringified. * Return type: `str` * Returns: a string representation of value. --- # viktor.external.tekla <!-- --> <!-- --> <!-- --> ## TeklaAnalysis[​](https://docs.viktor.ai/sdk/api/external/tekla/.md#_TeklaAnalysis "Direct link to TeklaAnalysis") * *class *viktor.external.tekla.TeklaAnalysis(*script=None*, *script\_key=''*, *files=None*, *output\_filenames=None*)[](#TeklaAnalysis "Link to this definition") Bases: [`PythonAnalysis`](https://docs.viktor.ai/sdk/api/external/python/.md#PythonAnalysis "viktor.external.python.PythonAnalysis") New in 14.17.0 TeklaAnalysis can be used to evaluate a tekla-python script on third-party infrastructure. The script is expected to be blocking, i.e. if the script is invoked from command prompt, it should wait until the executable is finished. The default behaviour, is that the python script is defined within the app and send to the worker to be executed on third-party infrastructure. If desired (due to security considerations) the worker can be configured to only run local scripts. These scripts must be defined the in worker configuration file and can be selected through the script\_key. Usage: ``` script = vkt.File.from_path(Path(__file__).parent / "run_tekla.py") files = [ ('input1.txt', file1), ] analysis = TeklaAnalysis(script=script, files=files, output_filenames=["output.txt"]) analysis.execute(timeout=60) output_file = analysis.get_output_file("output.txt") ``` Exceptions which can be raised during calculation: > * [`viktor.errors.LicenseError`](https://docs.viktor.ai/sdk/api/errors/.md#LicenseError "viktor.errors.LicenseError"): no license available > > * [`viktor.errors.ExecutionError`](https://docs.viktor.ai/sdk/api/errors/.md#ExecutionError "viktor.errors.ExecutionError"): generic error. Error message provides more information * Parameters: * **script** ([`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Script file that is transferred to the working directory on the server. * **script\_key** (`str`) – The key of the script that needs to be run. Only use this when the worker is configured to run local scripts. This key should be present in the configuration file of the worker. * **files** (`List`\[`Tuple`\[`str`, `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]]) – Additional files that are transferred to the working directory on the server. Each file is a tuple containing the content and the filename which is used to save on the infrastructure. * **output\_filenames** (`List`\[`str`]) – A list of filenames (including extension) that are to be transferred back to the app. This filename is relative to the working directory. Either one of ‘script’ or ‘script\_key’ should be defined. * Raises: **ValueError** – when neither ‘script’ or ‘script\_key’ is included OR when both are included. --- # viktor.external.word <!-- --> <!-- --> <!-- --> ## WordFileComponent[​](https://docs.viktor.ai/sdk/api/external/word/.md#_WordFileComponent "Direct link to WordFileComponent") * *class *viktor.external.word.WordFileComponent(*identifier*)[](#WordFileComponent "Link to this definition") Bases: `ABC` Abstract base class for specific word file components, such as tags, images… <!-- --> ## WordFileImage[​](https://docs.viktor.ai/sdk/api/external/word/.md#_WordFileImage "Direct link to WordFileImage") * *class *viktor.external.word.WordFileImage(*file*, *identifier*, *width=None*, *height=None*)[](#WordFileImage "Link to this definition") Bases: [`WordFileComponent`](#WordFileComponent "viktor.external.word.WordFileComponent") Add an image in a Word file template. When neither width or height is provided, the original size is used. When only one is provided, the other is scaled. When both are provided, both are used and the original aspect ratio might be changed. * Parameters: * **file** (`BinaryIO`) – image to be placed at the tag location * **identifier** (`str`) – used to find the location in the template * **width** (`int`) – optional parameter for sizing. in Pt * **height** (`int`) – optional parameter for sizing. in Pt - *classmethod *from\_path(*file\_path*, *identifier*, *width=None*, *height=None*)[](#WordFileImage.from_path "Link to this definition") Create a WordFileImage from an image defined by its file path. * Return type: [`WordFileImage`](#WordFileImage "viktor.external.word.WordFileImage") <!-- --> ## WordFileResult[​](https://docs.viktor.ai/sdk/api/external/word/.md#_WordFileResult "Direct link to WordFileResult") * *class *viktor.external.word.WordFileResult(*\**, *file\_content=None*)[](#WordFileResult "Link to this definition") * *property *file\_content*: bytes*[](#WordFileResult.file_content "Link to this definition") <!-- --> ## WordFileTag[​](https://docs.viktor.ai/sdk/api/external/word/.md#_WordFileTag "Direct link to WordFileTag") * *class *viktor.external.word.WordFileTag(*identifier*, *value*)[](#WordFileTag "Link to this definition") Bases: [`WordFileComponent`](#WordFileComponent "viktor.external.word.WordFileComponent") Add a value in a Word file template by tag. * Parameters: * **identifier** (`str`) – used to find the location in the template * **value** (`str` | `int` | `float` | `bool` | `None` | `list` | `dict`) – what needs to be placed at the tag location. A scalar (str, int, float, bool, None) fills a single value; a list or dict (optionally nested) is iterated over, e.g. to fill repeating table rows. <!-- --> ## WordFileTemplate[​](https://docs.viktor.ai/sdk/api/external/word/.md#_WordFileTemplate "Direct link to WordFileTemplate") * *class *viktor.external.word.WordFileTemplate(*file*, *components*)[](#WordFileTemplate "Link to this definition") Note Prefer to use the function [`render_word_file()`](#render_word_file "viktor.external.word.render_word_file") instead. Fill wordfile template with components (e.g. text, image). Note that the template file should be a BytesIO object of a .docx file (not .doc). Example usage: ``` >>> file = BytesIO(b'file') >>> image = BytesIO(b'image') >>> >>> tags = [ >>> WordFileTag('x', 1), >>> WordFileTag('y', 2), >>> WordFileImage(image, 'fig_tag', width=300), >>> ] >>> word_file_template = WordFileTemplate(file, tags) >>> result = word_file_template.render() >>> word_file = result.file_content ``` * Parameters: * **file** (`BytesIO`) – BytesIO object of the Word template * **components** (`List`\[[`WordFileComponent`](#WordFileComponent "viktor.external.word.WordFileComponent")]) – items that need to be inserted in the template - *classmethod *from\_path(*file\_path*, *components*)[](#WordFileTemplate.from_path "Link to this definition") * Parameters: * **file\_path** (`str` | `bytes` | `PathLike`) – Complete path including extension * **components** (`List`\[[`WordFileComponent`](#WordFileComponent "viktor.external.word.WordFileComponent")]) – items that need to be inserted in the template * Return type: [`WordFileTemplate`](#WordFileTemplate "viktor.external.word.WordFileTemplate") * render()[](#WordFileTemplate.render "Link to this definition") This function renders the docx template and returns the resulting file. Note This method needs to be mocked in (automated) unit and integration tests. * Return type: [`WordFileResult`](#WordFileResult "viktor.external.word.WordFileResult") - *property *result*: [WordFileResult](#WordFileResult "viktor.external.word.WordFileResult")*[](#WordFileTemplate.result "Link to this definition") <!-- --> ## render\_word\_file[​](https://docs.viktor.ai/sdk/api/external/word/.md#_render_word_file "Direct link to render_word_file") * viktor.external.word.render\_word\_file(*template*, *components*)[](#render_word_file "Link to this definition") Fill Word file with components (e.g. text, image). Example usage: ``` components = [ WordFileTag('x', 1), WordFileImage(image, 'fig_tag', width=300), ] template_path = Path(__file__).parent / 'my' / 'relative' / 'path' / 'template.docx' with open(template_path, 'rb') as template: word_file = render_word_file(template, components) ``` Note This method needs to be mocked in (automated) unit and integration tests. * Parameters: * **template** (`BinaryIO`) – Word file template of type .docx (not .doc) * **components** (`List`\[[`WordFileComponent`](#WordFileComponent "viktor.external.word.WordFileComponent")]) – components to fill the template with * Return type: [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") * Returns: File object containing the rendered Word file * Raises: [`viktor.errors.WordFileError`](https://docs.viktor.ai/sdk/api/errors/.md#WordFileError "viktor.errors.WordFileError") when rendering fails --- # viktor.geo <!-- --> <!-- --> <!-- --> ## GEFData[​](https://docs.viktor.ai/sdk/api/geo/.md#_GEFData "Direct link to GEFData") * *class *viktor.geo.GEFData(*gef\_dict*)[](#GEFData "Link to this definition") Initialize GEFData object to simplify working with GEF data. Every GEF has different header fields, and therefore only a limited amount of fields is compulsory. All other header fields are also added as attribute. Compulsory header fields are: > * name > > * ground\_level\_wrt\_reference Other header fields might be compulsory for methods on the object (e.g. get\_cone\_visualization). See docstring of the specific method for needed headers. The following measurement\_data fields are also compulsory and are implicitly parsed from the file (do NOT need to be specified explicitly): > * elevation > > * qc > > * Rf Examples of optional attributes from header are: > * height\_system > > * project\_name > > * project\_id > > * gef\_file\_date > > * gef\_version\_number > > * x\_y\_coordinates > > * coordinate\_system > > * excavation\_depth > > * measurement\_standard > > * surface\_area\_quotient\_tip > > * water\_level > > * cone\_tip\_area > > * cone\_type Measurement\_data fields that are optional are: > * u2 > > * fs > > * penetration\_length > > * corrected\_depth > > * inclination > > * inclination\_n\_s > > * inclination\_e\_w Example implementation to create GEFData object: ``` import viktor as vkt class GEFFileController(vkt.Controller): ... @vkt.ParamsFromFile(file_types=['.gef']) def process_file(self, file, **kwargs) -> dict: file_content = file.getvalue(encoding="ISO-8859-1") gef_file = vkt.geo.GEFFile(file_content) gef_data_object = gef_file.parse(additional_columns=['elevation', 'qc', 'Rf', 'fs', 'u2'], return_gef_data_obj=True) gef_dict = gef_data_object.serialize() return {'gef_dict': gef_dict} def get_gef_content_from_database(self) -> vkt.geo.GEFData: # API call to right entity return vkt.geo.GEFData(gef_file_entity.last_saved_params['gef_dict']) ``` * Parameters: **gef\_dict** (`dict` | `Munch`) – dictionary with \[‘headers’] and \[‘measurement\_data’] keys - classify(*method*, *return\_soil\_layout\_obj=True*)[](#GEFData.classify "Link to this definition") Create SoilLayout object or dictionary by classifying the GEF measurement data, using either the Robertson method or a qualification table method. **RobertsonMethod** This method requires the GEFData object to at least contain the measurement data ‘corrected\_depth’. See [`GEFData`](#GEFData "viktor.geo.GEFData") for all possible measurement data columns. ``` from viktor.geo import RobertsonMethod soil_properties = [ {'name': 'Robertson zone unknown', 'extra_property1': 1, 'extra_property2': 2}, {'name': 'Robertson zone 1', 'extra_property1': 3, 'extra_property2': 4}, ] classification_method = RobertsonMethod(soil_properties) soil_layout_dict = gef_data.classify(method=classification_method, return_soil_layout_obj=False) ``` **TableMethod** For this method a qualification table has to be provided by the user, for example through a VIKTOR editor. Please refer to the docstring of [`TableMethod`](#TableMethod "viktor.geo.TableMethod") for the structure of this table. This table is usually controlled on a project-wide level, so in a parent entity. On the controller of the GEF file, you can use the API to retrieve the table content and pass it to the TableMethod: ``` import viktor as vkt api = vkt.api_v1.API() parent_entity = api.get_entity(entity_id).parent() parent_params = parent.last_saved_params qualification_table = parent_params['material_properties'] ground_water_level = parent_params['ground_water_level'] classification_method = vkt.geo.TableMethod(qualification_table, ground_water_level) soil_layout_obj = gef_data.classify(method=classification_method, return_soil_layout_obj=False) ``` Note This method needs to be mocked in (automated) unit and integration tests. * Parameters: * **method** (`_ClassificationMethod`) – Specifies which method should be used for qualification: TableMethod | RobertsonMethod | NormalizedSoilBehaviourTypeIndexMethod. * **return\_soil\_layout\_obj** (`bool`) – Flag to return SoilLayout object or dictionary * Return type: `dict` | [`SoilLayout`](#SoilLayout "viktor.geo.SoilLayout") * Returns: SoilLayout object or dictionary (=SoilLayout.serialize()) * get\_cone\_visualization(*axes*)[](#GEFData.get_cone_visualization "Link to this definition") Modify (clean/empty) ‘axes’ input argument to plot cone resistance (with pore pressure if present in GEF data). * Parameters: **axes** (`Axes`) – Axes object that will be modified. * Return type: `None` The following header fields are compulsory and need to be specified when the GEFData object is created: > * max\_measurement\_depth\_wrt\_reference > > * ground\_level\_wrt\_reference > > * height\_system Example usage: ``` import matplotlib.pyplot as plt # Create main figure fig = plt.figure(figsize=(8.27, 11.69)) # Define contour (rectangle) for cone visualization, and create Axes object that can be modified by # functions rect_cone = [0.1, 0.1, 0.4, 0.9] # [left, bottom, width, height] cone_axes = plt.axes(rect_cone) # Modify created Axes objects self.gef_data.get_cone_visualization(cone_axes) # Convert to SVG for visualization svg_data = StringIO() fig.savefig(svg_data, format='svg', bbox_inches='tight', pad_inches=0.8) plt.close() gef_visualisation_data = svg_data.getvalue() ``` - get\_plotted\_denotation\_large\_qc\_values(*axes*, *x\_loc\_text*)[](#GEFData.get_plotted_denotation_large_qc_values "Link to this definition") Can be used to add text labels with the maximum qc value of a layer that exceeds the maximum value of the x-axis. * Parameters: * **axes** (`Axes`) – Axes object that will be modified. * **x\_loc\_text** (`float`) – Maximum qc value. * Return type: `None` The following header fields are compulsory and need to be specified when the GEFData object is created: > * max\_measurement\_depth\_wrt\_reference An example is shown below where the figure is capped at a maximum qc of 30 MPa (hence x\_loc\_text=30). [![/\_images/gefdata\_plot\_large\_qc.svg](/_images/gefdata_plot_large_qc.svg)](https://docs.viktor.ai/_images/gefdata_plot_large_qc.svg) * get\_resistance\_visualization(*axes*)[](#GEFData.get_resistance_visualization "Link to this definition") Modify (clean/empty) ‘axes’ input argument to plot resistance number. * Parameters: **axes** (`Axes`) – Axes object that will be modified. * Return type: `None` The following header fields are compulsory and need to be specified when the GEFData object is created: > * max\_measurement\_depth\_wrt\_reference > > * ground\_level\_wrt\_reference Example usage: ``` import matplotlib.pyplot as plt # Create main figure fig = plt.figure(figsize=(8.27, 11.69)) # Define contour (rectangle) for resistance number visualization, and create Axes object that can be # modified by functions rect_resistance = [0.1, 0.1, 0.4, 0.9] # [left, bottom, width, height] resistance_axes = plt.axes(rect_resistance) # Modify created Axes objects self.gef_data.get_resistance_visualization(resistance_axes) # Convert to SVG for visualization svg_data = StringIO() fig.savefig(svg_data, format='svg', bbox_inches='tight', pad_inches=0.8) plt.close() gef_visualisation_data = svg_data.getvalue() ``` - serialize()[](#GEFData.serialize "Link to this definition") * Return type: `dict` | `Munch` <!-- --> ## GEFFile[​](https://docs.viktor.ai/sdk/api/geo/.md#_GEFFile "Direct link to GEFFile") * *class *viktor.geo.GEFFile(*file\_content*)[](#GEFFile "Link to this definition") * *classmethod *from\_file(*file\_path*, *encoding='ISO-8859-1'*)[](#GEFFile.from_file "Link to this definition") * Return type: [`GEFFile`](#GEFFile "viktor.geo.GEFFile") - parse(*additional\_columns=None*, *verbose=True*, *return\_gef\_data\_obj=True*)[](#GEFFile.parse "Link to this definition") Parse GEFFile, and return information from GEF in dict with \[‘headers’] and \[‘measurement data’] sub-dicts or a GEFData object. Example implementation: ``` import viktor as vkt class GEFFileController(vkt.Controller): ... @vkt.ParamsFromFile(file_types=['.gef']) def process_file(self, file, **kwargs) -> dict: file_content = file.getvalue(encoding="ISO-8859-1") gef_file = vkt.geo.GEFFile(file_content) gef_data_obj = gef_file.parse(additional_columns=['fs', 'u2'], return_gef_data_obj=True) soil_properties = [ {'name': Robertson zone unknown, 'extra_property1': 1, 'extra_property2': 2}, {'name': Robertson zone 1, 'extra_property1': 3, 'extra_property2': 4}, ] soil_layout_dict = gef_data_obj.classify(method=vkt.geo.RobertsonMethod(soil_properties), return_soil_layout_obj=False) parsed_dict = gef_data_obj.serialize() parsed_dict['soils'] = soil_layout_dict return parsed_dict ``` Note This method needs to be mocked in (automated) unit and integration tests. * Parameters: * **additional\_columns** (`List`\[`str`]) – In order for a GEF file to be of use in VIKTOR, three columns are required: * elevation (corrected depth with respect to a specified datum) * qc (tip pressure as measured) * Rf (friction number, either measured or computed using qc and fs) These three columns will always be parsed and returned, additional columns can be parsed as well. Possible columns to request are: * ”penetration\_length” * ”corrected\_depth” * ”fs” * ”u2” (for more accuracy when qualifying layers using Robertson method) * ”inclination” * ”inclination\_n\_s” * ”inclination\_e\_w” * **verbose** (`bool`) – Boolean specifying if parsing should output warnings or work in silence * **return\_gef\_data\_obj** (`bool`) – Boolean to return GEFData or dictionary * Return type: `dict` | [`GEFData`](#GEFData "viktor.geo.GEFData") * Returns: dictionary with GEF parameters or GEFData object with GEF parameters as attributes <!-- --> ## NormalizedSoilBehaviourTypeIndexMethod[​](https://docs.viktor.ai/sdk/api/geo/.md#_NormalizedSoilBehaviourTypeIndexMethod "Direct link to NormalizedSoilBehaviourTypeIndexMethod") * *class *viktor.geo.NormalizedSoilBehaviourTypeIndexMethod(*ic\_table*, *ground\_water\_level*, *specific\_weight\_soil*, *resolution=None*)[](#NormalizedSoilBehaviourTypeIndexMethod "Link to this definition") Bases: `_ClassificationMethod` Class to classify soil based on the normalized soil behaviour type index Example: ``` ic_table = [ {'name': 'Zand', 'color': '0, 50, 255', 'ic_min': 0, 'ic_max': 3.5}, {'name': 'Klei', 'color': '80, 70, 25', 'ic_min': 3.5, 'cone_factor': 20}, ] ground_water_level = 0 specific_weight_soil = 17 method = NormalizedSoilBehaviourTypeIndexMethod(ic_table, ground_water_level, specific_weight_soil) ``` This method uses the assumption that the specific weight of all the soil layers is the same, this is a simplification. It is possible to calculate the specific weight from qc values. * Parameters: * **ic\_table** (`List`\[`dict`]) – Table with soil types that correspond to Ic values. Keys: name, ic\_min, ic\_max, color, cone\_factor * **ground\_water\_level** (`float`) – Ground water level used to compute qc\_norm * **specific\_weight\_soil** (`float`) – Specific weight of soil in kN/m^3 used to calculate sigma’ * **resolution** (`float`) – Resolution of the classification in m; if None classify each line of data - get\_method\_params()[](#NormalizedSoilBehaviourTypeIndexMethod.get_method_params "Link to this definition") * Return type: `dict` <!-- --> ## PiezoLine[​](https://docs.viktor.ai/sdk/api/geo/.md#_PiezoLine "Direct link to PiezoLine") * *class *viktor.geo.PiezoLine(*points*, *phreatic=False*)[](#PiezoLine "Link to this definition") Bases: [`Polyline`](https://docs.viktor.ai/sdk/api/geometry/.md#Polyline "viktor.geometry.Polyline") Class to represent a Piezo line. Essentially, this is a polyline with a flag added to mark the phreatic polyline. * Parameters: * **points** (`List`\[[`Point`](https://docs.viktor.ai/sdk/api/geometry/.md#Point "viktor.geometry.Point")]) – points of the polyline * **phreatic** (`bool`) – mark the phreatic waterline - *classmethod *from\_dict(*piezo\_line\_dict*)[](#PiezoLine.from_dict "Link to this definition") * Return type: [`PiezoLine`](#PiezoLine "viktor.geo.PiezoLine") * *classmethod *from\_lines(*lines*, *phreatic=False*)[](#PiezoLine.from_lines "Link to this definition") create a polyline object from a list of lines the end of one line must always coincide with the start of the next * Parameters: * **lines** (`List`\[[`Line`](https://docs.viktor.ai/sdk/api/geometry/.md#Line "viktor.geometry.Line") | [`Polyline`](https://docs.viktor.ai/sdk/api/geometry/.md#Polyline "viktor.geometry.Polyline")]) * **phreatic** (`bool`) * Return type: [`PiezoLine`](#PiezoLine "viktor.geo.PiezoLine") - serialize()[](#PiezoLine.serialize "Link to this definition") Return a json serializable dict of form: ``` [ {'x': point_1.x, 'y': point_1.y}, {'x': point_2.x, 'y': point_2.y} ] ``` * Return type: `dict` <!-- --> ## PositionalSoilLayout[​](https://docs.viktor.ai/sdk/api/geo/.md#_PositionalSoilLayout "Direct link to PositionalSoilLayout") * *class *viktor.geo.PositionalSoilLayout(*x*, *soil\_layers*)[](#PositionalSoilLayout "Link to this definition") Bases: [`SoilLayout`](#SoilLayout "viktor.geo.SoilLayout") A subclass of SoilLayout that adds an x location. This can be useful to generate a Soil Layout 2D Generate a positional soil layout from an x location and a list of soil layers * Parameters: * **x** (`float`) * **soil\_layers** (`List`\[[`SoilLayer`](#SoilLayer "viktor.geo.SoilLayer")]) - *classmethod *from\_dict(*positional\_soil\_layout\_dict*)[](#PositionalSoilLayout.from_dict "Link to this definition") Instantiates a PositionalSoilLayout from the provided soil layout data. * Parameters: **positional\_soil\_layout\_dict** (`dict` | `Munch`) – Soil layout data. * Return type: [`PositionalSoilLayout`](#PositionalSoilLayout "viktor.geo.PositionalSoilLayout") * serialize()[](#PositionalSoilLayout.serialize "Link to this definition") Generate a JSON serializable dict from this positional soil layout. * Return type: `dict` <!-- --> ## RobertsonMethod[​](https://docs.viktor.ai/sdk/api/geo/.md#_RobertsonMethod "Direct link to RobertsonMethod") * *class *viktor.geo.RobertsonMethod(*soil\_properties*)[](#RobertsonMethod "Link to this definition") Bases: `_ClassificationMethod` Class to pass Robertson specific properties such as soil\_properties. Every list element at least requires a ‘name’ key that specifies the RobertsonZone. It is important that ‘name’ key matches with hardcoded RobertsonZone.name property. There are 9 Robertson zones and 1 Robertson zone unknown that can be specified By default, the colors as defined in (red, green, blue) for each zone are as shown in this figure: [![/\_images/robertson\_colors.png](/_images/robertson_colors.png)](https://docs.viktor.ai/_images/robertson_colors.png) Example: ``` soil_properties = [ {'name': 'Robertson zone unknown', 'extra_property1': 1, 'extra_property2': 2}, {'name': 'Robertson zone 1', 'extra_property1': 3, 'extra_property2': 4}, ] method = RobertsonMethod(soil_properties) ``` * Parameters: **soil\_properties** (`List`\[`dict`]) – dictionary with soil properties - get\_method\_params()[](#RobertsonMethod.get_method_params "Link to this definition") * Return type: `dict` <!-- --> ## Soil[​](https://docs.viktor.ai/sdk/api/geo/.md#_Soil "Direct link to Soil") * *class *viktor.geo.Soil(*name*, *color*, *properties=None*)[](#Soil "Link to this definition") Set name and color of Soil material. Extra properties can be added with dictionary, and keys are added as attribute via ‘munchify’. They are accessible as self.properties.{extra\_property\_name} * Parameters: * **name** (`str`) * **color** ([`Color`](https://docs.viktor.ai/sdk/api/core/.md#Color "viktor.core.Color")) – color of soil used in plots * **properties** (`dict` | `Munch`) – dict with optional extra parameters to be added to Soil - *property *color*: [Color](https://docs.viktor.ai/sdk/api/core/.md#Color "viktor.core.Color")*[](#Soil.color "Link to this definition") * *classmethod *from\_dict(*d*)[](#Soil.from_dict "Link to this definition") * Return type: [`Soil`](#Soil "viktor.geo.Soil") - serialize()[](#Soil.serialize "Link to this definition") Serialize Soil in following dictionary structure: ``` { 'name', 'color', 'properties': { (..extra_properties..) }, } ``` * Return type: `dict` * Returns: dictionary with all properties of Soil * update\_properties(*properties*)[](#Soil.update_properties "Link to this definition") Replace the current properties dict with the provided new one. For backwards compatibility, this function is kept with this functionality. In order to be able to update the existing properties dict, the properties property is public and mutable. * Parameters: **properties** (`dict` | `Munch`) – dictionary with all SoilLayer properties * Return type: `None` <!-- --> ## SoilLayer[​](https://docs.viktor.ai/sdk/api/geo/.md#_SoilLayer "Direct link to SoilLayer") * *class *viktor.geo.SoilLayer(*soil*, *top\_of\_layer*, *bottom\_of\_layer*, *properties=None*)[](#SoilLayer "Link to this definition") Create a SoilLayer to be used in SoilLayout * Parameters: * **soil** ([`Soil`](#Soil "viktor.geo.Soil")) – Type of soil * **top\_of\_layer** (`float`) – Top of layer * **bottom\_of\_layer** (`float`) – Bottom of layer * **properties** (`dict` | `Munch`) – dict with optional extra parameters to be added to SoilLayer - *classmethod *from\_dict(*soil\_layer\_dict*)[](#SoilLayer.from_dict "Link to this definition") * Return type: [`SoilLayer`](#SoilLayer "viktor.geo.SoilLayer") * serialize()[](#SoilLayer.serialize "Link to this definition") Serialize SoilLayer in following dictionary structure: ``` { 'soil', 'top_of_layer', 'bottom_of_layer', } ``` * Return type: `dict` * Returns: dictionary with properties of SoilLayer - *property *thickness*: float*[](#SoilLayer.thickness "Link to this definition") * update\_properties(*properties*)[](#SoilLayer.update_properties "Link to this definition") Replace the current properties dict with the provided new one. For backwards compatibility, this function is kept with this functionality. In order to be able to update the existing properties dict, the properties property is public and mutable. * Parameters: **properties** (`dict` | `Munch`) – dictionary with all SoilLayer properties * Return type: `None` - update\_soil\_properties(*properties*)[](#SoilLayer.update_soil_properties "Link to this definition") * Return type: `None` <!-- --> ## SoilLayer2D[​](https://docs.viktor.ai/sdk/api/geo/.md#_SoilLayer2D "Direct link to SoilLayer2D") * *class *viktor.geo.SoilLayer2D(*soil*, *top\_profile*, *bottom\_profile*, *properties=None*, *piezo\_line\_top=None*, *piezo\_line\_bottom=None*)[](#SoilLayer2D "Link to this definition") A 2D representation of a soil layer A Soil layer 2d always consists of a soil and a top and bottom profile Optionally, properties and top and bottom pl lines can be added Top and bottom profiles need to be monotonic ascending in x-direction Top and bottom profiles need to have identical start x and end x coordinates. These will become the left and right boundaries Top and bottom profiles can overlap, but not intersect. The layer can have one or multiple ranges with zero thickness, but the top profile may never lie below the bottom profile * Parameters: * **soil** ([`Soil`](#Soil "viktor.geo.Soil")) * **top\_profile** ([`Polyline`](https://docs.viktor.ai/sdk/api/geometry/.md#Polyline "viktor.geometry.Polyline")) * **bottom\_profile** ([`Polyline`](https://docs.viktor.ai/sdk/api/geometry/.md#Polyline "viktor.geometry.Polyline")) * **properties** (`dict` | `Munch`) * **piezo\_line\_top** ([`PiezoLine`](#PiezoLine "viktor.geo.PiezoLine")) * **piezo\_line\_bottom** ([`PiezoLine`](#PiezoLine "viktor.geo.PiezoLine")) - bottom\_y\_coordinate(*x*)[](#SoilLayer2D.bottom_y_coordinate "Link to this definition") Determine the y-coordinate along the bottom boundary, belonging to the x value used as input If a profile has a vertical section on the given x-location, this method will return the first touching point of the polyline with the vertical line * Parameters: **x** (`float`) – The x-coordinate where the height is requested. * Return type: `float` * Returns: The y-coordinate of the top at the x-coordinate location. * *classmethod *from\_dict(*soil\_layer\_dict*)[](#SoilLayer2D.from_dict "Link to this definition") Instantiates a SoilLayer2D from the provided soil layer data. dict structure: ``` { 'soil': serialized Soil 'top_profile': serialized Polyline 'bottom_profile': serialized Polyline 'piezo_line_top': serialized PiezoLine 'piezo_line_bottom': serialized PiezoLine 'properties': Dict } ``` * Parameters: **soil\_layer\_dict** (`dict` | `Munch`) – Soil layer data. * Return type: [`SoilLayer2D`](#SoilLayer2D "viktor.geo.SoilLayer2D") - height\_at\_x(*x*)[](#SoilLayer2D.height_at_x "Link to this definition") Returns the height at a specific x location. If a profile has a vertical section on the given x-location, this method will return the first touching point of the polyline with the vertical line * Parameters: **x** (`float`) – The x-coordinate where the height is requested. * Return type: `float` * Returns: The height at the x-coordinate location. * *property *left\_boundary*: float*[](#SoilLayer2D.left_boundary "Link to this definition") - polygons()[](#SoilLayer2D.polygons "Link to this definition") Generate a list of polygons representing this soil layer. For every region of this soil layout that has a non-zero thickness, a polygon is generated. * Return type: `List`\[[`Polygon`](https://docs.viktor.ai/sdk/api/geometry/.md#Polygon "viktor.geometry.Polygon")] * *property *right\_boundary*: float*[](#SoilLayer2D.right_boundary "Link to this definition") - serialize()[](#SoilLayer2D.serialize "Link to this definition") Serialize SoilLayer in following dictionary structure: ``` { 'soil': Soil 'top_profile': Polyline 'bottom_profile': Polyline 'piezo_line_top': serialized PiezoLine 'piezo_line_bottom': serialized PiezoLine 'properties': Dict } ``` * Return type: `dict` * Returns: dictionary with properties of SoilLayer * top\_y\_coordinate(*x*)[](#SoilLayer2D.top_y_coordinate "Link to this definition") Determine the y-coordinate along the top boundary, belonging to the x value used as input If a profile has a vertical section on the given x-location, this method will return the first touching point of the polyline with the vertical line * Parameters: **x** (`float`) – The x-coordinate where the height is requested. * Return type: `float` * Returns: The y-coordinate of the top at the x-coordinate location. - update\_properties(*properties*)[](#SoilLayer2D.update_properties "Link to this definition") Replace the current properties dict with the provided new one. For backwards compatibility, this function is kept with this functionality. In order to be able to update the existing properties dict, the properties property is public and mutable. * Parameters: **properties** (`dict` | `Munch`) – dictionary with all SoilLayer properties * Return type: `None` * Returns: * update\_soil\_properties(*properties*)[](#SoilLayer2D.update_soil_properties "Link to this definition") Replace the current soil properties dict with a new one * Parameters: **properties** (`dict` | `Munch`) * Return type: `None` * Returns: - visualize\_geometry(*visualize\_border=False*, *opacity=1*, *material=None*)[](#SoilLayer2D.visualize_geometry "Link to this definition") Returns the visualization elements (group, labels) of the SoilLayer2D which can be used in a GeometryView. * Parameters: * **visualize\_border** (`bool`) – visualize the border surrounding this soil layout with an extra line. * **opacity** (`float`) – float between 0 (transparent) - 1 (opaque) * **material** ([`Material`](https://docs.viktor.ai/sdk/api/geometry/.md#Material "viktor.geometry.Material")) – optional material to be applied on the geometry. * Return type: `Tuple`\[[`Group`](https://docs.viktor.ai/sdk/api/geometry/.md#Group "viktor.geometry.Group"), `List`\[[`Label`](https://docs.viktor.ai/sdk/api/views/.md#Label "viktor.views.Label")]] <!-- --> ## SoilLayout[​](https://docs.viktor.ai/sdk/api/geo/.md#_SoilLayout "Direct link to SoilLayout") * *class *viktor.geo.SoilLayout(*soil\_layers*)[](#SoilLayout "Link to this definition") Aggregation object of SoilLayer * Parameters: **soil\_layers** (`List`\[[`SoilLayer`](#SoilLayer "viktor.geo.SoilLayer")]) – list of SoilLayer objects - append(*layer*)[](#SoilLayout.append "Link to this definition") Add a layer to the bottom of the classification * Parameters: **layer** ([`SoilLayer`](#SoilLayer "viktor.geo.SoilLayer")) – SoilLayer instance * Return type: `None` * *property *bottom*: float*[](#SoilLayout.bottom "Link to this definition") Height level of the bottom of the layout. - filter\_layers\_on\_thickness(*min\_layer\_thickness*, *merge\_adjacent\_same\_soil\_layers=False*)[](#SoilLayout.filter_layers_on_thickness "Link to this definition") Collects layers that are thinner than min\_layer\_thickness in groups, and replaces them by one of two things: > * If the group is thinner than min\_layer\_thickness, it is removed from the soil layout and the layer above it is elongated to fill the gap. See explanation figure, situation A. > > * If the group is equal to or thicker than min\_layer\_thickness, a new layer with Soil and properties of the most dominant (based cumulative thickness) soiltype occurring within this block of layers that was replaced by the new layer. See explanation figure, situation B. After all replacements have been made, if merge\_adjacent\_same\_soil\_layers is specified as True (default is False), `_merge_adjacent_same_soil_layers()` is called, which merges adjacent soil layers that have the same soiltype and have the same set of parameters. Note that this merging results in a new layer that has the average value for all soil layer properties present in the layers that were merged. See the docstring of `_merge_adjacent_same_soil_layers()` for more detailed information about how this is done. * Parameters: * **min\_layer\_thickness** (`float`) – Minimum thickness * **merge\_adjacent\_same\_soil\_layers** (`bool`) – Try to merge adjacent layers that have the same soil type * Return type: [`SoilLayout`](#SoilLayout "viktor.geo.SoilLayout") Note: this method alters the instance! [![/\_images/soil\_layout\_filtering\_explanation.svg](/_images/soil_layout_filtering_explanation.svg)](https://docs.viktor.ai/_images/soil_layout_filtering_explanation.svg) * filter\_unique\_soils()[](#SoilLayout.filter_unique_soils "Link to this definition") * Return type: `List`\[[`Soil`](#Soil "viktor.geo.Soil")] - *classmethod *from\_dict(*soil\_layout\_dict*)[](#SoilLayout.from_dict "Link to this definition") Create SoilLayout with dictionary from SoilLayout.serialize(). Useful when SoilLayout needs to be created from dictionary from the database. Example usage: ``` class Controller(vkt.Controller): ... def get_soil_layout_from_database(self) -> vkt.geo.SoilLayout: # API call to entity that stores complete SoilLayout layout_dict = entity.last_saved_params['layout_dict'] soil_layout = vkt.geo.SoilLayout.from_dict(layout_dict) return soil_layout ``` * Parameters: **soil\_layout\_dict** (`Dict`\[`str`, `List`] | `Munch`) – dictionary with same structure as SoilLayout.serialize() * Return type: [`SoilLayout`](#SoilLayout "viktor.geo.SoilLayout") * get\_visualization(*axes*)[](#SoilLayout.get_visualization "Link to this definition") Modify (clean/empty) ‘axes’ input argument to plot SoilLayout structure. Layers must be sorted from top to bottom. * Parameters: **axes** (`Axes`) – Axes object that will be modified * Return type: `None` - *property *number\_of\_layers*: int*[](#SoilLayout.number_of_layers "Link to this definition") Number of layers * serialize()[](#SoilLayout.serialize "Link to this definition") Serialize SoilLayout to dict (e.g. to store in database). The structure of dict is: ``` { 'layers': [...] } ``` * Return type: `dict` - *property *top*: float*[](#SoilLayout.top "Link to this definition") Height level of the top of the layout. * update\_layers()[](#SoilLayout.update_layers "Link to this definition") Merges adjacent layers that have the same soil type. The merged layer is assigned the average value of each SoilLayer’s individual properties. This average is calculated in ratio to the thickness of the layers. After merging layer depths are corrected by going from top to bottom and setting each bottom\_of\_layer equal to top\_of\_layer of next SoilLayer * Return type: `None` Example layer 1 has thickness 10 and for property A a value of 5 layer 2 has thickness 40 and for property A a value of 2 Resulting layer will have thickness 50, and property A = (10 \* 5 + 40 \* 2) / (10 + 40) = 2.6 - update\_soil\_properties(*df*)[](#SoilLayout.update_soil_properties "Link to this definition") Update SoilLayout with Soil properties * Parameters: **df** (`DataFrame`) – dataframe with soil properties by name (must at least have column ‘name’). * Return type: `None` * Returns: <!-- --> ## SoilLayout2D[​](https://docs.viktor.ai/sdk/api/geo/.md#_SoilLayout2D "Direct link to SoilLayout2D") * *class *viktor.geo.SoilLayout2D(*soil\_layers*, *piezo\_lines=None*)[](#SoilLayout2D "Link to this definition") A 2D representation of a soil body build up from layers. A Soil Layout 2D basically consists of the following elements: * A list of soil layers: objects of the class SoilLayer2D * A list of piezo lines * A left and right boundary * A top and bottom profile Left and right boundaries, as well as top and bottom profiles, are automatically taken from the given soil layers The following requirements are to be met: * Each soil layer has to stretch all the way from the left boundary to the right boundary * The layers have to be stacked starting from bottom to top * There can be no holes in the soil layout 2d, meaning that the top profile of a previous layer always has to be identical to the bottom profile of the next layer * A layer can have zero thickness over (part of) the width of the soil layout 2d * All soil layers and piezo lines have to exactly identical ranges in x direction, meaning that they all range exactly from left boundary to right boundary A SoilLayout2D will have roughly the following shape, with each layer containing it’s own soil and soil properties: ``` | xxxxxxxxxx | |xxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx| | | | | | xxxxxxxx | |xxxxxxxxxxxxxx xxxxxxxxxxxxx xxxxxxxxxxxxxxxx| | xxx xxxxxx | | xxx | | | | | |xxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxx| | xxxxxxxxxxxxxxxxxx | | | | xxxxxxxxxxxxxxx | |xxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx| ``` The SoilLayout2D class is immutable. Any methods that alter or change properties of the class will return a new instance. * Parameters: * **soil\_layers** (`List`\[[`SoilLayer2D`](#SoilLayer2D "viktor.geo.SoilLayer2D")]) – an ordered dict of 2D soil layers. Starting from the bottom layer * **piezo\_lines** (`List`\[[`PiezoLine`](#PiezoLine "viktor.geo.PiezoLine")]) – list of piezo lines - *property *bottom\_profile*: [Polyline](https://docs.viktor.ai/sdk/api/geometry/.md#Polyline "viktor.geometry.Polyline")*[](#SoilLayout2D.bottom_profile "Link to this definition") bottom profile of the soil layout: Polyline * Type: return * *classmethod *combine\_soil\_layouts\_2d(*\*soil\_layouts\_2d*)[](#SoilLayout2D.combine_soil_layouts_2d "Link to this definition") Combine multiple SoilLayout2D’s in into one big SoilLayout2D All given soil layouts need to connect seemlessly, so that the resulting SoilLayout2D fullfills the requirement that it has got no holes and the top and bottom profile are monotonic ascending in x direction All layers will be continued (with zero thickness) to the new right and left boundaries * Parameters: **soil\_layouts\_2d** ([`SoilLayout2D`](#SoilLayout2D "viktor.geo.SoilLayout2D")) * Return type: [`SoilLayout2D`](#SoilLayout2D "viktor.geo.SoilLayout2D") * Returns: POSSIBLE COMBINATIONS: combining a left and a right soil layout 2d ``` _____________________ | |_______________________ | | | |-------------------|----------------------| | | | |___________________|----------------------| | | |______________________| ``` combining a top and bottom soil layout 2d ``` _____________________ | | |-------------------| | | |___________________|______________ | | |--------------------------| |__________________________| ``` combining n soil layouts, as long as there are no holes in the resulting soil layout, and it is possible to keep all layer profiles monotonic ascending in x-directions ``` _____________________ | |_______________________ | | | |-------------------|----------------------| | | | |___________________|______________________| | | |-------------------| |___________________| ``` IMPOSSIBLE COMBINATIONS: soillayouts without seem ``` _____________________ | | ________________________ | | | | |-------------------| |----------------------| | | | | |___________________| |----------------------| | | |______________________| ``` overlapping soil layouts ``` _____________________ | ________|_______________ | | | | |-----------|-------| | | |-------|--------------| |___________|_______| | | | |______________________| ``` the resulting soil layout does contain layers with profiles that are not monotonic ascending in x-direction ``` _____________________ | |_______________________ | | | |-------------------| | | |----------------------| |___________________| | | | ________|______________________| | | |-------------------| |___________________| ``` - *classmethod *from\_dict(*soil\_layout\_2d\_dict*)[](#SoilLayout2D.from_dict "Link to this definition") Create SoilLayout2D with dictionary from SoilLayout2D.serialize(). Useful when SoilLayout2D needs to be created from dictionary from the database. Example usage: ``` class Controller(vkt.Controller): ... def get_interpolated_soil_layout_from_database(self) -> vkt.geo.SoilLayout2D: # API call to entity that stores complete SoilLayout2D layout_dict = entity.last_saved_params['layout_dict'] interpolated_soil_layout = vkt.geo.SoilLayout2D.from_dict(layout_dict) return interpolated_soil_layout ``` * Parameters: **soil\_layout\_2d\_dict** (`dict` | `Munch`) – dictionary with same structure as SoilLayout2D.serialize() * Return type: [`SoilLayout2D`](#SoilLayout2D "viktor.geo.SoilLayout2D") * *classmethod *from\_positional\_soil\_layouts(*positional\_soil\_layouts*, *top\_profile*, *piezo\_lines=None*)[](#SoilLayout2D.from_positional_soil_layouts "Link to this definition") Instantiate a soil layout 2d from multiple 1d soil layouts combined with x locations and a ground profile all 1d soil layouts should have the same layers in the same order. Variation in height and thickness are possible the top profile has to be monotonic ascending in x direction * Parameters: * **positional\_soil\_layouts** (`List`\[[`PositionalSoilLayout`](#PositionalSoilLayout "viktor.geo.PositionalSoilLayout")]) – 1d soil layouts with x locations * **top\_profile** ([`Polyline`](https://docs.viktor.ai/sdk/api/geometry/.md#Polyline "viktor.geometry.Polyline")) – a polyline representing the ground level * **piezo\_lines** (`List`\[[`PiezoLine`](#PiezoLine "viktor.geo.PiezoLine")]) – list of piezo lines * Return type: [`SoilLayout2D`](#SoilLayout2D "viktor.geo.SoilLayout2D") - *classmethod *from\_single\_soil\_layout(*soil\_layout*, *left\_boundary*, *right\_boundary*, *top\_profile*, *piezo\_lines=None*)[](#SoilLayout2D.from_single_soil_layout "Link to this definition") A special case when a 1D soil layout is stretched in the 2D plane. This class method will create a 2D layout with horizontal layers and a top\_profile. * Parameters: * **soil\_layout** ([`SoilLayout`](#SoilLayout "viktor.geo.SoilLayout")) * **top\_profile** ([`Polyline`](https://docs.viktor.ai/sdk/api/geometry/.md#Polyline "viktor.geometry.Polyline")) * **left\_boundary** (`float`) * **right\_boundary** (`float`) * **piezo\_lines** (`List`\[[`PiezoLine`](#PiezoLine "viktor.geo.PiezoLine")]) * Return type: [`SoilLayout2D`](#SoilLayout2D "viktor.geo.SoilLayout2D") * get\_left\_boundary\_polyline()[](#SoilLayout2D.get_left_boundary_polyline "Link to this definition") Get the polyline describing the left boundary This will always be a straight boundary This will contain a point on every boundary between layers * Return type: [`Polyline`](https://docs.viktor.ai/sdk/api/geometry/.md#Polyline "viktor.geometry.Polyline") * Returns: Polyline - get\_right\_boundary\_polyline()[](#SoilLayout2D.get_right_boundary_polyline "Link to this definition") Get the polyline describing the right boundary This will always be a straight boundary This will contain a point on every boundary between layers * Return type: [`Polyline`](https://docs.viktor.ai/sdk/api/geometry/.md#Polyline "viktor.geometry.Polyline") * Returns: Polyline * serialize()[](#SoilLayout2D.serialize "Link to this definition") Serialize to dict (e.g. to store in database). The structure of dict is: ``` {'layers': [layer.serialize} for layer in self.layers, 'piezo_lines': [line.serialize() for line in self.piezo_lines]} ``` * Return type: `dict` * Returns: dictionary with structure above - split(*\*split\_lines*)[](#SoilLayout2D.split "Link to this definition") Split the soil layout by given polylines. Each split line has to: > * have a start and end point that lies outside of this soil layout > > * intersect the soil layout in at least one region > > * be monotonic ascending in x-direction Split lines are allowed to cross each other one or multiple times. Examples: Single split line ``` ___________ ___________ ___________ ____________ | / | | / / | | / | ==> | / / | |-------/-------------| |-------/ /-------------| |______/______________| |______/ /______________| ``` Single split line with multiple intersections ``` /\ ___________/__\________ _______________________ | / \ | | / \ | | / \ | ==> | / \ | |-------/--------\----| |-------/ ____ \----| |______/__________\___| |______/ / \ \___| / \ / \ /--------\ /__________\ ``` Two crossing split lines ``` ____ ______ ____ ___________ _______ \ / ____________ | \ / | | \ \/ / | | \/ | ==> | \ / | |-------/\------------| |-------/ \------------| |______/__\___________| |______/ /\ \___________| /__\ ``` * Parameters: **split\_lines** ([`Polyline`](https://docs.viktor.ai/sdk/api/geometry/.md#Polyline "viktor.geometry.Polyline")) – a list of polylines * Return type: `List`\[[`SoilLayout2D`](#SoilLayout2D "viktor.geo.SoilLayout2D")] * *property *top\_profile*: [Polyline](https://docs.viktor.ai/sdk/api/geometry/.md#Polyline "viktor.geometry.Polyline")*[](#SoilLayout2D.top_profile "Link to this definition") top profile of the soil layout: Polyline * Type: return - visualize\_geometry(*visualize\_border=False*, *opacity=1*)[](#SoilLayout2D.visualize_geometry "Link to this definition") Returns the visualization elements (group, labels) of the SoilLayout2D which can be used in a GeometryView. * Parameters: * **visualize\_border** (`bool`) – visualize the border surrounding this soil layout with an extra line. * **opacity** (`float`) – float between 0 (transparent) - 1 (opaque) * Return type: `Tuple`\[[`Group`](https://docs.viktor.ai/sdk/api/geometry/.md#Group "viktor.geometry.Group"), `List`\[[`Label`](https://docs.viktor.ai/sdk/api/views/.md#Label "viktor.views.Label")]] <!-- --> ## TableMethod[​](https://docs.viktor.ai/sdk/api/geo/.md#_TableMethod "Direct link to TableMethod") * *class *viktor.geo.TableMethod(*qualification\_table*, *ground\_water\_level*)[](#TableMethod "Link to this definition") Bases: `_ClassificationMethod` Class to pass TableMethod specific properties, such as a qualification\_table and ground\_water\_level. The qualification\_table is a list of dictionaries, containing for each user-specified soil type the accompanying qualification parameters (and possibly additional material properties). The required fields for each row are: > * name > > * color in r, g, b Also required fields, but can also be (partly) empty: > * qc\_min > > * qc\_max > > * qc\_norm\_min > > * qc\_norm\_max > > * rf\_min > > * rf\_max > > * gamma\_dry\_min > > * gamma\_dry\_max > > * gamma\_wet\_min > > * gamma\_wet\_max For more information about qc\_norm (qc\_normalized), see table 2.b in in NEN 9997-1+C1:2012, point g specifically. Besides the qualification table, a ground\_water\_level has to be provided as well, which is used to determine if gamma\_dry or gamma\_wet should be used to calculate qc\_norm for each entry in the GEF file. Example: ``` qualification_table = [ {'name': 'Peat', 'color': '166,42,42', 'qc_min': 0, 'qc_max': '', 'qc_norm_min': '', 'qc_norm_max': '', 'rf_min': 8, 'rf_max': '', 'gamma_dry_min': 10, 'gamma_wet_min': 10, <OTHER>}, {'name': 'Clay', 'color': '125,180,116', 'qc_min': '', 'qc_max': 2, 'qc_norm_min': '', 'qc_norm_max': '', 'rf_min': 1, 'rf_max': 8, 'gamma_dry_min': 20, 'gamma_wet_min': 22, <OTHER>}, {'name': 'Loam', 'color': '125,150,116', 'qc_min': 2, 'qc_max': '', 'qc_norm_min': '', 'qc_norm_max': '', 'rf_min': 1, 'rf_max': 8, 'gamma_dry_min': 20, 'gamma_wet_min': 22, <OTHER>}, {'name': 'Sand', 'color': '239,255,12', 'qc_min': '', 'qc_max': '', 'qc_norm_min': 22, 'qc_norm_max': '', 'rf_min': 0, 'rf_max': 1, 'gamma_dry_min': 24, 'gamma_wet_min': 26, <OTHER>}, {'name': 'Gravel', 'color': '255,255,128', 'qc_min': '', 'qc_max': '', 'qc_norm_min': '', 'qc_norm_max': 22, 'rf_min': 0, 'rf_max': 1, 'gamma_dry_min': 24, 'gamma_wet_min': 26, <OTHER>} ] ground_water_level = -4.63 method = TableMethod(qualification_table, ground_water_level) ``` * Parameters: * **ground\_water\_level** (`float`) – Ground water level is used to compute qc\_norm using either gamma\_dry or gamma\_wet * **qualification\_table** (`List`\[`dict`]) – List containing rows defining a soil - get\_method\_params()[](#TableMethod.get_method_params "Link to this definition") * Return type: `dict` * get\_qualification\_table\_plot(*fileformat*)[](#TableMethod.get_qualification_table_plot "Link to this definition") Use this method to obtain a plot of the qualification table. On the x axis the Rf values are plotted, on the y axis Qc values are shown. Each line, representing a soil, is shown as an area in this plot. This allows for easy inspection of the qualification rules, showing areas of the plot that might still be empty, or soil areas that overlap (in which case the area on top will be chosen). Use the fileformat argument to specify if the result should be a BytesIO containing pdf or png bytes or a StringIO containing svg data * Parameters: **fileformat** (`str`) – specify if required fileformat is pdf, png or svg * Return type: `BytesIO` | `StringIO` * Returns: qualification table plot as either BytesIO (‘pdf’ or ‘png’) or StringIO (‘svg’) object <!-- --> ## UndefinedSoil[​](https://docs.viktor.ai/sdk/api/geo/.md#_UndefinedSoil "Direct link to UndefinedSoil") * *class *viktor.geo.UndefinedSoil[](#UndefinedSoil "Link to this definition") Bases: [`Soil`](#Soil "viktor.geo.Soil") Set name and color of Soil material. Extra properties can be added with dictionary, and keys are added as attribute via ‘munchify’. They are accessible as self.properties.{extra\_property\_name} * Parameters: * **name** * **color** – color of soil used in plots * **properties** – dict with optional extra parameters to be added to Soil <!-- --> ## gef\_visualization[​](https://docs.viktor.ai/sdk/api/geo/.md#_gef_visualization "Direct link to gef_visualization") * viktor.geo.gef\_visualization(*gef\_data*, *soil\_layout\_original*, *soil\_layout\_user*, *\**, *as\_file=False*)[](#gef_visualization "Link to this definition") Standard visualization for GEF File. Example usage: ``` class Controller(vkt.Controller): ... @vkt.ImageView("GEF plot", duration_guess=2) def visualize(self, params, **kwargs): gef_data = ... soil_layout_original = ... soil_layout_user = ... svg_image = vkt.geo.gef_visualization(gef_data, soil_layout_original, soil_layout_user) return vkt.ImageResult(svg_image) ``` * Parameters: * **gef\_data** ([`GEFData`](#GEFData "viktor.geo.GEFData")) – GEFData object to be visualized * **soil\_layout\_original** ([`SoilLayout`](#SoilLayout "viktor.geo.SoilLayout")) – SoilLayout from GEFData. Layers must be sorted from top to bottom. * **soil\_layout\_user** ([`SoilLayout`](#SoilLayout "viktor.geo.SoilLayout")) – SoilLayout that is filtered/modified by user. Layers must be sorted from top to bottom. * **as\_file** (`bool`) – return as str (default) or File New in v13.5.0 * Return type: `str` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") * Returns: SVG image file --- # viktor.geometry <!-- --> <!-- --> <!-- --> ## Arc[​](https://docs.viktor.ai/sdk/api/geometry/.md#_Arc "Direct link to Arc") * *class *viktor.geometry.Arc(*centre\_point*, *start\_point*, *end\_point*, *short\_arc=True*, *\**, *n\_segments=30*, *color=(0, 0, 0)*, *identifier=None*)[](#Arc "Link to this definition") Bases: [`TransformableObject`](#TransformableObject "viktor.geometry.TransformableObject") Creates a constant radius arc in the xy plane. Clockwise rotation creates an outward surface. * Parameters: * **centre\_point** ([`Point`](#Point "viktor.geometry.Point") | `Tuple`\[`float`, `float`, `float`]) – Point in xy plane. * **start\_point** ([`Point`](#Point "viktor.geometry.Point") | `Tuple`\[`float`, `float`, `float`]) – Point in xy plane. Should have the same distance to centre\_point as end\_point. * **end\_point** ([`Point`](#Point "viktor.geometry.Point") | `Tuple`\[`float`, `float`, `float`]) – Point in xy plane. Should have the same distance to centre\_point as start\_point. * **short\_arc** (`bool`) – Angle of arc smaller than pi if True, larger than pi if False. * **n\_segments** (`int`) – Number of discrete segments of the arc (default: 30) New in v13.5.0 . * **color** ([`Color`](https://docs.viktor.ai/sdk/api/core/.md#Color "viktor.core.Color")) – Visualization color New in v13.5.0 . * **identifier** (`str`) – object identifier (new in v14.10.0) - *property *angle*: float*[](#Arc.angle "Link to this definition") Absolute angle of the arc in radians, which is the difference between theta1 and theta2. * *property *centre\_point*: [Point](#Point "viktor.geometry.Point")*[](#Arc.centre_point "Link to this definition") - discretize(*num=2*)[](#Arc.discretize "Link to this definition") Returns a discrete representation of the arc, as a list of Point objects. The amount of points can be specified using ‘num’, which should be larger than 1. * Return type: `List`\[[`Point`](#Point "viktor.geometry.Point")] * *property *end\_point*: [Point](#Point "viktor.geometry.Point")*[](#Arc.end_point "Link to this definition") - *property *length*: float*[](#Arc.length "Link to this definition") Arc length. * *property *n\_segments*: int*[](#Arc.n_segments "Link to this definition") - *property *radius*: float*[](#Arc.radius "Link to this definition") * revolve(*\**, *rotation\_angle=None*, *material=None*, *identifier=None*, *\*\*kwargs*)[](#Arc.revolve "Link to this definition") Returns an ArcRevolve object, revolved around the global y-axis. * Parameters: * **rotation\_angle** (`float`) – Angle of the revolved object according to the right-hand-rule, with the start of the rotation in positive z-direction. Angle in radians. If not specified, 2 pi will be used. * **material** ([`Material`](#Material "viktor.geometry.Material")) – optional material * **identifier** (`str`) – object identifier (new in v14.10.0) * Return type: [`ArcRevolve`](#ArcRevolve "viktor.geometry.ArcRevolve") - *property *short\_arc*: bool*[](#Arc.short_arc "Link to this definition") * *property *start\_point*: [Point](#Point "viktor.geometry.Point")*[](#Arc.start_point "Link to this definition") - *property *theta1*: float*[](#Arc.theta1 "Link to this definition") Angle of the end point with respect to the x-axis in radians. * *property *theta1\_theta2*: Tuple\[float, float]*[](#Arc.theta1_theta2 "Link to this definition") Angles of the end (theta1) and start (theta2) points with respect to the x-axis in radians. - *property *theta2*: float*[](#Arc.theta2 "Link to this definition") Angle of the start point with respect to the x-axis in radians. <!-- --> ## ArcExtrusion[​](https://docs.viktor.ai/sdk/api/geometry/.md#_ArcExtrusion "Direct link to ArcExtrusion") * *class *viktor.geometry.ArcExtrusion(*profile*, *arc*, *profile\_rotation=0*, *n\_segments=50*, *\**, *material=None*, *identifier=None*)[](#ArcExtrusion "Link to this definition") Bases: [`Group`](#Group "viktor.geometry.Group") Given an Arc and a cross-section of the extrusion, a discretized Extrusion object is returned. The coordinates of the profile are defined with respect to the Arc and have a LOCAL coordinate system: > * z-axis is in direction of the arc from start to end. > > * x-axis is in positive global z-axis. > > * y-axis follows from the right-hand-rule. Rotation of the profile is about the axis according to the right-hand-rule with LOCAL z-axis (see definition above). Example: ``` profile = [ Point(1, 1), Point(1, 2), Point(3, 2), Point(3, 1), Point(1, 1), ] arc = Arc(Point(1, 1, 0), Point(3, 1, 0), Point(1, 3, 0)) arc_ext = ArcExtrusion(profile, arc, profile_rotation=10, n_segments=10) ``` This will result in the following visualization, where the Arc itself is also shown in the xy plane: [![/\_images/arc-extrusion.png](/_images/arc-extrusion.png)](https://docs.viktor.ai/_images/arc-extrusion.png) * Parameters: * **profile** (`List`\[[`Point`](#Point "viktor.geometry.Point")]) – Coordinates of cross-section. * **arc** ([`Arc`](#Arc "viktor.geometry.Arc")) – An Arc object is used to define the direction of the extrusion. * **profile\_rotation** (`float`) – Rotation of the profile around its local Z-axis in degrees. * **n\_segments** (`int`) – Number of discrete segments of the arc, which is 50 by default. * **material** ([`Material`](#Material "viktor.geometry.Material")) – optional material * **identifier** (`str`) – object identifier (new in v14.10.0) <!-- --> ## ArcRevolve[​](https://docs.viktor.ai/sdk/api/geometry/.md#_ArcRevolve "Direct link to ArcRevolve") * *class *viktor.geometry.ArcRevolve(*arc*, *\*args*, *rotation\_angle=None*, *material=None*, *identifier=None*, *\*\*kwargs*)[](#ArcRevolve "Link to this definition") Bases: [`Revolve`](#Revolve "viktor.geometry.Revolve") Returns a revolved object of an arc around the global y-axis. In the example below, rotation\_angle is equal to pi / 3: [![/\_images/arc-revolve.png](/_images/arc-revolve.png)](https://docs.viktor.ai/_images/arc-revolve.png) * Parameters: * **arc** ([`Arc`](#Arc "viktor.geometry.Arc")) – Arc object. * **rotation\_angle** (`float`) – Angle of the revolved object according to the right-hand-rule, with the start of the rotation in positive z-direction. Angle in radians. If not specified, 2 pi will be used. * **material** ([`Material`](#Material "viktor.geometry.Material")) – optional material * **identifier** (`str`) – object identifier (new in v14.10.0) - *property *arc*: [Arc](#Arc "viktor.geometry.Arc")*[](#ArcRevolve.arc "Link to this definition") [`Arc`](#Arc "viktor.geometry.Arc") * *property *height*: float*[](#ArcRevolve.height "Link to this definition") Height of the object. - *property *inner\_volume*: float*[](#ArcRevolve.inner_volume "Link to this definition") Returns the inner volume of the revolved object. This method will only return a value if the defined Arc meets the following conditions: > * it should be short, i.e. short\_arc=True > > * the start- and end-point are located on the same side w\.r.t. the y-axis of the center-point of the Arc > > * it is defined in clockwise direction * *property *surface\_area*: float*[](#ArcRevolve.surface_area "Link to this definition") Total exterior area of the object. - *property *uuid*: str*[](#ArcRevolve.uuid "Link to this definition") <!-- --> ## BidirectionalPattern[​](https://docs.viktor.ai/sdk/api/geometry/.md#_BidirectionalPattern "Direct link to BidirectionalPattern") * *class *viktor.geometry.BidirectionalPattern(*base\_object*, *direction\_1*, *direction\_2*, *number\_of\_elements\_1*, *number\_of\_elements\_2*, *spacing\_1*, *spacing\_2*, *\**, *identifier=None*)[](#BidirectionalPattern "Link to this definition") Bases: [`Pattern`](#Pattern "viktor.geometry.Pattern") Instantiates a two-dimensional pattern, evenly spaced in two separate directions. If identifier has been set on the base-object, the identifiers of the objects within the pattern are suffixed with ‘-i’ (i = 1, 2, 3, …). * Parameters: * **base\_object** ([`TransformableObject`](#TransformableObject "viktor.geometry.TransformableObject")) – the object to be duplicated * **direction\_1** (`List`\[`float`]) – a unit vector specifying the first direction * **direction\_2** (`List`\[`float`]) – a unit vector specifying the second direction * **number\_of\_elements\_1** (`int`) – total amount of elements along direction 1 * **number\_of\_elements\_2** (`int`) – total amount of elements along direction 2 * **spacing\_1** (`float`) – the applied spacing in direction 1 * **spacing\_2** (`float`) – the applied spacing in direction 2 * **identifier** (`str`) – object identifier (new in v14.10.0) <!-- --> ## CartesianAxes[​](https://docs.viktor.ai/sdk/api/geometry/.md#_CartesianAxes "Direct link to CartesianAxes") * *class *viktor.geometry.CartesianAxes(*origin=Point(0.000e+00, 0.000e+00, 0.000e+00)*, *axis\_length=1*, *axis\_diameter=0.05*)[](#CartesianAxes "Link to this definition") Bases: [`Group`](#Group "viktor.geometry.Group") Helper visualisation object to show positive x (red), y (green) and z (blue) axes. [![/\_images/cartesian-axes.png](/_images/cartesian-axes.png)](https://docs.viktor.ai/_images/cartesian-axes.png) * Parameters: * **origin** ([`Point`](#Point "viktor.geometry.Point")) – Coordinates of the origin. * **axis\_length** (`float`) – Length of the axes. * **axis\_diameter** (`float`) – Diameter of the axes. <!-- --> ## CircularExtrusion[​](https://docs.viktor.ai/sdk/api/geometry/.md#_CircularExtrusion "Direct link to CircularExtrusion") * *class *viktor.geometry.CircularExtrusion(*diameter*, *line*, *\**, *shell\_thickness=None*, *material=None*, *identifier=None*)[](#CircularExtrusion "Link to this definition") Bases: [`TransformableObject`](#TransformableObject "viktor.geometry.TransformableObject") This class is used to construct an extrusion which has a circular base, e.g. a circular foundation pile. * Parameters: * **diameter** (`float`) – Outer diameter of the cross-section. * **line** ([`Line`](#Line "viktor.geometry.Line")) – Line object along which the circular cross-section is extruded. * **shell\_thickness** (`float`) – Optional shell thickness. None for solid (default: None) New in v13.6.0 . * **material** ([`Material`](#Material "viktor.geometry.Material")) – Optional material. * **identifier** (`str`) – object identifier (new in v14.10.0) - *property *cross\_sectional\_area*: float*[](#CircularExtrusion.cross_sectional_area "Link to this definition") * *property *diameter*: float*[](#CircularExtrusion.diameter "Link to this definition") - *property *length*: float*[](#CircularExtrusion.length "Link to this definition") * *property *line*: [Line](#Line "viktor.geometry.Line")*[](#CircularExtrusion.line "Link to this definition") - *property *radius*: float*[](#CircularExtrusion.radius "Link to this definition") * *property *shell\_thickness*: float | None*[](#CircularExtrusion.shell_thickness "Link to this definition") <!-- --> ## Cone[​](https://docs.viktor.ai/sdk/api/geometry/.md#_Cone "Direct link to Cone") * *class *viktor.geometry.Cone(*diameter*, *height*, *\**, *origin=None*, *orientation=None*, *material=None*, *identifier=None*)[](#Cone "Link to this definition") Bases: [`TransformableObject`](#TransformableObject "viktor.geometry.TransformableObject") Creates a cone object. * Parameters: * **diameter** (`float`) – Diameter of the circular base surface. * **height** (`float`) – Height from base to tip. * **origin** ([`Point`](#Point "viktor.geometry.Point")) – Optional location of the centroid of the base surface (default: Point(0, 0, 0)). * **orientation** ([`Vector`](#Vector "viktor.geometry.Vector")) – Optional orientation from origin to the tip (default: Vector(0, 0, 1)). * **material** ([`Material`](#Material "viktor.geometry.Material")) – Optional material. * **identifier** (`str`) – object identifier (new in v14.10.0) - *classmethod *from\_line(*diameter*, *line*, *\**, *material=None*, *identifier=None*)[](#Cone.from_line "Link to this definition") Create a Cone object by a given base diameter and line. * Parameters: * **diameter** (`float`) – Diameter of the circular base surface. * **line** ([`Line`](#Line "viktor.geometry.Line")) – Line from base to top of the cone. The start point of the line represents the location of the center of the base, and the end point represents the tip of the cone. * **material** ([`Material`](#Material "viktor.geometry.Material")) – Optional material. * **identifier** (`str`) – object identifier (new in v14.10.0) * Return type: [`Cone`](#Cone "viktor.geometry.Cone") <!-- --> ## Extrusion[​](https://docs.viktor.ai/sdk/api/geometry/.md#_Extrusion "Direct link to Extrusion") * *class *viktor.geometry.Extrusion(*profile*, *line*, *profile\_rotation=0*, *\**, *material=None*, *identifier=None*)[](#Extrusion "Link to this definition") Bases: [`Group`](#Group "viktor.geometry.Group") Extruded object from a given set of points, which is called the profile. This profile should meet the following requirements: > * start point should be added at the end for closed profile > > * points should be defined in z=0 plane > > * circumference should be defined clockwise Note that the profile is defined with respect to the start point of the Line object, i.e. the profile is defined in the local coordinate system. An example is given below of two extrusions with the same dimensions. Their corresponding Line objects are also visualized. The extrusion have the following profile: ``` # black box profile_b = [ Point(1, 1), Point(1, 2), Point(2, 2), Point(2, 1), Point(1, 1), ] box_b = Extrusion(profile_b, Line(Point(4, 1, 0), Point(4, 1, 1))) # yellow box profile_y = [ Point(-0.5, -0.5), Point(-0.5, 0.5), Point(0.5, 0.5), Point(0.5, -0.5), Point(-0.5, -0.5), ] box_y = Extrusion(profile_y, Line(Point(2, 2, 0), Point(2, 2, 1))) ``` [![/\_images/extrusion-profile.png](/_images/extrusion-profile.png)](https://docs.viktor.ai/_images/extrusion-profile.png) * Parameters: * **profile** (`List`\[[`Point`](#Point "viktor.geometry.Point")]) – Coordinates of cross-section. * **line** ([`Line`](#Line "viktor.geometry.Line")) – A line object is used to define the length (thickness) of the extrusion. * **profile\_rotation** (`float`) – Rotation of the profile around the Z-axis in degrees. * **material** ([`Material`](#Material "viktor.geometry.Material")) – optional material * **identifier** (`str`) – object identifier (new in v14.10.0) - *property *length*: float*[](#Extrusion.length "Link to this definition") * *property *line*: [Line](#Line "viktor.geometry.Line")*[](#Extrusion.line "Link to this definition") - *property *material*: [Material](#Material "viktor.geometry.Material")*[](#Extrusion.material "Link to this definition") * *property *profile*: List\[[Point](#Point "viktor.geometry.Point")]*[](#Extrusion.profile "Link to this definition") <!-- --> ## GeoPoint[​](https://docs.viktor.ai/sdk/api/geometry/.md#_GeoPoint "Direct link to GeoPoint") * *class *viktor.geometry.GeoPoint(*lat*, *lon*)[](#GeoPoint "Link to this definition") Geographical point on the Earth’s surface described by a latitude / longitude coordinate pair. This object can be created directly, or will be returned in the params when using a [`GeoPointField`](https://docs.viktor.ai/sdk/api/parametrization/.md#GeoPointField "viktor.parametrization.GeoPointField"). * Parameters: * **lat** (`float`) – Latitude, between -90 and 90 degrees. * **lon** (`float`) – Longitude, between -180 and 180 degrees. - *classmethod *from\_rd(*coords*)[](#GeoPoint.from_rd "Link to this definition") Instantiates a GeoPoint from the provided RD coordinates. * Parameters: **coords** (`Tuple`\[`float`, `float`]) – RD coordinates (x, y). * Return type: [`GeoPoint`](#GeoPoint "viktor.geometry.GeoPoint") * *property *latitude*: float*[](#GeoPoint.latitude "Link to this definition") New in v14.22.0 - *property *longitude*: float*[](#GeoPoint.longitude "Link to this definition") New in v14.22.0 * *property *rd*: Tuple\[float, float]*[](#GeoPoint.rd "Link to this definition") RD representation (x, y) of the GeoPoint. <!-- --> ## GeoPolygon[​](https://docs.viktor.ai/sdk/api/geometry/.md#_GeoPolygon "Direct link to GeoPolygon") * *class *viktor.geometry.GeoPolygon(*\*points*)[](#GeoPolygon "Link to this definition") Geographical polygon on the Earth’s surface described by a list of [`GeoPoints`](#GeoPoint "viktor.geometry.GeoPoint"). This object can be created directly, or will be returned in the params when using a [`GeoPolygonField`](https://docs.viktor.ai/sdk/api/parametrization/.md#GeoPolygonField "viktor.parametrization.GeoPolygonField"). * Parameters: **points** ([`GeoPoint`](#GeoPoint "viktor.geometry.GeoPoint")) – Geo points (minimum 3). The profile is automatically closed, so it is not necessary to add the start point at the end. - *property *points*: List\[[GeoPoint](#GeoPoint "viktor.geometry.GeoPoint")]*[](#GeoPolygon.points "Link to this definition") <!-- --> ## GeoPolyline[​](https://docs.viktor.ai/sdk/api/geometry/.md#_GeoPolyline "Direct link to GeoPolyline") * *class *viktor.geometry.GeoPolyline(*\*points*)[](#GeoPolyline "Link to this definition") Geographical polyline on the Earth’s surface described by a list of [`GeoPoints`](#GeoPoint "viktor.geometry.GeoPoint"). This object can be created directly, or will be returned in the params when using a [`GeoPolylineField`](https://docs.viktor.ai/sdk/api/parametrization/.md#GeoPolylineField "viktor.parametrization.GeoPolylineField"). * Parameters: **points** ([`GeoPoint`](#GeoPoint "viktor.geometry.GeoPoint")) – Geo points (minimum 2). - *property *points*: List\[[GeoPoint](#GeoPoint "viktor.geometry.GeoPoint")]*[](#GeoPolyline.points "Link to this definition") <!-- --> ## Group[​](https://docs.viktor.ai/sdk/api/geometry/.md#_Group "Direct link to Group") * *class *viktor.geometry.Group(*objects*, *\**, *identifier=None*)[](#Group "Link to this definition") Bases: [`TransformableObject`](#TransformableObject "viktor.geometry.TransformableObject") * Parameters: * **objects** (`Sequence`\[[`TransformableObject`](#TransformableObject "viktor.geometry.TransformableObject")]) – Objects that are part of the group. * **identifier** (`str`) – object identifier (new in v14.10.0) - add(*objects*)[](#Group.add "Link to this definition") * Return type: `None` * *property *children*: List\[[TransformableObject](#TransformableObject "viktor.geometry.TransformableObject")]*[](#Group.children "Link to this definition") - duplicate()[](#Group.duplicate "Link to this definition") * Return type: [`Group`](#Group "viktor.geometry.Group") <!-- --> ## Line[​](https://docs.viktor.ai/sdk/api/geometry/.md#_Line "Direct link to Line") * *class *viktor.geometry.Line(*start\_point*, *end\_point*, *\**, *color=(0, 0, 0)*, *identifier=None*)[](#Line "Link to this definition") Bases: [`TransformableObject`](#TransformableObject "viktor.geometry.TransformableObject") * Parameters: * **start\_point** ([`Point`](#Point "viktor.geometry.Point") | `Tuple`\[`float`, `float`, `float`]) – Start point of the line (cannot coincide with end\_point). * **end\_point** ([`Point`](#Point "viktor.geometry.Point") | `Tuple`\[`float`, `float`, `float`]) – End point of the line (cannot coincide with start\_point). * **color** ([`Color`](https://docs.viktor.ai/sdk/api/core/.md#Color "viktor.core.Color")) – Visualization color New in v13.5.0 . * **identifier** (`str`) – object identifier (new in v14.10.0) - collinear(*point*)[](#Line.collinear "Link to this definition") True if point is collinear (in line) with Line, else False. * Return type: `bool` * direction(*normalize=True*)[](#Line.direction "Link to this definition") Direction vector between start and end point. * Return type: [`Vector`](#Vector "viktor.geometry.Vector") - distance\_to\_point(*point*)[](#Line.distance_to_point "Link to this definition") Calculate the (minimal) distance from the given point to the (unbounded) line. * Return type: `float` * *property *end\_point*: [Point](#Point "viktor.geometry.Point")*[](#Line.end_point "Link to this definition") - find\_overlap(*other*, *inclusive=False*)[](#Line.find_overlap "Link to this definition") Find the overlapping part of this line with another line. The returned value depends on the situation: * None, if no overlap is found or the two lines are not parallel * Point, if an overlap is found with length equal to 0 * Line, if an overlap is found with length larger than 0 - Parameters: * **other** ([`Line`](#Line "viktor.geometry.Line")) – Other Line object * **inclusive** (`bool`) – True to treat overlapping points as overlap - Return type: [`Point`](#Point "viktor.geometry.Point") | [`Line`](#Line "viktor.geometry.Line") | `None` * get\_line\_function\_parameters()[](#Line.get_line_function_parameters "Link to this definition") Get parameters for y=ax+b definition of a line. * Return type: `Tuple`\[`float`, `float`] * Returns: (a, b) or (nan, nan) if line is vertical - *property *horizontal*: bool*[](#Line.horizontal "Link to this definition") * *property *length*: float*[](#Line.length "Link to this definition") - *property *length\_vector*: numpy.ndarray*[](#Line.length_vector "Link to this definition") * project\_point(*point*)[](#Line.project_point "Link to this definition") Project the point on the (unbounded) line. * Return type: [`Point`](#Point "viktor.geometry.Point") - revolve(*\**, *material=None*, *identifier=None*, *\*\*kwargs*)[](#Line.revolve "Link to this definition") Revolve line around y-axis, only possible for lines in x-y plane. * Parameters: * **material** ([`Material`](#Material "viktor.geometry.Material")) – optional material * **identifier** (`str`) – object identifier (new in v14.10.0) * Raises: **NotImplementedError** – when line is not in x-y plane * Return type: [`LineRevolve`](#LineRevolve "viktor.geometry.LineRevolve") * *property *start\_point*: [Point](#Point "viktor.geometry.Point")*[](#Line.start_point "Link to this definition") - *property *unit\_vector*: numpy.ndarray*[](#Line.unit_vector "Link to this definition") * *property *vertical*: bool*[](#Line.vertical "Link to this definition") <!-- --> ## LineRevolve[​](https://docs.viktor.ai/sdk/api/geometry/.md#_LineRevolve "Direct link to LineRevolve") * *class *viktor.geometry.LineRevolve(*line*, *\*args*, *material=None*, *identifier=None*, *\*\*kwargs*)[](#LineRevolve "Link to this definition") Bases: [`Revolve`](#Revolve "viktor.geometry.Revolve") Returns a revolved object of a Line around the global y-axis. An example revolve of a line between the point (1, 1, 0) and (3, 2, 0) is shown below, with the line object shown in black. ``` line = Line(Point(1, 1, 0), Point(3, 2, 0)) line_rev = LineRevolve(line) ``` [![/\_images/line-revolve.png](/_images/line-revolve.png)](https://docs.viktor.ai/_images/line-revolve.png) * Parameters: * **line** ([`Line`](#Line "viktor.geometry.Line")) – Line object which is to be revolved. * **material** ([`Material`](#Material "viktor.geometry.Material")) – optional material * **identifier** (`str`) – object identifier (new in v14.10.0) - *property *height*: float*[](#LineRevolve.height "Link to this definition") * *property *inner\_volume*: float*[](#LineRevolve.inner_volume "Link to this definition") Returns the inner volume of the revolved object. This method will only return a value if the defined Line meets the following conditions: > * it should NOT be horizontal, i.e. y\_start != y\_end > > * it should be defined in positive y-direction, i.e. y\_start < y\_end - *property *line*: [Line](#Line "viktor.geometry.Line")*[](#LineRevolve.line "Link to this definition") * *property *surface\_area*: float*[](#LineRevolve.surface_area "Link to this definition") Returns the total exterior area of the revolved object. - *property *uuid*: UUID*[](#LineRevolve.uuid "Link to this definition") <!-- --> ## LinearPattern[​](https://docs.viktor.ai/sdk/api/geometry/.md#_LinearPattern "Direct link to LinearPattern") * *class *viktor.geometry.LinearPattern(*base\_object*, *direction*, *number\_of\_elements*, *spacing*, *\**, *identifier=None*)[](#LinearPattern "Link to this definition") Bases: [`Pattern`](#Pattern "viktor.geometry.Pattern") Instantiates a linear, evenly spaced, pattern along a single direction. If identifier has been set on the base-object, the identifiers of the objects within the pattern are suffixed with ‘-i’ (i = 1, 2, 3, …). * Parameters: * **base\_object** ([`TransformableObject`](#TransformableObject "viktor.geometry.TransformableObject")) – the object to be duplicated * **direction** (`List`\[`float`]) – a unit vector specifying in which direction the pattern propagates * **number\_of\_elements** (`int`) – total amount of elements in the pattern, including the base object * **spacing** (`float`) – the applied spacing * **identifier** (`str`) – object identifier (new in v14.10.0) <!-- --> ## Material[​](https://docs.viktor.ai/sdk/api/geometry/.md#_Material "Direct link to Material") * *class *viktor.geometry.Material(*name=None*, *density=None*, *price=None*, *\**, *threejs\_type='MeshStandardMaterial'*, *roughness=1.0*, *metalness=0.5*, *opacity=1.0*, *color=(221, 221, 221)*)[](#Material "Link to this definition") Note The following properties were renamed since v14.5.0. If you are using a lower version, please use the old naming. * threejs\_roughness -> roughness * threejs\_metalness -> metalness * threejs\_opacity -> opacity **(new in v14.22.0)** Provide a hex value or tuple (r, g, b) as ‘color’. * Parameters: * **name** (`str`) – Optional name. * **density** (`float`) – Optional density. * **price** (`float`) – Optional price. * **threejs\_type** (`str`) – deprecated * **roughness** (`float`) – Between 0 - 1 where closer to 1 gives the material a rough texture. * **metalness** (`float`) – Between 0 - 1 where closer to 1 gives the material a shiny metal look. * **opacity** (`float`) – Between 0 - 1 where closer to 0 makes the material less visible. * **color** (`str` | `tuple`\[`int`, `int`, `int`] | [`Color`](https://docs.viktor.ai/sdk/api/core/.md#Color "viktor.core.Color")) – Color of the material. <!-- --> ## Pattern[​](https://docs.viktor.ai/sdk/api/geometry/.md#_Pattern "Direct link to Pattern") * *class *viktor.geometry.Pattern(*base\_object*, *duplicate\_translation\_list*, *\**, *identifier=None*)[](#Pattern "Link to this definition") Bases: [`Group`](#Group "viktor.geometry.Group") Instantiates a pattern based on a base object and several duplicates, each translated by an input vector. If identifier has been set on the base-object, the identifiers of the objects within the pattern are suffixed with ‘-i’ (i = 1, 2, 3, …). * Parameters: * **base\_object** ([`TransformableObject`](#TransformableObject "viktor.geometry.TransformableObject")) – the object to be duplicated * **duplicate\_translation\_list** (`List`\[`List`\[`float`]]) – a list of translation vectors, each of which generates a duplicate * **identifier** (`str`) – object identifier (new in v14.10.0) <!-- --> ## Point[​](https://docs.viktor.ai/sdk/api/geometry/.md#_Point "Direct link to Point") * *class *viktor.geometry.Point(*x*, *y*, *z=0*)[](#Point "Link to this definition") This class represents a point object, which is instantiated by means of 3-dimensional coordinates X, Y, and Z. It forms a basis of many structural 2D and 3D objects. Example usage: ``` p1 = Point(1, 2) # create a 2D point p1.z # 0 p2 = Point(1, 2, 3) # create a 3D point p1.z # 3 ``` * Parameters: * **x** (`float`) – X-coordinate. * **y** (`float`) – Y-coordinate. * **z** (`float`) – (optional) Z-coordinate, defaults to 0. * Raises: **TypeError** – if the point is instantiated with a None value. - coincides\_with(*other*)[](#Point.coincides_with "Link to this definition") Given another Point object, this method determines whether the two points coincide. * Return type: `bool` * *property *coordinates*: numpy.ndarray*[](#Point.coordinates "Link to this definition") Coordinates of the Point as array (X, Y, Z). - copy()[](#Point.copy "Link to this definition") Returns a deep copy of the object. * Return type: [`Point`](#Point "viktor.geometry.Point") * get\_local\_coordinates(*local\_origin*, *spherical=False*)[](#Point.get_local_coordinates "Link to this definition") Method to determine the local coordinates of the current Point with respect to a ‘local origin’. * Return type: `ndarray` - vector\_to(*point*)[](#Point.vector_to "Link to this definition") Vector pointing from self to point. Example usage: ``` p1 = Point(1, 2, 3) p2 = Point(0, 0, 0) # origin v = p1.vector_to(p2) # vector from p1 to the origin v = p1.vector_to((0, 0, 0)) # short notation ``` * Return type: [`Vector`](#Vector "viktor.geometry.Vector") * *property *x*: float*[](#Point.x "Link to this definition") X-coordinate. - *property *y*: float*[](#Point.y "Link to this definition") Y-coordinate. * *property *z*: float*[](#Point.z "Link to this definition") Z-coordinate. <!-- --> ## Polygon[​](https://docs.viktor.ai/sdk/api/geometry/.md#_Polygon "Direct link to Polygon") * *class *viktor.geometry.Polygon(*points*, *\**, *surface\_orientation=False*, *material=None*, *skip\_duplicate\_vertices\_check=False*, *identifier=None*)[](#Polygon "Link to this definition") Bases: [`TransformableObject`](#TransformableObject "viktor.geometry.TransformableObject") 2D closed polygon without holes in x-y plane. * Parameters: * **points** (`list`\[[`Point`](#Point "viktor.geometry.Point")]) – profile is automatically closed, do not add start point at the end. only the x and y coordinates are considered. left hand rule around circumference determines surface direction * **surface\_orientation** (`bool`) – * if True, the left hand rule around circumference determines surface direction * if False, surface always in +z direction * **material** ([`Material`](#Material "viktor.geometry.Material")) – optional material * **skip\_duplicate\_vertices\_check** (`bool`) – if True, duplicate vertices are not filtered on serialization of the triangles. This may boost performance (default: False). * **identifier** (`str`) – object identifier (new in v14.10.0) * Raises: **ValueError** – * if less than 3 points are provided. * if points contains duplicates. * if points form a polygon with self-intersecting lines. * if points are all collinear. - *property *centroid*: tuple\[float, float]*[](#Polygon.centroid "Link to this definition") Returns the centroid (X, Y) of the polygon. * *property *cross\_sectional\_area*: float*[](#Polygon.cross_sectional_area "Link to this definition") - extrude(*line*, *\**, *profile\_rotation=0*, *material=None*, *identifier=None*)[](#Polygon.extrude "Link to this definition") Extrude the Polygon in the direction of the given line. * Parameters: * **line** ([`Line`](#Line "viktor.geometry.Line")) – A line object is used to define the length (thickness) of the extrusion. * **profile\_rotation** (`float`) – Rotation of the profile around the Z-axis in degrees. * **material** ([`Material`](#Material "viktor.geometry.Material")) – optional material * **identifier** (`str`) – object identifier (new in v14.10.0) * Return type: [`Extrusion`](#Extrusion "viktor.geometry.Extrusion") * has\_clockwise\_circumference()[](#Polygon.has_clockwise_circumference "Link to this definition") * Return type: `bool` - Method determines the direction of the input points, and returns: * True if the circumference is clockwise * False if the circumference is counter-clockwise - *property *moment\_of\_inertia*: tuple\[float, float]*[](#Polygon.moment_of_inertia "Link to this definition") Returns the moment of inertia (Ix, Iy) in xy-plane. <!-- --> ## Polyline[​](https://docs.viktor.ai/sdk/api/geometry/.md#_Polyline "Direct link to Polyline") * *class *viktor.geometry.Polyline(*points*, *\**, *color=(0, 0, 0)*, *identifier=None*)[](#Polyline "Link to this definition") Bases: [`TransformableObject`](#TransformableObject "viktor.geometry.TransformableObject") Representation of a polyline made up of multiple straight line segments. This class is immutable, meaning that all functions that perform changes on a polyline will return a mutated copy of the original polyline. * Parameters: * **points** (`List`\[[`Point`](#Point "viktor.geometry.Point")]) – List of points, which may contain duplicate points. Note that when calling the individual lines of the polyline, duplicate points are filtered (i.e. zero-length lines are omitted). * **color** ([`Color`](https://docs.viktor.ai/sdk/api/core/.md#Color "viktor.core.Color")) – Visualization color New in v13.5.0 . * **identifier** (`str`) – object identifier (new in v14.10.0) - combine\_with(*other*)[](#Polyline.combine_with "Link to this definition") Given two polylines that have at least one point in common and together form one line without any side branches, combine those two polylines. The combined line will contain all points of both polylines. * Parameters: **other** ([`Polyline`](#Polyline "viktor.geometry.Polyline")) * Return type: [`Polyline`](#Polyline "viktor.geometry.Polyline") * *property *end\_point*: [Point](#Point "viktor.geometry.Point")*[](#Polyline.end_point "Link to this definition") Last point in polyline.points - filter\_duplicate\_points()[](#Polyline.filter_duplicate_points "Link to this definition") Returns a new Polyline object. If two consecutive points in this polyline coincide, the second point will be omitted * Return type: [`Polyline`](#Polyline "viktor.geometry.Polyline") * find\_overlaps(*other*)[](#Polyline.find_overlaps "Link to this definition") Find all overlapping regions of this polyline with another polyline. The returned overlapping regions will all point in the direction of this line. The overlap polylines will contain all points of both polylines, even if they only occur in one of the lines. If no overlaps are found, an empty list will be returned. * Parameters: **other** ([`Polyline`](#Polyline "viktor.geometry.Polyline")) * Return type: `List`\[[`Polyline`](#Polyline "viktor.geometry.Polyline")] - *classmethod *from\_lines(*lines*)[](#Polyline.from_lines "Link to this definition") Create a polyline object from a list of lines. The end of one line must always coincide with the start of the next line. * Parameters: **lines** (`Sequence`\[[`Line`](#Line "viktor.geometry.Line")]) – Sequence of lines * Return type: [`Polyline`](#Polyline "viktor.geometry.Polyline") * *classmethod *get\_lowest\_or\_highest\_profile\_x(*profile\_1*, *profile\_2*, *lowest*)[](#Polyline.get_lowest_or_highest_profile_x "Link to this definition") Given two polylines with n intersections, return a third polyline that will always follow the lowest (or highest) of the two lines the x locations of the points of the two polylines should be not descending (lines from left to right or vertical) the returned polyline will only cover the overlapping range in x coordinates. If one of the profiles is an empty polyline, an empty polyline will be returned. examples: ``` /----------------| / /-------|-------------------- profile_1: ----------------\ / / | \ / / |_____________________________ profile_2: -------------\-/ / \_________/ get_lowest_or_highest_profile_x(cls, profile_1, profile_2, lowest=True) will return: /-------| / | / |____________________ result: -------------\ / \_________/ ``` Note that only the overlapping region of the two profiles is returned! * Parameters: * **profile\_1** ([`Polyline`](#Polyline "viktor.geometry.Polyline")) * **profile\_2** ([`Polyline`](#Polyline "viktor.geometry.Polyline")) * **lowest** (`bool`) – switch to decide whether to return highest or lowest profile * Return type: [`Polyline`](#Polyline "viktor.geometry.Polyline") Currently, this implementation is exclusive. Meaning that vertical line parts that lie on the start or end of the overlap region in x are not taken into account. - get\_polyline\_between(*start\_point*, *end\_point*, *inclusive=False*)[](#Polyline.get_polyline_between "Link to this definition") Given two points that both lie on a polyline, return the polyline that lies between those two points start\_point has to lie before end\_point on this polyline. If the given start point lies after the given end point on this polyline, an empty polyline will be returned. If the two given points are identical, it depends on the inclusive flag whether a polyline containing that point once, or an empty polyline will be returned. * Parameters: * **start\_point** ([`Point`](#Point "viktor.geometry.Point")) * **end\_point** ([`Point`](#Point "viktor.geometry.Point")) * **inclusive** (`bool`) – if true, the start and the end points will be added to the returned list * Raises: **ValueError** – when one of the two given points does not lie on this polyline * Return type: [`Polyline`](#Polyline "viktor.geometry.Polyline") * get\_reversed\_polyline()[](#Polyline.get_reversed_polyline "Link to this definition") Returns a polyline that is the reverse of this one. * Return type: [`Polyline`](#Polyline "viktor.geometry.Polyline") - intersections\_with\_polyline(*other\_polyline*)[](#Polyline.intersections_with_polyline "Link to this definition") Find all intersections with another polyline and return them ordered according to the direction of this polyline If the polylines are partly parallel, the start and end points of the parallel section will be returned as intersections. If one of the polylines is a subset of the other, or the two lines are completely parallel, no intersections will be found. * Parameters: **other\_polyline** ([`Polyline`](#Polyline "viktor.geometry.Polyline")) * Return type: `List`\[[`Point`](#Point "viktor.geometry.Point")] * intersections\_with\_x\_location(*x*)[](#Polyline.intersections_with_x_location "Link to this definition") Find all intersections of this polyline with a given x location. Ordered from start to end of this polyline. If this line is partly vertical, the start and end points of the vertical section will be returned as an intersection. If this line is completely vertical, no intersections will be found. * Parameters: **x** (`float`) * Return type: `List`\[[`Point`](#Point "viktor.geometry.Point")] - is\_equal\_to(*other*)[](#Polyline.is_equal_to "Link to this definition") Check if all points in this polyline coincide with all points of another polyline * Parameters: **other** ([`Polyline`](#Polyline "viktor.geometry.Polyline")) – Other polyline * Return type: `bool` * is\_monotonic\_ascending\_x(*strict=True*)[](#Polyline.is_monotonic_ascending_x "Link to this definition") Check if the x coordinates of the points of this polyline are ascending. * Parameters: **strict** (`bool`) – when set to false, equal x coordinates are accepted between points * Return type: `bool` - is\_monotonic\_ascending\_y(*strict=True*)[](#Polyline.is_monotonic_ascending_y "Link to this definition") Check if the y coordinates of the points of this polyline are ascending * Parameters: **strict** (`bool`) – when set to false, equal y coordinates are accepted between points * Return type: `bool` * *property *lines*: List\[[Line](#Line "viktor.geometry.Line")]*[](#Polyline.lines "Link to this definition") A list of lines connecting all polyline points. Lines between coincident points are skipped. - point\_is\_on\_polyline(*point*)[](#Polyline.point_is_on_polyline "Link to this definition") Check if a given point lies on this polyline * Parameters: **point** ([`Point`](#Point "viktor.geometry.Point")) * Return type: `bool` * *property *points*: List\[[Point](#Point "viktor.geometry.Point")]*[](#Polyline.points "Link to this definition") - serialize()[](#Polyline.serialize "Link to this definition") Return a json serializable dict of form: ``` [ {'x': point_1.x, 'y': point_1.y}, {'x': point_2.x, 'y': point_2.y} ] ``` * Return type: `List`\[`dict`] * split(*point*)[](#Polyline.split "Link to this definition") return the two separate parts of this polyline before and after the given point. * Parameters: **point** ([`Point`](#Point "viktor.geometry.Point")) * Raises: **ValueError** – if the provided point does not lie on this polyline. * Return type: `Tuple`\[[`Polyline`](#Polyline "viktor.geometry.Polyline"), [`Polyline`](#Polyline "viktor.geometry.Polyline")] - *property *start\_point*: [Point](#Point "viktor.geometry.Point")*[](#Polyline.start_point "Link to this definition") First point in polyline.points * *property *x\_max*: float | None*[](#Polyline.x_max "Link to this definition") The highest x-coordinate present within this polyline. - *property *x\_min*: float | None*[](#Polyline.x_min "Link to this definition") The lowest x-coordinate present within this polyline. * *property *y\_max*: float | None*[](#Polyline.y_max "Link to this definition") The highest y-coordinate present within this polyline. - *property *y\_min*: float | None*[](#Polyline.y_min "Link to this definition") The lowest y-coordinate present within this polyline. * *property *z\_max*: float | None*[](#Polyline.z_max "Link to this definition") The highest z-coordinate present within this polyline. - *property *z\_min*: float | None*[](#Polyline.z_min "Link to this definition") The lowest z-coordinate present within this polyline. <!-- --> ## RDWGSConverter[​](https://docs.viktor.ai/sdk/api/geometry/.md#_RDWGSConverter "Direct link to RDWGSConverter") * *class *viktor.geometry.RDWGSConverter[](#RDWGSConverter "Link to this definition") Class that provides functions to translate latitude and longitude coordinates between the WGS system and RD system. The RD coordinate system is a cartesian coordinate system that is frequently used for in civil engineering to describe locations in the Netherlands. The origin is located in france, so that for all of the Netherlands, both x (m) and y (m) values are positive and y is always larger then x. The domain in which the RD coordinate system is valid is: * x: \[-7000, 300000] * y: \[289000, 629000] About the RD coordinate system: <https://nl.wikipedia.org/wiki/Rijksdriehoeksco%C3%B6rdinaten> * X0* = 155000*[](#RDWGSConverter.X0 "Link to this definition") - Y0* = 463000*[](#RDWGSConverter.Y0 "Link to this definition") * *static *from\_rd\_to\_wgs(*coords*)[](#RDWGSConverter.from_rd_to_wgs "Link to this definition") Convert RD coordinates (x, y) to WGS coordinates \[latitude, longitude]. ``` lat, lon = RDWGSConverter.from_rd_to_wgs((100000, 400000)) ``` * Parameters: **coords** (`Tuple`\[`float`, `float`]) – RD coordinates (x, y) * Return type: `List`\[`float`] - *static *from\_wgs\_to\_rd(*coords*)[](#RDWGSConverter.from_wgs_to_rd "Link to this definition") Convert WGS coordinates (latitude, longitude) to RD coordinates \[x, y]. ``` x, y = RDWGSConverter.from_wgs_to_rd((51.58622, 4.59360)) ``` * Parameters: **coords** (`Tuple`\[`float`, `float`]) – WGS coordinates (latitude, longitude) * Return type: `List`\[`float`] * lam0* = 5.38720621*[](#RDWGSConverter.lam0 "Link to this definition") - phi0* = 52.1551744*[](#RDWGSConverter.phi0 "Link to this definition") <!-- --> ## RectangularExtrusion[​](https://docs.viktor.ai/sdk/api/geometry/.md#_RectangularExtrusion "Direct link to RectangularExtrusion") * *class *viktor.geometry.RectangularExtrusion(*width*, *height*, *line*, *profile\_rotation=0*, *\**, *material=None*, *identifier=None*)[](#RectangularExtrusion "Link to this definition") Bases: [`Extrusion`](#Extrusion "viktor.geometry.Extrusion") Extruded object from a given set of points, which is called the profile. This profile should meet the following requirements: > * start point should be added at the end for closed profile > > * points should be defined in z=0 plane > > * circumference should be defined clockwise Note that the profile is defined with respect to the start point of the Line object, i.e. the profile is defined in the local coordinate system. An example is given below of two extrusions with the same dimensions. Their corresponding Line objects are also visualized. The extrusion have the following profile: ``` # black box profile_b = [ Point(1, 1), Point(1, 2), Point(2, 2), Point(2, 1), Point(1, 1), ] box_b = Extrusion(profile_b, Line(Point(4, 1, 0), Point(4, 1, 1))) # yellow box profile_y = [ Point(-0.5, -0.5), Point(-0.5, 0.5), Point(0.5, 0.5), Point(0.5, -0.5), Point(-0.5, -0.5), ] box_y = Extrusion(profile_y, Line(Point(2, 2, 0), Point(2, 2, 1))) ``` [![/\_images/extrusion-profile.png](/_images/extrusion-profile.png)](https://docs.viktor.ai/_images/extrusion-profile.png) * Parameters: * **profile** – Coordinates of cross-section. * **line** ([`Line`](#Line "viktor.geometry.Line")) – A line object is used to define the length (thickness) of the extrusion. * **profile\_rotation** (`float`) – Rotation of the profile around the Z-axis in degrees. * **material** ([`Material`](#Material "viktor.geometry.Material")) – optional material * **identifier** (`str`) – object identifier (new in v14.10.0) - *property *cross\_sectional\_area*: float*[](#RectangularExtrusion.cross_sectional_area "Link to this definition") Returns the area of the cross-section (width x height). * *property *height*: float*[](#RectangularExtrusion.height "Link to this definition") Height of the extrusion. - *property *inner\_volume*: float*[](#RectangularExtrusion.inner_volume "Link to this definition") Returns the inner volume of the extruded object. * *property *width*: float*[](#RectangularExtrusion.width "Link to this definition") Width of the extrusion. <!-- --> ## Revolve[​](https://docs.viktor.ai/sdk/api/geometry/.md#_Revolve "Direct link to Revolve") * *class *viktor.geometry.Revolve(*\*args*, *rotation\_angle=None*, *material=None*, *identifier=None*, *\*\*kwargs*)[](#Revolve "Link to this definition") Bases: [`TransformableObject`](#TransformableObject "viktor.geometry.TransformableObject"), `ABC` Abstract base class of a revolved object. * *abstract property *inner\_volume*: float*[](#Revolve.inner_volume "Link to this definition") - *property *mass*: float*[](#Revolve.mass "Link to this definition") Calculates the mass of the object as rho \* area \* thickness, with rho the density of the Material. * *abstract property *surface\_area*: float*[](#Revolve.surface_area "Link to this definition") - *property *thickness*: float*[](#Revolve.thickness "Link to this definition") <!-- --> ## Sphere[​](https://docs.viktor.ai/sdk/api/geometry/.md#_Sphere "Direct link to Sphere") * *class *viktor.geometry.Sphere(*centre\_point*, *radius*, *width\_segments=30*, *height\_segments=30*, *material=None*, *\**, *identifier=None*)[](#Sphere "Link to this definition") Bases: [`TransformableObject`](#TransformableObject "viktor.geometry.TransformableObject") This class can be used to construct a spherical object around the specified coordinate. The smoothness of the edges can be altered by setting width\_segments and height\_segments. In the example below both the default smoothness of 30 (left) and a rough sphere with 5 segments (right) is shown: [![/\_images/sphere.png](/_images/sphere.png)](https://docs.viktor.ai/_images/sphere.png) * Parameters: * **centre\_point** ([`Point`](#Point "viktor.geometry.Point")) – Center point of the sphere. * **radius** (`float`) – Radius of the sphere. * **width\_segments** (`float`) – Sets the smoothness in xz-plane. * **height\_segments** (`float`) – Sets the smoothness in yz-plane. * **material** ([`Material`](#Material "viktor.geometry.Material")) – Optionally a custom material can be set. * **identifier** (`str`) – object identifier (new in v14.10.0) - circumference()[](#Sphere.circumference "Link to this definition") * Return type: `float` * diameter()[](#Sphere.diameter "Link to this definition") * Return type: `float` - surface\_area()[](#Sphere.surface_area "Link to this definition") * Return type: `float` * volume()[](#Sphere.volume "Link to this definition") * Return type: `float` <!-- --> ## SquareBeam[​](https://docs.viktor.ai/sdk/api/geometry/.md#_SquareBeam "Direct link to SquareBeam") * *class *viktor.geometry.SquareBeam(*length\_x*, *length\_y*, *length\_z*, *\**, *material=None*, *identifier=None*)[](#SquareBeam "Link to this definition") Bases: [`RectangularExtrusion`](#RectangularExtrusion "viktor.geometry.RectangularExtrusion") High level object to create a rectangular beam object around the origin. The centroid of the beam is located at the origin (0, 0, 0). * Parameters: * **length\_x** (`float`) – Width of the extrusion in x-direction. * **length\_y** (`float`) – Length of the extrusion in y-direction. * **length\_z** (`float`) – Height of the extrusion in z-direction. * **material** ([`Material`](#Material "viktor.geometry.Material")) – optional material * **identifier** (`str`) – object identifier (new in v14.10.0) <!-- --> ## Torus[​](https://docs.viktor.ai/sdk/api/geometry/.md#_Torus "Direct link to Torus") * *class *viktor.geometry.Torus(*radius\_cross\_section*, *radius\_rotation\_axis*, *rotation\_angle=6.283185307179586*, *\**, *material=None*, *identifier=None*)[](#Torus "Link to this definition") Bases: [`Group`](#Group "viktor.geometry.Group") Create a torus object * Parameters: * **radius\_cross\_section** (`float`) * **radius\_rotation\_axis** (`float`) – measured from central axis to centre of cross-section. * **rotation\_angle** (`float`) – optional argument to control how large of a torus section you want. 2pi for complete torus * **material** ([`Material`](#Material "viktor.geometry.Material")) – optional material * **identifier** (`str`) – object identifier (new in v14.10.0) - *property *inner\_volume*: float*[](#Torus.inner_volume "Link to this definition") * *property *material*: [Material](#Material "viktor.geometry.Material")*[](#Torus.material "Link to this definition") <!-- --> ## TransformableObject[​](https://docs.viktor.ai/sdk/api/geometry/.md#_TransformableObject "Direct link to TransformableObject") * *class *viktor.geometry.TransformableObject(*\**, *identifier=None*)[](#TransformableObject "Link to this definition") Bases: `ABC` * mirror(*point*, *normal*)[](#TransformableObject.mirror "Link to this definition") Mirror an object on a plane defined by a point and normal vector. * Parameters: * **point** ([`Point`](#Point "viktor.geometry.Point") | `Tuple`\[`float`, `float`, `float`]) – Point within the mirror plane. * **normal** ([`Vector`](#Vector "viktor.geometry.Vector") | `Tuple`\[`float`, `float`, `float`]) – Normal vector of the mirror plane. * Return type: [`TransformableObject`](#TransformableObject "viktor.geometry.TransformableObject") - rotate(*angle*, *direction*, *point=None*)[](#TransformableObject.rotate "Link to this definition") Rotate an object along an axis (direction) by an angle. Direction will follow right hand rule. * Parameters: * **angle** (`float`) – Angle of desired rotation in radians. * **direction** ([`Vector`](#Vector "viktor.geometry.Vector") | `Tuple`\[`float`, `float`, `float`]) – Vector along which rotation is to be performed. * **point** ([`Point`](#Point "viktor.geometry.Point") | `Tuple`\[`float`, `float`, `float`]) – Point through which the rotation vector runs. * Return type: [`TransformableObject`](#TransformableObject "viktor.geometry.TransformableObject") * scale(*scaling\_vector*)[](#TransformableObject.scale "Link to this definition") Scale an object along a scaling vector. * Parameters: **scaling\_vector** ([`Vector`](#Vector "viktor.geometry.Vector") | `Tuple`\[`float`, `float`, `float`]) – Vector along which scaling is to be performed. * Return type: [`TransformableObject`](#TransformableObject "viktor.geometry.TransformableObject") - translate(*translation\_vector*)[](#TransformableObject.translate "Link to this definition") Translate an object along a translation vector. * Parameters: **translation\_vector** ([`Vector`](#Vector "viktor.geometry.Vector") | `Tuple`\[`float`, `float`, `float`]) – Vector along which translation is to be performed. * Return type: [`TransformableObject`](#TransformableObject "viktor.geometry.TransformableObject") <!-- --> ## Triangle[​](https://docs.viktor.ai/sdk/api/geometry/.md#_Triangle "Direct link to Triangle") * *class *viktor.geometry.Triangle(*point1*, *point2*, *point3*)[](#Triangle "Link to this definition") Creates a Triangle object from 3D vertices. * Parameters: * **point1** ([`Point`](#Point "viktor.geometry.Point")) – First vertex. * **point2** ([`Point`](#Point "viktor.geometry.Point")) – Second vertex. * **point3** ([`Point`](#Point "viktor.geometry.Point")) – Third vertex. - area()[](#Triangle.area "Link to this definition") Returns the area of the triangle. * Return type: `float` * *property *centroid*: Tuple\[float, float, float]*[](#Triangle.centroid "Link to this definition") Returns the centroid (X, Y, Z) of the triangle. - *property *moment\_of\_inertia*: Tuple\[float, float]*[](#Triangle.moment_of_inertia "Link to this definition") Returns the moment of inertia (Ix, Iy) (only in x-y plane). <!-- --> ## TriangleAssembly[​](https://docs.viktor.ai/sdk/api/geometry/.md#_TriangleAssembly "Direct link to TriangleAssembly") * *class *viktor.geometry.TriangleAssembly(*triangles*, *\**, *material=None*, *skip\_duplicate\_vertices\_check=False*, *identifier=None*)[](#TriangleAssembly "Link to this definition") Bases: [`TransformableObject`](#TransformableObject "viktor.geometry.TransformableObject") Fundamental visualisation geometry, built up from triangles. Right hand rule on triangle circumference determines the surface direction. * Parameters: * **triangles** (`List`\[[`Triangle`](#Triangle "viktor.geometry.Triangle")]) – Triangles of the assembly. * **material** ([`Material`](#Material "viktor.geometry.Material")) – optional material. * **skip\_duplicate\_vertices\_check** (`bool`) – if True, duplicate vertices are not filtered on serialization of the triangles. This may boost performance (default: False). * **identifier** (`str`) – object identifier (new in v14.10.0) <!-- --> ## Vector[​](https://docs.viktor.ai/sdk/api/geometry/.md#_Vector "Direct link to Vector") * *class *viktor.geometry.Vector(*x*, *y*, *z=0*)[](#Vector "Link to this definition") A 3-dimensional vector in space. The following operations are supported: * Negation > ``` > v1 = Vector(1, 2, 3) > v2 = -v1 # results in Vector(-1, -2, -3) > ``` * Addition > ``` > v1 = Vector(1, 2, 3) > v2 = Vector(1, 2, 3) > v3 = v1 + v2 # results in Vector(2, 4, 6) > ``` * Subtraction > ``` > v1 = Vector(1, 2, 3) > v2 = Vector(1, 2, 3) > v3 = v1 - v2 # results in Vector(0, 0, 0) > ``` * (reverse) Multiplication > ``` > v1 = Vector(1, 2, 3) > v2 = v1 * 3 # results in Vector(3, 6, 9) > v3 = 3 * v1 # results in Vector(3, 6, 9) > ``` * Dot product > ``` > v1 = Vector(1, 2, 3) > v2 = Vector(1, 2, 3) > res = v1.dot(v2) # results in 14 > ``` * Cross product > ``` > v1 = Vector(1, 0, 0) > v2 = Vector(0, 1, 0) > v3 = v1.cross(v2) # results in Vector(0, 0, 1) > ``` - Parameters: * **x** (`float`) – X-coordinate. * **y** (`float`) – Y-coordinate. * **z** (`float`) – Z-coordinate (default: 0). * *property *coordinates*: Tuple\[float, float, float]*[](#Vector.coordinates "Link to this definition") Coordinates of the Vector as tuple (X, Y, Z). - cross(*other*)[](#Vector.cross "Link to this definition") Vector product of two vectors. * Parameters: **other** ([`Vector`](#Vector "viktor.geometry.Vector")) – Second Vector * Return type: [`Vector`](#Vector "viktor.geometry.Vector") * dot(*other*)[](#Vector.dot "Link to this definition") Scalar product of two vectors. * Parameters: **other** ([`Vector`](#Vector "viktor.geometry.Vector")) – Second Vector * Return type: `float` - *property *magnitude*: float*[](#Vector.magnitude "Link to this definition") Magnitude of the Vector. * normalize()[](#Vector.normalize "Link to this definition") Return the normalized vector (with unit-length). * Raises: **ValueError** – if vector is a null-vector. * Return type: [`Vector`](#Vector "viktor.geometry.Vector") - *property *squared\_magnitude*: float*[](#Vector.squared_magnitude "Link to this definition") Vector magnitude without square root; faster than magnitude. <!-- --> ## add\_point[​](https://docs.viktor.ai/sdk/api/geometry/.md#_add_point "Direct link to add_point") * viktor.geometry.add\_point(*unique\_points*, *point*)[](#add_point "Link to this definition") Adds a Point object to a unique list of Point objects. The point is only added when not already present in the list. * Parameters: * **unique\_points** (`List`\[[`Point`](#Point "viktor.geometry.Point")]) – List of point objects. * **point** ([`Point`](#Point "viktor.geometry.Point")) – Point object which has to be added. * Return type: `Tuple`\[`List`\[[`Point`](#Point "viktor.geometry.Point")], `int`] <!-- --> ## calculate\_distance\_vector[​](https://docs.viktor.ai/sdk/api/geometry/.md#_calculate_distance_vector "Direct link to calculate_distance_vector") * viktor.geometry.calculate\_distance\_vector(*start\_point*, *end\_point*)[](#calculate_distance_vector "Link to this definition") Calculates the distance between start and end point in the direction start -> end. * Parameters: * **start\_point** ([`Point`](#Point "viktor.geometry.Point")) – Start position of the distance vector. * **end\_point** ([`Point`](#Point "viktor.geometry.Point")) – End position of the distance vector. * Return type: `ndarray` <!-- --> ## calculate\_intersection\_bounded\_line\_extended\_line[​](https://docs.viktor.ai/sdk/api/geometry/.md#_calculate_intersection_bounded_line_extended_line "Direct link to calculate_intersection_bounded_line_extended_line") * viktor.geometry.calculate\_intersection\_bounded\_line\_extended\_line(*bounded\_line*, *extended\_line*, *inclusive=True*)[](#calculate_intersection_bounded_line_extended_line "Link to this definition") Calculate intersection between line with fixed endpoints and line which is indefinitely extended. * Parameters: * **bounded\_line** ([`Line`](#Line "viktor.geometry.Line")) – Bounded Line object. * **extended\_line** ([`Line`](#Line "viktor.geometry.Line")) – Extended Line object. * **inclusive** (`bool`) – If set to True, this method will also check for end points that are located on one of the line ends. * Return type: [`Point`](#Point "viktor.geometry.Point") | `None` <!-- --> ## calculate\_intersection\_bounded\_line\_with\_y[​](https://docs.viktor.ai/sdk/api/geometry/.md#_calculate_intersection_bounded_line_with_y "Direct link to calculate_intersection_bounded_line_with_y") * viktor.geometry.calculate\_intersection\_bounded\_line\_with\_y(*line*, *y\_intersection*)[](#calculate_intersection_bounded_line_with_y "Link to this definition") Calculate x intersection between two points and y value. Return None if no intersection is found. ``` Returns x: Returns None: o / y-----/--- y--------- /: o / : / o x o ``` * Parameters: * **line** ([`Line`](#Line "viktor.geometry.Line")) – Line object. * **y\_intersection** (`float`) – y-value of the intersection line. * Return type: `float` | `None` <!-- --> ## calculate\_intersection\_bounded\_lines[​](https://docs.viktor.ai/sdk/api/geometry/.md#_calculate_intersection_bounded_lines "Direct link to calculate_intersection_bounded_lines") * viktor.geometry.calculate\_intersection\_bounded\_lines(*bounded\_line1*, *bounded\_line2*, *inclusive=True*)[](#calculate_intersection_bounded_lines "Link to this definition") Calculate intersection between two lines with fixed endpoints (2D only, Z-coordinate is ignored!). * Parameters: * **bounded\_line1** ([`Line`](#Line "viktor.geometry.Line")) – First bounded Line object. * **bounded\_line2** ([`Line`](#Line "viktor.geometry.Line")) – Second bounded Line object. * **inclusive** (`bool`) – If set to True, intersections on the endpoint will also be taken into account. * Return type: [`Point`](#Point "viktor.geometry.Point") | `None` <!-- --> ## calculate\_intersection\_extended\_line\_with\_x[​](https://docs.viktor.ai/sdk/api/geometry/.md#_calculate_intersection_extended_line_with_x "Direct link to calculate_intersection_extended_line_with_x") * viktor.geometry.calculate\_intersection\_extended\_line\_with\_x(*line*, *x*)[](#calculate_intersection_extended_line_with_x "Link to this definition") Returns the point at which a given line intersects a vertical axis at position x. ``` Returns P(x, y): Returns P(x, y): o / y-----P--- y-----P---- /: o: / : / : o x o x ``` * Parameters: * **line** ([`Line`](#Line "viktor.geometry.Line")) – Line to be evaluated. * **x** (`float`) – x-value of the intersection line. * Return type: [`Point`](#Point "viktor.geometry.Point") <!-- --> ## calculate\_intersection\_extended\_line\_with\_y[​](https://docs.viktor.ai/sdk/api/geometry/.md#_calculate_intersection_extended_line_with_y "Direct link to calculate_intersection_extended_line_with_y") * viktor.geometry.calculate\_intersection\_extended\_line\_with\_y(*line*, *y\_intersection*)[](#calculate_intersection_extended_line_with_y "Link to this definition") Calculates the intersection x value of a line at a given y value. ``` Returns x: Returns x: o / y-----/--- y---------- /: o: / : / : o x o x ``` * Parameters: * **line** ([`Line`](#Line "viktor.geometry.Line")) – Line object. * **y\_intersection** (`float`) – y-value of the intersection line. * Return type: `float` <!-- --> ## calculate\_intersection\_extended\_lines[​](https://docs.viktor.ai/sdk/api/geometry/.md#_calculate_intersection_extended_lines "Direct link to calculate_intersection_extended_lines") * viktor.geometry.calculate\_intersection\_extended\_lines(*extended\_line1*, *extended\_line2*)[](#calculate_intersection_extended_lines "Link to this definition") Calculate intersection between two lines defined by start/end points. The lines are assumed to extend infinitely: bounds are not taken account. Returns None if lines are parallel (i.e. no intersection exists). ``` Returns P(x, y): Returns P(x, y): Returns None: o / o-----P---o o--o P o-----o / o / / o--o o o ``` * Parameters: * **extended\_line1** ([`Line`](#Line "viktor.geometry.Line")) – First Line object. * **extended\_line2** ([`Line`](#Line "viktor.geometry.Line")) – Second Line object. * Return type: [`Point`](#Point "viktor.geometry.Point") | `None` <!-- --> ## cartesian\_to\_cylindrical[​](https://docs.viktor.ai/sdk/api/geometry/.md#_cartesian_to_cylindrical "Direct link to cartesian_to_cylindrical") * viktor.geometry.cartesian\_to\_cylindrical(*cartesian\_coordinates*)[](#cartesian_to_cylindrical "Link to this definition") Using ISO convention: <https://commons.wikimedia.org/wiki/File:Coord_system_CY_1.svg> Reference plane is former Cartesian xy-plane and cylindrical axis is the Cartesian z-axis. * Parameters: **cartesian\_coordinates** (`Tuple`\[`float`, `float`, `float`]) – Cartesian coordinates (x, y, z). * Return type: `ndarray` * Returns: Cylindrical coordinates (rho, phi, z) with phi between -pi and +pi. <!-- --> ## cartesian\_to\_spherical[​](https://docs.viktor.ai/sdk/api/geometry/.md#_cartesian_to_spherical "Direct link to cartesian_to_spherical") * viktor.geometry.cartesian\_to\_spherical(*cartesian\_coordinates*)[](#cartesian_to_spherical "Link to this definition") Using ISO/physical convention: <https://upload.wikimedia.org/wikipedia/commons/4/4f/3D_Spherical.svg> * Parameters: **cartesian\_coordinates** (`Tuple`\[`float`, `float`, `float`]) – Cartesian coordinates (x, y, z). * Return type: `ndarray` * Returns: Spherical coordinates (r, theta, phi). <!-- --> ## circumference\_is\_clockwise[​](https://docs.viktor.ai/sdk/api/geometry/.md#_circumference_is_clockwise "Direct link to circumference_is_clockwise") * viktor.geometry.circumference\_is\_clockwise(*circumference*)[](#circumference_is_clockwise "Link to this definition") * Method determines the direction of a set of points, and returns: * True if the circumference is clockwise * False if the circumference is counter-clockwise - Parameters: **circumference** (`List`\[[`Point`](#Point "viktor.geometry.Point")]) – Circumference in x,y-plane. - Return type: `bool` <!-- --> ## convert\_points\_for\_lathe[​](https://docs.viktor.ai/sdk/api/geometry/.md#_convert_points_for_lathe "Direct link to convert_points_for_lathe") * viktor.geometry.convert\_points\_for\_lathe(*points*)[](#convert_points_for_lathe "Link to this definition") Method can be used to convert Point objects to lists of dictionaries in the format: {‘x’: point.x, ‘y’: point.y} * Parameters: **points** (`Sequence`\[[`Point`](#Point "viktor.geometry.Point")]) – Point objects. * Return type: `List`\[`dict`] <!-- --> ## cylindrical\_to\_cartesian[​](https://docs.viktor.ai/sdk/api/geometry/.md#_cylindrical_to_cartesian "Direct link to cylindrical_to_cartesian") * viktor.geometry.cylindrical\_to\_cartesian(*cylindrical\_coordinates*)[](#cylindrical_to_cartesian "Link to this definition") Using ISO convention: <https://commons.wikimedia.org/wiki/File:Coord_system_CY_1.svg> Reference plane is former Cartesian xy-plane and cylindrical axis is the Cartesian z-axis. * Parameters: **cylindrical\_coordinates** (`Tuple`\[`float`, `float`, `float`]) – Cylindrical coordinates (rho, phi, z). * Return type: `ndarray` * Returns: Cartesian coordinates (x, y, z). <!-- --> ## find\_overlap[​](https://docs.viktor.ai/sdk/api/geometry/.md#_find_overlap "Direct link to find_overlap") * viktor.geometry.find\_overlap(*region\_a*, *region\_b*, *inclusive=False*)[](#find_overlap "Link to this definition") Given to regions with upper and lower boundary, check if there is overlap and if so return a tuple with the overlap found The direction of the given regions does not matter: (1, 2) will be handled exactly the same as (2, 1) The returned Tuple will always be in ascending order Example usage: ``` find_overlap((2, 4), (3, 5)) -> (3, 4) find_overlap((4, 2), (5, 3)) -> (3, 4) find_overlap((2, 3), (3, 4)) -> None find_overlap((2, 3), (3, 4), inclusive=True) -> (3, 3) ``` * Parameters: * **region\_a** (`Tuple`\[`float`, `float`]) – Tuple of values of the first region. * **region\_b** (`Tuple`\[`float`, `float`]) – Tuple of values of the second region. * **inclusive** (`bool`) – A flag to decide whether a point overlap is counted as overlap or not. * Return type: `None` | `Tuple`\[`float`, `float`] * Returns: A tuple with upper and lower bounds of the overlapping region, or None. <!-- --> ## get\_line\_function\_parameters[​](https://docs.viktor.ai/sdk/api/geometry/.md#_get_line_function_parameters "Direct link to get_line_function_parameters") * viktor.geometry.get\_line\_function\_parameters(*line*)[](#get_line_function_parameters "Link to this definition") Returns the line function parameters (a, b) of a line (y = ax + b). * Return type: `Tuple`\[`float`, `float`] <!-- --> ## get\_vertices\_faces[​](https://docs.viktor.ai/sdk/api/geometry/.md#_get_vertices_faces "Direct link to get_vertices_faces") * viktor.geometry.get\_vertices\_faces(*triangles*)[](#get_vertices_faces "Link to this definition") Returns the vertices and faces of a list of Triangle objects. * Parameters: **triangles** (`List`\[[`Triangle`](#Triangle "viktor.geometry.Triangle")]) – List of triangle objects. * Return type: `Tuple`\[`list`, `list`] <!-- --> ## line\_is\_horizontal[​](https://docs.viktor.ai/sdk/api/geometry/.md#_line_is_horizontal "Direct link to line_is_horizontal") * viktor.geometry.line\_is\_horizontal(*line*)[](#line_is_horizontal "Link to this definition") Returns True if line is horizontal. * Return type: `bool` <!-- --> ## line\_is\_vertical[​](https://docs.viktor.ai/sdk/api/geometry/.md#_line_is_vertical "Direct link to line_is_vertical") * viktor.geometry.line\_is\_vertical(*line*)[](#line_is_vertical "Link to this definition") Returns True if line is vertical. * Return type: `bool` <!-- --> ## lines\_in\_same\_plane[​](https://docs.viktor.ai/sdk/api/geometry/.md#_lines_in_same_plane "Direct link to lines_in_same_plane") * viktor.geometry.lines\_in\_same\_plane(*line1*, *line2*)[](#lines_in_same_plane "Link to this definition") Method to determine whether two Line objects are located in a shared plane and hence are coplanar. * Parameters: * **line1** ([`Line`](#Line "viktor.geometry.Line")) – First line object. * **line2** ([`Line`](#Line "viktor.geometry.Line")) – Second line object. * Return type: `bool` <!-- --> ## mirror\_object[​](https://docs.viktor.ai/sdk/api/geometry/.md#_mirror_object "Direct link to mirror_object") * viktor.geometry.mirror\_object(*obj*, *point*, *normal*)[](#mirror_object "Link to this definition") Function that mirrors an object through a plane. The plane is defined by a point and a normal vector. The return is a copy of the original object, mirrored over the specified plane. * Parameters: * **obj** ([`TransformableObject`](#TransformableObject "viktor.geometry.TransformableObject")) – Object that is to be mirrored * **point** ([`Point`](#Point "viktor.geometry.Point")) – Point object on the desired mirror plane * **normal** ([`Vector`](#Vector "viktor.geometry.Vector") | `Tuple`\[`float`, `float`, `float`]) – Vector that denotes a normal vector of the desired mirror plane. * Return type: [`TransformableObject`](#TransformableObject "viktor.geometry.TransformableObject") <!-- --> ## point\_is\_on\_bounded\_line[​](https://docs.viktor.ai/sdk/api/geometry/.md#_point_is_on_bounded_line "Direct link to point_is_on_bounded_line") * viktor.geometry.point\_is\_on\_bounded\_line(*point*, *line*, *inclusive=True*)[](#point_is_on_bounded_line "Link to this definition") Check whether a given Point object is within the ends of a Line. * Parameters: * **point** ([`Point`](#Point "viktor.geometry.Point") | `Tuple`\[`float`, `float`, `float`]) – Point to be evaluated. * **line** ([`Line`](#Line "viktor.geometry.Line") | `Tuple`\[`Tuple`\[`float`, `float`, `float`], `Tuple`\[`float`, `float`, `float`]]) – Line object. * **inclusive** (`bool`) – If True, this method will also return True when the point is located on one of the line ends. * Return type: `bool` <!-- --> ## points\_are\_coplanar[​](https://docs.viktor.ai/sdk/api/geometry/.md#_points_are_coplanar "Direct link to points_are_coplanar") * viktor.geometry.points\_are\_coplanar(*points*)[](#points_are_coplanar "Link to this definition") Determine whether all given points are coplanar (are on a two-dimensional plane). * Parameters: **points** (`Sequence`\[[`Point`](#Point "viktor.geometry.Point") | `Tuple`\[`float`, `float`, `float`]]) – points to be evaluated (min. 3). * Return type: `bool` Example usage: ``` points = [[Point(0, 3, 1), Point(0, 5, 1), Point(2, 3, 4), Point(2, 5, 4)]] coplanar = points_are_coplanar(points) coplanar = points_are_coplanar([(0, 3, 1), (0, 5, 1), (2, 3, 4), (2, 5, 4)]) ``` <!-- --> ## reflection\_matrix[​](https://docs.viktor.ai/sdk/api/geometry/.md#_reflection_matrix "Direct link to reflection_matrix") * viktor.geometry.reflection\_matrix(*point*, *normal*)[](#reflection_matrix "Link to this definition") Returns the reflection matrix to mirror at a plane defined by a point and a normal vector. * Parameters: * **point** ([`Point`](#Point "viktor.geometry.Point") | `Tuple`\[`float`, `float`, `float`]) – Point object. * **normal** ([`Vector`](#Vector "viktor.geometry.Vector") | `Tuple`\[`float`, `float`, `float`]) – Normal vector of the mirror plane. * Return type: `ndarray` <!-- --> ## rotation\_matrix[​](https://docs.viktor.ai/sdk/api/geometry/.md#_rotation_matrix "Direct link to rotation_matrix") * viktor.geometry.rotation\_matrix(*angle*, *direction*, *point=None*)[](#rotation_matrix "Link to this definition") Returns the rotation matrix that corresponds to a rotation about an axis defined by a point and direction. Angle in radians, direction in accordance to right-hand rule. Example: ``` R = rotation_matrix(pi/2, [0, 0, 1], [1, 0, 0]) np.allclose(np.dot(R, [0, 0, 0, 1]), [1, -1, 0, 1]) # True ``` * Return type: `ndarray` <!-- --> ## scaling\_matrix[​](https://docs.viktor.ai/sdk/api/geometry/.md#_scaling_matrix "Direct link to scaling_matrix") * viktor.geometry.scaling\_matrix(*scaling\_vector*)[](#scaling_matrix "Link to this definition") Returns the scaling matrix that corresponds to a given scaling vector (3D). * Parameters: **scaling\_vector** ([`Vector`](#Vector "viktor.geometry.Vector") | `Tuple`\[`float`, `float`, `float`]) – Three-dimensional scaling vector. * Return type: `ndarray` <!-- --> ## spherical\_to\_cartesian[​](https://docs.viktor.ai/sdk/api/geometry/.md#_spherical_to_cartesian "Direct link to spherical_to_cartesian") * viktor.geometry.spherical\_to\_cartesian(*spherical\_coordinates*)[](#spherical_to_cartesian "Link to this definition") Using ISO/physical convention: <https://upload.wikimedia.org/wikipedia/commons/4/4f/3D_Spherical.svg> * Parameters: **spherical\_coordinates** (`Tuple`\[`float`, `float`, `float`]) – Spherical coordinates (r, theta, phi). * Return type: `ndarray` * Returns: Cartesian coordinates (x, y, z). <!-- --> ## surface\_area\_dome[​](https://docs.viktor.ai/sdk/api/geometry/.md#_surface_area_dome "Direct link to surface_area_dome") * viktor.geometry.surface\_area\_dome(*theta1*, *theta2*, *r*, *R*)[](#surface_area_dome "Link to this definition") Computes the surface area of a dome (arc-revolve). * Parameters: * **theta1** (`float`) – Starting angle of arc in radians. * **theta2** (`float`) – Ending angle of arc in radians. * **r** (`float`) – Radius of arc. * **R** (`float`) – Distance from centre of arc to rotation line. * Return type: `float` * Returns: surface area of arc-revolve. <!-- --> ## surface\_cone\_without\_base[​](https://docs.viktor.ai/sdk/api/geometry/.md#_surface_cone_without_base "Direct link to surface_cone_without_base") * viktor.geometry.surface\_cone\_without\_base(*r*, *h*)[](#surface_cone_without_base "Link to this definition") Calculates the exterior surface of the cone, excluding the area of the circular base. * Parameters: * **r** (`float`) – Radius of the base. * **h** (`float`) – Height of the cone. * Return type: `float` <!-- --> ## translation\_matrix[​](https://docs.viktor.ai/sdk/api/geometry/.md#_translation_matrix "Direct link to translation_matrix") * viktor.geometry.translation\_matrix(*direction*)[](#translation_matrix "Link to this definition") Returns the translation matrix that corresponds to a give direction vector (3D). * Parameters: **direction** ([`Vector`](#Vector "viktor.geometry.Vector") | `Tuple`\[`float`, `float`, `float`]) – Direction vector of the translation. * Return type: `ndarray` <!-- --> ## unit\_vector[​](https://docs.viktor.ai/sdk/api/geometry/.md#_unit_vector "Direct link to unit_vector") * viktor.geometry.unit\_vector(*data*, *axis=None*, *out=None*)[](#unit_vector "Link to this definition") Returns the unit vector of a given vector. * Return type: `ndarray` | `None` <!-- --> ## volume\_cone[​](https://docs.viktor.ai/sdk/api/geometry/.md#_volume_cone "Direct link to volume_cone") * viktor.geometry.volume\_cone(*r*, *h*)[](#volume_cone "Link to this definition") Calculates the volume of a cone. * Parameters: * **r** (`float`) – Radius of the base. * **h** (`float`) – Height of the cone. * Return type: `float` <!-- --> ## x\_between\_bounds[​](https://docs.viktor.ai/sdk/api/geometry/.md#_x_between_bounds "Direct link to x_between_bounds") * viktor.geometry.x\_between\_bounds(*x*, *x1*, *x2*, *inclusive=True*)[](#x_between_bounds "Link to this definition") Method checks whether the x value is between the bounds x1 and x2. * Parameters: * **x** (`float`) – x-value to be evaluated. * **x1** (`float`) – Lower bound. * **x2** (`float`) – Upper bound. * **inclusive** (`bool`) – If set to True, this method will also return True when the x value is equal to either x1 or x2. * Return type: `bool` <!-- --> ## y\_between\_bounds[​](https://docs.viktor.ai/sdk/api/geometry/.md#_y_between_bounds "Direct link to y_between_bounds") * viktor.geometry.y\_between\_bounds(*y*, *y1*, *y2*, *inclusive=True*)[](#y_between_bounds "Link to this definition") Method checks whether the y value is between the bounds y1 and y2. * Parameters: * **y** (`float`) – y-value to be evaluated. * **y1** (`float`) – Lower bound. * **y2** (`float`) – Upper bound. * **inclusive** (`bool`) – If set to True, this method will also return True when the y value is equal to either y1 or y2. * Return type: `bool` --- # viktor.llm <!-- --> <!-- --> <!-- --> ## ViktorOpenAI[​](https://docs.viktor.ai/sdk/api/llm/.md#_ViktorOpenAI "Direct link to ViktorOpenAI") * *class *viktor.llm.ViktorOpenAI[](#ViktorOpenAI "Link to this definition") New in v14.29.0 Helper class for using the VIKTOR OpenAI service. Example: ``` from openai import OpenAI import viktor as vkt client = OpenAI( base_url=vkt.ViktorOpenAI.get_base_url(version='v1'), api_key=vkt.ViktorOpenAI.get_api_key() ) ``` * *static *get\_api\_key()[](#ViktorOpenAI.get_api_key "Link to this definition") Returns the API key that is required to access the VIKTOR OpenAI service. * Return type: `str` - *static *get\_base\_url(*\**, *version*)[](#ViktorOpenAI.get_base_url "Link to this definition") Returns the base URL to the VIKTOR OpenAI service. * Parameters: **version** (`str`) – version identifier that is appended to the base URL (e.g. “v1”) * Return type: `str` --- # viktor.parametrization <!-- --> <!-- --> <!-- --> ## ActionButton[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_ActionButton "Direct link to ActionButton") * *class *viktor.parametrization.ActionButton(*ui\_name*, *method*, *longpoll=True*, *\**, *visible=True*, *always\_available=False*, *flex=None*, *description=None*, *interaction=None*)[](#ActionButton "Link to this definition") Bases: `_ActionButton` Action button which can be pressed to perform a (heavy) calculation without returning a result. Example usage: ``` # in parametrization: calculation_btn = vkt.ActionButton("Analysis", "calculation", longpoll=True) # in controller: def calculation(self, params, **kwargs): # perform calculation, no return necessary ``` * Parameters: * **ui\_name** (`str`) – Name which is visible in the VIKTOR user interface. * **method** (`str`) – Name of the download method that is defined in the controller * **longpoll** (`bool`) – Set this option to True if the process that is invoked by the action button cannot be completed within the timeout limit. * **visible** (`bool` | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | [`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`FunctionLookup`](#FunctionLookup "viktor.parametrization.FunctionLookup") | [`DynamicArrayConstraint`](#DynamicArrayConstraint "viktor.parametrization.DynamicArrayConstraint") | [`RowLookup`](#RowLookup "viktor.parametrization.RowLookup") | `Callable`) – Visibility of the button. A Constraint can be used when the visibility depends on other input fields. * **always\_available** (`bool`) – deprecated * **flex** (`int`) – The width of the field can be altered via this argument. value between 0 and 100 (default=33). * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **interaction** ([`Interaction`](#Interaction "viktor.parametrization.Interaction")) – Enable view interaction through this button New in v13.2.0 <!-- --> ## AnalyseButton[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_AnalyseButton "Direct link to AnalyseButton") * viktor.parametrization.AnalyseButton[](#AnalyseButton "Link to this definition") alias of [`ActionButton`](#ActionButton "viktor.parametrization.ActionButton") <!-- --> ## And[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_And "Direct link to And") * *class *viktor.parametrization.And(*\*operands*)[](#And "Link to this definition") Bases: [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") Can be used to evaluate multiple operands to be True. ``` field_1 = vkt.NumberField('Field 1') field_2 = vkt.BooleanField('Field 2') field_3 = vkt.NumberField('Field 3', visible=vkt.And(vkt.IsEqual(vkt.Lookup('field_1'), 5), vkt.Lookup('field_2'))) ``` * Parameters: **operands** ([`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | `bool`) – Operands to be evaluated. <!-- --> ## AutocompleteField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_AutocompleteField "Direct link to AutocompleteField") * *class *viktor.parametrization.AutocompleteField(*ui\_name*, *options*, *name=None*, *prefix=None*, *suffix=None*, *default=None*, *visible=True*, *flex=None*, *\**, *description=None*)[](#AutocompleteField "Link to this definition") Bases: `_SelectField` Similar to OptionField, except for two differences: * user can type to search for option * single option is not pre-selected Example usage: ``` field = vkt.AutocompleteField('Available options', options=['Option 1', 'Option 2'], default='Option 1') ``` Or use an OptionListElement to obtain a value in the params which differs from the interface name: ``` _options = [vkt.OptionListElement('option_1', 'Option 1'), vkt.OptionListElement('option_2', 'Option 2')] field = vkt.AutocompleteField('Available options', options=_options, default='option_1') ``` See [`Field`](#Field "viktor.parametrization.Field") for parameters. Additional parameters: * Parameters: **options** (`list`\[`float` | `str` | [`OptionListElement`](#OptionListElement "viktor.parametrization.OptionListElement")] | `Callable`) – Options should be defined as a list of numbers, strings, or OptionListElement objects. Data: * type of selected option: integer, float or string * None when nothing is selected <!-- --> ## AutodeskFileField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_AutodeskFileField "Direct link to AutodeskFileField") * *class *viktor.parametrization.AutodeskFileField(*ui\_name*, *oauth2\_integration*, *\**, *file\_types=None*, *name=None*, *visible=True*, *flex=None*, *description=None*)[](#AutodeskFileField "Link to this definition") Bases: [`Field`](#Field "viktor.parametrization.Field") New in 14.25.0 See [`Field`](#Field "viktor.parametrization.Field") for parameters. Additional parameters: * Parameters: * **oauth2\_integration** (`str`) – Name of the Autodesk OAuth2Integration this field is linked to. * **file\_types** (`Sequence`\[`str`]) – Optional restriction on file type(s) (e.g. \[‘.rvt’]) (case-insensitive). <!-- --> ## BoolOperator[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_BoolOperator "Direct link to BoolOperator") * *class *viktor.parametrization.BoolOperator[](#BoolOperator "Link to this definition") Bases: `ABC` Warning Do not use this class directly in an application. Base class for operators that can be used for field visibility and min/max. See the documentation of the subclasses for example implementations. <!-- --> ## BooleanField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_BooleanField "Direct link to BooleanField") * *class *viktor.parametrization.BooleanField(*ui\_name*, *name=None*, *\**, *default=None*, *visible=True*, *flex=None*, *always\_available=False*, *description=None*)[](#BooleanField "Link to this definition") Bases: [`Field`](#Field "viktor.parametrization.Field") See [`Field`](#Field "viktor.parametrization.Field") for parameters Additional parameters: * Parameters: **always\_available** (`bool`) – deprecated Data: * False or True <!-- --> ## Chat[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_Chat "Direct link to Chat") * *class *viktor.parametrization.Chat(*ui\_name*, *method*, *\**, *first\_message=None*, *placeholder=None*, *flex=None*, *visible=True*)[](#Chat "Link to this definition") Bases: `_ActionButton` New in v14.21.0 **This field is currently in BETA** Chat field, e.g. to enable an LLM conversation. Example usage: ``` # in parametrization: chat = vkt.Chat("Chatbot", method="call_llm", first_message="How can I help you?", placeholder="Ask anything") # in controller: def call_llm(self, params, **kwargs): conversation = params.chat text_stream = ... # dependent on full conversation obtained with conversation.get_messages() return vkt.ChatResult(conversation, text_stream) ``` Data: * [`ChatConversation`](https://docs.viktor.ai/sdk/api/api-v1/.md#ChatConversation "viktor.api_v1.ChatConversation") - Parameters: * **ui\_name** (`str`) – Name which is visible in the VIKTOR user interface. * **method** (`str`) – Name of the download method that is defined in the controller * **first\_message** (`str`) – First message that is shown in the chat (or None for default message) * **placeholder** (`str`) – Placeholder message in the prompt (or None for default message) * **flex** (`int`) – Width of the image as percentage of the parametrization component (value betweeb 0-100) * **visible** (`bool` | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | [`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`FunctionLookup`](#FunctionLookup "viktor.parametrization.FunctionLookup") | [`DynamicArrayConstraint`](#DynamicArrayConstraint "viktor.parametrization.DynamicArrayConstraint") | [`RowLookup`](#RowLookup "viktor.parametrization.RowLookup") | `Callable`) – Visibility of the button. A Constraint can be used when the visibility depends on other input fields. <!-- --> ## ChildEntityManager[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_ChildEntityManager "Direct link to ChildEntityManager") * *class *viktor.parametrization.ChildEntityManager(*entity\_type\_name*, *\**, *visible=True*)[](#ChildEntityManager "Link to this definition") Bases: [`Field`](#Field "viktor.parametrization.Field") New in v14.2.0 Manager in which a user can create, inspect, and delete child entities of a specific type. * Parameters: * **entity\_type\_name** (`str`) – User will only be able to manage entities of specified type. * **visible** (`bool` | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | [`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`FunctionLookup`](#FunctionLookup "viktor.parametrization.FunctionLookup") | [`DynamicArrayConstraint`](#DynamicArrayConstraint "viktor.parametrization.DynamicArrayConstraint") | [`RowLookup`](#RowLookup "viktor.parametrization.RowLookup") | `Callable`) – Can be used when the visibility depends on other input fields. <!-- --> ## ChildEntityMultiSelectField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_ChildEntityMultiSelectField "Direct link to ChildEntityMultiSelectField") * *class *viktor.parametrization.ChildEntityMultiSelectField(*ui\_name*, *name=None*, *visible=True*, *flex=None*, *\**, *entity\_type\_names=None*, *description=None*)[](#ChildEntityMultiSelectField "Link to this definition") Bases: `_EntityMultiSelectField` Field to select zero or more child entities of given type(s). Up to 5000 entities may be visualized in the dropdown in the interface. Data: * list\[[`Entity`](https://docs.viktor.ai/sdk/api/api-v1/.md#Entity "viktor.api_v1.Entity")] * Empty list when nothing is selected See [`Field`](#Field "viktor.parametrization.Field") for parameters. Additional parameters: * Parameters: **entity\_type\_names** (`list`\[`str`]) – User will only be able to select entities of types within this list. None = all entities. <!-- --> ## ChildEntityOptionField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_ChildEntityOptionField "Direct link to ChildEntityOptionField") * *class *viktor.parametrization.ChildEntityOptionField(*ui\_name*, *name=None*, *visible=True*, *flex=None*, *\**, *entity\_type\_names=None*, *description=None*)[](#ChildEntityOptionField "Link to this definition") Bases: `_EntityOptionField` Field to select a child entity of given type(s). Single option is not automatically pre-selected. Data: * [`Entity`](https://docs.viktor.ai/sdk/api/api-v1/.md#Entity "viktor.api_v1.Entity") * None when nothing is selected See [`Field`](#Field "viktor.parametrization.Field") for parameters. Additional parameters: * Parameters: **entity\_type\_names** (`list`\[`str`]) – User will only be able to select entities of types within this list. None = all entities. <!-- --> ## ColorField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_ColorField "Direct link to ColorField") * *class *viktor.parametrization.ColorField(*ui\_name*, *name=None*, *\**, *default=None*, *flex=None*, *visible=True*, *description=None*)[](#ColorField "Link to this definition") Bases: [`Field`](#Field "viktor.parametrization.Field") New in v14.0.0 See [`Field`](#Field "viktor.parametrization.Field") for parameters. Additional params: - Data: > * [`Color`](https://docs.viktor.ai/sdk/api/core/.md#Color "viktor.core.Color") > > * None when empty <!-- --> ## DateField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_DateField "Direct link to DateField") * *class *viktor.parametrization.DateField(*ui\_name*, *name=None*, *\**, *default=None*, *flex=None*, *visible=True*, *description=None*)[](#DateField "Link to this definition") Bases: [`Field`](#Field "viktor.parametrization.Field") See [`Field`](#Field "viktor.parametrization.Field") for parameters. Additional params: - Data: * datetime.date object * None, when empty <!-- --> ## DownloadButton[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_DownloadButton "Direct link to DownloadButton") * *class *viktor.parametrization.DownloadButton(*ui\_name*, *method*, *longpoll=False*, *\**, *visible=True*, *always\_available=False*, *flex=None*, *description=None*, *interaction=None*)[](#DownloadButton "Link to this definition") Bases: `_ActionButton` Action button which can be pressed to download a result to a file. Example usage: ``` # in parametrization: download_btn = vkt.DownloadButton("Download file", "get_download_result", longpoll=True) # in controller: def get_download_result(self, params, **kwargs): return vkt.DownloadResult(file_content='file_content', file_name='some_file.txt') ``` * Parameters: * **ui\_name** (`str`) – Name which is visible in the VIKTOR user interface. * **method** (`str`) – Name of the download method that is defined in the controller * **longpoll** (`bool`) – Set this option to True if the process that is invoked by the action button cannot be completed within the timeout limit. * **visible** (`bool` | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | [`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`FunctionLookup`](#FunctionLookup "viktor.parametrization.FunctionLookup") | [`DynamicArrayConstraint`](#DynamicArrayConstraint "viktor.parametrization.DynamicArrayConstraint") | [`RowLookup`](#RowLookup "viktor.parametrization.RowLookup") | `Callable`) – Visibility of the button. A Constraint can be used when the visibility depends on other input fields. * **always\_available** (`bool`) – deprecated * **flex** (`int`) – The width of the field can be altered via this argument. value between 0 and 100 (default=33). * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **interaction** ([`Interaction`](#Interaction "viktor.parametrization.Interaction")) – Enable view interaction through this button New in v13.2.0 <!-- --> ## DynamicArray[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_DynamicArray "Direct link to DynamicArray") * *class *viktor.parametrization.DynamicArray(*ui\_name*, *min=None*, *max=None*, *copylast=None*, *visible=True*, *default=None*, *\**, *name=None*, *description=None*, *row\_label=None*)[](#DynamicArray "Link to this definition") Bases: `_AttrGroup` Dynamic array input field with row definitions. Warning **Nesting Restrictions:** * Cannot nest [`DynamicArray`](#DynamicArray "viktor.parametrization.DynamicArray") within [`DynamicArray`](#DynamicArray "viktor.parametrization.DynamicArray") * Cannot nest [`DynamicArray`](#DynamicArray "viktor.parametrization.DynamicArray") within [`Table`](#Table "viktor.parametrization.Table") **Unsupported Field Types:** The following field types cannot be added to a dynamic array: * [`ActionButton`](#ActionButton "viktor.parametrization.ActionButton") * [`ChildEntityManager`](#ChildEntityManager "viktor.parametrization.ChildEntityManager") * [`DownloadButton`](#DownloadButton "viktor.parametrization.DownloadButton") * [`HiddenField`](#HiddenField "viktor.parametrization.HiddenField") * [`Image`](#Image "viktor.parametrization.Image") * [`OptimizationButton`](#OptimizationButton "viktor.parametrization.OptimizationButton") * [`SetParamsButton`](#SetParamsButton "viktor.parametrization.SetParamsButton") * [`Text`](#Text "viktor.parametrization.Text") Example usage: ``` # Define dynamic array structure layers = vkt.DynamicArray("Layers") layers.depth = vkt.NumberField("Depth", suffix='m') layers.material = vkt.TextField("Material") ``` A dynamic array can also be created with default content. Assume the fields as defined above: ``` _default_content = [ {'depth': 2.5, 'material': 'Sand'}, {'depth': 5.0, 'material': 'Clay'}, {'depth': 3.2, 'material': 'Gravel'}, ] layers = vkt.DynamicArray("Layers", default=_default_content) ... ``` * Parameters: * **ui\_name** (`str`) – This string is visible in the VIKTOR user interface. * **min** (`int` | [`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`FunctionLookup`](#FunctionLookup "viktor.parametrization.FunctionLookup") | `Callable`) – Minimum number of rows in the array. * **max** (`int` | [`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`FunctionLookup`](#FunctionLookup "viktor.parametrization.FunctionLookup") | `Callable`) – Maximum number of rows in the array. * **copylast** (`bool`) – Copy the last row when clicking the + button. Takes precedence over field defaults. * **visible** (`bool` | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | [`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`FunctionLookup`](#FunctionLookup "viktor.parametrization.FunctionLookup") | `Callable`) – Can be used when the visibility depends on other input fields. * **default** (`list`\[`dict`]) – Default values of complete array. Filled before user interaction. * **name** (`str`) – The position of the parameter in the database can be specified in this argument. New in v14.18.0 * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **row\_label** (`str`) – Label to be shown at each row. The row number is appended to the label (max. 30 characters). The default values of the DynamicArray are filled when the editor is entered for the first time (just like the other fields). The fields underneath the dynamic array can also have default values. These are filled when the user adds a new row. If copylast is True, the last values are copied, and the Field defaults are ignored. ``` array = vkt.DynamicArray('Dyn Array', default=[{'a': 1, 'b': 'hello'}, {'a': 2, 'b': 'there'}]) array.a = vkt.NumberField('A', default=99) array.b = vkt.TextField('B', default='foo') ``` When first entering the editor: | A | B | | - | ----- | | 1 | hello | | 2 | there | When adding a new row: | A | B | | -- | ----- | | 1 | hello | | 2 | there | | 99 | foo | When using copylast: ``` array = vkt.DynamicArray('Dyn Array', copylast=True, default=[{'a': 1, 'b': 'hello'}]) array.a = vkt.NumberField('A', default=99) array.b = vkt.TextField('B', default='foo') ``` When first entering the editor: | A | B | | - | ----- | | 1 | hello | When adding a new row: | A | B | | - | ----- | | 1 | hello | | 1 | hello | Data: * list of dictionaries: e.g. \[{‘a’: 1, ‘b’: ‘1’}, {‘a’: 2, ‘b’: ‘2’}] * empty list if there are no ‘rows’ * when fields are empty, the corresponding empty values are used (see documentation of specific field) <!-- --> ## DynamicArrayConstraint[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_DynamicArrayConstraint "Direct link to DynamicArrayConstraint") * *class *viktor.parametrization.DynamicArrayConstraint(*dynamic\_array\_name*, *operand*)[](#DynamicArrayConstraint "Link to this definition") This constraint facilitates usage of other constraints within a dynamic array row. Warning The DynamicArrayConstraint can currently only be used for the **visibility** of DynamicArray components. Example usage: ``` _show_y = vkt.DynamicArrayConstraint('array_name', vkt.IsTrue(vkt.Lookup('$row.param_x'))) array = vkt.DynamicArray('My array') array.param_x = vkt.BooleanField('X') array.param_y = vkt.NumberField('Y', visible=_show_y) ``` * Parameters: * **dynamic\_array\_name** (`str`) – name of the dynamic array on which the constraint should be applied. * **operand** ([`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | [`FunctionLookup`](#FunctionLookup "viktor.parametrization.FunctionLookup")) – The inputs of the operand have to be altered to access the correct row within the dynamic array. The input for a target field becomes ‘$row.{field\_name}’. <!-- --> ## EntityMultiSelectField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_EntityMultiSelectField "Direct link to EntityMultiSelectField") * *class *viktor.parametrization.EntityMultiSelectField(*ui\_name*, *entity\_type\_names*, *\**, *name=None*, *visible=True*, *flex=None*, *description=None*)[](#EntityMultiSelectField "Link to this definition") Bases: `_EntityMultiField` Field to select zero or more entities of given type(s). See [`Field`](#Field "viktor.parametrization.Field") for parameters. Additional parameters: * Parameters: **entity\_type\_names** (`list`\[`str`]) – User will only be able to select entities of types within this list. Data: > * list\[[`Entity`](https://docs.viktor.ai/sdk/api/api-v1/.md#Entity "viktor.api_v1.Entity")] > > * Empty list when nothing is selected <!-- --> ## EntityOptionField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_EntityOptionField "Direct link to EntityOptionField") * *class *viktor.parametrization.EntityOptionField(*ui\_name*, *entity\_type\_names*, *\**, *name=None*, *visible=True*, *flex=None*, *description=None*)[](#EntityOptionField "Link to this definition") Bases: `_EntitySelectField` Field to select any entity of given type(s). Single option is not automatically pre-selected. See [`Field`](#Field "viktor.parametrization.Field") for parameters. Additional parameters: * Parameters: **entity\_type\_names** (`list`\[`str`]) – User will only be able to select entities of type(s) within this list. Data: > * [`Entity`](https://docs.viktor.ai/sdk/api/api-v1/.md#Entity "viktor.api_v1.Entity") > > * None when nothing is selected <!-- --> ## Field[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_Field "Direct link to Field") * *class *viktor.parametrization.Field(*\**, *ui\_name*, *name=None*, *prefix=None*, *suffix=None*, *default=None*, *flex=None*, *visible=True*, *description=None*)[](#Field "Link to this definition") Bases: `_Field` * Parameters: * **ui\_name** (`str`) – This string is visible in the VIKTOR user interface. * **name** (`str`) – The position of the parameter in the database can be specified in this argument. Warning **Reserved Names:** The following names are reserved and cannot be used: * `'name'` (reserved for internal use) * `'filename'` (reserved for file handling) Using a reserved name will cause an error. Choose a different name for your field. * **prefix** (`str`) – A prefix will be put in front of the ui\_name to provide info such as a dollar sign. Note that this function does not yet work for input fields. * **suffix** (`str`) – A suffix will be put behind the ui\_name to provide additional information such as units. * **default** (`Any`) – The value or string that is specified here is filled in as a default input. * **flex** (`int`) – The width of the field can be altered via this argument. value between 0 and 100 (default=33). * **visible** (`bool` | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | [`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`FunctionLookup`](#FunctionLookup "viktor.parametrization.FunctionLookup") | [`DynamicArrayConstraint`](#DynamicArrayConstraint "viktor.parametrization.DynamicArrayConstraint") | [`RowLookup`](#RowLookup "viktor.parametrization.RowLookup") | `Callable`) – Can be used when the visibility depends on other input fields. * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). <!-- --> ## FileField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_FileField "Direct link to FileField") * *class *viktor.parametrization.FileField(*ui\_name*, *file\_types=None*, *\**, *max\_size=None*, *name=None*, *visible=True*, *flex=None*, *description=None*)[](#FileField "Link to this definition") Bases: `_FileField` FileField can be used to let the user upload a file. Data: * [`FileResource`](https://docs.viktor.ai/sdk/api/api-v1/.md#FileResource "viktor.api_v1.FileResource") * None when nothing is uploaded See [`Field`](#Field "viktor.parametrization.Field") for parameters. Additional parameters: * Parameters: * **file\_types** (`Sequence`\[`str`]) – Optional restriction on file type(s) (e.g. \[‘.png’, ‘.jpg’, ‘.jpeg’]) (case-insensitive). * **max\_size** (`int`) – Optional restriction on file size in bytes (e.g. 10\_000\_000 = 10 MB). <!-- --> ## FunctionLookup[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_FunctionLookup "Direct link to FunctionLookup") * *class *viktor.parametrization.FunctionLookup(*func*, *\*func\_args*, *\*\*kwargs*)[](#FunctionLookup "Link to this definition") Defines a lookup constraint where the output value is any function of several input fields. Example usages: ``` def multiply(a, b=10): return a * b field_1 = vkt.NumberField('Field 1') field_2 = vkt.NumberField('Field 2') ``` Standard usage with two field arguments: ``` field_3 = vkt.NumberField('Field 3', min=FunctionLookup(multiply, Lookup('field_1'), Lookup('field_2'))) ``` Using the default value of argument b: ``` field_4 = vkt.NumberField('Field 4', min=FunctionLookup(multiply, Lookup('field_1'))) ``` Using a constant instead of a field for argument a: ``` field_5 = vkt.NumberField('Field 5', min=FunctionLookup(multiply, 8, Lookup('field_2'))) ``` * Parameters: * **func** (`Callable`) – Python function or lambda expression. The function can have arguments with default values. * **func\_args** (`Any`) – Arguments that are provided to the function. Arguments of type Lookup / BoolOperator are evaluated first (e.g. to refer to the value of a Field in the editor, a Lookup can be used). <!-- --> ## GeoPointField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_GeoPointField "Direct link to GeoPointField") * *class *viktor.parametrization.GeoPointField(*ui\_name*, *\**, *name=None*, *default=None*, *visible=True*, *description=None*)[](#GeoPointField "Link to this definition") Bases: `_GeoField` GeoPointField can be used for the selection of a geographical location on a MapView/GeoJSONView. See [`Field`](#Field "viktor.parametrization.Field") for parameters. Data: > * [`GeoPoint`](https://docs.viktor.ai/sdk/api/geometry/.md#GeoPoint "viktor.geometry.GeoPoint") **Data Access:** Multiple patterns are supported: ``` # ✓ Property access (recommended) lat = params.my_location.lat # or .latitude lon = params.my_location.lon # or .longitude # ✓ Subscript access lat = params.my_location['lat'] # or ['latitude'] lon = params.my_location['lon'] # or ['longitude'] ``` <!-- --> ## GeoPolygonField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_GeoPolygonField "Direct link to GeoPolygonField") * *class *viktor.parametrization.GeoPolygonField(*ui\_name*, *\**, *name=None*, *default=None*, *visible=True*, *description=None*)[](#GeoPolygonField "Link to this definition") Bases: `_GeoField` GeoPolygonField can be used for the selection of a geographical polygon on a MapView/GeoJSONView. See [`Field`](#Field "viktor.parametrization.Field") for parameters. Data: > * [`GeoPolygon`](https://docs.viktor.ai/sdk/api/geometry/.md#GeoPolygon "viktor.geometry.GeoPolygon") **Data Access:** Multiple patterns are supported: ``` # ✓ Direct iteration (recommended) for point in params.my_polygon: lat, lon = point.lat, point.lon # ✓ Access points via .points property for point in params.my_polygon.points: lat, lon = point.lat, point.lon ``` <!-- --> ## GeoPolylineField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_GeoPolylineField "Direct link to GeoPolylineField") * *class *viktor.parametrization.GeoPolylineField(*ui\_name*, *\**, *name=None*, *default=None*, *visible=True*, *description=None*)[](#GeoPolylineField "Link to this definition") Bases: `_GeoField` GeoPolylineField can be used for the selection of a geographical (poly)line on a MapView/GeoJSONView. See [`Field`](#Field "viktor.parametrization.Field") for parameters. Data: > * [`GeoPolyline`](https://docs.viktor.ai/sdk/api/geometry/.md#GeoPolyline "viktor.geometry.GeoPolyline") **Data Access:** Multiple patterns are supported: ``` # ✓ Direct iteration (recommended) for point in params.my_polyline: lat, lon = point.lat, point.lon # ✓ Access points via .points property for point in params.my_polyline.points: lat, lon = point.lat, point.lon ``` <!-- --> ## GeometryMultiSelectField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_GeometryMultiSelectField "Direct link to GeometryMultiSelectField") * *class *viktor.parametrization.GeometryMultiSelectField(*ui\_name*, *\**, *name=None*, *default=None*, *visible=True*, *flex=None*, *description=None*, *view=None*, *min\_select=1*, *max\_select=None*)[](#GeometryMultiSelectField "Link to this definition") Bases: `_GeometryField` New in v14.10.0 GeometryMultiSelectField can be used to let the user select multiple geometry objects from a View. Data: * list\[str] * Empty list when nothing is selected See [`Field`](#Field "viktor.parametrization.Field") for parameters. Additional parameters: * Parameters: * **view** (`str`) – View method to which the field is connected (default: first GeometryView / IFCView). * **min\_select** (`int`) – Minimum amount of objects the user needs to select. * **max\_select** (`int`) – Maximum amount of objects the user is allowed to select. <!-- --> ## GeometrySelectField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_GeometrySelectField "Direct link to GeometrySelectField") * *class *viktor.parametrization.GeometrySelectField(*ui\_name*, *\**, *name=None*, *default=None*, *visible=True*, *flex=None*, *description=None*, *view=None*)[](#GeometrySelectField "Link to this definition") Bases: `_GeometryField` New in v14.10.0 GeometrySelectField can be used to let the user select a geometry object from a View. Data: * str * None when nothing is selected See [`Field`](#Field "viktor.parametrization.Field") for parameters. Additional parameters: * Parameters: **view** (`str`) – View method to which the field is connected (default: first GeometryView / IFCView). <!-- --> ## HiddenField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_HiddenField "Direct link to HiddenField") * *class *viktor.parametrization.HiddenField(*ui\_name*, *name=None*)[](#HiddenField "Link to this definition") The purpose of a HiddenField is to store data in the parametrization, without the necessity to show this information in the editor. Warning Do NOT store tremendous amounts of data when it is not necessary, as this will make your application slow and perhaps unstable! * Parameters: * **ui\_name** (`str`) – User-defined name of the field. * **name** (`str`) – The position of the parameter in the database can be specified in this argument. <!-- --> ## Image[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_Image "Direct link to Image") * *class *viktor.parametrization.Image(*path*, *\**, *align='center'*, *caption=None*, *flex=100*, *max\_width=None*, *visible=True*)[](#Image "Link to this definition") Bases: [`Field`](#Field "viktor.parametrization.Field") New in v14.3.0 Field that can be used to display a static image. * Parameters: * **path** (`str`) – Path to the image relative to the assets directory, note that path traversal is not allowed. * **align** (`Literal`\[`'left'`, `'center'`, `'right'`]) – Image alignment (“left” | “center” | “right”). * **caption** (`str`) – Image caption (max. 200 characters). * **flex** (`int`) – Width of the image as percentage of the parametrization component. * **max\_width** (`int`) – A maximum width (pixels) can be set to ensure an image does not end up pixelated. * **visible** (`bool` | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | [`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`FunctionLookup`](#FunctionLookup "viktor.parametrization.FunctionLookup") | [`DynamicArrayConstraint`](#DynamicArrayConstraint "viktor.parametrization.DynamicArrayConstraint") | [`RowLookup`](#RowLookup "viktor.parametrization.RowLookup") | `Callable`) – Can be used when the visibility depends on other input fields. <!-- --> ## IntegerField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_IntegerField "Direct link to IntegerField") * *class *viktor.parametrization.IntegerField(*ui\_name*, *name=None*, *prefix=None*, *\**, *suffix=None*, *default=None*, *step=None*, *min=None*, *max=None*, *visible=True*, *flex=None*, *description=None*)[](#IntegerField "Link to this definition") Bases: [`NumberField`](#NumberField "viktor.parametrization.NumberField") See [`NumberField`](#NumberField "viktor.parametrization.NumberField") for parameters Additional parameters: - Data: * integer, when filled * None, when empty <!-- --> ## Interaction[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_Interaction "Direct link to Interaction") * *class *viktor.parametrization.Interaction(*view*, *selection=None*)[](#Interaction "Link to this definition") Bases: `ABC` * Parameters: * **view** (`str`) – method name of the view to be interacted with. * **selection** (`Sequence`\[`str`]) – only features/objects within selected interaction groups can be interacted with. Interaction groups can be created on the view result (e.g. `MapResult`) using ‘interaction\_groups’. None, to enable interaction with all features/objects with ‘identifier’ assigned, ignoring interaction groups (default: None). <!-- --> ## IsEqual[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_IsEqual "Direct link to IsEqual") * *class *viktor.parametrization.IsEqual(*operand1*, *operand2*)[](#IsEqual "Link to this definition") Bases: [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") Can be used to evaluate two operands to be equal. ``` field_1 = vkt.NumberField('Field 1') field_2 = vkt.NumberField('Field 2', visible=vkt.IsEqual(vkt.Lookup('field_1'), 5)) ``` * Parameters: * **operand1** ([`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | `Any`) – First operand to be evaluated. * **operand2** ([`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | `Any`) – Second operand to be evaluated. <!-- --> ## IsFalse[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_IsFalse "Direct link to IsFalse") * *class *viktor.parametrization.IsFalse(*operand*)[](#IsFalse "Link to this definition") Bases: [`IsEqual`](#IsEqual "viktor.parametrization.IsEqual") Can be used to evaluate an operand to be False. ``` field_1 = vkt.NumberField('Field 1') field_2 = vkt.NumberField('Field 2', visible=vkt.IsFalse(vkt.Lookup('field_1'))) ``` * Parameters: **operand** ([`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | `Any`) – Operand to be evaluated. <!-- --> ## IsNotEqual[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_IsNotEqual "Direct link to IsNotEqual") * *class *viktor.parametrization.IsNotEqual(*operand1*, *operand2*)[](#IsNotEqual "Link to this definition") Bases: [`IsEqual`](#IsEqual "viktor.parametrization.IsEqual") Can be used to evaluate two operands to be NOT equal. ``` field_1 = vkt.NumberField('Field 1') field_2 = vkt.NumberField('Field 2', visible=vkt.IsNotEqual(vkt.Lookup('field_1'), 5)) ``` * Parameters: * **operand1** ([`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | `Any`) – First operand to be evaluated. * **operand2** ([`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | `Any`) – Second operand to be evaluated. <!-- --> ## IsNotNone[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_IsNotNone "Direct link to IsNotNone") * *class *viktor.parametrization.IsNotNone(*operand*)[](#IsNotNone "Link to this definition") Bases: [`IsNotEqual`](#IsNotEqual "viktor.parametrization.IsNotEqual") Can be used to evaluate an operand to be NOT None. ``` field_1 = vkt.NumberField('Field 1') field_2 = vkt.NumberField('Field 2', visible=vkt.IsNotNone(vkt.Lookup('field_1'))) ``` * Parameters: **operand** ([`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | `Any`) – Operand to be evaluated. <!-- --> ## IsTrue[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_IsTrue "Direct link to IsTrue") * *class *viktor.parametrization.IsTrue(*operand*)[](#IsTrue "Link to this definition") Bases: [`IsEqual`](#IsEqual "viktor.parametrization.IsEqual") Can be used to evaluate an operand to be True. ``` field_1 = vkt.NumberField('Field 1') field_2 = vkt.NumberField('Field 2', visible=vkt.IsTrue(vkt.Lookup('field_1'))) ``` * Parameters: **operand** ([`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | `Any`) – Operand to be evaluated. <!-- --> ## LineBreak[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_LineBreak "Direct link to LineBreak") * *class *viktor.parametrization.LineBreak(*\**, *visible=True*)[](#LineBreak "Link to this definition") Linebreaks can be used to force input fields to be placed in the next row to obtain a cleaner looking editor. Example usage: ``` field_1 = vkt.NumberField() new_line = vkt.LineBreak() field_2 = vkt.NumberField() ``` * Parameters: **visible** (`bool` | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | [`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`FunctionLookup`](#FunctionLookup "viktor.parametrization.FunctionLookup") | [`DynamicArrayConstraint`](#DynamicArrayConstraint "viktor.parametrization.DynamicArrayConstraint") | [`RowLookup`](#RowLookup "viktor.parametrization.RowLookup") | `Callable`) – Can be used when the visibility depends on other input fields. New in v14.37.0 <!-- --> ## Lookup[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_Lookup "Direct link to Lookup") * *class *viktor.parametrization.Lookup(*target*)[](#Lookup "Link to this definition") Can be used to lookup the value of an input field. This can be used to set visibility of a field and to set a minimum and / or maximum boundary on a number field. Example usage on visibility: ``` field_1 = vkt.BooleanField('Field 1') field_2 = vkt.NumberField('Field 2', visible=Lookup('field_1')) ``` Example usage on min / max: ``` field_1 = vkt.NumberField('Field 1') field_2 = vkt.NumberField('Field 2', min=Lookup('field_1')) ``` * Parameters: **target** (`str`) – Name of input field. <!-- --> ## MapSelectInteraction[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_MapSelectInteraction "Direct link to MapSelectInteraction") * *class *viktor.parametrization.MapSelectInteraction(*view*, *\**, *selection=None*, *min\_select=1*, *max\_select=None*)[](#MapSelectInteraction "Link to this definition") Bases: [`Interaction`](#Interaction "viktor.parametrization.Interaction") New in v13.2.0 Interaction for the selection of feature(s) in a map view. See [`Interaction`](#Interaction "viktor.parametrization.Interaction") for parameters. Additional parameters: * Parameters: * **min\_select** (`int`) – minimum number of features a user must select (>=1). * **max\_select** (`int`) – maximum number of features a user may select. None for no limit (default: None). Example: ``` button = vkt.ActionButton(..., interaction=vkt.MapSelectInteraction('my_map_view', selection=['points'])) ``` <!-- --> ## MultiFileField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_MultiFileField "Direct link to MultiFileField") * *class *viktor.parametrization.MultiFileField(*ui\_name*, *file\_types=None*, *\**, *max\_size=None*, *name=None*, *visible=True*, *flex=None*, *description=None*)[](#MultiFileField "Link to this definition") Bases: `_FileField` MultiFileField can be used to let the user upload multiple files. Data: * list\[[`FileResource`](https://docs.viktor.ai/sdk/api/api-v1/.md#FileResource "viktor.api_v1.FileResource")] * Empty list when nothing is uploaded See [`Field`](#Field "viktor.parametrization.Field") for parameters. Additional parameters: * Parameters: * **file\_types** (`Sequence`\[`str`]) – Optional restriction on file type(s) (e.g. \[‘.png’, ‘.jpg’, ‘.jpeg’]) (case-insensitive). * **max\_size** (`int`) – Optional restriction on file size in bytes (e.g. 10\_000\_000 = 10 MB). <!-- --> ## MultiSelectField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_MultiSelectField "Direct link to MultiSelectField") * *class *viktor.parametrization.MultiSelectField(*ui\_name*, *options*, *name=None*, *prefix=None*, *suffix=None*, *default=None*, *visible=True*, *flex=None*, *\**, *description=None*)[](#MultiSelectField "Link to this definition") Bases: `_SelectField` Present dropdown list with options for user, in which multiple options can be selected. If there is only one option, this option will not be automatically selected. Example usage: ``` field = vkt.MultiSelectField('Available options', options=['Option 1', 'Option 2'], default=['Option 1', 'Option 2']) ``` Or use an OptionListElement to obtain a value in the params which differs from the interface name: ``` _options = [vkt.OptionListElement('option_1', 'Option 1'), OptionListElement('option_2', 'Option 2')] field = vkt.MultiSelectField('Available options', options=_options, default=['option_1', 'option_2']) ``` See [`Field`](#Field "viktor.parametrization.Field") for parameters. Additional parameters: * Parameters: **options** (`list`\[`float` | `str` | [`OptionListElement`](#OptionListElement "viktor.parametrization.OptionListElement")] | `Callable`) – Options should be defined as a list of numbers, strings, or OptionListElement objects. Data: * empty list if no options are selected * list with values of [`OptionListElements`](#OptionListElement "viktor.parametrization.OptionListElement"): integer, float or string <!-- --> ## MultipleSelectField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_MultipleSelectField "Direct link to MultipleSelectField") * viktor.parametrization.MultipleSelectField[](#MultipleSelectField "Link to this definition") alias of [`MultiSelectField`](#MultiSelectField "viktor.parametrization.MultiSelectField") <!-- --> ## Not[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_Not "Direct link to Not") * *class *viktor.parametrization.Not(*operand*)[](#Not "Link to this definition") Bases: [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") Can be used to evaluate an operand to be False. ``` field_1 = vkt.NumberField('Field 1') field_2 = vkt.NumberField('Field 2', visible=vkt.Not(vkt.IsEqual(vkt.Lookup('field_1'), 5))) ``` Note, above construction is the same as: ``` field_1 = vkt.NumberField('Field 1') field_2 = vkt.NumberField('Field 2', visible=vkt.IsNotEqual(vkt.Lookup('field_1'), 5)) ``` * Parameters: **operand** ([`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | `bool`) – Operand to be evaluated. <!-- --> ## NumberField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_NumberField "Direct link to NumberField") * *class *viktor.parametrization.NumberField(*ui\_name*, *name=None*, *prefix=None*, *\**, *suffix=None*, *default=None*, *step=None*, *min=None*, *max=None*, *num\_decimals=None*, *visible=True*, *flex=None*, *variant='standard'*, *description=None*)[](#NumberField "Link to this definition") Bases: [`Field`](#Field "viktor.parametrization.Field") See [`Field`](#Field "viktor.parametrization.Field") for parameters. Additional parameters: * Parameters: * **step** (`float`) – Stepping interval when clicking up and down spinner buttons. When min, max, and step are all specified, max must be reachable from min in a whole number of steps. * **min** (`float` | [`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`FunctionLookup`](#FunctionLookup "viktor.parametrization.FunctionLookup") | [`RowLookup`](#RowLookup "viktor.parametrization.RowLookup") | `Callable`) – Specifies a minimum value constraint. * **max** (`float` | [`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`FunctionLookup`](#FunctionLookup "viktor.parametrization.FunctionLookup") | [`RowLookup`](#RowLookup "viktor.parametrization.RowLookup") | `Callable`) – Specifies a maximum value constraint. * **num\_decimals** (`int`) – Specifies the number of decimals. * **variant** (`str`) – Visually alter the input field. Possible options: * ’standard’: default [![/\_images/variant\_NumberField\_standard.png](/_images/variant_NumberField_standard.png)](https://docs.viktor.ai/_images/variant_NumberField_standard.png) * ’slider’: slider (ignored in Table) [![/\_images/variant\_NumberField\_slider.png](/_images/variant_NumberField_slider.png)](https://docs.viktor.ai/_images/variant_NumberField_slider.png) Data: * integer or float * None, when empty <!-- --> ## OptimiseButton[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_OptimiseButton "Direct link to OptimiseButton") * viktor.parametrization.OptimiseButton[](#OptimiseButton "Link to this definition") alias of [`OptimizationButton`](#OptimizationButton "viktor.parametrization.OptimizationButton") <!-- --> ## OptimizationButton[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_OptimizationButton "Direct link to OptimizationButton") * *class *viktor.parametrization.OptimizationButton(*ui\_name*, *method*, *longpoll=True*, *\**, *visible=True*, *always\_available=False*, *flex=None*, *description=None*, *interaction=None*)[](#OptimizationButton "Link to this definition") Bases: `_ActionButton` Action button which can be pressed to perform an optimization routine. Example usage: ``` # in parametrization: optimize_btn = vkt.OptimizationButton("Optimization", "get_optimal_result", longpoll=True) # in controller: def get_optimal_result(self, params, **kwargs): # specific optimization routine ... return vkt.OptimizationResult(results) ``` * Parameters: * **ui\_name** (`str`) – Name which is visible in the VIKTOR user interface. * **method** (`str`) – Name of the download method that is defined in the controller * **longpoll** (`bool`) – Set this option to True if the process that is invoked by the action button cannot be completed within the timeout limit. * **visible** (`bool` | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | [`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`FunctionLookup`](#FunctionLookup "viktor.parametrization.FunctionLookup") | [`DynamicArrayConstraint`](#DynamicArrayConstraint "viktor.parametrization.DynamicArrayConstraint") | [`RowLookup`](#RowLookup "viktor.parametrization.RowLookup") | `Callable`) – Visibility of the button. A Constraint can be used when the visibility depends on other input fields. * **always\_available** (`bool`) – deprecated * **flex** (`int`) – The width of the field can be altered via this argument. value between 0 and 100 (default=33). * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **interaction** ([`Interaction`](#Interaction "viktor.parametrization.Interaction")) – Enable view interaction through this button New in v13.2.0 <!-- --> ## OptionField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_OptionField "Direct link to OptionField") * *class *viktor.parametrization.OptionField(*ui\_name*, *options*, *name=None*, *prefix=None*, *suffix=None*, *default=None*, *visible=True*, *flex=None*, *\**, *description=None*, *variant='standard'*, *autoselect\_single\_option=False*)[](#OptionField "Link to this definition") Bases: `_SelectField` Present dropdown list with options for user. If there is only one option, this option is automatically selected. If you want to enable multiple options to be select, use a MultiSelectField. Example usage: ``` field = vkt.OptionField('Available options', options=['Option 1', 'Option 2'], default='Option 1') ``` Or use an OptionListElement to obtain a value in the params which differs from the interface name: ``` _options = [vkt.OptionListElement('option_1', 'Option 1'), vkt.OptionListElement('option_2', 'Option 2')] field = vkt.OptionField('Available options', options=_options, default='option_1') ``` See [`Field`](#Field "viktor.parametrization.Field") for parameters. Additional parameters: * Parameters: * **options** (`list`\[`float` | `str` | [`OptionListElement`](#OptionListElement "viktor.parametrization.OptionListElement")] | `Callable`) – Options should be defined as a list of numbers, strings, or OptionListElement objects. * **variant** (`str`) – Visually alter the input field. Possible options: * ’standard’: default ![/\_images/variant\_OptionField\_standard.png](/_images/variant_OptionField_standard.png) * ’radio’: radio buttons, vertically positioned (ignored in Table) ![/\_images/variant\_OptionField\_radio.png](/_images/variant_OptionField_radio.png) * ’radio-inline’: radio buttons, horizontally positioned (ignored in Table) ![/\_images/variant\_OptionField\_radio-inline.png](/_images/variant_OptionField_radio-inline.png) * **autoselect\_single\_option** (`bool`) – True to always automatically select when a single option is provided. This holds for static options as well as dynamic options (see examples below). When autoselect\_single\_option=False (default), expect the following behavior: | Action | Options | | ----------------------------------------------------------------------------- | --------------------------------------- | | enter the editor | ⚪ A, ⚪ B, ⚪ C | | options dynamically change to single option A | ⚪ A | | options dynamically change to multiple options | ⚪ A, ⚪ B, ⚪ C | | user selects option B | ⚪ A, ⚫ B, ⚪ C | | options dynamically change to multiple options, excluding the selected option | ⚪ A, ❌ B, ⚪ C (warning in interface) | When autoselect\_single\_option=True, expect the following behavior: Warning Keep in mind that in case of dynamic options and the possibility of having a single option, the (automatically) selected option might be changed without the user being aware of this! | Action | Options | | ----------------------------------------------------------------------------- | --------------------------------------- | | enter the editor | ⚪ A, ⚪ B, ⚪ C | | options dynamically change to single option A | ⚫ A | | options dynamically change to multiple options | ⚫ A, ⚪ B, ⚪ C | | options dynamically change to single option B (user might not be aware!) | ⚫ B | | options dynamically change to multiple options, excluding the selected option | ⚪ A, ❌ B, ⚪ C (warning in interface) | Data: * type of selected option: integer, float or string * None when nothing is selected <!-- --> ## OptionListElement[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_OptionListElement "Direct link to OptionListElement") * *class *viktor.parametrization.OptionListElement(*value*, *label=None*, *visible=True*)[](#OptionListElement "Link to this definition") Create an option which can be used inside an OptionField. Example: value only with type str ``` >>> option = OptionListElement('apple') >>> option.value 'apple' >>> option.label 'apple' ``` Example: value only with type int ``` >>> option = OptionListElement(33) >>> option.value 33 >>> option.label '33' ``` Example: value and label ``` >>> option = OptionListElement('apple', 'Delicious apple') >>> option.value 'apple' >>> option.label 'Delicious apple' ``` * Parameters: * **value** (`float` | `str`) – The identifier which is used to store and retrieve chosen option. * **label** (`str`) – The identifier which is shown to the user. If no label is specified, the value identifier is used, cast to a string. * **visible** (`bool` | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | [`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`FunctionLookup`](#FunctionLookup "viktor.parametrization.FunctionLookup")) – Determines whether option is visible. Will mostly be used with Constraint. - *property *label*: str*[](#OptionListElement.label "Link to this definition") * *property *value*: float | str*[](#OptionListElement.value "Link to this definition") <!-- --> ## Or[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_Or "Direct link to Or") * *class *viktor.parametrization.Or(*\*operands*)[](#Or "Link to this definition") Bases: [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") Can be used to evaluate if at least one operand is True. ``` field_1 = vkt.NumberField('Field 1') field_2 = vkt.BooleanField('Field 2') field_3 = vkt.NumberField('Field 3', visible=vkt.Or(vkt.IsEqual(vkt.Lookup('field_1'), 5), vkt.Lookup('field_2'))) ``` * Parameters: **operands** ([`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | `bool`) – Operands to be evaluated. <!-- --> ## OutputField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_OutputField "Direct link to OutputField") * *class *viktor.parametrization.OutputField(*ui\_name*, *\**, *value=None*, *prefix=None*, *suffix=None*, *visible=True*, *flex=None*, *description=None*)[](#OutputField "Link to this definition") See [`Field`](#Field "viktor.parametrization.Field") for parameters. Additional parameters: * Parameters: **value** (`float` | `str` | `bool` | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | [`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`FunctionLookup`](#FunctionLookup "viktor.parametrization.FunctionLookup") | [`RowLookup`](#RowLookup "viktor.parametrization.RowLookup") | `Callable`) – Value to be presented in the interface (can be hard-coded or calculated). Example: Point to another parameter ``` field_1 = vkt.NumberField() field_2 = vkt.OutputField(ui_name, value=vkt.Lookup("field_1")) ``` Example: Compute output value using callback function ``` def get_value(params, entity_id, **kwargs): # app specific logic value = ... return value field = vkt.OutputField(ui_name, value=get_value) ``` Data: * OutputFields are not present in the params <!-- --> ## Page[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_Page "Direct link to Page") * *class *viktor.parametrization.Page(*title*, *\**, *views=None*, *description=None*, *visible=True*, *width=None*)[](#Page "Link to this definition") Bases: `_Group` A Page can be used to group certain inputs (e.g. fields) with certain outputs (views). For example: ``` class Parametrization(vkt.Parametrization): page_1 = vkt.Page('Page 1') # no views page_1.field_1 = vkt.NumberField(...) ... page_2 = vkt.Page('Page 2', views='view_data') # single view page_2.field_1 = vkt.NumberField(...) ... page_3 = vkt.Page('Page 3', views=['view_map', 'view_data']) # multiple views page_3.field_1 = vkt.NumberField(...) ... class Controller(vkt.Controller): ... @vkt.DataView(...) # visible on "Page 2" and "Page 3" def view_data(self, params, **kwargs): ... @vkt.MapView(...) # only visible on "Page 3" def view_map(self, params, **kwargs): ... ``` **(new in v14.7.0)** Adjust the width of a specific page: ``` class Parametrization(vkt.Parametrization): page_1 = vkt.Page('Page 1', width=30) ... page_2 = vkt.Page('Page 2', width=70) ... ``` * Parameters: * **title** (`str`) – Title which is shown in the interface. * **views** (`str` | `Sequence`\[`str`]) – View method(s) that should be visible in this page, e.g. ‘my\_view’ for a single view, or \[‘my\_data\_view’, ‘my\_geometry\_view’, …] for multiple views (default: None). * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **visible** (`bool` | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | [`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`FunctionLookup`](#FunctionLookup "viktor.parametrization.FunctionLookup") | `Callable`) – Can be used when the visibility depends on other input fields. New in v14.7.0 * **width** (`int`) – Sets the width of the parametrization side of this page as percentage of the complete width of the editor (input + output). The value should be an integer between 20 and 80. If a width is defined both on the Parametrization and the Page, the Page takes precedence. New in v14.7.0 <!-- --> ## Parametrization[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_Parametrization "Direct link to Parametrization") * *class *viktor.parametrization.Parametrization(*\**, *width=None*)[](#Parametrization "Link to this definition") The Parametrization class functions as the basis of the parameter set of an entity. A simple parametrization looks as follows: ``` import viktor as vkt class Parametrization(vkt.Parametrization): input_1 = vkt.TextField('This is a text field') input_2 = vkt.NumberField('This is a number field') ``` In the VIKTOR user interface, this will be visualized as: [![/\_images/editor-single-layered.png](/_images/editor-single-layered.png)](https://docs.viktor.ai/_images/editor-single-layered.png) In some cases, the parametrization becomes quite big which requires a more structured layout. This can be achieved by making use of a [`Tab`](#Tab "viktor.parametrization.Tab") and [`Section`](#Section "viktor.parametrization.Section") object, which represent a tab and collapsible section in the interface respectively. A 2-layered structure using Tab objects looks like this: ``` import viktor as vkt class Parametrization(vkt.Parametrization): tab_1 = vkt.Tab('Tab 1') tab_1.input_1 = vkt.TextField('This is a text field') tab_1.input_2 = vkt.NumberField('This is a number field') tab_2 = vkt.Tab('Tab 2') tab_2.input_1 = vkt.TextField('Text field in Tab 2') tab_2.input_2 = vkt.NumberField('Number field in Tab 2') ``` [![/\_images/editor-two-layered-tabs.png](/_images/editor-two-layered-tabs.png)](https://docs.viktor.ai/_images/editor-two-layered-tabs.png) Using Section objects results in the following: ``` import viktor as vkt class Parametrization(vkt.Parametrization): section_1 = vkt.Section('Section 1') section_1.input_1 = vkt.TextField('This is a text field') section_1.input_2 = vkt.NumberField('This is a number field') section_2 = vkt.Section('Section 2') section_2.input_1 = vkt.TextField('Text field in Section 2') section_2.input_2 = vkt.NumberField('Number field in Section 2') ``` [![/\_images/editor-two-layered-sections.png](/_images/editor-two-layered-sections.png)](https://docs.viktor.ai/_images/editor-two-layered-sections.png) A parametrization with a maximum depth of 3 layers consists of Tab, Section, and Field objects: ``` import viktor as vkt class Parametrization(vkt.Parametrization): tab_1 = vkt.Tab('Tab 1') tab_1.section_1 = vkt.Section('Section 1') tab_1.section_1.input_1 = vkt.TextField('This is a text field') tab_1.section_1.input_2 = vkt.NumberField('This is a number field') tab_1.section_2 = vkt.Section('Section 2') ... tab_2 = vkt.Tab('Tab 2') ... ``` [![/\_images/editor-three-layered.png](/_images/editor-three-layered.png)](https://docs.viktor.ai/_images/editor-three-layered.png) Every class attribute is treated as a tab, section, or field. If you want to use a variable inside a field, you can either define it outside of the class or as class attribute starting with an underscore: ``` OPTIONS = ['Option 1', 'Option 2'] class Parametrization(vkt.Parametrization): _options = ['Option 3', 'Option 4'] field_1 = vkt.OptionField('Choose option', options=OPTIONS) field_2 = vkt.OptionField('Choose option', options=_options) ``` **Callback Functions:** When using callback functions for `visible`, `min`, or `max` parameters, define them before the Parametrization class: ``` import viktor as vkt def my_visibility(params, **kwargs): return params.field_1 > 5 class Parametrization(vkt.Parametrization): field_1 = vkt.NumberField('Field 1') field_2 = vkt.NumberField('Field 2', visible=my_visibility) ``` **Adjusting Width:** The parametrization width defaults to 40% of the editor. Use the `width` parameter (range: 20-80%) to adjust this ratio: ``` class Parametrization(vkt.Parametrization): number = vkt.NumberField('Number', flex=100) class Controller(vkt.Controller): parametrization = Parametrization(width=60) ``` Individual fields can use `flex` (0-100) to adjust their width relative to the parametrization side. The `width` and `flex` parameters multiply: `width=30` with `flex=100` results in a field taking 30% of the total editor width. * Parameters: **width** (`int`) – Sets the width of the parametrization side as percentage of the complete width of the editor (input + output). The value should be an integer between 20 and 80 (default: 40). If a width is defined both on the Parametrization and a Page / Step, the Page / Step takes precedence. <!-- --> ## RowLookup[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_RowLookup "Direct link to RowLookup") * *class *viktor.parametrization.RowLookup(*target*)[](#RowLookup "Link to this definition") Can be used to lookup the value of an input field within the same row of the dynamic array. This can be used to set the visibility of a field and a minimum and / or maximum boundary on a number field. Example usage: ``` array = vkt.DynamicArray('Array') array.field_1 = vkt.NumberField('Field 1') array.field_2 = vkt.NumberField('Field 2', min=vkt.RowLookup('field_1')) ``` For more complex constructions, it is advised to use a callback function. * Parameters: **target** (`str`) – Name of input field within the dynamic array. <!-- --> ## Section[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_Section "Direct link to Section") * *class *viktor.parametrization.Section(*title*, *\**, *description=None*, *initially\_expanded=None*, *visible=True*)[](#Section "Link to this definition") Bases: `_Group` * Parameters: * **title** (`str`) – Title which is shown in the interface. * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **initially\_expanded** (`bool` | `None`) – Whether the section should be expanded on editor entry New in v14.21.0 * **visible** (`bool` | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | [`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`FunctionLookup`](#FunctionLookup "viktor.parametrization.FunctionLookup") | `Callable`) – Can be used when the visibility depends on other input fields. New in v14.7.0 <!-- --> ## SetParamsButton[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_SetParamsButton "Direct link to SetParamsButton") * *class *viktor.parametrization.SetParamsButton(*ui\_name*, *method*, *longpoll=True*, *\**, *visible=True*, *always\_available=False*, *flex=None*, *description=None*, *interaction=None*)[](#SetParamsButton "Link to this definition") Bases: `_ActionButton` Action button which can be pressed to perform an analysis and override current input fields. Example usage: ``` # in parametrization: set_params_btn = vkt.SetParamsButton("Set params", "set_param_a", longpoll=True) # in controller: def set_param_a(self, params, **kwargs): # get updated input parameters ... return vkt.SetParamsResult(updated_parameter_set) ``` * Parameters: * **ui\_name** (`str`) – Name which is visible in the VIKTOR user interface. * **method** (`str`) – Name of the download method that is defined in the controller * **longpoll** (`bool`) – Set this option to True if the process that is invoked by the action button cannot be completed within the timeout limit. * **visible** (`bool` | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | [`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`FunctionLookup`](#FunctionLookup "viktor.parametrization.FunctionLookup") | [`DynamicArrayConstraint`](#DynamicArrayConstraint "viktor.parametrization.DynamicArrayConstraint") | [`RowLookup`](#RowLookup "viktor.parametrization.RowLookup") | `Callable`) – Visibility of the button. A Constraint can be used when the visibility depends on other input fields. * **always\_available** (`bool`) – deprecated * **flex** (`int`) – The width of the field can be altered via this argument. value between 0 and 100 (default=33). * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **interaction** ([`Interaction`](#Interaction "viktor.parametrization.Interaction")) – Enable view interaction through this button New in v13.2.0 <!-- --> ## SiblingEntityMultiSelectField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_SiblingEntityMultiSelectField "Direct link to SiblingEntityMultiSelectField") * *class *viktor.parametrization.SiblingEntityMultiSelectField(*ui\_name*, *name=None*, *visible=True*, *flex=None*, *\**, *entity\_type\_names=None*, *description=None*)[](#SiblingEntityMultiSelectField "Link to this definition") Bases: `_EntityMultiSelectField` Field to select zero or more sibling entities of given type(s). Up to 5000 entities may be visualized in the dropdown in the interface. Data: * list\[[`Entity`](https://docs.viktor.ai/sdk/api/api-v1/.md#Entity "viktor.api_v1.Entity")] * Empty list when nothing is selected See [`Field`](#Field "viktor.parametrization.Field") for parameters. Additional parameters: * Parameters: **entity\_type\_names** (`list`\[`str`]) – User will only be able to select entities of types within this list. None = all entities. <!-- --> ## SiblingEntityOptionField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_SiblingEntityOptionField "Direct link to SiblingEntityOptionField") * *class *viktor.parametrization.SiblingEntityOptionField(*ui\_name*, *name=None*, *visible=True*, *flex=None*, *\**, *entity\_type\_names=None*, *description=None*)[](#SiblingEntityOptionField "Link to this definition") Bases: `_EntityOptionField` Field to select a sibling entity of given type(s). Single option is not automatically pre-selected. Data: * [`Entity`](https://docs.viktor.ai/sdk/api/api-v1/.md#Entity "viktor.api_v1.Entity") * None when nothing is selected See [`Field`](#Field "viktor.parametrization.Field") for parameters. Additional parameters: * Parameters: **entity\_type\_names** (`list`\[`str`]) – User will only be able to select entities of types within this list. None = all entities. <!-- --> ## Step[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_Step "Direct link to Step") * *class *viktor.parametrization.Step(*title*, *\**, *views=None*, *description=None*, *enabled=True*, *previous\_label=None*, *next\_label=None*, *on\_next=None*, *width=None*)[](#Step "Link to this definition") Bases: [`Page`](#Page "viktor.parametrization.Page") A Step can be used to group certain inputs (e.g. fields) with certain outputs (views) within a predefined order, browsable through a previous and next button. For example: ``` class Parametrization(vkt.Parametrization): step_1 = vkt.Step('Step 1') # no views step_1.field_1 = vkt.NumberField(...) ... step_2 = vkt.Step('Step 2', views='view_data') # single view step_2.field_1 = vkt.NumberField(...) ... step_3 = vkt.Step('Step 3', views=['view_map', 'view_data']) # multiple views step_3.field_1 = vkt.NumberField(...) ... class Controller(vkt.Controller): ... @vkt.DataView(...) # visible on "Step 2" and "Step 3" def view_data(self, params, **kwargs): ... @vkt.MapView(...) # only visible on "Step 3" def view_map(self, params, **kwargs): ... ``` **(new in v13.7.0)** When implementing the on\_next argument, the corresponding function is called when a user clicks the ‘next’ button to move to the next step. This can be used to, for example, validate the input of the current active step: ``` def validate_step_1(params, **kwargs): if params.step_1.field_z <= params.step_1.field_x + params.step_1.field_y: raise vkt.UserError(...) class Parametrization(vkt.Parametrization): step_1 = vkt.Step('Step 1', on_next=validate_step_1) ... ``` **(new in v14.7.0)** Adjust the width of a specific step: ``` class Parametrization(vkt.Parametrization): step_1 = vkt.Step('Step 1', width=30) ... step_2 = vkt.Step('Step 2', width=70) ... ``` **(new in v14.11.0)** Disable steps: Disabled steps are skipped, you will go straight from Step 1 to Step 3 if Step 2 is disabled. ``` def is_step_enabled(params, **kwargs): return params.step_1.field_z <= params.step_1.field_x + params.step_1.field_y class Parametrization(vkt.Parametrization): step_1 = vkt.Step('Step 1', enabled=True) ... step_2 = vkt.Step('Step 2', enabled=is_step_enabled) ... step_3 = vkt.Step('Step 3') # enabled=True by default ... ``` * Parameters: * **title** (`str`) – Title which is shown in the interface. * **views** (`str` | `Sequence`\[`str`]) – View method(s) that should be visible in this step, e.g. ‘my\_view’ for a single view, or \[‘my\_data\_view’, ‘my\_geometry\_view’, …] for multiple views (default: None). * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **enabled** (`bool` | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | [`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`FunctionLookup`](#FunctionLookup "viktor.parametrization.FunctionLookup") | `Callable`) – Can be used to disable (skip) steps, may depend on other input fields. New in v14.11.0 * **previous\_label** (`str`) – Text to be shown on the previous button (ignored for first step, max. 30 characters). * **next\_label** (`str`) – Text to be shown on the next button (ignored for last step, max. 30 characters). * **on\_next** (`Callable`) – Callback function which is triggered when the user moves to the next step. New in v13.7.0 * **width** (`int`) – Sets the width of the parametrization side of this step as percentage of the complete width of the editor (input + output). The value should be an integer between 20 and 80. If a width is defined both on the Parametrization and the Step, the Step takes precedence. New in v14.7.0 <!-- --> ## Tab[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_Tab "Direct link to Tab") * *class *viktor.parametrization.Tab(*title*, *\**, *description=None*, *visible=True*)[](#Tab "Link to this definition") Bases: `_Group` * Parameters: * **title** (`str`) – Title which is shown in the interface. * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **visible** (`bool` | [`BoolOperator`](#BoolOperator "viktor.parametrization.BoolOperator") | [`Lookup`](#Lookup "viktor.parametrization.Lookup") | [`FunctionLookup`](#FunctionLookup "viktor.parametrization.FunctionLookup") | `Callable`) – Can be used when the visibility depends on other input fields. New in v14.7.0 <!-- --> ## Table[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_Table "Direct link to Table") * *class *viktor.parametrization.Table(*ui\_name*, *name=None*, *\**, *default=None*, *visible=True*, *description=None*)[](#Table "Link to this definition") Bases: [`Field`](#Field "viktor.parametrization.Field"), `_AttrGroup` Table input field with column definitions. Warning **Nesting Restrictions:** * Specifying a `default` on a field within a table is not supported * Specifying constraints on a field within a table is not supported * Cannot nest [`Table`](#Table "viktor.parametrization.Table") within [`Table`](#Table "viktor.parametrization.Table") * Cannot nest [`DynamicArray`](#DynamicArray "viktor.parametrization.DynamicArray") within [`Table`](#Table "viktor.parametrization.Table") * Tables can **only** contain the field types listed below **Supported Column Types:** > * [`TextField`](#TextField "viktor.parametrization.TextField") > > * [`NumberField`](#NumberField "viktor.parametrization.NumberField") (without min/max constraints) > > * [`IntegerField`](#IntegerField "viktor.parametrization.IntegerField") > > * [`BooleanField`](#BooleanField "viktor.parametrization.BooleanField") > > * [`OptionField`](#OptionField "viktor.parametrization.OptionField") (options argument required) > > * [`AutocompleteField`](#AutocompleteField "viktor.parametrization.AutocompleteField") Example usage: ``` # Define table structure table = vkt.Table('Input table') table.name = vkt.TextField('Planet') table.period = vkt.NumberField('Orbital period', suffix='years') table.eccentricity = vkt.NumberField('Orbital eccentricity', num_decimals=3) # ❌ INCORRECT: min/max not allowed in tables # table.invalid = vkt.NumberField('Value', min=0, max=100) # Will be ignored ``` A table can also be created with default content. Assume the columns as defined above: ``` _default_content = [ {'name': 'Earth', 'period': 1, 'eccentricity': 0.017}, {'name': 'Mars', 'period': 1.88, 'eccentricity': 0.093}, {'name': 'Saturn', 'period': 29.42, 'eccentricity': 0.054}, ] table = vkt.Table('Input table', default=_default_content) ... ``` See [`Field`](#Field "viktor.parametrization.Field") for parameters. Data: * list of dictionaries * empty list if there are no rows * when fields are empty, the corresponding empty values are used (see documentation of specific field) <!-- --> ## TableInput[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_TableInput "Direct link to TableInput") * viktor.parametrization.TableInput[](#TableInput "Link to this definition") alias of [`Table`](#Table "viktor.parametrization.Table") <!-- --> ## Text[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_Text "Direct link to Text") * *class *viktor.parametrization.Text(*value*, *\**, *visible=True*, *flex=100*)[](#Text "Link to this definition") Bases: [`Field`](#Field "viktor.parametrization.Field") Field that can be used to display a static text (max. 1800 characters). It is not included in the params. Changed in v13.3.0: character limit has been increased from 500 to 1800. See [`Field`](#Field "viktor.parametrization.Field") for parameters. Additional parameters: * Parameters: **value** (`str`) – Text to be shown <!-- --> ## TextAreaField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_TextAreaField "Direct link to TextAreaField") * *class *viktor.parametrization.TextAreaField(*ui\_name*, *name=None*, *default=None*, *visible=True*, *flex=100*, *\**, *description=None*)[](#TextAreaField "Link to this definition") Bases: [`Field`](#Field "viktor.parametrization.Field") Multiple lines textual input. For one line use TextField. See [`Field`](#Field "viktor.parametrization.Field") for parameters. Data: * string * empty string, when empty <!-- --> ## TextAreaInput[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_TextAreaInput "Direct link to TextAreaInput") * viktor.parametrization.TextAreaInput[](#TextAreaInput "Link to this definition") alias of [`TextAreaField`](#TextAreaField "viktor.parametrization.TextAreaField") <!-- --> ## TextField[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_TextField "Direct link to TextField") * *class *viktor.parametrization.TextField(*ui\_name*, *name=None*, *prefix=None*, *\**, *suffix=None*, *default=None*, *visible=True*, *flex=None*, *description=None*)[](#TextField "Link to this definition") Bases: [`Field`](#Field "viktor.parametrization.Field") See [`Field`](#Field "viktor.parametrization.Field") for parameters. Additional parameters: - Data: * string * empty string, when empty <!-- --> ## ToggleButton[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_ToggleButton "Direct link to ToggleButton") * viktor.parametrization.ToggleButton[](#ToggleButton "Link to this definition") alias of [`BooleanField`](#BooleanField "viktor.parametrization.BooleanField") <!-- --> ## ViktorParametrization[​](https://docs.viktor.ai/sdk/api/parametrization/.md#_ViktorParametrization "Direct link to ViktorParametrization") * viktor.parametrization.ViktorParametrization[](#ViktorParametrization "Link to this definition") alias of [`Parametrization`](#Parametrization "viktor.parametrization.Parametrization") --- # viktor.result <!-- --> <!-- --> <!-- --> ## ChatResult[​](https://docs.viktor.ai/sdk/api/result/.md#_ChatResult "Direct link to ChatResult") * *class *viktor.result.ChatResult(*conversation*, *response*)[](#ChatResult "Link to this definition") Bases: `_ButtonResult` Container for the output of a [`Chat`](https://docs.viktor.ai/sdk/api/parametrization/.md#Chat "viktor.parametrization.Chat"). ``` vkt.ChatResult(conversation=my_conversation, response="The LLM response") ``` * Parameters: * **conversation** ([`ChatConversation`](https://docs.viktor.ai/sdk/api/api-v1/.md#ChatConversation "viktor.api_v1.ChatConversation")) – The conversation that has to be updated. * **response** (`str` | `Iterable`\[`str`]) – The response that the conversation has to be updated with. <!-- --> ## DownloadResult[​](https://docs.viktor.ai/sdk/api/result/.md#_DownloadResult "Direct link to DownloadResult") * *class *viktor.result.DownloadResult(*file\_content=None*, *file\_name=None*, *encoding='utf-8'*, *\**, *zipped\_files=None*)[](#DownloadResult "Link to this definition") Bases: `_ButtonResult` Container for the output of a [`DownloadButton`](https://docs.viktor.ai/sdk/api/parametrization/.md#DownloadButton "viktor.parametrization.DownloadButton"). Download of single file: ``` vkt.DownloadResult(file_content=my_file, file_name="my_file.txt") ``` Download of multiple files bundled in a zip-file: ``` vkt.DownloadResult(zipped_files={'my_file_1.txt': my_file_1, 'my_file_2.txt': my_file_2}, file_name="my_file.zip") ``` * Parameters: * **file\_content** (`str` | `bytes` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | `StringIO` | `BytesIO`) – if type str and encoding is not utf-8, specify in additional argument. Mutual exclusive with ‘zipped\_files’. * **file\_name** (`str`) – name (including extension) to be used for download. In case of ‘zipped\_files’, this is the name of the zip-file. May only consist of alphanumeric characters, underscores and dots (any other characters are converted to an underscore). * **encoding** (`str`) – optional argument to specify file encoding when file\_content is provided with type str * **zipped\_files** (`dict`\[`str`, [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | `StringIO` | `BytesIO`]) – a dict of {file name: content} to be bundled in a zip-file with file-name ‘file\_name’. Mutual exclusive with ‘file\_content’. <!-- --> ## OptimisationResult[​](https://docs.viktor.ai/sdk/api/result/.md#_OptimisationResult "Direct link to OptimisationResult") * viktor.result.OptimisationResult[](#OptimisationResult "Link to this definition") alias of [`OptimizationResult`](#OptimizationResult "viktor.result.OptimizationResult") <!-- --> ## OptimisationResultElement[​](https://docs.viktor.ai/sdk/api/result/.md#_OptimisationResultElement "Direct link to OptimisationResultElement") * viktor.result.OptimisationResultElement[](#OptimisationResultElement "Link to this definition") alias of [`OptimizationResultElement`](#OptimizationResultElement "viktor.result.OptimizationResultElement") <!-- --> ## OptimizationResult[​](https://docs.viktor.ai/sdk/api/result/.md#_OptimizationResult "Direct link to OptimizationResult") * *class *viktor.result.OptimizationResult(*results*, *result\_column\_names\_input=None*, *output\_headers=None*, *image=None*)[](#OptimizationResult "Link to this definition") Bases: `_ButtonResult` Container for the output of an [`OptimizationButton`](https://docs.viktor.ai/sdk/api/parametrization/.md#OptimizationButton "viktor.parametrization.OptimizationButton"). * Parameters: * **results** (`list`\[[`OptimizationResultElement`](#OptimizationResultElement "viktor.result.OptimizationResultElement")]) – list of results, order is kept in user interface. * **result\_column\_names\_input** (`list`\[`str`]) – specifies which input parameters should be shown the table. The parametrization class defined the label which is shown * **output\_headers** (`dict`) – specifies which results should be shown in the results table. Key should match the key of the analysis\_result inside each result. Value is the corresponding label which the end user sees. * **image** ([`ImageResult`](https://docs.viktor.ai/sdk/api/views/.md#ImageResult "viktor.views.ImageResult")) – image which is shown next to the results. Could be JPG, PNG or SVG. Example: ``` params1 = {'tab': {'section': {'field1': 'a', 'field2': 5}}} params2 = {'tab': {'section': {'field1': 'b', 'field2': 8}}} analysis1 = {'result1': 10, 'result2': 20} analysis2 = {'result1': 100, 'result2': 150} results = [ vkt.OptimizationResultElement(params1, analysis1), vkt.OptimizationResultElement(params2, analysis2), ] vkt.OptimizationResult( results, result_column_names_input=['tab.section.field1'], output_headers={'result1': 'Result 1'} ) ``` This renders as the following table for the end-user: | # | Field 1 | Result 1 | | - | ------- | -------- | | 1 | a | 10 | | 2 | b | 100 | <!-- --> ## OptimizationResultElement[​](https://docs.viktor.ai/sdk/api/result/.md#_OptimizationResultElement "Direct link to OptimizationResultElement") * *class *viktor.result.OptimizationResultElement(*params*, *analysis\_result=None*)[](#OptimizationResultElement "Link to this definition") * Parameters: * **params** (`dict` | `Munch`) – a complete parameter set * **analysis\_result** (`dict`) – the accompanying results. For an example, see [`OptimizationResult`](#OptimizationResult "viktor.result.OptimizationResult") <!-- --> ## SetParametersResult[​](https://docs.viktor.ai/sdk/api/result/.md#_SetParametersResult "Direct link to SetParametersResult") * viktor.result.SetParametersResult[](#SetParametersResult "Link to this definition") alias of [`SetParamsResult`](#SetParamsResult "viktor.result.SetParamsResult") <!-- --> ## SetParamsResult[​](https://docs.viktor.ai/sdk/api/result/.md#_SetParamsResult "Direct link to SetParamsResult") * *class *viktor.result.SetParamsResult(*params*)[](#SetParamsResult "Link to this definition") Bases: `_ButtonResult` Container for the output of a [`SetParamsButton`](https://docs.viktor.ai/sdk/api/parametrization/.md#SetParamsButton "viktor.parametrization.SetParamsButton"). In order to set the content of the field Tab 1 > Section 1 > NumberField 1 to 1234 use the format: ``` vkt.SetParamsResult({ "tab_1": { "section_1": { "numberfield_1": 1234 } } }) ``` To clear one or more fields one has to explicitly set the params to the empty state. Note that the empty value is different for each field and can be found in their docs: ``` vkt.SetParamsResult({ "tab_1": { "section_1": { "numberfield_1": None, } } }) ``` * Parameters: **params** (`dict` | `Munch`) – the params you want to set. If a param is not specified, the value will be kept as is. - get(*key*)[](#SetParamsResult.get "Link to this definition") * Return type: `Any` <!-- --> ## ViktorResult[​](https://docs.viktor.ai/sdk/api/result/.md#_ViktorResult "Direct link to ViktorResult") * *class *viktor.result.ViktorResult(*optimisation\_result=None*, *set\_parameters\_result=None*, *download\_result=None*, *\**, *optimization\_result=None*, *set\_params\_result=None*)[](#ViktorResult "Link to this definition") Bases: `_SerializableObject` Standard output object of a ViktorController method, which serialises and combines several individual results into the standard automation output. All inputs are optional to facilitate many combinations of results where needed in the future. Currently, the serialisation only accounts for the following (backward compatible) combinations: * a single optimization result * a single set\_params result * a single download result - Parameters: * **optimisation\_result** ([`OptimizationResult`](#OptimizationResult "viktor.result.OptimizationResult")) – alias for optimization\_result * **set\_parameters\_result** ([`SetParamsResult`](#SetParamsResult "viktor.result.SetParamsResult")) – alias for set\_params\_result * **download\_result** ([`DownloadResult`](#DownloadResult "viktor.result.DownloadResult")) – DownloadResult object * **optimization\_result** ([`OptimizationResult`](#OptimizationResult "viktor.result.OptimizationResult")) – OptimizationResult object * **set\_params\_result** ([`SetParamsResult`](#SetParamsResult "viktor.result.SetParamsResult")) – SetParamsResult object --- # viktor.testing <!-- --> <!-- --> <!-- --> ## MockedEntity[​](https://docs.viktor.ai/sdk/api/testing/.md#_MockedEntity "Direct link to MockedEntity") * *class *viktor.testing.MockedEntity(*\**, *entity\_id=1*, *name='Mocked Entity'*, *entity\_type=None*, *last\_saved\_params=None*, *last\_saved\_summary=None*, *get\_file=None*, *parent=None*, *children=None*, *siblings=None*, *revisions=None*, *invalid=False*, *workspace\_id=1*)[](#MockedEntity "Link to this definition") New in v13.3.0 To mock an Entity. All arguments are optional: instantiating MockedEntity without parameters returns a default MockedEntity. Example: ``` import viktor as vkt mocked_entity = vkt.testing.MockedEntity(last_saved_params=params, revisions=[vkt.testing.MockedEntityRevision(params)]) ``` last\_saved\_params can be passed from a JSON file by making use of [`mock_params()`](#mock_params "viktor.testing.mock_params"): ``` import viktor as vkt from app.my_entity.controller import MyEntityController json_file = vkt.File.from_path("path to JSON file") params = vkt.testing.mock_params(json_file, MyEntityController.parametrization) mocked_entity = vkt.testing.MockedEntity(last_saved_params=params, revisions=[vkt.testing.MockedEntityRevision(params)]) ``` * Parameters: * **entity\_id** (`int`) – Return value of Entity.id. * **name** (`str`) – Return value of Entity.name. * **entity\_type** ([`MockedEntityType`](#MockedEntityType "viktor.testing.MockedEntityType")) – Return value of Entity.entity\_type. None for default MockedEntityType. * **last\_saved\_params** (`dict` | `Munch`) – Return value of Entity.last\_saved\_params(). Must be the deserialized params (see [`mock_params()`](#mock_params "viktor.testing.mock_params")). None to simulate an entity without params. * **last\_saved\_summary** (`dict`) – Return value of Entity.last\_saved\_summary(). None to simulate an entity without summary. * **get\_file** ([`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Return value of Entity.get\_file. None to simulate an entity without file. * **parent** ([`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity")) – Return value of Entity.parent. None to simulate an entity without parent. * **children** (`Sequence`\[[`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity")]) – Return value of Entity.children. None to simulate an entity without children. * **siblings** (`Sequence`\[[`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity")]) – Return value of Entity.siblings. None to simulate an entity without siblings. * **revisions** (`Sequence`\[[`MockedEntityRevision`](#MockedEntityRevision "viktor.testing.MockedEntityRevision")]) – Return value of Entity.revisions. None to simulate an entity without revisions. * **invalid** (`bool`) – Set to True to simulate failing API calls on this Entity. - children(*\*args*, *entity\_type\_names=None*, *\*\*kwargs*)[](#MockedEntity.children "Link to this definition") * Return type: [`MockedEntityList`](#MockedEntityList "viktor.testing.MockedEntityList") * create\_child(*entity\_type\_name*, *name*, *\*args*, *params=None*, *\*\*kwargs*)[](#MockedEntity.create_child "Link to this definition") * Return type: [`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity") - delete(*\*args*, *\*\*kwargs*)[](#MockedEntity.delete "Link to this definition") * Return type: `None` * *property *entity\_type*: [MockedEntityType](#MockedEntityType "viktor.testing.MockedEntityType")*[](#MockedEntity.entity_type "Link to this definition") - get\_file(*\*args*, *\*\*kwargs*)[](#MockedEntity.get_file "Link to this definition") * Return type: [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") * *property *id*: int*[](#MockedEntity.id "Link to this definition") - *property *last\_saved\_params*: munch.Munch*[](#MockedEntity.last_saved_params "Link to this definition") * *property *last\_saved\_summary*: munch.Munch*[](#MockedEntity.last_saved_summary "Link to this definition") - *property *name*: str*[](#MockedEntity.name "Link to this definition") * parent(*\*args*, *\*\*kwargs*)[](#MockedEntity.parent "Link to this definition") * Return type: [`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity") - rename(*name*, *\*args*, *\*\*kwargs*)[](#MockedEntity.rename "Link to this definition") * Return type: [`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity") * revisions(*\*args*, *\*\*kwargs*)[](#MockedEntity.revisions "Link to this definition") * Return type: `List`\[[`MockedEntityRevision`](#MockedEntityRevision "viktor.testing.MockedEntityRevision")] - set\_params(*params*, *\*args*, *\*\*kwargs*)[](#MockedEntity.set_params "Link to this definition") * Return type: [`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity") * siblings(*\*args*, *entity\_type\_names=None*, *\*\*kwargs*)[](#MockedEntity.siblings "Link to this definition") * Return type: [`MockedEntityList`](#MockedEntityList "viktor.testing.MockedEntityList") <!-- --> ## MockedEntityList[​](https://docs.viktor.ai/sdk/api/testing/.md#_MockedEntityList "Direct link to MockedEntityList") * *class *viktor.testing.MockedEntityList(*entities*, *\**, *error=None*)[](#MockedEntityList "Link to this definition") <!-- --> ## MockedEntityRevision[​](https://docs.viktor.ai/sdk/api/testing/.md#_MockedEntityRevision "Direct link to MockedEntityRevision") * *class *viktor.testing.MockedEntityRevision(*params=None*, *created\_date=None*, *entity\_revision\_id=1*)[](#MockedEntityRevision "Link to this definition") Bases: [`EntityRevision`](https://docs.viktor.ai/sdk/api/api-v1/.md#EntityRevision "viktor.api_v1.EntityRevision") New in v13.3.0 To mock an EntityRevision. Example: ``` import viktor as vkt params = { 'number': 1, 'entity': vkt.testing.MockedEntity(name="MyEntity"), 'file': vkt.testing.MockedFileResource(vkt.File.from_data("content"), "file.txt") } mocked_entity_revision = vkt.testing.MockedEntityRevision(params) ``` params can be passed from a JSON file by making use of [`mock_params()`](#mock_params "viktor.testing.mock_params"): ``` import viktor as vkt from app.my_entity.controller import MyEntityController json_file = vkt.File.from_path("path to JSON file") params = vkt.mock_params( json_file, MyEntityController.parametrization, entities={1: vkt.testing.MockedEntity(name="MyEntity")}, file_resources={1: vkt.testing.MockedFileResource(vkt.File.from_data("content"), "file")} ) mocked_entity_revision = vkt.testing.MockedEntityRevision(params) ``` * Parameters: * **params** (`dict` | `Munch`) – Return value of EntityRevision.params. Must be the deserialized params (see [`mock_params()`](#mock_params "viktor.testing.mock_params")). None to set default (empty) params. * **created\_date** (`datetime`) – Return value of EntityRevision.created\_date. None to set default date (2000, 1, 1). * **entity\_revision\_id** (`int`) – Return value of EntityRevision.id. <!-- --> ## MockedEntityType[​](https://docs.viktor.ai/sdk/api/testing/.md#_MockedEntityType "Direct link to MockedEntityType") * *class *viktor.testing.MockedEntityType(*name='MockedEntityType'*, *entity\_type\_id=1*)[](#MockedEntityType "Link to this definition") Bases: [`EntityType`](https://docs.viktor.ai/sdk/api/api-v1/.md#EntityType "viktor.api_v1.EntityType") New in v13.3.0 To mock a EntityType. <!-- --> ## MockedFileResource[​](https://docs.viktor.ai/sdk/api/testing/.md#_MockedFileResource "Direct link to MockedFileResource") * *class *viktor.testing.MockedFileResource(*file=None*, *filename='mocked\_file.txt'*)[](#MockedFileResource "Link to this definition") New in v13.3.0 To mock a FileResource. * Parameters: * **file** ([`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Return value of FileResource.file. None to set default file with content = “mocked content”. * **filename** (`str`) – Return value of FileResource.filename. - open(*encoding=None*)[](#MockedFileResource.open "Link to this definition") New in v14.28.0 Open the file in text mode directly. ``` with params.my_file.open() as f: content = f.read() ``` * Parameters: **encoding** (`str`) – Text encoding (default: system encoding) * Return type: `TextIO` * Returns: Text file-like object * open\_binary()[](#MockedFileResource.open_binary "Link to this definition") New in v14.28.0 Open the file in binary mode directly. ``` with params.my_file.open_binary() as f: content = f.read() ``` * Return type: `BinaryIO` * Returns: Binary file-like object <!-- --> ## MockedUser[​](https://docs.viktor.ai/sdk/api/testing/.md#_MockedUser "Direct link to MockedUser") * *class *viktor.testing.MockedUser(*\**, *first\_name='John'*, *last\_name='Doe'*, *email='john.doe\@email.com'*, *job\_title='Employee'*, *user\_id=1*)[](#MockedUser "Link to this definition") Bases: [`User`](https://docs.viktor.ai/sdk/api/api-v1/.md#User "viktor.api_v1.User") New in v13.3.0 To mock a User. <!-- --> ## mock\_API[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_API "Direct link to mock_API") * viktor.testing.mock\_API(*\**, *get\_entity=None*, *create\_child\_entity=None*, *generate\_upload\_url=None*, *get\_current\_user=None*, *get\_entities\_by\_type=None*, *get\_entity\_children=None*, *get\_entity\_siblings=None*, *get\_root\_entities=None*, *get\_entity\_parent=None*, *get\_entity\_revisions=None*, *get\_entity\_file=None*, *rename\_entity=None*, *set\_entity\_params=None*)[](#mock_API "Link to this definition") New in v13.3.0 Decorator that can be used to mock API() method calls, to facilitate easier testing. Example: ``` import unittest import viktor as vkt from app.my_entity.controller import MyEntityController class TestMyEntityController(unittest.TestCase): @vkt.testing.mock_API( get_entity=[vkt.testing.MockedEntity(entity_id=98), vkt.testing.MockedEntity(entity_id=99)], get_entity_file=vkt.File.from_data("fake content") ) def test_api_calls(self): MyEntityController().api_calls() ``` Note that last\_saved\_params can be passed to MockedEntity from a JSON file by making use of [`mock_params()`](#mock_params "viktor.testing.mock_params"): ``` import unittest import viktor as vkt from app.my_entity.controller import MyEntityController class TestMyEntityController(unittest.TestCase): json_file = vkt.File.from_path("path to JSON file") params = vkt.testing.mock_params( json_file, MyEntityController.parametrization, entities={1: vkt.testing.MockedEntity(name="MyEntity")}, file_resources={1: vkt.testing.MockedFileResource(vkt.File.from_data("content"), "file")} ) @vkt.testing.mock_API( get_entity=vkt.testing.MockedEntity(last_saved_params=params, revisions=[vkt.testing.MockedEntityRevision(params)]) ) def test_api_calls(self): MyEntityController().api_calls() ``` * For all parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding API method call. When an API method is called on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding API method is called (endlessly). * If None is provided (default), a default object is returned each time the corresponding API method is called (endlessly). - Parameters: * **get\_entity** (`Sequence`\[[`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity")] | [`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity")) – Return value of API.get\_entity. * **create\_child\_entity** (`Sequence`\[[`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity")] | [`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity")) – Return value of API.create\_child\_entity. * **generate\_upload\_url** (`Sequence`\[`dict`] | `dict`) – Return value of API.generate\_upload\_url. * **get\_current\_user** (`Sequence`\[[`MockedUser`](#MockedUser "viktor.testing.MockedUser")] | [`MockedUser`](#MockedUser "viktor.testing.MockedUser")) – Return value of API.get\_current\_user. * **get\_entities\_by\_type** (`Sequence`\[`Sequence`\[[`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity")]] | `Sequence`\[[`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity")]) – Return value of API.get\_entities\_by\_type. * **get\_entity\_children** (`Sequence`\[`Sequence`\[[`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity")]] | `Sequence`\[[`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity")]) – Return value of API.get\_entity\_children. * **get\_entity\_siblings** (`Sequence`\[`Sequence`\[[`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity")]] | `Sequence`\[[`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity")]) – Return value of API.get\_entity\_siblings. * **get\_root\_entities** (`Sequence`\[`Sequence`\[[`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity")]] | `Sequence`\[[`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity")]) – Return value of API.get\_root\_entities. * **get\_entity\_parent** (`Sequence`\[[`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity")] | [`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity")) – Return value of API.get\_entity\_parent. * **get\_entity\_revisions** (`Sequence`\[`Sequence`\[[`MockedEntityRevision`](#MockedEntityRevision "viktor.testing.MockedEntityRevision")]] | `Sequence`\[[`MockedEntityRevision`](#MockedEntityRevision "viktor.testing.MockedEntityRevision")]) – Return value of API.get\_entity\_revisions. * **get\_entity\_file** (`Sequence`\[[`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Return value of API.get\_entity\_file. * **rename\_entity** (`Sequence`\[[`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity")] | [`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity")) – Return value of API.rename\_entity. * **set\_entity\_params** (`Sequence`\[[`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity")] | [`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity")) – Return value of API.set\_entity\_params. - Return type: `Callable` <!-- --> ## mock\_AutoCADConnection[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_AutoCADConnection "Direct link to mock_AutoCADConnection") * viktor.testing.mock\_AutoCADConnection(*results=None*)[](#mock_AutoCADConnection "Link to this definition") New in 14.35.0 Decorator to mock `viktor.external.autocad.connect()` and `viktor.external.autocad.attach()`, to facilitate easier testing. Map each ActiveX path to the result it should return. A result of the form `{"__handle__": <int>}` is decoded into an object handle exactly like production, so handle flows (using a returned object in later calls, writing its properties) are testable without a worker: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_AutoCADConnection(results={ 'ActiveDocument.ModelSpace.AddLine': [{"__handle__": 1}], 'Length': [6.0], }) def test_build_drawing(self): MyEntityTypeController().build_drawing() ``` Paths not in the dict return `None`. For a result that depends on the call, pass a function of the ActiveX path and its arguments instead: ``` def mocked_autocad_results(path, args): if path == 'ActiveDocument.ModelSpace.AddLine': return [{"__handle__": 1}] return [None] class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_AutoCADConnection(results=mocked_autocad_results) def test_build_drawing(self): ... ``` The mock sends calls in chunks like the real connection. A `results` function runs when the mock sends the chunk, not at the call line, and gets plain values for results passed between calls. `batch()` works as in production, with one exception: a result of a `results` function cannot be unpacked inside the block, because the function only runs when the block ends. Unpack it after the block, or use a dict. * Parameters: **results** (`Dict`\[`str`, `list`] | `Callable`\[\[`str`, `list`], `list`]) – a dict mapping each ActiveX path to its result, or a `(path, args)` function returning one; `None` (default) returns `None` for every call. * Return type: `Callable` <!-- --> ## mock\_AxisVMAnalysis[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_AxisVMAnalysis "Direct link to mock_AxisVMAnalysis") * viktor.testing.mock\_AxisVMAnalysis(*get\_model\_file=None*, *get\_result\_file=None*, *get\_results=None*)[](#mock_AxisVMAnalysis "Link to this definition") New in v13.5.0 Decorator that can be used to mock [`viktor.external.axisvm.AxisVMAnalysis`](https://docs.viktor.ai/sdk/api/external/axisvm/.md#AxisVMAnalysis "viktor.external.axisvm.AxisVMAnalysis"), to facilitate easier testing. Example: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_AxisVMAnalysis( get_model_file=vkt.File.from_path(Path(__file__).parent / 'test_model.axs'), get_result_file=vkt.File.from_path(Path(__file__).parent / 'test_model.axe'), get_results={'Forces': ...} ) def test_axisvm_analysis(self): MyEntityTypeController().axisvm_analysis() ``` * For all parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/BytesIO/dict object (with empty content) is returned each time the corresponding method is called (endlessly). - Parameters: * **get\_model\_file** (`Sequence`\[`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Return value of AxisVMAnalysis.get\_model\_file. * **get\_result\_file** (`Sequence`\[`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Return value of AxisVMAnalysis.get\_result\_file. * **get\_results** (`Sequence`\[`dict`] | `dict`) – Return value of AxisVMAnalysis.get\_results. - Return type: `Callable` <!-- --> ## mock\_Civil3DConnection[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_Civil3DConnection "Direct link to mock_Civil3DConnection") * viktor.testing.mock\_Civil3DConnection(*results=None*)[](#mock_Civil3DConnection "Link to this definition") New in 14.36.0 Decorator to mock `viktor.external.civil3d.connect()` and `viktor.external.civil3d.attach()`, to facilitate easier testing. Map each COM path to the result it should return. A result of the form `{"__handle__": <int>}` is decoded into an object handle exactly like production, so handle flows (using a returned object in later calls, writing its properties) are testable without a worker: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_Civil3DConnection(results={ 'ActiveDocument.Points.Add': [{"__handle__": 1}], 'Easting': [1000.0], 'ActiveDocument.PipeNetworks.Count': [2], }) def test_build_model(self): MyEntityTypeController().build_model() ``` Paths not in the dict return `None`. For a result that depends on the call, pass a function of the COM path and its arguments instead (see [`mock_AutoCADConnection()`](#mock_AutoCADConnection "viktor.testing.mock_AutoCADConnection") for the callable form). Two mock-specific notes: * the domain roots resolve without a fixture — `c3d.pipe` and `c3d.roadway` are transport, answered by the mock itself, so `results` maps app-visible COM paths only; * results are keyed by path alone, without the root: `c3d.pipe.ActiveDocument.PipeNetworks.Count()` is keyed `'ActiveDocument.PipeNetworks.Count'`, and therefore collides with the same path reached from `c3d` itself. Key by the most specific path your test calls. The mock sends calls in chunks like the real connection. A `results` function runs when the mock sends the chunk, not at the call line, and gets plain values for results passed between calls. `batch()` works as in production, with one exception: a result of a `results` function cannot be unpacked inside the block, because the function only runs when the block ends. Unpack it after the block, or use a dict. * Parameters: **results** (`Dict`\[`str`, `list`] | `Callable`\[\[`str`, `list`], `list`]) – a dict mapping each COM path to its result, or a `(path, args)` function returning one; `None` (default) returns `None` for every call. * Return type: `Callable` <!-- --> ## mock\_DFoundationsAnalysis[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_DFoundationsAnalysis "Direct link to mock_DFoundationsAnalysis") * viktor.testing.mock\_DFoundationsAnalysis(*get\_output\_file=None*)[](#mock_DFoundationsAnalysis "Link to this definition") New in v13.5.0 Decorator that can be used to mock [`viktor.external.dfoundations.DFoundationsAnalysis`](https://docs.viktor.ai/sdk/api/external/dfoundations/.md#DFoundationsAnalysis "viktor.external.dfoundations.DFoundationsAnalysis"), to facilitate easier testing. Example: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_DFoundationsAnalysis(get_output_file={ '.fod': vkt.File.from_path(Path(__file__).parent / 'test_output.fod'), '.fos': vkt.File.from_path(Path(__file__).parent / 'test_output.fos') }) def test_dfoundations_analysis(self): MyEntityTypeController().dfoundations_analysis() ``` * For all parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). - Parameters: **get\_output\_file** (`Dict`\[`str`, `Sequence`\[`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]) – Return value of DFoundationsAnalysis.get\_output\_file. - Return type: `Callable` <!-- --> ## mock\_DGeoStabilityAnalysis[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_DGeoStabilityAnalysis "Direct link to mock_DGeoStabilityAnalysis") * viktor.testing.mock\_DGeoStabilityAnalysis(*get\_output\_file=None*)[](#mock_DGeoStabilityAnalysis "Link to this definition") New in v13.5.0 Decorator that can be used to mock [`viktor.external.dgeostability.DGeoStabilityAnalysis`](https://docs.viktor.ai/sdk/api/external/dgeostability/.md#DGeoStabilityAnalysis "viktor.external.dgeostability.DGeoStabilityAnalysis"), to facilitate easier testing. Example: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_DGeoStabilityAnalysis(get_output_file={ '.sto': vkt.File.from_path(Path(__file__).parent / 'test_output.sto') }) def test_dgeostability_analysis(self): MyEntityTypeController().dgeostability_analysis() ``` * For all parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). - Parameters: **get\_output\_file** (`Dict`\[`str`, `Sequence`\[`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]) – Return value of DGeoStabilityAnalysis.get\_output\_file. - Return type: `Callable` <!-- --> ## mock\_DSettlementAnalysis[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_DSettlementAnalysis "Direct link to mock_DSettlementAnalysis") * viktor.testing.mock\_DSettlementAnalysis(*get\_output\_file=None*, *get\_sld\_file=None*)[](#mock_DSettlementAnalysis "Link to this definition") New in v13.5.0 Decorator that can be used to mock [`viktor.external.dsettlement.DSettlementAnalysis`](https://docs.viktor.ai/sdk/api/external/dsettlement/.md#DSettlementAnalysis "viktor.external.dsettlement.DSettlementAnalysis"), to facilitate easier testing. Example: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_DSettlementAnalysis(get_output_file={ '.sld': vkt.File.from_path(Path(__file__).parent / 'test_output.sld'), '.slo': vkt.File.from_path(Path(__file__).parent / 'test_output.slo') }) def test_dsettlement_analysis(self): MyEntityTypeController().dsettlement_analysis() ``` * For all parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File or StringIO/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). - Parameters: * **get\_output\_file** (`Dict`\[`str`, `Sequence`\[`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]) – Return value of DSettlementAnalysis.get\_output\_file. * **get\_sld\_file** (`Sequence`\[`StringIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | `StringIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Return value of DSettlementAnalysis.get\_sld\_file. - Return type: `Callable` <!-- --> ## mock\_DSheetPilingAnalysis[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_DSheetPilingAnalysis "Direct link to mock_DSheetPilingAnalysis") * viktor.testing.mock\_DSheetPilingAnalysis(*get\_output\_file=None*)[](#mock_DSheetPilingAnalysis "Link to this definition") New in v13.5.0 Decorator that can be used to mock [`viktor.external.dsheetpiling.DSheetPilingAnalysis`](https://docs.viktor.ai/sdk/api/external/dsheetpiling/.md#DSheetPilingAnalysis "viktor.external.dsheetpiling.DSheetPilingAnalysis"), to facilitate easier testing. Example: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_DSheetPilingAnalysis(get_output_file={ '.shd': vkt.File.from_path(Path(__file__).parent / 'test_output.shd'), '.shl': vkt.File.from_path(Path(__file__).parent / 'test_output.shl'), '.shs': vkt.File.from_path(Path(__file__).parent / 'test_output.shs'), '.sho': vkt.File.from_path(Path(__file__).parent / 'test_output.sho') }) def test_dsheetpiling_analysis(self): MyEntityTypeController().dsheetpiling_analysis() ``` * For all parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). - Parameters: **get\_output\_file** (`Dict`\[`str`, `Sequence`\[`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]) – Return value of DSheetPilingAnalysis.get\_output\_file. - Return type: `Callable` <!-- --> ## mock\_DStabilityAnalysis[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_DStabilityAnalysis "Direct link to mock_DStabilityAnalysis") * viktor.testing.mock\_DStabilityAnalysis(*get\_output\_file=None*)[](#mock_DStabilityAnalysis "Link to this definition") New in v13.5.0 Decorator that can be used to mock [`viktor.external.dstability.DStabilityAnalysis`](https://docs.viktor.ai/sdk/api/external/dstability/.md#DStabilityAnalysis "viktor.external.dstability.DStabilityAnalysis"), to facilitate easier testing. Example: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_DStabilityAnalysis(get_output_file={ '.stix': vkt.File.from_path(Path(__file__).parent / 'test_output.stix') }) def test_dstability_analysis(self): MyEntityTypeController().dstability_analysis() ``` * For all parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File object (with empty content) is returned each time the corresponding method is called (endlessly). - Parameters: **get\_output\_file** (`Dict`\[`str`, `Sequence`\[[`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]) – Return value of DStabilityAnalysis.get\_output\_file. - Return type: `Callable` <!-- --> ## mock\_DynamoAnalysis[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_DynamoAnalysis "Direct link to mock_DynamoAnalysis") * viktor.testing.mock\_DynamoAnalysis(*get\_output\_file=None*)[](#mock_DynamoAnalysis "Link to this definition") New in 14.17.0 Decorator that can be used to mock [`viktor.external.dynamo.DynamoAnalysis`](https://docs.viktor.ai/sdk/api/external/dynamo/.md#DynamoAnalysis "viktor.external.dynamo.DynamoAnalysis"), to facilitate easier testing. Example: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_DynamoAnalysis(get_output_file={ 'data.out': vkt.File.from_path(Path(__file__).parent / 'data.out'), 'info.log': vkt.File.from_path(Path(__file__).parent / 'info.log') }) def test_dynamo_analysis(self): MyEntityTypeController().dynamo_analysis() ``` * For all parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File or BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). - Parameters: **get\_output\_file** (`Dict`\[`str`, `Sequence`\[`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]) – Return value of DynamoAnalysis.get\_output\_file. - Return type: `Callable` <!-- --> ## mock\_ETABSAnalysis[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_ETABSAnalysis "Direct link to mock_ETABSAnalysis") * viktor.testing.mock\_ETABSAnalysis(*get\_output\_file=None*)[](#mock_ETABSAnalysis "Link to this definition") New in 14.17.0 Decorator that can be used to mock `viktor.external.etabs.ETABSAnalysis`, to facilitate easier testing. Example: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_ETABSAnalysis(get_output_file={ 'data.out': vkt.File.from_path(Path(__file__).parent / 'data.out'), 'info.log': vkt.File.from_path(Path(__file__).parent / 'info.log') }) def test_etabs_analysis(self): MyEntityTypeController().etabs_analysis() ``` * For all parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File object (with empty content) is returned each time the corresponding method is called (endlessly). - Parameters: **get\_output\_file** (`Dict`\[`str`, `Sequence`\[[`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]) – Return value of ETABSAnalysis.get\_output\_file. - Return type: `Callable` <!-- --> ## mock\_ETABSConnection[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_ETABSConnection "Direct link to mock_ETABSConnection") * viktor.testing.mock\_ETABSConnection(*results=None*)[](#mock_ETABSConnection "Link to this definition") New in 14.31.0 Decorator to mock `viktor.external.etabs.connect()` and `viktor.external.etabs.attach()`, to facilitate easier testing. Map each OAPI path to the result it should return: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_ETABSConnection(results={ 'FrameObj.AddByCoord': ['B1', 0], 'FrameObj.GetPoints': ['P1', 'P2', 0], }) def test_build_model(self): MyEntityTypeController().build_model() ``` Paths not in the dict return `[0]`. For a result that depends on the call, pass a function of the OAPI path and its arguments instead: ``` def mocked_etabs_results(path, args): if path == 'FrameObj.GetPoints': return ['P1', 'P2', 0] return [0] class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_ETABSConnection(results=mocked_etabs_results) def test_build_model(self): ... ``` The mock sends calls in chunks like the real connection. A `results` function runs when the mock sends the chunk, not at the call line, and gets plain values for results passed between calls. `batch()` works as in production, with one exception: a result of a `results` function cannot be unpacked inside the block, because the function only runs when the block ends. Unpack it after the block, or use a dict. * Parameters: **results** (`Dict`\[`str`, `list`] | `Callable`\[\[`str`, `list`], `list`]) – a dict mapping each OAPI path to its result, or a `(path, args)` function returning one; `None` (default) returns `[0]` for every call. * Return type: `Callable` <!-- --> ## mock\_Excel[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_Excel "Direct link to mock_Excel") * viktor.testing.mock\_Excel(*get\_named\_cell\_result=None*, *get\_direct\_cell\_result=None*, *get\_filled\_template=None*)[](#mock_Excel "Link to this definition") New in v13.5.0 Decorator that can be used to mock [`viktor.external.excel.Excel`](https://docs.viktor.ai/sdk/api/external/excel/.md#Excel "viktor.external.excel.Excel"), to facilitate easier testing. Example: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_Excel( get_filled_template=vkt.File.from_path(Path(__file__).parent / 'test_model.xlsx'), get_named_cell_result={"cell name": 5.5}, get_direct_cell_result={ ("Sheet1", "A", 5): "cell value", ("Sheet2", "B", 1): 1.4, } ) def test_excel_analysis(self): MyEntityTypeController().excel_analysis() ``` * For all parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File object (with empty content) is returned for the template, whereas None is returned for the cell values, each time the corresponding method is called (endlessly). - Parameters: * **get\_named\_cell\_result** (`Dict`\[`str`, `Sequence`\[`str` | `int` | `float` | `bool`] | `str` | `int` | `float` | `bool`]) – Return value of Excel.get\_named\_cell\_result. * **get\_direct\_cell\_result** (`Dict`\[`Tuple`\[`str`, `str`, `int`], `Sequence`\[`str` | `int` | `float` | `bool`] | `str` | `int` | `float` | `bool`]) – Return value of Excel.get\_direct\_cell\_result. * **get\_filled\_template** (`Sequence`\[[`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Return value of Excel.get\_filled\_template. - Return type: `Callable` <!-- --> ## mock\_GRLWeapAnalysis[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_GRLWeapAnalysis "Direct link to mock_GRLWeapAnalysis") * viktor.testing.mock\_GRLWeapAnalysis(*get\_output\_file=None*)[](#mock_GRLWeapAnalysis "Link to this definition") New in v13.5.0 Decorator that can be used to mock [`viktor.external.grlweap.GRLWeapAnalysis`](https://docs.viktor.ai/sdk/api/external/grlweap/.md#GRLWeapAnalysis "viktor.external.grlweap.GRLWeapAnalysis"), to facilitate easier testing. Example: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_GRLWeapAnalysis( get_output_file=vkt.File.from_path(Path(__file__).parent / 'test_output.GWO') ) def test_grlweap_analysis(self): MyEntityTypeController().grlweap_analysis() ``` * For all parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). - Parameters: **get\_output\_file** (`Sequence`\[`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Return value of GRLWeapAnalysis.get\_output\_file. - Return type: `Callable` <!-- --> ## mock\_GenericAnalysis[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_GenericAnalysis "Direct link to mock_GenericAnalysis") * viktor.testing.mock\_GenericAnalysis(*get\_output\_file=None*)[](#mock_GenericAnalysis "Link to this definition") New in v13.5.0 Decorator that can be used to mock [`viktor.external.generic.GenericAnalysis`](https://docs.viktor.ai/sdk/api/external/generic/.md#GenericAnalysis "viktor.external.generic.GenericAnalysis"), to facilitate easier testing. Example: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_GenericAnalysis(get_output_file={ 'data.out': vkt.File.from_path(Path(__file__).parent / 'data.out'), 'info.log': vkt.File.from_path(Path(__file__).parent / 'info.log') }) def test_generic_analysis(self): MyEntityTypeController().generic_analysis() ``` * For all parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File or BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). - Parameters: **get\_output\_file** (`Dict`\[`str`, `Sequence`\[`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]) – Return value of GenericAnalysis.get\_output\_file. - Return type: `Callable` <!-- --> ## mock\_IdeaRcsAnalysis[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_IdeaRcsAnalysis "Direct link to mock_IdeaRcsAnalysis") * viktor.testing.mock\_IdeaRcsAnalysis(*get\_output\_file=None*, *get\_idea\_rcs\_file=None*)[](#mock_IdeaRcsAnalysis "Link to this definition") New in v13.5.0 Decorator that can be used to mock `viktor.external.idea_rcs.IdeaRcsAnalysis`, to facilitate easier testing. Example: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_IdeaRcsAnalysis( get_output_file=vkt.File.from_path(Path(__file__).parent / 'test_output.xml'), get_idea_rcs_file=vkt.File.from_path(Path(__file__).parent / 'test_rcs.ideaRcs') ) def test_idea_rcs_analysis(self): MyEntityTypeController().idea_rcs_analysis() ``` * For all parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). - Parameters: * **get\_output\_file** (`Sequence`\[`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Return value of IdeaRcsAnalysis.get\_output\_file. * **get\_idea\_rcs\_file** (`Sequence`\[`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Return value of IdeaRcsAnalysis.get\_idea\_rcs\_file. - Return type: `Callable` <!-- --> ## mock\_MatlabAnalysis[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_MatlabAnalysis "Direct link to mock_MatlabAnalysis") * viktor.testing.mock\_MatlabAnalysis(*get\_output\_file=None*)[](#mock_MatlabAnalysis "Link to this definition") New in 14.17.0 Decorator that can be used to mock [`viktor.external.matlab.MatlabAnalysis`](https://docs.viktor.ai/sdk/api/external/matlab/.md#MatlabAnalysis "viktor.external.matlab.MatlabAnalysis"), to facilitate easier testing. Example: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_MatlabAnalysis(get_output_file={ 'data.out': vkt.File.from_path(Path(__file__).parent / 'data.out'), 'info.log': vkt.File.from_path(Path(__file__).parent / 'info.log') }) def test_matlab_analysis(self): MyEntityTypeController().matlab_analysis() ``` * For all parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File or BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). - Parameters: **get\_output\_file** (`Dict`\[`str`, `Sequence`\[`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]) – Return value of MatlabAnalysis.get\_output\_file. - Return type: `Callable` <!-- --> ## mock\_ParamsFromFile[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_ParamsFromFile "Direct link to mock_ParamsFromFile") * viktor.testing.mock\_ParamsFromFile(*controller*)[](#mock_ParamsFromFile "Link to this definition") Decorator that can be used for testing methods decorated with [`viktor.core.ParamsFromFile`](https://docs.viktor.ai/sdk/api/core/.md#ParamsFromFile "viktor.core.ParamsFromFile"). Example: ``` import unittest import viktor as vkt from app.my_entity.controller import MyEntityController class TestMyEntityController(unittest.TestCase): @vkt.testing.mock_ParamsFromFile(MyEntityController) def test_process_file(self): file = vkt.File.from_data("abc") returned_dict = MyEntityController().process_file(file) self.assertDictEqual(returned_dict, {...}) ``` * Parameters: **controller** (`Type`\[[`Controller`](https://docs.viktor.ai/sdk/api/core/.md#Controller "viktor.core.Controller")]) – Controller class on which the ParamsFromFile should be mocked * Return type: `Callable` <!-- --> ## mock\_PlaxisAnalysis[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_PlaxisAnalysis "Direct link to mock_PlaxisAnalysis") * viktor.testing.mock\_PlaxisAnalysis(*get\_output\_file=None*)[](#mock_PlaxisAnalysis "Link to this definition") New in 14.17.0 Decorator that can be used to mock [`viktor.external.plaxis.PlaxisAnalysis`](https://docs.viktor.ai/sdk/api/external/plaxis/.md#PlaxisAnalysis "viktor.external.plaxis.PlaxisAnalysis"), to facilitate easier testing. Example: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_PlaxisAnalysis(get_output_file={ 'data.out': vkt.File.from_path(Path(__file__).parent / 'data.out'), 'info.log': vkt.File.from_path(Path(__file__).parent / 'info.log') }) def test_plaxis_analysis(self): MyEntityTypeController().plaxis_analysis() ``` * For all parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File object (with empty content) is returned each time the corresponding method is called (endlessly). - Parameters: **get\_output\_file** (`Dict`\[`str`, `Sequence`\[[`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]) – Return value of PlaxisAnalysis.get\_output\_file. - Return type: `Callable` <!-- --> ## mock\_PythonAnalysis[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_PythonAnalysis "Direct link to mock_PythonAnalysis") * viktor.testing.mock\_PythonAnalysis(*get\_output\_file=None*)[](#mock_PythonAnalysis "Link to this definition") New in 14.17.0 Decorator that can be used to mock [`viktor.external.python.PythonAnalysis`](https://docs.viktor.ai/sdk/api/external/python/.md#PythonAnalysis "viktor.external.python.PythonAnalysis"), to facilitate easier testing. Example: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_PythonAnalysis(get_output_file={ 'data.out': vkt.File.from_path(Path(__file__).parent / 'data.out'), 'info.log': vkt.File.from_path(Path(__file__).parent / 'info.log') }) def test_python_analysis(self): MyEntityTypeController().python_analysis() ``` * For all parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File object (with empty content) is returned each time the corresponding method is called (endlessly). - Parameters: **get\_output\_file** (`Dict`\[`str`, `Sequence`\[[`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]) – Return value of PythonAnalysis.get\_output\_file. - Return type: `Callable` <!-- --> ## mock\_RFEMAnalysis[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_RFEMAnalysis "Direct link to mock_RFEMAnalysis") * viktor.testing.mock\_RFEMAnalysis(*get\_model=None*, *get\_result=None*)[](#mock_RFEMAnalysis "Link to this definition") New in v13.5.0 Decorator that can be used to mock [`viktor.external.rfem.RFEMAnalysis`](https://docs.viktor.ai/sdk/api/external/rfem/.md#RFEMAnalysis "viktor.external.rfem.RFEMAnalysis"), to facilitate easier testing. Example: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_RFEMAnalysis( get_model=vkt.File.from_path(Path(__file__).parent / 'test_model.rfx') get_result={ 3: vkt.File.from_path(Path(__file__).parent / 'load_case_3.json'), 5: vkt.File.from_path(Path(__file__).parent / 'load_case_5.json') } ) def test_rfem_analysis(self): MyEntityTypeController().rfem_analysis() }) def test_rfem_analysis(self): MyEntityTypeController().rfem_analysis() ``` * For all parameters the following can be provided: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default BytesIO/File object (with empty content) is returned each time the corresponding method is called (endlessly). - Parameters: * **get\_model** (`Sequence`\[`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | `BytesIO`) – Return value of RFEMAnalysis.get\_model. * **get\_result** (`Dict`\[`int`, `Sequence`\[`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | `BytesIO`]) – Return value of RFEMAnalysis.get\_result. - Return type: `Callable` <!-- --> ## mock\_RevitAnalysis[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_RevitAnalysis "Direct link to mock_RevitAnalysis") * viktor.testing.mock\_RevitAnalysis(*get\_output\_file=None*)[](#mock_RevitAnalysis "Link to this definition") New in 14.17.0 Decorator that can be used to mock [`viktor.external.revit.RevitAnalysis`](https://docs.viktor.ai/sdk/api/external/revit/.md#RevitAnalysis "viktor.external.revit.RevitAnalysis"), to facilitate easier testing. Example: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_RevitAnalysis(get_output_file={ 'data.out': vkt.File.from_path(Path(__file__).parent / 'data.out'), 'info.log': vkt.File.from_path(Path(__file__).parent / 'info.log') }) def test_revit_analysis(self): MyEntityTypeController().revit_analysis() ``` * For all parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File object (with empty content) is returned each time the corresponding method is called (endlessly). - Parameters: **get\_output\_file** (`Dict`\[`str`, `Sequence`\[[`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]) – Return value of RevitAnalysis.get\_output\_file. - Return type: `Callable` <!-- --> ## mock\_RobotAnalysis[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_RobotAnalysis "Direct link to mock_RobotAnalysis") * viktor.testing.mock\_RobotAnalysis(*get\_model\_file=None*, *get\_results=None*)[](#mock_RobotAnalysis "Link to this definition") New in v13.5.0 Decorator that can be used to mock [`viktor.external.robot.RobotAnalysis`](https://docs.viktor.ai/sdk/api/external/robot/.md#RobotAnalysis "viktor.external.robot.RobotAnalysis"), to facilitate easier testing. Example: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_RobotAnalysis( get_model_file=vkt.File.from_path(Path(__file__).parent / 'test_model.rtd'), get_results={'bar_forces': {...}, ...} ) def test_robot_analysis(self): MyEntityTypeController().robot_analysis() ``` * For all parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/dict object (with empty content) is returned each time the corresponding method is called (endlessly). - Parameters: * **get\_model\_file** (`Sequence`\[[`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Return value of RobotAnalysis.get\_model\_file. * **get\_results** (`Sequence`\[`dict`] | `dict`) – Return value of RobotAnalysis.get\_results. - Return type: `Callable` <!-- --> ## mock\_SAP2000Analysis[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_SAP2000Analysis "Direct link to mock_SAP2000Analysis") * viktor.testing.mock\_SAP2000Analysis(*get\_output\_file=None*)[](#mock_SAP2000Analysis "Link to this definition") New in 14.17.0 Decorator that can be used to mock `viktor.external.sap2000.SAP2000Analysis`, to facilitate easier testing. Example: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_SAP2000Analysis(get_output_file={ 'data.out': vkt.File.from_path(Path(__file__).parent / 'data.out'), 'info.log': vkt.File.from_path(Path(__file__).parent / 'info.log') }) def test_sap2000_analysis(self): MyEntityTypeController().sap2000_analysis() ``` * For all parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File object (with empty content) is returned each time the corresponding method is called (endlessly). - Parameters: **get\_output\_file** (`Dict`\[`str`, `Sequence`\[[`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]) – Return value of SAP2000Analysis.get\_output\_file. - Return type: `Callable` <!-- --> ## mock\_SAP2000Connection[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_SAP2000Connection "Direct link to mock_SAP2000Connection") * viktor.testing.mock\_SAP2000Connection(*results=None*)[](#mock_SAP2000Connection "Link to this definition") New in 14.32.0 Decorator to mock `viktor.external.sap2000.connect()` and `viktor.external.sap2000.attach()`, to facilitate easier testing. Map each OAPI path to the result it should return: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_SAP2000Connection(results={ 'FrameObj.AddByCoord': ['B1', 0], 'FrameObj.GetPoints': ['P1', 'P2', 0], }) def test_build_model(self): MyEntityTypeController().build_model() ``` Paths not in the dict return `[0]`. For a result that depends on the call, pass a function of the OAPI path and its arguments instead: ``` def mocked_sap2000_results(path, args): if path == 'FrameObj.GetPoints': return ['P1', 'P2', 0] return [0] class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_SAP2000Connection(results=mocked_sap2000_results) def test_build_model(self): ... ``` The mock sends calls in chunks like the real connection. A `results` function runs when the mock sends the chunk, not at the call line, and gets plain values for results passed between calls. `batch()` works as in production, with one exception: a result of a `results` function cannot be unpacked inside the block, because the function only runs when the block ends. Unpack it after the block, or use a dict. * Parameters: **results** (`Dict`\[`str`, `list`] | `Callable`\[\[`str`, `list`], `list`]) – a dict mapping each OAPI path to its result, or a `(path, args)` function returning one; `None` (default) returns `[0]` for every call. * Return type: `Callable` <!-- --> ## mock\_SciaAnalysis[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_SciaAnalysis "Direct link to mock_SciaAnalysis") * viktor.testing.mock\_SciaAnalysis(*get\_engineering\_report=None*, *get\_updated\_esa\_model=None*, *get\_xml\_output\_file=None*)[](#mock_SciaAnalysis "Link to this definition") New in v13.3.0 Decorator that can be used to mock `viktor.external.scia.SciaAnalysis`, to facilitate easier testing. Example: ``` import unittest import viktor as vkt from app.my_entity.controller import MyEntityController class TestMyEntityController(unittest.TestCase): @vkt.testing.mock_SciaAnalysis( get_engineering_report=vkt.File.from_path(Path(__file__).parent / 'test_file.pdf'), get_updated_esa_model=vkt.File.from_path(Path(__file__).parent / 'test_file.esa'), get_xml_output_file=vkt.File.from_path(Path(__file__).parent / 'test_output.xml') ) def test_scia_analysis(self): MyEntityController().scia_analysis() ``` * For all parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly). - Parameters: * **get\_engineering\_report** (`Sequence`\[`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Return value of SciaAnalysis.get\_engineering\_report. * **get\_updated\_esa\_model** (`Sequence`\[`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Return value of SciaAnalysis.get\_updated\_esa\_model. * **get\_xml\_output\_file** (`Sequence`\[`BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Return value of SciaAnalysis.get\_xml\_output\_file. - Return type: `Callable` <!-- --> ## mock\_Storage[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_Storage "Direct link to mock_Storage") * viktor.testing.mock\_Storage(*\**, *get=None*, *list=None*)[](#mock_Storage "Link to this definition") Decorator that can be used for testing methods which invoke the [`viktor.core.Storage`](https://docs.viktor.ai/sdk/api/core/.md#Storage "viktor.core.Storage"). Use the get and list arguments to instruct which file(s) the respective Storage().get(…) and Storage().list(…) methods should return. Example: ``` import unittest import viktor as vkt from app.my_entity.controller import MyEntityController class TestMyEntityController(unittest.TestCase): @vkt.testing.mock_Storage( get=[vkt.File.from_data("abc"), vkt.File.from_data("def")], list=[{'data_key_3': vkt.File.from_data("ghi")}] ) def test_process_analysis_result(self): # Storage().get(...) invoked twice, Storage().list(...) invoked once result = MyEntityController().process_analysis_result() ... ``` * Parameters: * **get** (`Sequence`\[[`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]) – Files to be returned by Storage().get(…). The files are returned in order of the input list. * **list** (`Sequence`\[`Dict`\[`str`, [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]]) – File dicts to be returned by Storage().list(…). The dicts are returned in order of the input list. * Return type: `Callable` <!-- --> ## mock\_TeklaAnalysis[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_TeklaAnalysis "Direct link to mock_TeklaAnalysis") * viktor.testing.mock\_TeklaAnalysis(*get\_output\_file=None*)[](#mock_TeklaAnalysis "Link to this definition") New in 14.17.0 Decorator that can be used to mock [`viktor.external.tekla.TeklaAnalysis`](https://docs.viktor.ai/sdk/api/external/tekla/.md#TeklaAnalysis "viktor.external.tekla.TeklaAnalysis"), to facilitate easier testing. Example: ``` import unittest import viktor as vkt from app.my_entity_type.controller import MyEntityTypeController class TestMyEntityTypeController(unittest.TestCase): @vkt.testing.mock_TeklaAnalysis(get_output_file={ 'data.out': vkt.File.from_path(Path(__file__).parent / 'data.out'), 'info.log': vkt.File.from_path(Path(__file__).parent / 'info.log') }) def test_tekla_analysis(self): MyEntityTypeController().tekla_analysis() ``` * For all parameters the following holds: * If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised. * If a single object is provided, the object is returned each time the corresponding method is called (endlessly). * If None is provided (default), a default File object (with empty content) is returned each time the corresponding method is called (endlessly). - Parameters: **get\_output\_file** (`Dict`\[`str`, `Sequence`\[[`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")] | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")]) – Return value of TeklaAnalysis.get\_output\_file. - Return type: `Callable` <!-- --> ## mock\_View[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_View "Direct link to mock_View") * viktor.testing.mock\_View(*controller*)[](#mock_View "Link to this definition") New in v13.3.0 Decorator that can be used to mock @View decorators (any subclass of [`viktor.views.View`](https://docs.viktor.ai/sdk/api/views/.md#View "viktor.views.View")), to facilitate easier testing of view methods. Example: ``` import unittest import viktor as vkt from app.my_entity.controller import MyEntityController class TestMyEntityController(unittest.TestCase): @vkt.testing.mock_View(MyEntityController) def test_geometry_view(self): params = ... geometry_result = MyEntityController().geometry_view(params=params) self.assertIsInstance(geometry_result.geometry, vkt.TransformableObject) self.assertEqual(geometry_result.labels, ...) ``` * Parameters: **controller** (`Type`\[[`Controller`](https://docs.viktor.ai/sdk/api/core/.md#Controller "viktor.core.Controller")]) – Controller class on which the @View decorator should be mocked * Return type: `Callable` <!-- --> ## mock\_params[​](https://docs.viktor.ai/sdk/api/testing/.md#_mock_params "Direct link to mock_params") * viktor.testing.mock\_params(*params*, *parametrization*, *file\_resources=None*, *entities=None*)[](#mock_params "Link to this definition") Convert a plain dict to the (deserialized) params, replacing FileResource and Entity objects with their mocked counterpart (MockedFileResource, MockedEntity). Can be used to test methods with params in their signature that are called by the VIKTOR platform (e.g. view methods, button methods). Example: ``` import unittest import viktor as vkt from app.my_entity.controller import MyEntityController class TestMyEntityController(unittest.TestCase): def test_button_method(self): // provide the params manually... params_dict = {'number': 1, 'entity': 2, 'file': 3} // or from a JSON file... params_dict = vkt.File.from_path("path to my JSON file") mocked_params = vkt.testing.mock_params( params, MyEntityController.parametrization, entities={2: vkt.testing.MockedEntity(entity_id=2, name="My Entity")} file_resources={3: vkt.testing.MockedFileResource(vkt.File.from_data("content"), "file.txt")}, ) MyEntityController().button_method(mocked_params) ``` Deserialization only affects the raw values associated with the following fields: > * DateField > > * EntityOptionField > > * ChildEntityOptionField > > * SiblingEntityOptionField > > * EntityMultiSelectField > > * ChildEntityMultiSelectField > > * SiblingEntityMultiSelectField > > * GeoPointField > > * GeoPolylineField > > * GeoPolygonField > > * FileField > > * MultiFileField * Parameters: * **params** (`dict` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – Plain dict or JSON file (with serialized params) to be converted to the (deserialized) params. * **parametrization** ([`Parametrization`](https://docs.viktor.ai/sdk/api/parametrization/.md#Parametrization "viktor.parametrization.Parametrization") | `Type`\[[`Parametrization`](https://docs.viktor.ai/sdk/api/parametrization/.md#Parametrization "viktor.parametrization.Parametrization")]) – Parametrization corresponding to the params. * **file\_resources** (`Dict`\[`int`, [`MockedFileResource`](#MockedFileResource "viktor.testing.MockedFileResource")]) – Maps FileResource source id in params to mocked file resource. If source id is not in file\_resources, a default MockedFileResource (with default filename and File) is returned. * **entities** (`Dict`\[`int`, [`MockedEntity`](#MockedEntity "viktor.testing.MockedEntity")]) – Maps entity id in params to mocked entity. If entity id is not in entities, a default MockedEntity is returned. * Return type: `Munch` --- # viktor.utils <!-- --> <!-- --> <!-- --> ## convert\_excel\_to\_pdf[​](https://docs.viktor.ai/sdk/api/utils/.md#_convert_excel_to_pdf "Direct link to convert_excel_to_pdf") * viktor.utils.convert\_excel\_to\_pdf(*file*)[](#convert_excel_to_pdf "Link to this definition") Convert an Excel document to PDF. Example usages: ``` import viktor as vkt # using File object file1 = vkt.File.from_path(Path(__file__).parent / "mydocument.xlsx") with file1.open_binary() as f1: pdf = convert_excel_to_pdf(f1) # using built-in `open()` with open(Path(__file__).parent / "mydocument.xlsx", "rb") as f1: pdf = convert_excel_to_pdf(f1) ``` Note This method needs to be mocked in (automated) unit and integration tests. * Parameters: **file** (`BinaryIO`) – Document to be converted. * Return type: [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") * Returns: File object containing converted document. <!-- --> ## convert\_svg\_to\_pdf[​](https://docs.viktor.ai/sdk/api/utils/.md#_convert_svg_to_pdf "Direct link to convert_svg_to_pdf") * viktor.utils.convert\_svg\_to\_pdf(*file*)[](#convert_svg_to_pdf "Link to this definition") Convert a SVG document to PDF. Example usages: ``` import viktor as vkt # using File object file1 = vkt.File.from_path(Path(__file__).parent / "mydocument.svg") with file1.open_binary() as f1: pdf = convert_svg_to_pdf(f1) # using built-in `open()` with open(Path(__file__).parent / "mydocument.svg", "rb") as f1: pdf = convert_svg_to_pdf(f1) ``` Note This method needs to be mocked in (automated) unit and integration tests. * Parameters: **file** (`BinaryIO`) – Document to be converted. * Return type: [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") * Returns: File object containing converted document. <!-- --> ## convert\_word\_to\_pdf[​](https://docs.viktor.ai/sdk/api/utils/.md#_convert_word_to_pdf "Direct link to convert_word_to_pdf") * viktor.utils.convert\_word\_to\_pdf(*file*)[](#convert_word_to_pdf "Link to this definition") Convert a Word document to PDF. Example usages: ``` import viktor as vkt # using File object file1 = vkt.File.from_path(Path(__file__).parent / "mydocument.docx") with file1.open_binary() as f1: pdf = convert_word_to_pdf(f1) # using built-in `open()` with open(Path(__file__).parent / "mydocument.docx", "rb") as f1: pdf = convert_word_to_pdf(f1) ``` Note This method needs to be mocked in (automated) unit and integration tests. * Parameters: **file** (`BinaryIO`) – Document to be converted. * Return type: [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") * Returns: File object containing converted document. <!-- --> ## memoize[​](https://docs.viktor.ai/sdk/api/utils/.md#_memoize "Direct link to memoize") * viktor.utils.memoize(*fun*)[](#memoize "Link to this definition") Decorator that applies memoization to a function. This can increase performance when the function is called multiple times with identical input. When using multiple decorators, this should be the last decorator. Warning memoized keys will differ depending on parameters being passed as args or kwargs, which can cause a (unexpected) cache miss! For example, f(1, y=2) and f(x=1, y=2) will be treated as two different entries. Prefer to use functions with kwargs only to prevent this. Example: ``` # In this example, a DataView performs a long-running calculation when # calling `func`. When the user changes input in the editor and updates # the view again, `func` will only be evaluated again if either one of # `param_a`, `param_b`, or `param_c` is changed in-between jobs. import viktor as vkt @vkt.memoize def func(*, param_a, param_b, param_c): # perform lengthy calculation return result class Controller(vkt.Controller): ... @vkt.DataView("Results", duration_guess=30) def get_data_view(self, params, **kwargs): ... result = func(param_a=..., param_b=..., param_c=...) ... return vkt.DataResult(...) ``` CAUTION: Only use this function when you are 100% sure of the following: > * The function is a pure function (e.g. @staticmethod) meaning: > > > * It always returns the same result for a given input. [\[1\]](#id5) > > > > * It does not depend on other data and does not have side effects such as API calls or calls to others objects that persist state. [\[2\]](#id6) > > * If part of the returning data contains a modified input, it must not be a problem that the memory reference is lost and a new object is returned. > > * The input of the function is serializable. [\[3\]](#id7) > > * The output of the function is serializable. [\[3\]](#id7) > > * During memoization, tuples in the input are casted to lists before determining uniqueness. > > * During memoization, tuples in the output are casted to lists before returning. > > * In the design of your application you should take into account that the application should not fail in timeouts/unresponsiveness if the memoization does not work. It should be a bonus if it works. > > * The function name is unique within the Python file. \[[1](#id1)] Variables/objects/functions defined outside of the memoized function are not used in the memoized function. \[[2](#id2)] The function should only return results. Any other actions defined in the function are not performed if the function call is memoized. \[3] ([1](#id3),[2](#id4)) ‘Serializable’ in this context means the data is any of the following types: boolean, dictionary, float, int, list, none, string, tuple. Types as returned in the ‘params’ are also allowed (e.g. GeoPoint, FileResource, Color, datetime.date, etc.) with the exception of Entity. When data is nested, the nesting can only contain any of the aforementioned types. Practical uses of this are, but not limited to, function calls with input and output that is relatively small compared to the amount of time required for the evaluation. Cached results are kept for a maximum of 24 hours. Note When using the memoization decorator on your development environment the cache is stored locally. The local storage is limited to 50 function calls. If the limit is exceeded, cached results are cleared based on a first in, first out approach. In production the storage is unlimited. * Parameters: **fun** (`Callable`) – original function * Return type: `Callable` <!-- --> ## merge\_pdf\_files[​](https://docs.viktor.ai/sdk/api/utils/.md#_merge_pdf_files "Direct link to merge_pdf_files") * viktor.utils.merge\_pdf\_files(*\*files*)[](#merge_pdf_files "Link to this definition") This method can be used to merge several PDFs into one document. BinaryIO objects can be directly used as arguments in the method. The merged document is returned as a File object. The order of the input files is preserved in the resulting document. Example usages: ``` import viktor as vkt # using File object file1 = vkt.File.from_path(Path(__file__).parent / "pdf1.pdf") file2 = vkt.File.from_path(Path(__file__).parent / "pdf2.pdf") with file1.open_binary() as f1, file2.open_binary() as f2: merged_pdf = merge_pdf_files(f1, f2) # using built-in `open()` with open(Path(__file__).parent / "pdf1.pdf", "rb") as f1, open(Path(__file__).parent / "pdf2.pdf", "rb") as f2: merged_pdf = merge_pdf_files(f1, f2) ``` Note This method needs to be mocked in (automated) unit and integration tests. * Return type: [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") * Returns: File object containing merged document. <!-- --> ## render\_jinja\_template[​](https://docs.viktor.ai/sdk/api/utils/.md#_render_jinja_template "Direct link to render_jinja_template") * viktor.utils.render\_jinja\_template(*template*, *variables*)[](#render_jinja_template "Link to this definition") Render a template using Jinja. Example usage: ``` with open("path/to/template.jinja", 'rb') as template: result = render_jinja_template(template, {'name': 'John Doe'}) ``` Note This method needs to be mocked in (automated) unit and integration tests. * Parameters: * **template** (`BinaryIO`) – Jinja template file. * **variables** (`dict`) – set of variables to fill the template with. * Return type: [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") * Returns: File object containing the rendered template --- # viktor.views <!-- --> <!-- --> <!-- --> ## AutodeskResult[​](https://docs.viktor.ai/sdk/api/views/.md#_AutodeskResult "Direct link to AutodeskResult") * *class *viktor.views.AutodeskResult(*autodesk\_file*, *\**, *access\_token*)[](#AutodeskResult "Link to this definition") Bases: `_ViewResult` New in v14.25.0 Container with the Autodesk cloud storage file that should be visualized in a AutodeskView. * Parameters: * **autodesk\_file** ([`AutodeskFile`](https://docs.viktor.ai/sdk/api/external/autodesk/.md#AutodeskFile "viktor.external.autodesk.AutodeskFile") | `str`) – Autodesk file to show. Can also pass the URN (unique resource name) of the versioned file on Autodesk cloud storage (of the form “<urn:adsk.wipprod:fs.file:vf.XXX?version=Y>”) directly. * **access\_token** (`str`) – Autodesk cloud storage token to access the file. <!-- --> ## AutodeskView[​](https://docs.viktor.ai/sdk/api/views/.md#_AutodeskView "Direct link to AutodeskView") * *class *viktor.views.AutodeskView(*label*, *duration\_guess=None*, *\**, *description=None*, *update\_label=None*, *visible=True*, *\*\*kwargs*)[](#AutodeskView "Link to this definition") Bases: [`View`](#View "viktor.views.View") New in v14.25.0 A decorator class that configures a controller method to return an Autodesk-specific view, utilizing the Autodesk API for content display. Example usage: ``` @vkt.AutodeskView("Autodesk View") def get_autodesk_view(self, params, **kwargs): integration = vkt.external.OAuth2Integration("autodesk-integration") token = integration.get_access_token() autodesk_file = params.autodesk_file # value of AutodeskFileField if autodesk_file is None: raise vkt.UserError("Please select an Autodesk file") return vkt.AutodeskResult(autodesk_file, access_token=token) ``` * Parameters: * **label** (`str`) – Name which is shown on tab in interface. e.g: ‘3D Representation’ * **duration\_guess** (`int`) – Estimation of view calculation in seconds. This will be used to add a manual refresh button for long-running tasks (larger than 3s). This estimation does not need to be very precise, but the performance will be better if this is close to the real maximum computation time (defaults to 1). * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **update\_label** (`str`) – Name which is shown on the update button in case of a slow view (max. 30 characters). * **visible** (`bool` | `Callable`) – Visibility of the view. Can depend on params by using a callback function New in v14.22.0 <!-- --> ## DataGroup[​](https://docs.viktor.ai/sdk/api/views/.md#_DataGroup "Direct link to DataGroup") * *class *viktor.views.DataGroup(*\*args*, *\*\*kwargs*)[](#DataGroup "Link to this definition") Bases: `dict` Container for DataItems (max. 100). DataItems can be added with or without a keyword argument. Keywords are required when you want to use a DataItem in the summary (for lookup). Example: ``` DataGroup( DataItem('a', 1), DataItem('b', 2), output_c=DataItem('c', 3), # 'output_c' can be used in the entity summary output_d=DataItem('d', 4), # 'output_d' can be used in the entity summary ) ``` **(new in v14.22.0)** Append items to an existing data group using DataGroup.add(): ``` d = DataGroup( DataItem('a', 1), ) d.add(DataItem('b', 2)) d.add(DataItem('c', 3), DataItem('d', 4)) ``` * Parameters: * **args** ([`DataItem`](#DataItem "viktor.views.DataItem")) – DataItem entries. * **kwargs** ([`DataItem`](#DataItem "viktor.views.DataItem")) – Keyworded DataItem entries. * Raises: * AttributeError when more than 100 DataItems are used - add(*\*items*)[](#DataGroup.add "Link to this definition") New in v14.22.0 Add one or more DataItems to an existing DataGroup. * Return type: `None` * *classmethod *from\_data\_groups(*groups*)[](#DataGroup.from_data_groups "Link to this definition") Constructs a combined DataGroup object from a list of individual DataGroup entries. Note that is not possible to have multiple DataGroups that share a specific key for a DataItem, e.g. the following will result in an error: ``` d1 = DataGroup(output_a=DataItem(...)) d2 = DataGroup(output_a=DataItem(...)) d3 = DataGroup.from_data_groups([d1, d2]) # raises KeyError ``` * Return type: [`DataGroup`](#DataGroup "viktor.views.DataGroup") <!-- --> ## DataItem[​](https://docs.viktor.ai/sdk/api/views/.md#_DataItem "Direct link to DataItem") * *class *viktor.views.DataItem(*label*, *value=None*, *subgroup=None*, *\**, *prefix=''*, *suffix=''*, *number\_of\_decimals=None*, *status=DataStatus.INFO*, *status\_message=''*, *explanation\_label=''*)[](#DataItem "Link to this definition") Constructs an entry that can be used as input of a DataGroup, to fill the data view with results. The data view is dynamic, which means that a DataItem itself can consist of another DataGroup as subgroup. Both examples are demonstrated below. Example single entry: ``` result = "I am a great result" item = DataItem('output 1', result) ``` Example subgroup: ``` result = "I am a great result" item = DataItem('output 1', result, subgroup=DataGroup( output11=DataItem('output 1.1', "I can also be a numeric result"), output12=DataItem('output 1.2', 123) )) ``` The prefix / suffix can potentially change with every call. However, when the result is used in the Summary, the prefix / suffix of the DataItem should be equal to the prefix / suffix of the SummaryItem to maintain a consistent database. * Parameters: * **label** (`str`) – Description of the value which is shown. e.g: ‘Uc bending’ * **value** (`str` | `float`) – Value of the data. e.g: 0.9 * **subgroup** ([`DataGroup`](#DataGroup "viktor.views.DataGroup")) – Optional DataItems grouped together in a DataGroup underneath this DataItem. Maximum depth = 3 * **prefix** (`str`) – E.g: €. Should be equal to the prefix of the SummaryItem if linked. * **suffix** (`str`) – E.g: N. Should be equal to the suffix of the SummaryItem if linked. * **number\_of\_decimals** (`int`) – Number of decimals with which the value is rounded for display. * **status** ([`DataStatus`](#DataStatus "viktor.views.DataStatus")) – Status of value. This controls the formatting of the status\_message: * status=DataStatus.INFO: black text * status=DataStatus.SUCCESS: green text * status=DataStatus.WARNING: orange text * status=DataStatus.ERROR: red text * **status\_message** (`str`) – Message which will be shown underneath the value. Color can be formatted with status. * **explanation\_label** (`str`) – Optional text which is placed between the label and the value. Could for instance be used for a calculation. * Raises: **TypeError** – if number\_of\_decimals is used on a non-numeric value. - *property *subgroup*: [DataGroup](#DataGroup "viktor.views.DataGroup")*[](#DataItem.subgroup "Link to this definition") <!-- --> ## DataResult[​](https://docs.viktor.ai/sdk/api/views/.md#_DataResult "Direct link to DataResult") * *class *viktor.views.DataResult(*data*)[](#DataResult "Link to this definition") Bases: `_ViewResult` Container with the data that should be shown in a DataView. This data can be nested up to three levels deep. * Parameters: **data** ([`DataGroup`](#DataGroup "viktor.views.DataGroup")) – Result data. <!-- --> ## DataStatus[​](https://docs.viktor.ai/sdk/api/views/.md#_DataStatus "Direct link to DataStatus") * *class *viktor.views.DataStatus(*\*values*)[](#DataStatus "Link to this definition") Bases: `Enum` Enumeration of statuses to annotate a DataItem. * ERROR*: [`DataStatus`](#DataStatus "viktor.views.DataStatus")** = 'error'*[](#DataStatus.ERROR "Link to this definition") - INFO*: [`DataStatus`](#DataStatus "viktor.views.DataStatus")** = 'info'*[](#DataStatus.INFO "Link to this definition") * SUCCESS*: [`DataStatus`](#DataStatus "viktor.views.DataStatus")** = 'success'*[](#DataStatus.SUCCESS "Link to this definition") - WARNING*: [`DataStatus`](#DataStatus "viktor.views.DataStatus")** = 'warning'*[](#DataStatus.WARNING "Link to this definition") <!-- --> ## DataView[​](https://docs.viktor.ai/sdk/api/views/.md#_DataView "Direct link to DataView") * *class *viktor.views.DataView(*label*, *duration\_guess=None*, *\**, *description=None*, *update\_label=None*, *visible=True*, *\*\*kwargs*)[](#DataView "Link to this definition") Bases: [`View`](#View "viktor.views.View") Function decorator to instruct the controller method to return a data view that contains calculation result. Example usage: ``` @DataView("Cost breakdown") def get_data_view(self, params, **kwargs): # calculate data ... return DataResult(data_group) ``` **(new in v14.15.0)** The ‘duration\_guess’ argument is now optional. * Parameters: * **label** (`str`) – Name which is shown on tab in interface. e.g: ‘3D Representation’ * **duration\_guess** (`int`) – Estimation of view calculation in seconds. This will be used to add a manual refresh button for long-running tasks (larger than 3s). This estimation does not need to be very precise, but the performance will be better if this is close to the real maximum computation time (defaults to 1). * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **update\_label** (`str`) – Name which is shown on the update button in case of a slow view (max. 30 characters). * **visible** (`bool` | `Callable`) – Visibility of the view. Can depend on params by using a callback function New in v14.22.0 <!-- --> ## GeoJSONAndDataResult[​](https://docs.viktor.ai/sdk/api/views/.md#_GeoJSONAndDataResult "Direct link to GeoJSONAndDataResult") * *class *viktor.views.GeoJSONAndDataResult(*geojson*, *data*, *labels=None*, *legend=None*, *\**, *interaction\_groups=None*, *attribution=None*)[](#GeoJSONAndDataResult "Link to this definition") Bases: `_ViewResult` Container with the GeoJSON data and result data that should be visualized in a GeoJSONAndDataView. Optionally a legend and map labels can be included, as well as an attribution text for the data shown on the map. * Parameters: * **geojson** (`dict`) – GeoJSON dictionary. * **data** ([`DataGroup`](#DataGroup "viktor.views.DataGroup")) – Result data. * **labels** (`List`\[[`MapLabel`](#MapLabel "viktor.views.MapLabel")]) – Labels that should be placed on the map. * **legend** ([`MapLegend`](#MapLegend "viktor.views.MapLegend")) – Map legend. * **interaction\_groups** (`Dict`\[`str`, `Sequence`\[`int` | `str` | [`MapFeature`](#MapFeature "viktor.views.MapFeature")]]) – create named groups that can be referred to in a map interaction New in v13.2.0 * **attribution** (`str`) – text appended to the map’s attribution line (bottom-right), e.g. to credit a data source. Plain text (HTML is not interpreted), at most 200 characters. The base map provider attribution is always shown New in v14.37.0 - *property *geojson*: dict*[](#GeoJSONAndDataResult.geojson "Link to this definition") <!-- --> ## GeoJSONAndDataView[​](https://docs.viktor.ai/sdk/api/views/.md#_GeoJSONAndDataView "Direct link to GeoJSONAndDataView") * *class *viktor.views.GeoJSONAndDataView(*label*, *duration\_guess=None*, *\**, *description=None*, *update\_label=None*, *visible=True*, *\*\*kwargs*)[](#GeoJSONAndDataView "Link to this definition") Bases: [`View`](#View "viktor.views.View") Function decorator to instruct the controller method to return a combined view consisting of a GeoJSON and data. Example usage: ``` @vkt.GeoJSONAndDataView("Map / Data") def get_geojson_data_view(self, params, **kwargs): ... return vkt.GeoJSONAndDataResult(...) ``` **(new in v14.15.0)** The ‘duration\_guess’ argument is now optional. * Parameters: * **label** (`str`) – Name which is shown on tab in interface. e.g: ‘3D Representation’ * **duration\_guess** (`int`) – Estimation of view calculation in seconds. This will be used to add a manual refresh button for long-running tasks (larger than 3s). This estimation does not need to be very precise, but the performance will be better if this is close to the real maximum computation time (defaults to 1). * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **update\_label** (`str`) – Name which is shown on the update button in case of a slow view (max. 30 characters). * **visible** (`bool` | `Callable`) – Visibility of the view. Can depend on params by using a callback function New in v14.22.0 <!-- --> ## GeoJSONResult[​](https://docs.viktor.ai/sdk/api/views/.md#_GeoJSONResult "Direct link to GeoJSONResult") * *class *viktor.views.GeoJSONResult(*geojson*, *labels=None*, *legend=None*, *\**, *interaction\_groups=None*, *attribution=None*)[](#GeoJSONResult "Link to this definition") Bases: `_ViewResult` Container with the GeoJSON data that should be visualized in a GeoJSONView. Optionally a legend and map labels can be included, as well as an attribution text for the data shown on the map. The following geojson properties are supported that can be used for styling of the map elements: > * icon (geometry type ‘Point’ only): icon to be shown (default: “pin”). For a complete list of all available markers, see [`MapPoint`](#MapPoint "viktor.views.MapPoint") > > * marker-color: the color of a marker [\[\*\]](#id2) > > * description: text to show when this item is clicked > > * stroke: the color of a line as part of a polygon, polyline, or multigeometry \* > > * fill: the color of the interior of a polygon \* \[[\*](#id1)] color rules: Colors can be in short form “#ace” or long form “#aaccee”, and should contain the # prefix. Colors are interpreted the same as in CSS, in #RRGGBB and #RGB order. To enable interaction, the map feature identifiers can be defined within the geojson dict by adding an “id” attribute to a feature as follows: ``` { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": ..., "geometry": ... "id": "my identifier", ... ``` * Parameters: * **geojson** (`dict`) – GeoJSON dictionary. * **labels** (`List`\[[`MapLabel`](#MapLabel "viktor.views.MapLabel")]) – Labels that should be placed on the map. * **legend** ([`MapLegend`](#MapLegend "viktor.views.MapLegend")) – Map legend. * **interaction\_groups** (`Dict`\[`str`, `Sequence`\[`int` | `str` | [`MapFeature`](#MapFeature "viktor.views.MapFeature")]]) – create named groups that can be referred to in a map interaction New in v13.2.0 * **attribution** (`str`) – text appended to the map’s attribution line (bottom-right), e.g. to credit a data source. Plain text (HTML is not interpreted), at most 200 characters. The base map provider attribution is always shown New in v14.37.0 - *property *geojson*: dict*[](#GeoJSONResult.geojson "Link to this definition") <!-- --> ## GeoJSONView[​](https://docs.viktor.ai/sdk/api/views/.md#_GeoJSONView "Direct link to GeoJSONView") * *class *viktor.views.GeoJSONView(*label*, *duration\_guess=None*, *\**, *description=None*, *update\_label=None*, *visible=True*, *\*\*kwargs*)[](#GeoJSONView "Link to this definition") Bases: [`View`](#View "viktor.views.View") Function decorator to instruct the controller method to return a GeoJSON (geographic data) view. Example usage: ``` @GeoJSONView("Map") def get_geojson_view(self, params, **kwargs): ... return GeoJSONResult(...) ``` **(new in v14.15.0)** The ‘duration\_guess’ argument is now optional. * Parameters: * **label** (`str`) – Name which is shown on tab in interface. e.g: ‘3D Representation’ * **duration\_guess** (`int`) – Estimation of view calculation in seconds. This will be used to add a manual refresh button for long-running tasks (larger than 3s). This estimation does not need to be very precise, but the performance will be better if this is close to the real maximum computation time (defaults to 1). * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **update\_label** (`str`) – Name which is shown on the update button in case of a slow view (max. 30 characters). * **visible** (`bool` | `Callable`) – Visibility of the view. Can depend on params by using a callback function New in v14.22.0 <!-- --> ## GeometryAndDataResult[​](https://docs.viktor.ai/sdk/api/views/.md#_GeometryAndDataResult "Direct link to GeometryAndDataResult") * *class *viktor.views.GeometryAndDataResult(*geometry*, *data*, *labels=None*, *\**, *geometry\_type='gltf'*)[](#GeometryAndDataResult "Link to this definition") Bases: `_ViewResult` Container with the results that should be visualized in a GeometryAndDataView. This consists of three-dimensional geometry object(s) with optional text labels and data. Please have a look at GeometryResult for examples. * Parameters: * **geometry** ([`TransformableObject`](https://docs.viktor.ai/sdk/api/geometry/.md#TransformableObject "viktor.geometry.TransformableObject") | `Sequence`\[[`TransformableObject`](https://docs.viktor.ai/sdk/api/geometry/.md#TransformableObject "viktor.geometry.TransformableObject")] | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | [`FileResource`](https://docs.viktor.ai/sdk/api/api-v1/.md#FileResource "viktor.api_v1.FileResource")) – TransformableObject(s) that contain the geometric objects, or a geometry file such as glTF/GLB (v2.0) (<https://en.wikipedia.org/wiki/GlTF>). * **geometry\_type** (`str`) – Type of loader that should be used to render the geometry (“gltf”, “3dm”) New in v14.4.0 . * **data** ([`DataGroup`](#DataGroup "viktor.views.DataGroup")) – Result data. * **labels** (`List`\[[`Label`](#Label "viktor.views.Label")]) – Text labels that can be used to provide additional information. <!-- --> ## GeometryAndDataView[​](https://docs.viktor.ai/sdk/api/views/.md#_GeometryAndDataView "Direct link to GeometryAndDataView") * *class *viktor.views.GeometryAndDataView(*label*, *duration\_guess=None*, *\**, *description=None*, *update\_label=None*, *view\_mode='3D'*, *default\_shadow=False*, *up\_axis='Z'*, *x\_axis\_to\_right=None*, *visible=True*)[](#GeometryAndDataView "Link to this definition") Bases: [`View`](#View "viktor.views.View") Function decorator to instruct the controller method to return a combined view consisting of geometries and data. Example usage: ``` @GeometryAndDataView("Model / Cost") def get_geometry_data_view(self, params, **kwargs): ... return GeometryAndDataResult(...) ``` **(new in v14.15.0)** The ‘duration\_guess’ argument is now optional. * Parameters: * **label** (`str`) – See [`View`](#View "viktor.views.View"). * **duration\_guess** (`int`) – See [`View`](#View "viktor.views.View"). * **description** (`str`) – See [`View`](#View "viktor.views.View"). * **update\_label** (`str`) – See [`View`](#View "viktor.views.View"). * **view\_mode** (`Literal`\[`'2D'`, `'3D'`]) – Sets the view mode: * ’3D’: Camera is free to move and user can choose between orthographic and perspective view. * ’2D’: Camera is fixed on the xy-plane and view is orthographic. * **default\_shadow** (`bool`) – Show shadow when editor is opened. User can still switch it off. * **up\_axis** (`Literal`\[`'Y'`, `'Z'`]) – (view\_mode=’3D’ only) Upwards pointing axis. Possible options: ‘Y’, ‘Z’ (default: ‘Z’) * **x\_axis\_to\_right** (`bool`) – (view\_mode=’3D’ and up\_axis=’Y’ only) X-axis pointing to the right in the initial view New in v14.8.0 * **visible** (`bool` | `Callable`) – Visibility of the view. Can depend on params by using a callback function New in v14.22.0 <!-- --> ## GeometryResult[​](https://docs.viktor.ai/sdk/api/views/.md#_GeometryResult "Direct link to GeometryResult") * *class *viktor.views.GeometryResult(*geometry*, *labels=None*, *\**, *geometry\_type='gltf'*)[](#GeometryResult "Link to this definition") Bases: `_ViewResult` Container with the results that should be visualized in a GeometryView. This consists of three-dimensional geometry object(s) and optional text labels. To enable a geometric object for interaction, the object must be named using the ‘identifier’ argument. In case of a glTF/GLB-file, the objects name can be provided on the “name” key within a node. If none of the objects in the GeometryResult have a name assigned, default names are assigned to all of them (enabling them for interaction). Note: if there are multiple objects with the same name, a number will automatically be appended to enforce uniqueness. Example viktor.geometry TransformableObject(s): ``` geometry = vkt.Sphere(Point(0, 0), 10, identifier="MySphere") vkt.GeometryResult(geometry) # or [obj1, obj2, ...] in case of multiple objects ``` By specifying the geometry\_type you can render 3D geometry files either by providing a path, URL, or dynamically created (e.g. using trimesh). Currently supported geometry types are: “gltf”, “3dm”. Example static geometry file from path: ``` geometry = vkt.File.from_path(Path(__file__).parent / "my_model.gltf") vkt.GeometryResult(geometry, geometry_type="gltf") ``` Example static geometry file from a URL: ``` geometry = vkt.File.from_url("https://github.com/KhronosGroup/glTF-Sample-Models/tree/main/2.0/CesiumMilkTruck/glTF-Binary/CesiumMilkTruck.glb") vkt.GeometryResult(geometry, geometry_type="gltf") ``` Example from FileField: ``` vkt.GeometryResult(params.my_geometry_file, geometry_type="gltf") ``` Example dynamic geometry file (e.g. using trimesh): ``` sphere = trimesh.creation.uv_sphere(10) scene = trimesh.Scene(geometry={'sphere': sphere}) geometry = vkt.File() with geometry.open_binary() as w: w.write(trimesh.exchange.gltf.export_glb(scene)) vkt.GeometryResult(geometry, geometry_type="gltf") ``` * Parameters: * **geometry** ([`TransformableObject`](https://docs.viktor.ai/sdk/api/geometry/.md#TransformableObject "viktor.geometry.TransformableObject") | `Sequence`\[[`TransformableObject`](https://docs.viktor.ai/sdk/api/geometry/.md#TransformableObject "viktor.geometry.TransformableObject")] | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | [`FileResource`](https://docs.viktor.ai/sdk/api/api-v1/.md#FileResource "viktor.api_v1.FileResource")) – TransformableObject(s) that contain the geometric objects, or a geometry file such as glTF/GLB (v2.0) (<https://en.wikipedia.org/wiki/GlTF>). * **geometry\_type** (`str`) – Type of loader that should be used to render the geometry (“gltf”, “3dm”) New in v14.4.0 . * **labels** (`List`\[[`Label`](#Label "viktor.views.Label")]) – Text labels that can be used to provide additional information. <!-- --> ## GeometryView[​](https://docs.viktor.ai/sdk/api/views/.md#_GeometryView "Direct link to GeometryView") * *class *viktor.views.GeometryView(*label*, *duration\_guess=None*, *\**, *description=None*, *update\_label=None*, *view\_mode='3D'*, *default\_shadow=False*, *up\_axis='Z'*, *x\_axis\_to\_right=None*, *visible=True*)[](#GeometryView "Link to this definition") Bases: [`View`](#View "viktor.views.View") Function decorator to instruct the controller method to return a geometry view (2D / 3D). Example usage: ``` @GeometryView("3D model") def get_geometry_view(self, params, **kwargs): ... return GeometryResult(...) @GeometryView("2D model", view_mode='2D') def get_geometry_view_2d(self, params, **kwargs): ... return GeometryResult(...) ``` **(new in v14.15.0)** The ‘duration\_guess’ argument is now optional. See [`GeometryResult`](#GeometryResult "viktor.views.GeometryResult") for example implementations. * Parameters: * **label** (`str`) – See [`View`](#View "viktor.views.View"). * **duration\_guess** (`int`) – See [`View`](#View "viktor.views.View"). * **description** (`str`) – See [`View`](#View "viktor.views.View"). * **update\_label** (`str`) – See [`View`](#View "viktor.views.View"). * **view\_mode** (`Literal`\[`'2D'`, `'3D'`]) – Sets the view mode: * ’3D’: Camera is free to move and user can choose between orthographic and perspective view. * ’2D’: Camera is fixed on the xy-plane and view is orthographic. * **default\_shadow** (`bool`) – Show shadow when editor is opened. User can still switch it off. * **up\_axis** (`Literal`\[`'Y'`, `'Z'`]) – (view\_mode=’3D’ only) Upwards pointing axis. Possible options: ‘Y’, ‘Z’ (default: ‘Z’) * **x\_axis\_to\_right** (`bool`) – (view\_mode=’3D’ and up\_axis=’Y’ only) X-axis pointing to the right in the initial view New in v14.8.0 * **visible** (`bool` | `Callable`) – Visibility of the view. Can depend on params by using a callback function New in v14.22.0 <!-- --> ## IFCAndDataResult[​](https://docs.viktor.ai/sdk/api/views/.md#_IFCAndDataResult "Direct link to IFCAndDataResult") * *class *viktor.views.IFCAndDataResult(*ifc*, *data*)[](#IFCAndDataResult "Link to this definition") Bases: `_ViewResult` New in v14.6.0 Container with the results that should be visualized in an IFCAndDataView. Please have a look at IFCResult for examples. * Parameters: * **ifc** ([`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | [`FileResource`](https://docs.viktor.ai/sdk/api/api-v1/.md#FileResource "viktor.api_v1.FileResource")) – IFC geometry file. * **data** ([`DataGroup`](#DataGroup "viktor.views.DataGroup")) – Result data. <!-- --> ## IFCAndDataView[​](https://docs.viktor.ai/sdk/api/views/.md#_IFCAndDataView "Direct link to IFCAndDataView") * *class *viktor.views.IFCAndDataView(*label*, *duration\_guess=None*, *\**, *description=None*, *update\_label=None*, *visible=True*, *\*\*kwargs*)[](#IFCAndDataView "Link to this definition") Bases: [`View`](#View "viktor.views.View") New in v14.6.0 Function decorator to instruct the controller method to return a combined view consisting of an IFCView and a DataView. Example usage: ``` @IFCAndDataView("IFC and data view") def get_ifc_and_data_view(self, params, **kwargs): ifc = File.from_path(Path(__file__).parent / 'sample.ifc') data = ... return IFCAndDataResult(ifc, data) ``` **(new in v14.15.0)** The ‘duration\_guess’ argument is now optional. * Parameters: * **label** (`str`) – Name which is shown on tab in interface. e.g: ‘3D Representation’ * **duration\_guess** (`int`) – Estimation of view calculation in seconds. This will be used to add a manual refresh button for long-running tasks (larger than 3s). This estimation does not need to be very precise, but the performance will be better if this is close to the real maximum computation time (defaults to 1). * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **update\_label** (`str`) – Name which is shown on the update button in case of a slow view (max. 30 characters). * **visible** (`bool` | `Callable`) – Visibility of the view. Can depend on params by using a callback function New in v14.22.0 <!-- --> ## IFCResult[​](https://docs.viktor.ai/sdk/api/views/.md#_IFCResult "Direct link to IFCResult") * *class *viktor.views.IFCResult(*ifc*)[](#IFCResult "Link to this definition") Bases: `_ViewResult` New in v14.6.0 IFC to be visualized in an IFCView. Example static geometry file from path: ``` ifc = File.from_path(Path(__file__).parent / 'sample.ifc') IFCResult(ifc) ``` Example static geometry file from a URL: ``` ifc = File.from_url("https://github.com/IFCjs/test-ifc-files/raw/main/Others/haus.ifc") IFCResult(ifc) ``` **(new in v14.6.1)** In order to improve performance it is possible to use the value of a FileField (i.e. FileResource) directly: ``` IFCResult(params.file_field) ``` * Parameters: **ifc** ([`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | [`FileResource`](https://docs.viktor.ai/sdk/api/api-v1/.md#FileResource "viktor.api_v1.FileResource")) – IFC geometry file. <!-- --> ## IFCView[​](https://docs.viktor.ai/sdk/api/views/.md#_IFCView "Direct link to IFCView") * *class *viktor.views.IFCView(*label*, *duration\_guess=None*, *\**, *description=None*, *update\_label=None*, *visible=True*, *\*\*kwargs*)[](#IFCView "Link to this definition") Bases: [`View`](#View "viktor.views.View") New in v14.6.0 Function decorator to instruct the controller method to return an IFCView. Example usage: ``` @IFCView("IFC view") def get_ifc_view(self, params, **kwargs): ifc = File.from_path(Path(__file__).parent / 'sample.ifc') return IFCResult(ifc) ``` **(new in v14.15.0)** The ‘duration\_guess’ argument is now optional. * Parameters: * **label** (`str`) – Name which is shown on tab in interface. e.g: ‘3D Representation’ * **duration\_guess** (`int`) – Estimation of view calculation in seconds. This will be used to add a manual refresh button for long-running tasks (larger than 3s). This estimation does not need to be very precise, but the performance will be better if this is close to the real maximum computation time (defaults to 1). * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **update\_label** (`str`) – Name which is shown on the update button in case of a slow view (max. 30 characters). * **visible** (`bool` | `Callable`) – Visibility of the view. Can depend on params by using a callback function New in v14.22.0 <!-- --> ## ImageAndDataResult[​](https://docs.viktor.ai/sdk/api/views/.md#_ImageAndDataResult "Direct link to ImageAndDataResult") * *class *viktor.views.ImageAndDataResult(*image*, *data*)[](#ImageAndDataResult "Link to this definition") Bases: `_ViewResult` New in v13.7.0 Container with the image and result data that should be visualized in a ImageAndDataView. Supported image types are ‘svg’, ‘jpeg’, ‘png’, ‘gif’. * Parameters: * **image** (`StringIO` | `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File")) – image file. * **data** ([`DataGroup`](#DataGroup "viktor.views.DataGroup")) – Result data. <!-- --> ## ImageAndDataView[​](https://docs.viktor.ai/sdk/api/views/.md#_ImageAndDataView "Direct link to ImageAndDataView") * *class *viktor.views.ImageAndDataView(*label*, *duration\_guess=None*, *\**, *description=None*, *update\_label=None*, *visible=True*, *\*\*kwargs*)[](#ImageAndDataView "Link to this definition") Bases: [`View`](#View "viktor.views.View") New in v13.7.0 Function decorator to instruct the controller method to return a combined view consisting of an image and data. Supported image types are ‘svg’, ‘jpeg’, ‘png’, ‘gif’. Example usage: ``` @vkt.ImageAndDataView("Image View") def get_image_data_view(self, params, **kwargs): ... return vkt.ImageAndDataResult(image, data_group) ``` **(new in v14.15.0)** The ‘duration\_guess’ argument is now optional. * Parameters: * **label** (`str`) – Name which is shown on tab in interface. e.g: ‘3D Representation’ * **duration\_guess** (`int`) – Estimation of view calculation in seconds. This will be used to add a manual refresh button for long-running tasks (larger than 3s). This estimation does not need to be very precise, but the performance will be better if this is close to the real maximum computation time (defaults to 1). * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **update\_label** (`str`) – Name which is shown on the update button in case of a slow view (max. 30 characters). * **visible** (`bool` | `Callable`) – Visibility of the view. Can depend on params by using a callback function New in v14.22.0 <!-- --> ## ImageResult[​](https://docs.viktor.ai/sdk/api/views/.md#_ImageResult "Direct link to ImageResult") * *class *viktor.views.ImageResult(*image*)[](#ImageResult "Link to this definition") Bases: `_ViewResult` New in v13.7.0 Image to be visualized in an ImageView. Supported image types are ‘svg’, ‘jpeg’, ‘png’, ‘gif’. Example from FileField: ``` vkt.ImageResult(params.my_image_file) ``` * Parameters: **image** (`StringIO` | `BytesIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | [`FileResource`](https://docs.viktor.ai/sdk/api/api-v1/.md#FileResource "viktor.api_v1.FileResource")) – image file. - *classmethod *from\_path(*file\_path*)[](#ImageResult.from_path "Link to this definition") Use file path to construct the image result. * Parameters: **file\_path** (`str` | `bytes` | `PathLike`) – Path to the image. * Return type: [`ImageResult`](#ImageResult "viktor.views.ImageResult") <!-- --> ## ImageView[​](https://docs.viktor.ai/sdk/api/views/.md#_ImageView "Direct link to ImageView") * *class *viktor.views.ImageView(*label*, *duration\_guess=None*, *\**, *description=None*, *update\_label=None*, *visible=True*, *\*\*kwargs*)[](#ImageView "Link to this definition") Bases: [`View`](#View "viktor.views.View") New in v13.7.0 Function decorator to instruct the controller method to return an ImageView. Supported image types are ‘svg’, ‘jpeg’, ‘png’, ‘gif’. Example usage: ``` @vkt.ImageView("Image View") def get_image_view(self, params, **kwargs): file_path = Path(__file__).parent / 'sample.png' return vkt.ImageResult(File.from_path(file_path)) # or `vkt.ImageResult.from_path(file_path)` ``` **(new in v14.15.0)** The ‘duration\_guess’ argument is now optional. * Parameters: * **label** (`str`) – Name which is shown on tab in interface. e.g: ‘3D Representation’ * **duration\_guess** (`int`) – Estimation of view calculation in seconds. This will be used to add a manual refresh button for long-running tasks (larger than 3s). This estimation does not need to be very precise, but the performance will be better if this is close to the real maximum computation time (defaults to 1). * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **update\_label** (`str`) – Name which is shown on the update button in case of a slow view (max. 30 characters). * **visible** (`bool` | `Callable`) – Visibility of the view. Can depend on params by using a callback function New in v14.22.0 <!-- --> ## InteractionEvent[​](https://docs.viktor.ai/sdk/api/views/.md#_InteractionEvent "Direct link to InteractionEvent") * *class *viktor.views.InteractionEvent(*event\_type*, *value*)[](#InteractionEvent "Link to this definition") Event triggered by the user as a consequence of an [`viktor.parametrization.Interaction`](https://docs.viktor.ai/sdk/api/parametrization/.md#Interaction "viktor.parametrization.Interaction"). Warning Do not instantiate this class directly, it is returned as ‘event’ in the method of the button with the corresponding interaction. * Parameters: * **event\_type** (`str`) – type of the event (‘map\_select’) * **value** (`Any`) – value of the user performed interaction. Type depends on event\_type: * map\_select: List\[Union\[str, int]] = identifier of selected features <!-- --> ## Label[​](https://docs.viktor.ai/sdk/api/views/.md#_Label "Direct link to Label") * *class *viktor.views.Label(*point*, *\*text*, *size\_factor=1*, *color=(0, 0, 0)*)[](#Label "Link to this definition") Text label * Parameters: * **point** ([`Point`](https://docs.viktor.ai/sdk/api/geometry/.md#Point "viktor.geometry.Point")) – Position of the label. * **text** (`str`) – Text to show; multiple text arguments will each be shown on a new line. * **size\_factor** (`float`) – Factor to be applied to the font size (0 < size\_factor <= 10). * **color** ([`Color`](https://docs.viktor.ai/sdk/api/core/.md#Color "viktor.core.Color")) – Color of the text. - *property *point*: [Point](https://docs.viktor.ai/sdk/api/geometry/.md#Point "viktor.geometry.Point")*[](#Label.point "Link to this definition") * serialize()[](#Label.serialize "Link to this definition") * Return type: `dict` - *property *text*: str | Tuple\[str, ...]*[](#Label.text "Link to this definition") <!-- --> ## MapAndDataResult[​](https://docs.viktor.ai/sdk/api/views/.md#_MapAndDataResult "Direct link to MapAndDataResult") * *class *viktor.views.MapAndDataResult(*features*, *data*, *labels=None*, *legend=None*, *\**, *interaction\_groups=None*, *attribution=None*)[](#MapAndDataResult "Link to this definition") Bases: [`GeoJSONAndDataResult`](#GeoJSONAndDataResult "viktor.views.GeoJSONAndDataResult") Container with the Map data and result data that should be visualized in a MapAndDataView. Optionally a legend and map labels can be included, as well as an attribution text for the data shown on the map. * Parameters: * **features** (`List`\[[`MapFeature`](#MapFeature "viktor.views.MapFeature")]) – List that contains the map objects. * **data** ([`DataGroup`](#DataGroup "viktor.views.DataGroup")) – Result data. * **labels** (`List`\[[`MapLabel`](#MapLabel "viktor.views.MapLabel")]) – Labels that should be placed on the map. * **legend** ([`MapLegend`](#MapLegend "viktor.views.MapLegend")) – Map legend. * **interaction\_groups** (`Dict`\[`str`, `Sequence`\[`int` | `str` | [`MapFeature`](#MapFeature "viktor.views.MapFeature")]]) – create named groups that can be referred to in a map interaction New in v13.2.0 * **attribution** (`str`) – text appended to the map’s attribution line (bottom-right), e.g. to credit a data source. Plain text (HTML is not interpreted), at most 200 characters. The base map provider attribution is always shown New in v14.37.0 - *property *features*: List\[[MapFeature](#MapFeature "viktor.views.MapFeature")]*[](#MapAndDataResult.features "Link to this definition") * *property *geojson*: dict*[](#MapAndDataResult.geojson "Link to this definition") <!-- --> ## MapAndDataView[​](https://docs.viktor.ai/sdk/api/views/.md#_MapAndDataView "Direct link to MapAndDataView") * *class *viktor.views.MapAndDataView(*label*, *duration\_guess=None*, *\**, *description=None*, *update\_label=None*, *visible=True*, *\*\*kwargs*)[](#MapAndDataView "Link to this definition") Bases: [`View`](#View "viktor.views.View") Function decorator to instruct the controller method to return a combined view consisting of a Map and data. Example usage: ``` @vkt.MapAndDataView("Map / Data") def get_map_data_view(self, params, **kwargs): ... return vkt.MapAndDataResult(...) ``` **(new in v14.15.0)** The ‘duration\_guess’ argument is now optional. * Parameters: * **label** (`str`) – Name which is shown on tab in interface. e.g: ‘3D Representation’ * **duration\_guess** (`int`) – Estimation of view calculation in seconds. This will be used to add a manual refresh button for long-running tasks (larger than 3s). This estimation does not need to be very precise, but the performance will be better if this is close to the real maximum computation time (defaults to 1). * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **update\_label** (`str`) – Name which is shown on the update button in case of a slow view (max. 30 characters). * **visible** (`bool` | `Callable`) – Visibility of the view. Can depend on params by using a callback function New in v14.22.0 <!-- --> ## MapCircle[​](https://docs.viktor.ai/sdk/api/views/.md#_MapCircle "Direct link to MapCircle") * *class *viktor.views.MapCircle(*center*, *radius*, *\**, *num\_edges=64*, *fill\_opacity=None*, *stroke\_opacity=None*, *stroke\_width=None*, *dash\_size=None*, *gap\_size=None*, *\*\*kwargs*)[](#MapCircle "Link to this definition") Bases: [`MapFeature`](#MapFeature "viktor.views.MapFeature") New in v14.22.0 Represents a circular polygon on the Earth’s surface formed by a latitude/longitude coordinate and radius \[m]. Example usage: ``` circle = MapCircle( center=MapPoint(52.373922404495474, 5.2459716796875), radius=500 ) ``` * Parameters: * **center** ([`MapPoint`](#MapPoint "viktor.views.MapPoint")) – Center point of the circle. * **radius** (`float`) – Radius in \[m]. * **num\_edges** (`int`) – Number of polygon edges. * **fill\_opacity** (`float`) – opacity of the interior, between 0.0 and 1.0 New in v14.30.0 . * **stroke\_opacity** (`float`) – opacity of the border, between 0.0 and 1.0 New in v14.30.0 . * **stroke\_width** (`float`) – width of the border, greater than or equal to 0 New in v14.30.0 . * **dash\_size** (`float`) – size of the dashes of a dashed border, relative to the width of the path New in v14.30.0 . * **gap\_size** (`float`) – size of the gaps of a dashed border, relative to the width of the path New in v14.30.0 . * **kwargs** (`Any`) – See [`MapFeature`](#MapFeature "viktor.views.MapFeature") for possible kwargs. <!-- --> ## MapEntityLink[​](https://docs.viktor.ai/sdk/api/views/.md#_MapEntityLink "Direct link to MapEntityLink") * *class *viktor.views.MapEntityLink(*label*, *entity\_id*)[](#MapEntityLink "Link to this definition") Represents a link between a feature in a MapView and a specific entity. Example usage: ``` gef_link = MapEntityLink('GEF x', gef_entity_id) gef_marker = MapPoint(51.99311570849245, 4.385752379894256, entity_links=[gef_link]) ``` * Parameters: * **label** (`str`) – text which is shown to the user. * **entity\_id** (`int`) – id of the linked entity. <!-- --> ## MapFeature[​](https://docs.viktor.ai/sdk/api/views/.md#_MapFeature "Direct link to MapFeature") * *class *viktor.views.MapFeature(*\**, *title=None*, *description=None*, *color=(39, 45, 51)*, *entity\_links=None*, *identifier=None*)[](#MapFeature "Link to this definition") Bases: `ABC` Base class for features that can be shown in a MapView. See the documentation of the subclasses for example implementations. * Parameters: * **title** (`str`) – Title of a clickable map feature. * **description** (`str`) – Description of a clickable map feature. * **color** ([`Color`](https://docs.viktor.ai/sdk/api/core/.md#Color "viktor.core.Color")) – Specifies the color of the map feature. * **entity\_links** (`List`\[[`MapEntityLink`](#MapEntityLink "viktor.views.MapEntityLink")]) – When clicking on the map feature, links towards multiple entities can be shown. * **identifier** (`int` | `str`) – feature identifier New in v13.2.0 <!-- --> ## MapLabel[​](https://docs.viktor.ai/sdk/api/views/.md#_MapLabel "Direct link to MapLabel") * *class *viktor.views.MapLabel(*lat*, *lon*, *text*, *scale*, *\**, *fixed\_size=False*)[](#MapLabel "Link to this definition") Text which is placed as an overlay on the map. Scale 0-5 is approximately the scale for countries: [![/\_images/map\_label\_scale\_0\_5.png](/_images/map_label_scale_0_5.png)](https://docs.viktor.ai/_images/map_label_scale_0_5.png) Scale 6-10 is approximately the scale for cities: [![/\_images/map\_label\_scale\_6\_11.png](/_images/map_label_scale_6_11.png)](https://docs.viktor.ai/_images/map_label_scale_6_11.png) Scale 11-15 is approximately the scale for neighborhoods and streets [![/\_images/map\_label\_scale\_11\_15.png](/_images/map_label_scale_11_15.png)](https://docs.viktor.ai/_images/map_label_scale_11_15.png) Scale 16-18 is approximately for individual houses. [![/\_images/map\_label\_scale\_14\_19.png](/_images/map_label_scale_14_19.png)](https://docs.viktor.ai/_images/map_label_scale_14_19.png) * Parameters: * **lat** (`float`) – Latitude of text in degrees. * **lon** (`float`) – Longitude of text in degrees. * **text** (`str`) – Text with is displayed on the map. * **scale** (`float`) – Size of the text on an exponential scale. See example in class docstring for estimate. * **fixed\_size** (`bool`) – When True, the size of the text is fixed regardless of zoom level (default: False). <!-- --> ## MapLegend[​](https://docs.viktor.ai/sdk/api/views/.md#_MapLegend "Direct link to MapLegend") * *class *viktor.views.MapLegend(*entries*)[](#MapLegend "Link to this definition") A legend which is placed as an overlay on a map view. Example usage: ``` legend = MapLegend([ (Color.from_hex('#0016FF'), "I'm blue"), (Color.from_hex('#FF0000'), "I'm red"), ... ]) ``` * Parameters: **entries** (`List`\[`Tuple`\[[`Color`](https://docs.viktor.ai/sdk/api/core/.md#Color "viktor.core.Color"), `str`]]) – Items in the legend, defined by color and label. <!-- --> ## MapLine[​](https://docs.viktor.ai/sdk/api/views/.md#_MapLine "Direct link to MapLine") * *class *viktor.views.MapLine(*start\_point*, *end\_point*, *\*\*kwargs*)[](#MapLine "Link to this definition") Bases: [`MapPolyline`](#MapPolyline "viktor.views.MapPolyline") Represents a line on the earth’s surface between two latitude/longitude pairs. In case multiple line segments are to be created, a [`MapPolyline`](#MapPolyline "viktor.views.MapPolyline") may be preferred. Example usage: ``` line = MapLine( MapPoint(51.99311570849245, 4.385752379894256), MapPoint(52.40912125231122, 5.031738281255681) ) ``` * Parameters: * **start\_point** ([`MapPoint`](#MapPoint "viktor.views.MapPoint")) – Map point with latitude and longitude pair. * **end\_point** ([`MapPoint`](#MapPoint "viktor.views.MapPoint")) – Map point with latitude and longitude pair. * **kwargs** (`Any`) – See [`MapPolyline`](#MapPolyline "viktor.views.MapPolyline") and [`MapFeature`](#MapFeature "viktor.views.MapFeature") for possible kwargs. - *property *end\_point*: [MapPoint](#MapPoint "viktor.views.MapPoint")*[](#MapLine.end_point "Link to this definition") * *property *start\_point*: [MapPoint](#MapPoint "viktor.views.MapPoint")*[](#MapLine.start_point "Link to this definition") <!-- --> ## MapPoint[​](https://docs.viktor.ai/sdk/api/views/.md#_MapPoint "Direct link to MapPoint") * *class *viktor.views.MapPoint(*lat*, *lon*, *alt=0*, *\**, *icon=None*, *size='medium'*, *\*\*kwargs*)[](#MapPoint "Link to this definition") Bases: [`MapFeature`](#MapFeature "viktor.views.MapFeature") Represents a point on the Earth’s surface described by a latitude/longitude coordinate pair. Example usage: ``` marker = MapPoint(51.99311570849245, 4.385752379894256) ``` * Parameters: * **lat** (`float`) – Latitude. * **lon** (`float`) – Longitude. * **alt** (`float`) – Altitude. * **icon** (`str`) – icon to be shown (default: “pin”). See below for all possible icons. * **size** (`Literal`\[`'small'`, `'medium'`, `'large'`]) – size of the marker (“small” | “medium” | “large”) New in v14.5.0 . * **kwargs** (`Any`) – See [`MapFeature`](#MapFeature "viktor.views.MapFeature") for possible kwargs. List of icons: > * arrow-down: [![arrow-down](/_images/arrow-down.svg)](https://docs.viktor.ai/_images/arrow-down.svg) > > * arrow-left: [![arrow-left](/_images/arrow-left.svg)](https://docs.viktor.ai/_images/arrow-left.svg) > > * arrow-right: [![arrow-right](/_images/arrow-right.svg)](https://docs.viktor.ai/_images/arrow-right.svg) > > * arrow-up: [![arrow-up](/_images/arrow-up.svg)](https://docs.viktor.ai/_images/arrow-up.svg) > > * chevron-down: [![chevron-down](/_images/chevron-down.svg)](https://docs.viktor.ai/_images/chevron-down.svg) > > * chevron-left: [![chevron-left](/_images/chevron-left.svg)](https://docs.viktor.ai/_images/chevron-left.svg) > > * chevron-right: [![chevron-right](/_images/chevron-right.svg)](https://docs.viktor.ai/_images/chevron-right.svg) > > * chevron-up: [![chevron-up](/_images/chevron-up.svg)](https://docs.viktor.ai/_images/chevron-up.svg) > > * circle: [![circle](/_images/circle.svg)](https://docs.viktor.ai/_images/circle.svg) > > * circle-filled: [![circle-filled](/_images/circle-filled.svg)](https://docs.viktor.ai/_images/circle-filled.svg) > > * cross: [![cross](/_images/cross.svg)](https://docs.viktor.ai/_images/cross.svg) > > * diamond: [![diamond](/_images/diamond.svg)](https://docs.viktor.ai/_images/diamond.svg) > > * diamond-horizontal: [![diamond-horizontal](/_images/diamond-horizontal.svg)](https://docs.viktor.ai/_images/diamond-horizontal.svg) > > * drop: [![drop](/_images/drop.svg)](https://docs.viktor.ai/_images/drop.svg) > > * exclamation-circle: [![exclamation-circle](/_images/exclamation-circle.svg)](https://docs.viktor.ai/_images/exclamation-circle.svg) > > * exclamation-circle-filled: [![exclamation-circle-filled](/_images/exclamation-circle-filled.svg)](https://docs.viktor.ai/_images/exclamation-circle-filled.svg) > > * message: [![message](/_images/message.svg)](https://docs.viktor.ai/_images/message.svg) > > * minus: [![minus](/_images/minus.svg)](https://docs.viktor.ai/_images/minus.svg) > > * minus-circle: [![minus-circle](/_images/minus-circle.svg)](https://docs.viktor.ai/_images/minus-circle.svg) > > * minus-circle-filled: [![minus-circle-filled](/_images/minus-circle-filled.svg)](https://docs.viktor.ai/_images/minus-circle-filled.svg) > > * pin: [![pin](/_images/pin.svg)](https://docs.viktor.ai/_images/pin.svg) > > * pin-add: [![pin-add](/_images/pin-add.svg)](https://docs.viktor.ai/_images/pin-add.svg) > > * pin-edit: [![pin-edit](/_images/pin-edit.svg)](https://docs.viktor.ai/_images/pin-edit.svg) > > * plus: [![plus](/_images/plus.svg)](https://docs.viktor.ai/_images/plus.svg) > > * plus-circle: [![plus-circle](/_images/plus-circle.svg)](https://docs.viktor.ai/_images/plus-circle.svg) > > * plus-circle-filled: [![plus-circle-filled](/_images/plus-circle-filled.svg)](https://docs.viktor.ai/_images/plus-circle-filled.svg) > > * plus-thick: [![plus-thick](/_images/plus-thick.svg)](https://docs.viktor.ai/_images/plus-thick.svg) > > * question-circle: [![question-circle](/_images/question-circle.svg)](https://docs.viktor.ai/_images/question-circle.svg) > > * question-circle-filled: [![question-circle-filled](/_images/question-circle-filled.svg)](https://docs.viktor.ai/_images/question-circle-filled.svg) > > * square: [![square](/_images/square.svg)](https://docs.viktor.ai/_images/square.svg) > > * square-filled: [![square-filled](/_images/square-filled.svg)](https://docs.viktor.ai/_images/square-filled.svg) > > * star: [![star](/_images/star.svg)](https://docs.viktor.ai/_images/star.svg) > > * triangle: [![triangle](/_images/triangle.svg)](https://docs.viktor.ai/_images/triangle.svg) > > * triangle-down: [![triangle-down](/_images/triangle-down.svg)](https://docs.viktor.ai/_images/triangle-down.svg) > > * triangle-down-filled: [![triangle-down-filled](/_images/triangle-down-filled.svg)](https://docs.viktor.ai/_images/triangle-down-filled.svg) > > * triangle-filled: [![triangle-filled](/_images/triangle-filled.svg)](https://docs.viktor.ai/_images/triangle-filled.svg) > > * triangle-left: [![triangle-left](/_images/triangle-left.svg)](https://docs.viktor.ai/_images/triangle-left.svg) > > * triangle-left-filled: [![triangle-left-filled](/_images/triangle-left-filled.svg)](https://docs.viktor.ai/_images/triangle-left-filled.svg) > > * triangle-right: [![triangle-right](/_images/triangle-right.svg)](https://docs.viktor.ai/_images/triangle-right.svg) > > * triangle-right-filled: [![triangle-right-filled](/_images/triangle-right-filled.svg)](https://docs.viktor.ai/_images/triangle-right-filled.svg) > > * viktor: [![viktor](/_images/viktor.svg)](https://docs.viktor.ai/_images/viktor.svg) > > * warning: [![warning](/_images/warning.svg)](https://docs.viktor.ai/_images/warning.svg) > > * warning-filled: [![warning-filled](/_images/warning-filled.svg)](https://docs.viktor.ai/_images/warning-filled.svg) > > * wye: [![wye](/_images/wye.svg)](https://docs.viktor.ai/_images/wye.svg) * *property *alt*: float*[](#MapPoint.alt "Link to this definition") - *classmethod *from\_geo\_point(*point*, *\**, *icon=None*, *size='medium'*, *\*\*kwargs*)[](#MapPoint.from_geo_point "Link to this definition") Instantiates a MapPoint from the provided GeoPoint. * Parameters: * **point** ([`GeoPoint`](https://docs.viktor.ai/sdk/api/geometry/.md#GeoPoint "viktor.geometry.GeoPoint")) – GeoPoint. * **icon** (`str`) – icon to be shown (default: “pin”). For a complete list of all available markers, see `__init__()` * **size** (`Literal`\[`'small'`, `'medium'`, `'large'`]) – size of the marker (“small” | “medium” | “large”) New in v14.5.0 . * **kwargs** (`Any`) – See [`MapFeature`](#MapFeature "viktor.views.MapFeature") for possible kwargs. * Return type: [`MapPoint`](#MapPoint "viktor.views.MapPoint") * *property *lat*: float*[](#MapPoint.lat "Link to this definition") - *property *lon*: float*[](#MapPoint.lon "Link to this definition") <!-- --> ## MapPolygon[​](https://docs.viktor.ai/sdk/api/views/.md#_MapPolygon "Direct link to MapPolygon") * *class *viktor.views.MapPolygon(*points*, *\**, *holes=None*, *fill\_opacity=None*, *stroke\_opacity=None*, *stroke\_width=None*, *dash\_size=None*, *gap\_size=None*, *\*\*kwargs*)[](#MapPolygon "Link to this definition") Bases: [`MapFeature`](#MapFeature "viktor.views.MapFeature") Represents a polygon on the earth’s surface formed by a set of latitude/longitude pairs. Example usage: ``` polygon = MapPolygon([ MapPoint(52.373922404495474, 5.2459716796875), MapPoint(52.10313118589299, 5.3997802734375), MapPoint(52.373922404495474, 5.57281494140625), ]) ``` * Parameters: * **points** (`List`\[[`MapPoint`](#MapPoint "viktor.views.MapPoint")]) – Map points with latitude and longitude pair. The profile is automatically closed, so it is not necessary to add the start point at the end. * **holes** (`List`\[[`MapPolygon`](#MapPolygon "viktor.views.MapPolygon")]) – List of interior polygons which form holes in the exterior polygon. * **fill\_opacity** (`float`) – opacity of the interior, between 0.0 and 1.0 New in v14.30.0 . * **stroke\_opacity** (`float`) – opacity of the border, between 0.0 and 1.0 New in v14.30.0 . * **stroke\_width** (`float`) – width of the border, greater than or equal to 0 New in v14.30.0 . * **dash\_size** (`float`) – size of the dashes of a dashed border, relative to the width of the path New in v14.30.0 . * **gap\_size** (`float`) – size of the gaps of a dashed border, relative to the width of the path New in v14.30.0 . * **kwargs** (`Any`) – See [`MapFeature`](#MapFeature "viktor.views.MapFeature") for possible kwargs. - *classmethod *from\_geo\_polygon(*polygon*, *\*\*kwargs*)[](#MapPolygon.from_geo_polygon "Link to this definition") Instantiates a MapPolygon from the provided GeoPolygon. * Parameters: * **polygon** ([`GeoPolygon`](https://docs.viktor.ai/sdk/api/geometry/.md#GeoPolygon "viktor.geometry.GeoPolygon")) – GeoPolygon. * **kwargs** (`Any`) – See [`MapFeature`](#MapFeature "viktor.views.MapFeature") for possible kwargs. * Return type: [`MapPolygon`](#MapPolygon "viktor.views.MapPolygon") * *property *holes*: List\[[MapPolygon](#MapPolygon "viktor.views.MapPolygon")]*[](#MapPolygon.holes "Link to this definition") - *property *points*: List\[[MapPoint](#MapPoint "viktor.views.MapPoint")]*[](#MapPolygon.points "Link to this definition") <!-- --> ## MapPolyline[​](https://docs.viktor.ai/sdk/api/views/.md#_MapPolyline "Direct link to MapPolyline") * *class *viktor.views.MapPolyline(*\*points*, *stroke\_opacity=None*, *stroke\_width=None*, *dash\_size=None*, *gap\_size=None*, *\*\*kwargs*)[](#MapPolyline "Link to this definition") Bases: [`MapFeature`](#MapFeature "viktor.views.MapFeature") Represents a polyline on the earth’s surface between several latitude/longitude pairs. Example usage: ``` line = MapPolyline( MapPoint(51.99311570849245, 4.385752379894256), MapPoint(52.40912125231122, 5.031738281255681), ... ) ``` * Parameters: * **points** ([`MapPoint`](#MapPoint "viktor.views.MapPoint")) – MapPoints with latitude and longitude pair. * **stroke\_opacity** (`float`) – opacity of the line, between 0.0 and 1.0 New in v14.30.0 . * **stroke\_width** (`float`) – width of the line, greater than or equal to 0 New in v14.30.0 . * **dash\_size** (`float`) – size of the dashes of a dashed line, relative to the width of the path New in v14.30.0 . * **gap\_size** (`float`) – size of the gaps of a dashed line, relative to the width of the path New in v14.30.0 . * **kwargs** (`Any`) – See [`MapFeature`](#MapFeature "viktor.views.MapFeature") for possible kwargs. - *classmethod *from\_geo\_polyline(*polyline*, *\*\*kwargs*)[](#MapPolyline.from_geo_polyline "Link to this definition") Instantiates a MapPolyline from the provided GeoPolyline. * Parameters: * **polyline** ([`GeoPolyline`](https://docs.viktor.ai/sdk/api/geometry/.md#GeoPolyline "viktor.geometry.GeoPolyline")) – GeoPolyline. * **kwargs** (`Any`) – See [`MapFeature`](#MapFeature "viktor.views.MapFeature") for possible kwargs. * Return type: [`MapPolyline`](#MapPolyline "viktor.views.MapPolyline") * *property *points*: List\[[MapPoint](#MapPoint "viktor.views.MapPoint")]*[](#MapPolyline.points "Link to this definition") <!-- --> ## MapResult[​](https://docs.viktor.ai/sdk/api/views/.md#_MapResult "Direct link to MapResult") * *class *viktor.views.MapResult(*features*, *labels=None*, *legend=None*, *\**, *interaction\_groups=None*, *attribution=None*)[](#MapResult "Link to this definition") Bases: [`GeoJSONResult`](#GeoJSONResult "viktor.views.GeoJSONResult") Container with the Map data that should be visualized in a MapView. Optionally a legend and map labels can be included, as well as an attribution text for the data shown on the map. * Parameters: * **features** (`List`\[[`MapFeature`](#MapFeature "viktor.views.MapFeature")]) – List that contains the map objects. * **labels** (`List`\[[`MapLabel`](#MapLabel "viktor.views.MapLabel")]) – Labels that should be placed on the map. * **legend** ([`MapLegend`](#MapLegend "viktor.views.MapLegend")) – Map legend. * **interaction\_groups** (`Dict`\[`str`, `Sequence`\[`int` | `str` | [`MapFeature`](#MapFeature "viktor.views.MapFeature")]]) – create named groups that can be referred to in a map interaction New in v13.2.0 * **attribution** (`str`) – text appended to the map’s attribution line (bottom-right), e.g. to credit a data source. Plain text (HTML is not interpreted), at most 200 characters. The base map provider attribution is always shown New in v14.37.0 - *property *features*: List\[[MapFeature](#MapFeature "viktor.views.MapFeature")]*[](#MapResult.features "Link to this definition") * *property *geojson*: dict*[](#MapResult.geojson "Link to this definition") <!-- --> ## MapView[​](https://docs.viktor.ai/sdk/api/views/.md#_MapView "Direct link to MapView") * *class *viktor.views.MapView(*label*, *duration\_guess=None*, *\**, *description=None*, *update\_label=None*, *visible=True*, *\*\*kwargs*)[](#MapView "Link to this definition") Bases: [`View`](#View "viktor.views.View") Function decorator to instruct the controller method to return a Map (geographic data) view. Example usage: ``` @vkt.MapView("Map") def get_map_view(self, params, **kwargs): ... return vkt.MapResult(...) ``` **(new in v14.15.0)** The ‘duration\_guess’ argument is now optional. * Parameters: * **label** (`str`) – Name which is shown on tab in interface. e.g: ‘3D Representation’ * **duration\_guess** (`int`) – Estimation of view calculation in seconds. This will be used to add a manual refresh button for long-running tasks (larger than 3s). This estimation does not need to be very precise, but the performance will be better if this is close to the real maximum computation time (defaults to 1). * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **update\_label** (`str`) – Name which is shown on the update button in case of a slow view (max. 30 characters). * **visible** (`bool` | `Callable`) – Visibility of the view. Can depend on params by using a callback function New in v14.22.0 <!-- --> ## PDFResult[​](https://docs.viktor.ai/sdk/api/views/.md#_PDFResult "Direct link to PDFResult") * *class *viktor.views.PDFResult(*\**, *file=None*, *url=None*)[](#PDFResult "Link to this definition") Bases: `_ViewResult` PDF document to be visualized in a PDFView. Can be defined from a File object or from a URL (direct-sharing). If both file and url are defined, url takes precedence. In case of URL: the hosting website must allow for direct accessing for the document to be shown. If this is forbidden (undefined CORS-headers), the document can alternatively be shown via the file argument with a File.from\_url(…), in which it is downloaded first and viewed subsequently (indirect-sharing). Example usages: From URL (direct-sharing): ``` PDFResult(url="https://www...") ``` From URL (indirect-sharing): ``` f = File.from_url("https://www...") PDFResult(file=f) ``` From path: ``` file_path = Path(__file__).parent / 'sample.pdf' PDFResult.from_path(file_path) # or ... PDFResult(File.from_path(file_path)) ``` From FileField: ``` PDFResult(file=params.my_pdf_file) ``` * Parameters: * **file** ([`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | [`FileResource`](https://docs.viktor.ai/sdk/api/api-v1/.md#FileResource "viktor.api_v1.FileResource")) – PDF document to view * **url** (`str`) – URL of PDF document to view. If accessing the PDF directly from the URL is not allowed by the host website (undefined CORS-headers), this will result in the document not showing up in the view (as an alternative one can use File.from\_url). - *classmethod *from\_path(*file\_path*)[](#PDFResult.from_path "Link to this definition") Create the PDFResult from a path to the PDF file. * Parameters: **file\_path** (`str` | `bytes` | `PathLike`) – file path to a PDF file * Return type: [`PDFResult`](#PDFResult "viktor.views.PDFResult") <!-- --> ## PDFView[​](https://docs.viktor.ai/sdk/api/views/.md#_PDFView "Direct link to PDFView") * *class *viktor.views.PDFView(*label*, *duration\_guess=None*, *\**, *description=None*, *update\_label=None*, *visible=True*, *\*\*kwargs*)[](#PDFView "Link to this definition") Bases: [`View`](#View "viktor.views.View") Function decorator to instruct the controller method to return a PDFView. Example usage: ``` @PDFView("PDF View") def get_pdf_view(self, params, **kwargs): file_path = Path(__file__).parent / 'sample.pdf' return PDFResult(File.from_path(file_path)) # or `PDFResult.from_path(file_path)` ``` **(new in v14.15.0)** The ‘duration\_guess’ argument is now optional. * Parameters: * **label** (`str`) – Name which is shown on tab in interface. e.g: ‘3D Representation’ * **duration\_guess** (`int`) – Estimation of view calculation in seconds. This will be used to add a manual refresh button for long-running tasks (larger than 3s). This estimation does not need to be very precise, but the performance will be better if this is close to the real maximum computation time (defaults to 1). * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **update\_label** (`str`) – Name which is shown on the update button in case of a slow view (max. 30 characters). * **visible** (`bool` | `Callable`) – Visibility of the view. Can depend on params by using a callback function New in v14.22.0 <!-- --> ## PlotlyAndDataResult[​](https://docs.viktor.ai/sdk/api/views/.md#_PlotlyAndDataResult "Direct link to PlotlyAndDataResult") * *class *viktor.views.PlotlyAndDataResult(*figure*, *data*)[](#PlotlyAndDataResult "Link to this definition") Bases: `_ViewResult` Plotly figure to be visualized in a PlotlyAndDataView. The figure can be provided in json-string or dict format. **(new in v14.22.0)** Support a plotly ‘Figure’ object. Example usage: ``` @PlotlyAndDataView("Plotly and data view") def get_plotly_and_data_view(self, params, **kwargs): data_group = ... fig = go.Figure( data=[go.Bar(x=[1, 2, 3], y=[1, 3, 2])], layout=go.Layout(title=go.layout.Title(text="A Figure Specified By A Graph Object")) ) return PlotlyAndDataResult(fig, data_group) ``` * Parameters: * **figure** (`str` | `dict` | `Figure`) – Plotly figure * **data** ([`DataGroup`](#DataGroup "viktor.views.DataGroup")) – result data <!-- --> ## PlotlyAndDataView[​](https://docs.viktor.ai/sdk/api/views/.md#_PlotlyAndDataView "Direct link to PlotlyAndDataView") * *class *viktor.views.PlotlyAndDataView(*label*, *duration\_guess=None*, *\**, *description=None*, *update\_label=None*, *visible=True*, *\*\*kwargs*)[](#PlotlyAndDataView "Link to this definition") Bases: [`View`](#View "viktor.views.View") Function decorator to instruct the controller method to return a combined view consisting of a PlotlyView and a DataView. Example usage: ``` @PlotlyAndDataView("Plotly and data view") def get_plotly_and_data_view(self, params, **kwargs): ... return PlotlyAndDataResult(figure, data_group) ``` **(new in v14.15.0)** The ‘duration\_guess’ argument is now optional. * Parameters: * **label** (`str`) – Name which is shown on tab in interface. e.g: ‘3D Representation’ * **duration\_guess** (`int`) – Estimation of view calculation in seconds. This will be used to add a manual refresh button for long-running tasks (larger than 3s). This estimation does not need to be very precise, but the performance will be better if this is close to the real maximum computation time (defaults to 1). * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **update\_label** (`str`) – Name which is shown on the update button in case of a slow view (max. 30 characters). * **visible** (`bool` | `Callable`) – Visibility of the view. Can depend on params by using a callback function New in v14.22.0 <!-- --> ## PlotlyResult[​](https://docs.viktor.ai/sdk/api/views/.md#_PlotlyResult "Direct link to PlotlyResult") * *class *viktor.views.PlotlyResult(*figure*)[](#PlotlyResult "Link to this definition") Bases: `_ViewResult` Plotly figure to be visualized in a PlotlyView. The figure can be provided in json-string or dict format. **(new in v14.22.0)** Support a plotly ‘Figure’ object. Example usages: ``` @PlotlyView("Plotly view") def get_plotly_view(self, params, **kwargs): fig = go.Figure( data=[go.Bar(x=[1, 2, 3], y=[1, 3, 2])], layout=go.Layout(title=go.layout.Title(text="A Figure Specified By A Graph Object")) ) return PlotlyResult(fig) ``` ``` @PlotlyView("Plotly view") def get_plotly_view(self, params, **kwargs): fig = { "data": [{"type": "bar", "x": [1, 2, 3], "y": [1, 3, 2]}], "layout": {"title": {"text": "A Figure Specified By Python Dictionary"}} } return PlotlyResult(fig) ``` * Parameters: **figure** (`str` | `dict` | `Figure`) – Plotly figure <!-- --> ## PlotlyView[​](https://docs.viktor.ai/sdk/api/views/.md#_PlotlyView "Direct link to PlotlyView") * *class *viktor.views.PlotlyView(*label*, *duration\_guess=None*, *\**, *description=None*, *update\_label=None*, *visible=True*, *\*\*kwargs*)[](#PlotlyView "Link to this definition") Bases: [`View`](#View "viktor.views.View") Function decorator to instruct the controller method to return a PlotlyView. Example usage: ``` @PlotlyView("Plotly view") def get_plotly_view(self, params, **kwargs): ... return PlotlyResult(figure) ``` **(new in v14.15.0)** The ‘duration\_guess’ argument is now optional. * Parameters: * **label** (`str`) – Name which is shown on tab in interface. e.g: ‘3D Representation’ * **duration\_guess** (`int`) – Estimation of view calculation in seconds. This will be used to add a manual refresh button for long-running tasks (larger than 3s). This estimation does not need to be very precise, but the performance will be better if this is close to the real maximum computation time (defaults to 1). * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **update\_label** (`str`) – Name which is shown on the update button in case of a slow view (max. 30 characters). * **visible** (`bool` | `Callable`) – Visibility of the view. Can depend on params by using a callback function New in v14.22.0 <!-- --> ## Summary[​](https://docs.viktor.ai/sdk/api/views/.md#_Summary "Direct link to Summary") * *class *viktor.views.Summary(*\*\*items*)[](#Summary "Link to this definition") Bases: `OrderedDict` Summary of resulting data items, which can be used in the summary view of an entity. Example usage: ``` class Controller: ... summary = Summary( item_1=SummaryItem(...), item_2=SummaryItem(...), item_3=SummaryItem(...) ) ``` * Parameters: **items** ([`SummaryItem`](#SummaryItem "viktor.views.SummaryItem")) – Items that are shown in the summary, with a maximum of 6 items per summary. <!-- --> ## SummaryItem[​](https://docs.viktor.ai/sdk/api/views/.md#_SummaryItem "Direct link to SummaryItem") * *class *viktor.views.SummaryItem(*label*, *item\_type*, *source*, *value\_path*, *\**, *suffix=''*, *prefix=''*)[](#SummaryItem "Link to this definition") A summary consists of SummaryItem objects, that define which input / result values should be displayed. Suppose we have a data view with a controller method ‘data\_view’, which returns a DataItem with key ‘output\_item\_1’. The following summary item can be constructed to refer to this result: ``` item_1 = SummaryItem('Label', float, 'data_view', 'output_item_1', suffix='N') ``` Suppose we have a parametrization with a certain parameter defined as geometry.input.length, this can be converted to a summary item by doing: ``` item_2 = SummaryItem('Length', float, 'parametrization', 'geometry.input.length', suffix='m') ``` * Parameters: * **label** (`str`) – Text label of the item. * **item\_type** (`Type`\[`str` | `float`]) – Type of value, options are ‘str’ | ‘float’. * **source** (`str`) – Source from which the input / output should be extracted. * **value\_path** (`str`) – Dotted path of value in parametrization / data structure of view. e.g: level1.level2.value * **suffix** (`str`) – A suffix will be put behind the value to provide additional information such as units. * **prefix** (`str`) – A prefix will be put in front of the value to provide info such as a dollar sign. <!-- --> ## TableCell[​](https://docs.viktor.ai/sdk/api/views/.md#_TableCell "Direct link to TableCell") * *class *viktor.views.TableCell(*value*, *\**, *text\_color=None*, *background\_color=None*, *text\_style=None*)[](#TableCell "Link to this definition") <!-- --> ## TableHeader[​](https://docs.viktor.ai/sdk/api/views/.md#_TableHeader "Direct link to TableHeader") * *class *viktor.views.TableHeader(*title*, *\**, *align=None*, *num\_decimals=None*, *width=None*, *flex=None*, *min\_width=None*, *max\_width=None*)[](#TableHeader "Link to this definition") Header object that can be used in [`TableResult`](#TableResult "viktor.views.TableResult") to set styling. * Parameters: * **title** (`str`) – Title that will be shown in the header. * **align** (`Literal`\[`'center'`, `'left'`, `'right'`] | `None`) – Visual alignment of the corresponding row/column values within the table * **num\_decimals** (`int` | `None`) – Number of decimals that is shown for the row/column values (requires corresponding row/column to contain only numbers). * **width** (`int` | `None`) – Fixed width of the column in pixels. Mutually exclusive with `flex`. New in v14.34.0 * **flex** (`int` | `float` | `None`) – Width of the column as a ratio relative to other columns that use `flex` (e.g. a column with `flex=2` becomes twice as wide as a column with `flex=1`). Mutually exclusive with `width`. New in v14.34.0 * **min\_width** (`int` | `None`) – Minimum width of the column in pixels. New in v14.34.0 * **max\_width** (`int` | `None`) – Maximum width of the column in pixels. New in v14.34.0 <!-- --> ## TableResult[​](https://docs.viktor.ai/sdk/api/views/.md#_TableResult "Direct link to TableResult") * *class *viktor.views.TableResult(*data*, *\**, *column\_headers=None*, *row\_headers=None*, *enable\_sorting\_and\_filtering=None*, *enable\_column\_autosizing=False*, *show\_index=True*, *index\_header=None*)[](#TableResult "Link to this definition") Bases: `_ViewResult` New in v14.13.0 Data to be visualized in an TableView. Example of a simple TableResult: ``` data = [ [1.5, "Square"], [3.1, "Circle"], ] TableResult(data) ``` Example of a simple TableResult with column header titles: ``` data = [ [1.5, "Square"], [3.1, "Circle"], ] TableResult(data, column_headers=["Area [m²]", "Shape"]) ``` Example of a more complex TableResult with column and cell styling: ``` data = [ [1.5, "Square"], [ TableCell(3.1, text_color=Color.green()), TableCell("Circle", background_color=Color(211, 211, 211), text_style='italic') ], ] TableResult(data, column_headers=[ TableHeader("Area [m²]", num_decimals=2), TableHeader("Shape", align='center') ])) ``` Example of a transposed table: ``` data = [ [1.5, "Square"], [3.1, "Circle"], ] transposed_data = [list(i) for i in zip(*data)] TableResult( transposed_data, row_headers=[ TableHeader("Area [m²]", num_decimals=2), TableHeader("Shape", align='center') ], column_headers=["Object 1", "Object 2"] )) ``` Example of a pandas Dataframe object: ``` df = pd.DataFrame([[1, 4], [2, 3]]) TableResult(df) ``` Example of a pandas Styler object: ``` df = pd.DataFrame([[1, 4], [2, 3]]) styler = df.style.highlight_min(color="red") TableResult(styler) ``` Result to be shown in a TableView. In case the data is a pandas Styler object, the following properties will be inherited: * background\_color (per cell) * text\_color (per cell) * text\_style (per cell, bold or italic) * align (per column/row, only if all cells in a row/column have the same alignment) - Parameters: * **data** (`Sequence`\[`Sequence`\[`str` | `float` | `int` | `bool` | `datetime` | `date` | `None` | [`TableCell`](#TableCell "viktor.views.TableCell")]] | `DataFrame` | `Styler`) – Table content. Can also be a pandas DataFrame or Styler object. * **column\_headers** (`Sequence`\[`str` | [`TableHeader`](#TableHeader "viktor.views.TableHeader")] | `None`) – Headers shown above the columns. Can be used for custom titles and styling. In case the data is a pandas Styler object, this can be set explicitly to overwrite the generated titles and styling. * **row\_headers** (`Sequence`\[`str` | [`TableHeader`](#TableHeader "viktor.views.TableHeader")] | `None`) – Headers shown next to the rows. Can be used for custom titles and styling. In case the data is a pandas Styler object, this can be set explicitly to overwrite the generated titles and styling. * **enable\_sorting\_and\_filtering** (`bool` | `None`) – Enable sorting and filtering on columns. If set to None (default), sorting and filtering will be enabled if each of the columns in data is of homogeneous type, and disabled otherwise. If sorting and filtering is enabled explicitly, each column must be of homogeneous type. * **enable\_column\_autosizing** (`bool`) – Fit all columns to their content (including headers) on render, honouring any per-column min/max width. Defaults to False. New in v14.34.0 * **show\_index** (`bool`) – Show the auto-generated index (position + 1) on axes without headers. If set to False, the index is hidden on both axes. Provided row\_headers/column\_headers are always shown regardless; this flag only suppresses the auto-generated index on an axis without headers. New in v14.34.0 * **index\_header** ([`TableHeader`](#TableHeader "viktor.views.TableHeader") | `None`) – Sizes the index column (the leftmost column that shows the row headers). Only the sizing properties (`width`, `flex`, `min_width`, `max_width`) of the provided [`TableHeader`](#TableHeader "viktor.views.TableHeader") take effect; `title`, `align` and `num_decimals` are ignored. New in v14.34.0 <!-- --> ## TableView[​](https://docs.viktor.ai/sdk/api/views/.md#_TableView "Direct link to TableView") * *class *viktor.views.TableView(*label*, *duration\_guess=None*, *\**, *description=None*, *update\_label=None*, *visible=True*, *\*\*kwargs*)[](#TableView "Link to this definition") Bases: [`View`](#View "viktor.views.View") New in v14.13.0 Function decorator to instruct the controller method to return an TableView. Example usage: ``` @TableView("Table view") def get_table_view(self, params, **kwargs): data = [ [2.5, 7, "Square"], [1.5, 8, "Circle"], ] return TableResult(data, column_headers=["Width", "Height", "Shape"]) ``` **(new in v14.15.0)** The ‘duration\_guess’ argument is now optional. * Parameters: * **label** (`str`) – Name which is shown on tab in interface. e.g: ‘3D Representation’ * **duration\_guess** (`int`) – Estimation of view calculation in seconds. This will be used to add a manual refresh button for long-running tasks (larger than 3s). This estimation does not need to be very precise, but the performance will be better if this is close to the real maximum computation time (defaults to 1). * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **update\_label** (`str`) – Name which is shown on the update button in case of a slow view (max. 30 characters). * **visible** (`bool` | `Callable`) – Visibility of the view. Can depend on params by using a callback function New in v14.22.0 <!-- --> ## View[​](https://docs.viktor.ai/sdk/api/views/.md#_View "Direct link to View") * *class *viktor.views.View(*label*, *duration\_guess=None*, *\**, *description=None*, *update\_label=None*, *visible=True*, *\*\*kwargs*)[](#View "Link to this definition") Bases: `ABC` Warning Do not use this class directly in an application. Base-class of a function decorator that can be used to specify the desired view to be returned. See the subclasses for specific examples of each type of view. **(new in v14.15.0)** The ‘duration\_guess’ argument is now optional. * Parameters: * **label** (`str`) – Name which is shown on tab in interface. e.g: ‘3D Representation’ * **duration\_guess** (`int`) – Estimation of view calculation in seconds. This will be used to add a manual refresh button for long-running tasks (larger than 3s). This estimation does not need to be very precise, but the performance will be better if this is close to the real maximum computation time (defaults to 1). * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **update\_label** (`str`) – Name which is shown on the update button in case of a slow view (max. 30 characters). * **visible** (`bool` | `Callable`) – Visibility of the view. Can depend on params by using a callback function New in v14.22.0 <!-- --> ## WebAndDataResult[​](https://docs.viktor.ai/sdk/api/views/.md#_WebAndDataResult "Direct link to WebAndDataResult") * *class *viktor.views.WebAndDataResult(*\**, *html=None*, *url=None*, *data=None*)[](#WebAndDataResult "Link to this definition") Bases: `_ViewResult` Container with the web data and result data that should be visualized in a WebAndDataView. The Web part can be constructed in two ways, which should not be used together: * url: to serve a URL (takes precedence if both are defined) * html: for serving a single html page - Parameters: * **html** (`StringIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | `str`) – HTML formatted content. * **url** (`str`) – Direct URL. * **data** ([`DataGroup`](#DataGroup "viktor.views.DataGroup")) – Result data. <!-- --> ## WebAndDataView[​](https://docs.viktor.ai/sdk/api/views/.md#_WebAndDataView "Direct link to WebAndDataView") * *class *viktor.views.WebAndDataView(*label*, *duration\_guess=None*, *\**, *description=None*, *update\_label=None*, *visible=True*, *\*\*kwargs*)[](#WebAndDataView "Link to this definition") Bases: [`View`](#View "viktor.views.View") Function decorator to instruct the controller method to return a combined view consisting of web-content and data. Example usage: ``` @WebAndDataView("Web / Data") def get_web_data_view(self, params, **kwargs): # calculate data ... return WebAndDataResult(html="<html>Hello world</html>", data=data_group) ``` **(new in v14.15.0)** The ‘duration\_guess’ argument is now optional. * Parameters: * **label** (`str`) – Name which is shown on tab in interface. e.g: ‘3D Representation’ * **duration\_guess** (`int`) – Estimation of view calculation in seconds. This will be used to add a manual refresh button for long-running tasks (larger than 3s). This estimation does not need to be very precise, but the performance will be better if this is close to the real maximum computation time (defaults to 1). * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **update\_label** (`str`) – Name which is shown on the update button in case of a slow view (max. 30 characters). * **visible** (`bool` | `Callable`) – Visibility of the view. Can depend on params by using a callback function New in v14.22.0 <!-- --> ## WebResult[​](https://docs.viktor.ai/sdk/api/views/.md#_WebResult "Direct link to WebResult") * *class *viktor.views.WebResult(*\**, *html=None*, *url=None*)[](#WebResult "Link to this definition") Bases: `_ViewResult` Container with the data that should be visualized in a WebView. There are two options, which should not be used together: * url: to serve a URL (takes precedence if both are defined) * html: for serving a single html page Example usage: ``` @vkt.WebView("Hello world") def get_web_view(self, params, **kwargs): html = textwrap.dedent(""" <html> <head> <meta charset="UTF-8"> <title>My View

Hello world 🌎

""") return vkt.WebResult(html=html) ``` ``` @vkt.WebView('Python wiki') def get_web_view(self, params, **kwargs): return vkt.WebResult(url='https://en.wikipedia.org/wiki/Python_(programming_language)') ``` * Parameters: * **html** (`StringIO` | [`File`](https://docs.viktor.ai/sdk/api/core/.md#File "viktor.core.File") | `str`) – HTML formatted content. * **url** (`str`) – Direct URL. - *classmethod *from\_path(*file\_path*)[](#WebResult.from_path "Link to this definition") * Return type: [`WebResult`](#WebResult "viktor.views.WebResult") ## WebView[​](https://docs.viktor.ai/sdk/api/views/.md#_WebView "Direct link to WebView") * *class *viktor.views.WebView(*label*, *duration\_guess=None*, *\**, *description=None*, *update\_label=None*, *visible=True*, *\*\*kwargs*)[](#WebView "Link to this definition") Bases: [`View`](#View "viktor.views.View") Function decorator to instruct the controller method to return a web-content view. Example usage: ``` @vkt.WebView("Hello world") def get_web_view(self, params, **kwargs): return vkt.WebResult(html="Hello world") ``` **(new in v14.15.0)** The ‘duration\_guess’ argument is now optional. * Parameters: * **label** (`str`) – Name which is shown on tab in interface. e.g: ‘3D Representation’ * **duration\_guess** (`int`) – Estimation of view calculation in seconds. This will be used to add a manual refresh button for long-running tasks (larger than 3s). This estimation does not need to be very precise, but the performance will be better if this is close to the real maximum computation time (defaults to 1). * **description** (`str`) – Show more information to the user through a tooltip on hover (max. 200 characters). * **update\_label** (`str`) – Name which is shown on the update button in case of a slow view (max. 30 characters). * **visible** (`bool` | `Callable`) – Visibility of the view. Can depend on params by using a callback function New in v14.22.0 ---