Skip to main content

FEM-Design section/material with the API

· 5 min read
Marco Pellegrino
Nerd Structural Engineer

The following article will show you how to use your personal library of sections and materials with the API.

You can download the Grasshopper definition used in this tutorial from here 👉Grasshopper Definition

Dump sections and materials

FEM-Design stores the section and material data in a binary format which can not be directly read, this means that we need to export the data from FEM-Design using the graphical user interface (GUI).

note

You only need to perform the following procedure once, or when you update your material and section libraries.

The first step is to save your assets in a .struxml file format. In order to do so, in FEM-Design, open the dialog to create a Bar and navigate to Section

Click on export and make sure to select .struxml file format:

Save Sections

Save Sections

Now navigate to Material and perform the same procedure:

Save Materials

Save Materials

Your materials and sections have now been serialised to a .struxml file and they will look something similar to this:

section.struxml
<?xml version="1.0" encoding="UTF-8"?>
<!-- (c) StruSoft 2012-2021, http://www.strusoft.com -->
<database struxml_version="01.00.000" source_software="FEM-Design 21.00.005" start_time="1970-01-01T00:00:00.000" end_time="1970-01-01T00:00:00.000" guid="8b367fc0-4425-48f7-bfa2-2bafca0cd7c8" convertid="00000000-0000-0000-0000-000000000000" standard="EC" country="S" xmlns="urn:strusoft">
<sections>
<section guid="4987c406-68d0-42d5-a158-6ab8f608c851" last_change="1970-01-01T00:00:00.000" action="added" name="Concrete sections, Rectangle, 120x150" type="custom" fd-mat="3" fd_name_code="Concrete sections" fd_name_type="Rectangle" fd_name_size="120x150">
<region_group>
<region>
<contour>
<edge type="line">
<point x="-0.06" y="-0.075" z="0"></point>
<point x="0.06" y="-0.075" z="0"></point>
<normal x="0" y="1" z="0"></normal>
</edge>
<edge type="line">
<point x="0.06" y="-0.075" z="0"></point>
<point x="0.06" y="0.075" z="0"></point>
<normal x="-1" y="0" z="0"></normal>
</edge>
<edge type="line">
<point x="0.06" y="0.075" z="0"></point>
<point x="-0.06" y="0.075" z="0"></point>
<normal x="0" y="-1" z="0"></normal>
</edge>
<edge type="line">
<point x="-0.06" y="0.075" z="0"></point>
<point x="-0.06" y="-0.075" z="0"></point>
<normal x="1" y="0" z="0"></normal>
</edge>
</contour>
</region>
</region_group>
<end></end>
</section>
</sections>
<end></end>
</database>
material.struxml
<?xml version="1.0" encoding="UTF-8"?>
<!-- (c) StruSoft 2012-2021, http://www.strusoft.com -->
<database struxml_version="01.00.000" source_software="FEM-Design 21.00.005" start_time="1970-01-01T00:00:00.000" end_time="2022-10-21T11:03:16.000" guid="01615fbb-a4af-4b7b-96a2-768dae4cd79b" convertid="00000000-0000-0000-0000-000000000000" standard="EC" country="S" xmlns="urn:strusoft">
<materials>
<material guid="6fa49e6a-7088-4054-92f4-da62c762ec4f" last_change="2020-11-11T14:10:49.000" action="added" standard="EC" country="S" name="Lättklinkerbetong 5.0 M0.5">
<masonry fk="1.2" nu="0.25" rho="0.8" alpha_thermal="0.000012" gammaM_0="2" gammaM_1="1.5" fm="5" K="0.55" alpha="0.7" beta="0.3" elasticity_modulus="1200" creep_U="1.5" creep_Sq="1.5" creep_Sf="1.5" creep_Sc="1.5" phi="1.5" filled_vertical_joints="false" km="0.07" muk="1" ct="0.5" fvk0="0.2" fvlt="0.3"></masonry>
</material>
<material guid="8d399552-5c0f-48ed-9cae-fbfe5b5e2838" last_change="2022-10-21T11:03:16.000" action="added" standard="general" country="n/a" name="MyMaterial">
<custom mass="0.0000000001" E_0="210000000000000" E_1="0" E_2="0" nu_0="0.3" nu_1="0" nu_2="0" alfa_0="0.000012" alfa_1="0" alfa_2="0" G_0="0" G_1="0" G_2="0"></custom>
</material>
</materials>
<end></end>
</database>

Read sections and materials

FEM-Design API Toolbox for Grasshopper provide a specific component to read and deserialise the .struxml files for sections and materials.

Use SectionDatabase.FromStruxml and MaterialDatabase.FromStruxml to get the deserialise the .struxml files into to objects.

Read Sections

Section from struxml

Read Material

Material from struxml

As soon as you have deserialised the files, you will be able to select your section and material from the list and use it in your project with the API.

Workflow

Element with Custom Section and Custom Material

Create a section database

There are special case studies where you needs to use custom made sections that are not available in the default database. In such a scenario, you can create your sections with the FEM-Design GUI or the API.

You can define the section geometry as a surface and use it in your workflow. FEM-Design will calculate the mechanical properties automatically and transform the object to a structural section.

gh-Workflow

result

Beam Element with Custom Section in FEM-Design

Save the sections to database

If you want to import your new sections to FEM-Design this can be done. Save the section objects to a .struxml file with SectionDatabase.Save component and import it in FEM-Design.

result

Save Custom Section to Database

Create family section

advanced

The parametric environment allows you to define a vast amount of sections with the use of a parametric model.

The example below shows how you can create a family of cellular beam sections that can be used in FEM-Design to perform some optimisation.

You can download the Grasshopper definition used to create a section family from here 👉Grasshopper Definition

Progress in construction and production methods makes it possible to refine our design using custom made sections. But how do we "feed" the model with the section family to choose from? One possible solution is to create a logic that build the section geometry as it is shown in the picture below.

family

Section parametrically defined

As soon as you have created the computational logic to create the sections, export them as explained in the previous paragraph and import them in FEM-Design.

family-femdesign

Family in FEM-Design

Every section has a different mechanical properties and FEM-Design will be able to pick the most efficient one when you run the auto-design.

Do you want to learn more about this topic? Get in touch with us.

We are always ready to reply to help you with your issues if you reach out to us! 🙂

🔗 Repository

🔗 Support

🔗 FEM-Design wiki