> For the complete documentation index, see [llms.txt](https://scripting.karamba3d.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://scripting.karamba3d.com/2.-scripting-with-karamba3d-inside-grasshopper/2.8-the-python-3-component/2.8.3-how-to-create-structural-models.md).

# 2.8.3: How to Create Structural Models

The detailed account of the equivalent C# example can be found in [section 2.3](/2.-scripting-with-karamba3d-inside-grasshopper/2.3-how-to-create-structural-models.md). Here the Python 3 sourcecode and the Grasshopper definition:

```
from Karamba.Utilities import MessageLogger
from Karamba.Geometry import *
import Karamba.Loads
from System.Collections.Generic import List
from System import String

import KarambaCommon

logger = MessageLogger()
k3d = KarambaCommon.Toolkit()

p0 = Point3(0, 0, 0)
p1 = Point3(0, 0, 5)
L0 = Line3(p0, p1)

bending = True
limitDist = 0.005
elems, nodes = k3d.Part.LineToBeam(L0, "B1", None, logger)

cond = [True, True, True, True, True, True]
support = k3d.Support.Support(0, cond)
supports = [ support ]

pload = k3d.Load.PointLoad(1, Vector3(0, 0, -10), Vector3())
ploads = [ pload ]

# for Karamba3D Version <= 3.1.41119
model, info, mass, cog, info, runtimeWarning = k3d.Model.AssembleModel(
    elems, 
    supports, 
    List[Karamba.Loads.Load](ploads))

# for Karamba3D Version > 3.1.41119
# model, info, mass, cog, info, runtimeWarning = k3d.Model.AssembleModel(
#     elems, 
#     supports, 
#     ploads)    

# for Karamba3D Version <= 3.1.41119
loadCases = List[String](["LC0"])

# for Karamba3D Version > 3.1.41119
# loadCases = ["LC0"]

model_analysed, maxDisp, outForce, outEnergy, Warning = k3d.Algorithms.Analyze(model, loadCases)

ucf = Karamba.Utilities.UnitsConversionFactory.Conv();
cm = ucf.cm();
print(f"max disp: {cm.toUnit(maxDisp[0])}" + cm.unitB);

Model_out = Karamba.GHopper.Models.GH_Model(model_analysed);
```

{% file src="/files/dLFf1zPVJOJ3H7QpgqH6" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://scripting.karamba3d.com/2.-scripting-with-karamba3d-inside-grasshopper/2.8-the-python-3-component/2.8.3-how-to-create-structural-models.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
