Skip to content

Commit

Permalink
Load Push Results In Error (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjamesnugent authored Jun 18, 2024
2 parents 395d070 + 21c78cf commit 8c58eca
Show file tree
Hide file tree
Showing 8 changed files with 285 additions and 184 deletions.
30 changes: 17 additions & 13 deletions RFEM6_Adapter/CRUD/Create/BHoMDataStructure/Geometry/Panel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,26 @@ namespace BH.Adapter.RFEM6
public partial class RFEM6Adapter
{

private bool CreateCollection(IEnumerable<Panel> bhPanels)
{
private bool CreateCollection(IEnumerable<Panel> bhPanels)
{
foreach (Panel bhPanel in bhPanels)
{
rfModel.surface surface = bhPanel.ToRFEM6();

foreach (Panel bhPanel in bhPanels)
{
if (m_PanelIDdict.ContainsKey(bhPanel))
{
m_PanelIDdict[bhPanel] = bhPanel.GetRFEM6ID();
}
else
{
m_PanelIDdict.Add(bhPanel, bhPanel.GetRFEM6ID());
}

rfModel.surface surface = bhPanel.ToRFEM6();
m_PanelIDdict.Add(bhPanel, bhPanel.GetRFEM6ID());
m_Model.set_surface(surface);
}


m_Model.set_surface(surface);

}

return true;
}
return true;
}

}
}
Expand Down
10 changes: 5 additions & 5 deletions RFEM6_Adapter/CRUD/Create/BHoMDataStructure/Loading/Load.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private bool CreateCollection(IEnumerable<ILoad> bhLoads)
var currrSurfaceIds = (bhLoad as AreaUniformlyDistributedLoad).Objects.Elements.ToList().Select(e => m_PanelIDdict[e as Panel]).ToArray();
rfemAreaLoad.surfaces = currrSurfaceIds;
//rfemAreaLoad. = currrSurfaceIds;
m_Model.set_surface_load(bhLoad.Loadcase.GetRFEM6ID(), rfemAreaLoad);
m_Model.set_surface_load(bhLoad.Loadcase.Number, rfemAreaLoad);

continue;
}
Expand Down Expand Up @@ -106,7 +106,7 @@ private bool CreateCollection(IEnumerable<ILoad> bhLoads)
int id = m_LoadcaseLoadIdDict[bhLoad.Loadcase][bhLoad.GetType().Name];
member_load member_load = (bhLoad as BarUniformlyDistributedLoad).ToRFEM6((member_load_load_type)nodalLoadType, id);
var rfMemberLoad = member_load;
m_Model.set_member_load(bhLoad.Loadcase.GetRFEM6ID(), rfMemberLoad);
m_Model.set_member_load(bhLoad.Loadcase.Number, rfMemberLoad);
continue;
}

Expand All @@ -116,7 +116,7 @@ private bool CreateCollection(IEnumerable<ILoad> bhLoads)
UpdateLoadIdDictionary(bhLoad);
int id = m_LoadcaseLoadIdDict[bhLoad.Loadcase][bhLoad.GetType().Name];
nodal_load rfPointLoad = (bhLoad as PointLoad).ToRFEM6((nodal_load_load_type)nodalLoadType, id);
m_Model.set_nodal_load(bhLoad.Loadcase.GetRFEM6ID(), rfPointLoad);
m_Model.set_nodal_load(bhLoad.Loadcase.Number, rfPointLoad);
continue;

}
Expand Down Expand Up @@ -156,7 +156,7 @@ private bool CreateCollection(IEnumerable<ILoad> bhLoads)
int id = m_LoadcaseLoadIdDict[bhLoad.Loadcase][bhLoad.GetType().Name + "_NonFreeLineLoad"];
var locatedEdte = edgeProsepectSet.Where(e => (edgeComparer).Equals(e, new Edge() { Curve = (bhLoad as GeometricalLineLoad).Location })).FirstOrDefault();
line_load rfLineLoad = (bhLoad as GeometricalLineLoad).ToRFEM6(id, locatedEdte.GetRFEM6ID(), (line_load_load_type)MomentOfForceLoad(bhLoad));
m_Model.set_line_load(bhLoad.Loadcase.GetRFEM6ID(), rfLineLoad);
m_Model.set_line_load(bhLoad.Loadcase.Number, rfLineLoad);
continue;
}
else
Expand Down Expand Up @@ -203,7 +203,7 @@ private bool CreateCollection(IEnumerable<ILoad> bhLoads)
//
int id = m_LoadcaseLoadIdDict[bhLoad.Loadcase][bhLoad.GetType().Name + "_FreeLineLoad"];
free_line_load rfFreeLineLoad = (bhLoad as GeometricalLineLoad).ToRFEM6(id, currrSurfaceIds);
m_Model.set_free_line_load(bhLoad.Loadcase.GetRFEM6ID(), rfFreeLineLoad);
m_Model.set_free_line_load(bhLoad.Loadcase.Number, rfFreeLineLoad);
continue;
}

Expand Down
4 changes: 4 additions & 0 deletions RFEM6_Adapter/CRUD/Delete/_IDelete.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ protected override int IDelete(Type type, IEnumerable<object> ids, ActionConfig

if (!rfemType.HasValue)
{
//Avoind warking when type is edge
if (type.Name == "Edge") { return 0; }

// Log a warning if the type is not supported
BH.Engine.Base.Compute.RecordWarning($"Delete not implemented for obejcts of type {type.Name}.");
return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions RFEM6_Adapter/CRUD/NextId/NextId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ protected override object NextFreeId(Type objectType, bool refresh = false)

int id = 0;

if (objectType.Name.Equals("PointLoad")|| objectType.Name.Equals("BarUniformlyDistributedLoad")|| objectType.Name.Equals("GeometricalLineLoad")|| objectType.Name.Equals("AreaUniformlyDistributedLoad"))
if (objectType.Name.Equals("PointLoad") || objectType.Name.Equals("BarUniformlyDistributedLoad") || objectType.Name.Equals("GeometricalLineLoad") || objectType.Name.Equals("AreaUniformlyDistributedLoad"))
{

id = m_Model.get_first_free_number(rfType.Value, 1);
id = 0;

}
else
Expand Down
Loading

0 comments on commit 8c58eca

Please sign in to comment.