Skip to main content

Getting started

Python is a versatile, high-level, and dynamically-typed programming language known for its simplicity and readability. Python enables developers to build a wide range of applications, from web development to data science, automation, and beyond.

This guide shows how to create and run a Python script using Visual Studio Code and the Python command-line interface (CLI). Project tasks, such as creating, editing, and running a script, are managed through the terminal.

note

The python package is mainly focus on fdscript automation which will help you in automatise processes as running analysis, design and read results.

The construction of the Database object is currently out of scope as it is delegated to the users. Database is based on xml sintax and you can use library such as xml.etree.ElementTree to manipulate the file.

Prerequisities

Create a python script

  1. Start Visual Studio Code.

  2. Select File > Open Folder from the main menu.

  3. In the Open Folder dialog, create a HelloStruSoft folder and select it. Then click Select Folder

  4. Create a new file and save it as program.py.

  5. Copy the following script contents in program.py with the following code:

    from femdesign.comunication import FemDesignConnection

    pipe = FemDesignConnection()
    try:
    pipe.SetProjectDescription(project_name="Amazing project",
    project_description="Created through Python",
    designer="Super Engineer",
    signature="",
    comment="Wish for the best",
    additional_info={"italy": "amazing", "sweden": "amazing_too"})
    pipe.Detach()
    except Exception as err:
    pipe.KillProgramIfExists()
    raise err

Run the application

Run the following command in the Terminal:

python program.py

Congratulations, you have successfully created your first FEM-Design Application! 🎉

A small range of examples can be found at GitHub. If you need any help or you are looking for new features, give us some feedback by our Community page.