OptiCroSec customization and other minor stuff

Dear Karamba team,

I have several questions and/or minor bug reports for your new release:

  1. Is the OptiCroSec code publicly available elsewere? EDIT: I´m sorry, as you indicated here in the scripting guide, karambaCommon.dll can be easily decompiled with the free tool ILSpy.

  2. I´m trying to adapt the OptiCroSec scripting example from single to multiple Load Cases (LCs). However, when some input LC identifier other than “-1” is introduced into the ret_lc_ind input from BeamResultantForces.solve method (Karamba3D v.2.2.0.8-211122 for Rhino7) the following error is dumped: “Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index (line: 0)”. You can reproduce this error by setting lcind input in MyOptiCroSec C# component (red color group) in the sketch: MyOptiCroSec.gh (100.6 KB)

  3. By the way, the ret_lc_ind input variable seems to have changed from int to string input from v.1.3.3 to v.2.2.0.8, I´m sure you will update this as soon as you release the Karamba3D new API reference guide :slight_smile:

  4. Should ThII (right) maximum displacements be always higher than ThI (left)?
    image image

  5. How would I check if a cross-section is Class-4 or even Class-3 from your C# interface? Said cross-sections may not be good for some applications where the maximum structural efficiency is mandatory. This is why I figure it out that you´ve added the corresponding warning message to the Utilization component (“Cross section class 4 detected at element #X. May lead to local buckling.”). Perhaps some option may be added to future versions of your OptiCroSec to prevent the selection of Class-4 or -3 cross-sections :slight_smile:

EDIT: As workaround, I can parse the detailed output string to find Class 4 cross-sections:

 Karamba.Results.Utilization.solve(model, new List<string>(){ "" }, -1, 2, true, 1, 1.1, true, out util, out message);
 Print("Elem " + elem_ind + " Class4 " + util.details[elem_ind].Contains("crosec-class:4").ToString());

Can the detailed output fields be accessed directly using your API?

  1. What does ModelView component visualize when “–all–” is selected in Result Case field? In the contextual help it says: “All” means that all present result-cases are superimposed. However, it seems that what is visualized is sum of all Deformations, Reactions, Loads, etc… (which may be interesting as well). What about having two different options here, i.e. --all-- and --sum–, for example.

  2. May the order of the Load Cases be preserved? I think they are sorted by name in ascending order at some point. The problem arises when, for example, if setting the ResCase input (ModelView component) to 0, the visualized LC does not correspond to the first LC shown in the Result-Case list, look:

This is the first Result-Case “A” as shown in the Result-Case tab:

And this is the case visualized when trying to visualize the first result case by setting ResCase to 0 the the Result-Case “B” instead of the “A” is dumped:

It seems that some kind of arithmetic operation is performed between ResCase and Result-Case inputs…
EDIT: I´m sorry, I´ve just read the ResCase input contextual help… it says that “This number is added to the visible result-case selected in the drop-down list of the Model View component”, so it is the expected behavior.

Instead of reinventing the wheel, I´m trying first to reproduce your OptiCroSec component.

To this end I´ve copy/pasted the component code (Karamba.GHopper.Algorithms.Component_OptiCroSecEC3) from your karambaCommon.dll using the ILSpy tool (recommended here in the Scripting Guide) into the MyOptiCroSec2 component (pink color group) in MyOptiCroSec2.gh (108.9 KB)… but for some reason it does not perform the calculations.

Would you take a look to the code and tell me what am I doing wrong? Thanks a lot!