Recursive support additions in Karamba3D

Hello @karamba3d

I am trying to recursively add new supports to a floor plate with every analysis. So the idea is to check for max nodal displacement and add a support at that location and then reanalyze and repeat the process for a fixed number of iterations.

I am trying to script that in python with the help of all the example files published but to no success, obviously doing something wrong. Any guidance is appreciated Here is the code:

import clr

clr.AddReferenceToFileAndPath("C:\Program Files\Rhino 7\Plug-ins\Karamba\Karamba.gha")
clr.AddReferenceToFileAndPath("C:\Program Files\Rhino 7\Plug-ins\Karamba\KarambaCommon.dll")

import Karamba.Models.Model as Model
import Karamba.Results as Result
import Karamba.Algorithms as Algorithm
import Karamba.Nodes as Nodes
import Karamba.Supports as Support
import Karamba.GHopper.Models as GModel
import Rhino.Geometry as rg

out = Algorithm.ThIAnalyze.solve(model)
model = out[4]

node_count = model.nodes.Count
node_disp = Result.NodalDisp.solve(model,0)
max_disp_ind = 0
max_disp = node_disp[0][1].Length

for i in range (0,node_count-1):
    disp = node_disp[0][i].Length
    if max_disp < disp:
        max_disp = disp
        max_disp_ind = i

col = Support.Support(max_disp_ind)
model.supports.Add(col)
b = max_disp_ind
final = Algorithm.ThIAnalyze.solve(model)        
z = final[4]   
a = GModel.GH_Model(z)     

Thanks in advance,
Pinaki

Hi @pinaki.mohanty91 , I do not have an answer for you but I edited your post to enclose your code in triple backticks (```), so that it is properly formatted as a code block.

Thanks for showing me @pierrec . I will remember to do that next time.

Do we have to everytime assemble the whole model when we make any changes to it. But none of the example file had to do that.

You have to clone the model and the parts of it that you want to change in order to avoid side effects. An example script can be found in ‘Karamba\Examples\TestExamples\Tension_Compression_Eliminator_Scripted.gh’:
Tension_Compression_Eliminator_Scripted.gh (29.9 KB)
–Clemens