# Error message using karamba library in c#

**URL:** <https://discourse.mcneel.com/t/error-message-using-karamba-library-in-c/155174>\
**Category:** Karamba3D\
**Tags:** windows\
**Created:** [February 20, 2023, 9:47pm UTC](https://discourse.mcneel.com/t/error-message-using-karamba-library-in-c/155174 "2023-02-20T21:47:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Augustin\_L](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/augustin_l/32/414242_2.png) [@Augustin\_L](https://discourse.mcneel.com/u/Augustin_L)\
**Post date:** [February 20, 2023, 9:47pm UTC](https://discourse.mcneel.com/t/error-message-using-karamba-library-in-c/155174/1 "2023-02-20T21:47:52Z")

</div>

Hi everyone,

I try to create a cross section optimization workflow for mass timber. I developped one script using karamba library. But, when I start to compile the program with a certain amount of elements, I get this error message: “an external component has thrown an exception”.  
You can find my grasshopper file in the description with the two csv data base for cross section. In this case, when you put more than 6 levels, the code is crashing.

[test\_erreur.gh](https://discourse.mcneel.com/uploads/short-url/1o1x2SYXllYMMvLZr5RxvmPMpAT.gh) (60.2 KB)  
[DataBaseForBeam.csv](https://discourse.mcneel.com/uploads/short-url/iM4uBbMloKRZzaxl3Luu36KcStw.csv) (24.5 KB)  
[DataBaseForColumn.csv](https://discourse.mcneel.com/uploads/short-url/rtNAqO28EdXZ01QVTvRXpyXHx7p.csv) (3.0 KB)

Thanks in advance for your help

@karamba3d  
@Guillaume_Bédard-Bla

---

<div class="post-metadata">

**Author:** ![karamba3d](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/karamba3d/32/472725_2.png) [@karamba3d](https://discourse.mcneel.com/u/karamba3d)\
**Post date:** [February 23, 2023, 8:51am UTC](https://discourse.mcneel.com/t/error-message-using-karamba-library-in-c/155174/2 "2023-02-23T08:51:31Z")

</div>

Hello @Augustin_L,

I am sorry I can not debug your code. There is a cross section optimization example script which you probably have already seen: [https://scripting.karamba3d.com/2.-scripting/2.4-how-to-modify-structural-models/2.4.1-cross-section-optimization](https://scripting.karamba3d.com/2.-scripting/2.4-how-to-modify-structural-models/2.4.1-cross-section-optimization).

When I open your definition with Karamba3D version 2.2.0.17.1 I do not get an error. Try to apply the divide and conquer strategy to find out a which point the problem occurs.

– Clemens

---

<div class="post-metadata">

**Author:** ![Augustin\_L](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/augustin_l/32/414242_2.png) [@Augustin\_L](https://discourse.mcneel.com/u/Augustin_L)\
**Post date:** [February 27, 2023, 10:23pm UTC](https://discourse.mcneel.com/t/error-message-using-karamba-library-in-c/155174/3 "2023-02-27T22:23:04Z")

</div>

Hi Clemens,

I used a calculated model instead of an assembled model as input for the cross section optimization. It looks better now but I don’t know why exactly, it may come from a side effect.

Augustin

---

<div class="post-metadata">

**Author:** ![cp1](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/cp1/32/472725_2.png) [@cp1](https://discourse.mcneel.com/u/cp1)\
**Post date:** [February 28, 2023, 7:41am UTC](https://discourse.mcneel.com/t/error-message-using-karamba-library-in-c/155174/4 "2023-02-28T07:41:27Z")

</div>

Hi @Augustin_L,  
thanks for the hint!  
– Clemens
