API Karamba 3.1.40718 - BeamForces

Hi,

I have updated the KarambaCommon library to version 3.1.40718. However, I am having trouble retrieving the model_state. In the previous version, this was not an issue as the method had the following characteristics:

BeamForces.solve(Model model, List<string> ret_elem_ids, int ret_lc_ind, double max_res_dist, int max_res_num, out List<List<List<List<double>>>> model_state)

But now, Visual Studio indicates that the arguments are as follows:
BeamForces.solve(ModelBeam model, List<string> elementIDs, string resultSelection, double maxResultsDistance, int minResultsIntervals, out List<List>List<Vector3>>> translations, out List<List<List<Vector3>>> rotations, out List<List<List<Karamba.Loads.Combination.LoadCase>>> governingLoadCases, out List<List<List<int>>> governingLoadCaseInds, out List<int> elementInds)

How can I access the model_state in this version?

Hi @Lucas_NG,

the signature of the method in Karamba3D version 3 is this:

/// retrieve section forces along all elements which are active and of linear type.
/// model:model with calculated displacements.
/// elementsIDs: list of identifiers of elements for which to retrieve results.
/// resultSelection: name of load-case for which to retrieve results.
/// maxResultsDistance: maximum distance between points where section forces are determined.
/// minResultsIntervals: maximum number of points where section forces are determined. Can be overruled by max_res_dist.
/// translations: translational displacements: list-structure: element, position, state min/max.
/// rotations: rotational displacements: list-structure: element, position, state min/max.
/// governingLoadCases: list of governing load cases.
/// governingLoadCaseInds: list of governing load case indexes.
/// elementInds: list of element indexes for which results are returned.
public static void solve(
Model model,
List elementsIDs,
string resultSelection,
double maxResultsDistance,
int minResultsIntervals,
out List<List<List>> translations,
out List<List<List>> rotations,
out List<List<List>> governingLoadCases,
out List<List<List>> governingLoadCaseInds,
out List elementInds)

In case “ResultSelection” is an empty string or null all results will be returned. The “ResultSelection” string can be constructed with the “ResultSelector”-component.

I will try to update the Karamba3D API documentation in the next days.

– Clemens

Hi, thank you.

Taking advantage of the opportunity, I noticed that Karamba.Results.NodalDisp.Solve() no longer exists in the new library. Is the equivalent Karamba.Results.NodalDisp_Deprecated_1.Solve()?

I am still facing issues with the BeamForces.solve method. In the previous version of the method, I had no problems, but in the updated signature, I am encountering difficulties.

I’ve tested various values for maxResultsDistance and minResultsIntervals to calculate the forces for a beam of 9 meters, for example. However, I consistently get the error: “Invalid position: X. Position must be between 0 and 1.”

Is this method functioning as expected on your end? Any suggestions on how to resolve this ?

The new signature for NodalDisplacements.solve is now:

///
/// retrieve nodal displacements.
///
/// “model”: Model with calculated displacements.
/// “resultSelection”: name of load-case for which to retrieve the support reactions.
/// “nodeIndexes”: List of indexes of nodes for which to get results. If empty then the displacements of all nodes are retrieved.
/// “trans”: nodal translations. List-structure: node/min-max result.
/// “rotat”: nodal rotations. List-structure: node/min-max result.
/// “governingLoadCases”: list of governing load cases. Null in case of non-unique load case.
/// “governingLoadCaseInds”: list of governing load case indexes.‘-1’ in case of non-unique load case.
/// “positions”: positions of the displacement results.
public static void solve(
Model model,
string resultSelection,
List nodeIndexes,
out List<List> trans,
out List<List> rotat,
out List<List> governingLoadCases,
out List<List> governingLoadCaseInds,
out List positions)

– Clemens

Dear @Lucas_NG,
the position is supposed to be a parameter t where 0<t<1: 0 corresponds to the start of the element, t=1 to its end. For example t=0.5 lies in the middle of the beam.
– Clemens

Hi @cp1

Your answer works alright when you BeamForce.solve witht the signature that uses ts:

But when you try using BeamForce.solve specifying maxResultsDistance instead, which was working fine in Karamaba 2 - then the above mentioned exception appears: “Invalid position: X. Position must be between 0 and 1.”

I debugged it further and it seems to be thrown at BeamForces.cs, LN 40

As the Interval3.Split method is not returning a remapped value between 0 and 1, but rather using the colum length instead. Here’s an example with an element of length 7.9 and maxDistance 0.5

→ In addtion: if I set the element length to 1.0m the method works.

Are we missing something in this new behavior or could it be a bug?

We want to avoid using the “ts” signature because we want our plugin to show results based on a “length resolution”, so shorter elements don’t show as many section results as longer elements. If there’s a better way of achieving this we’re glad to hear suggestions too

Hi @pegiachini,
thanks for your bug report! That looks like an error.
I will try to fix this a.s.a.p. and give you notice.
– Clemens

Hi @pegiachini,
I think I fixed the bug. You can download the new version from here: Releases · karamba3d/K3D_NightlyBuilds · GitHub.
– Clemens

Hi @cp1,

In the latest update, you fixed this issue(BeamForces), but it seems like a similar situation is happening with BeamDisplacement.

I believe this part of the BeamDisplacement code:
GetCollectionsOfDisplacements(Interval3.Create(0.0, item.elementLength(model)).Split(maxResultsDistance, minResultsIntervals), item, model, stateSelectors, out var translations2, out var rotations2, out var governingLoadCases2, out var governingLoadCaseInds2);

should be similar to BeamForces, like this:
GetCollectionsOfDisplacements(Interval3.Create(0.0, 1.0).Split(maxResultsDistance, minResultsIntervals), item, model, stateSelectors, out var translations2, out var rotations2, out var governingLoadCases2, out var governingLoadCaseInds2);

Could you help me with this?

Hi @Lucas_NG,
thanks for the bug report!
I fixed the problem. The fix will be part of the next service release of Karamba3D.
– Clemens