> 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.1-hello-karamba3d.md).

# 2.8.1: Hello Karamba3D

In order to get started with Python3 scripting in Grasshopper place a "Python 3 Script"-component on the canvas. Details regarding its functionality can be found [here](https://developer.rhino3d.com/guides/scripting/scripting-gh-python/).

<figure><img src="/files/GMlVt530CiudKDRB5XuB" alt=""><figcaption><p>Fig. 2.8.1.1: A minimal K3D-model for retrieving the number of elements, materials and cross sections via Python 3.</p></figcaption></figure>

When Karamba3D is installed in your Grasshopper the following code retrieves properties of a Karamba3D model:

```
import Karamba

model = Model_in;

if not isinstance(model, Karamba.Models.Model):
    raise Exception("The input is not of type 'Model'")

print(f"Number of Elements: {model.elems.Count}")
print(f"Number of Materials: {model.materials.Count}")
print(f"Number of Cross sections: {model.crosecs.Count}")
```

The source code is explained in [section 2.1](/2.-scripting-with-karamba3d-inside-grasshopper/2.1-hello-karamba3d.md).

{% file src="/files/0srqSDT3IslBbFOZjEfw" %}


---

# 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.1-hello-karamba3d.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.
