Skip to content

Commit

Permalink
Input attributes renamed for compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
enarhi committed Mar 19, 2020
1 parent 4e47926 commit 589d305
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 66 deletions.
100 changes: 50 additions & 50 deletions RAM_Adapter/Convert/ToBHoM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -653,16 +653,16 @@ public static Panel ToBHoMObject(this IWall ramWall)

/***************************************************/

public static Node ToBHoMObject(this INode INode)
public static Node ToBHoMObject(this INode ramNode)
{

// Get the location of the node
SCoordinate Location = new SCoordinate();
Location = INode.sLocation;
Location = ramNode.sLocation;

Node Node = Engine.Structure.Create.Node(new oM.Geometry.Point() { X = Location.dXLoc, Y = Location.dYLoc, Z = Location.dZLoc });

IMemberForces IMemberForces = INode.GetReactions();
IMemberForces IMemberForces = ramNode.GetReactions();

// Collect all member forces at node, tracked by index; should these be combined?
for (int i = 0; i < IMemberForces.GetCount(); i++)
Expand Down Expand Up @@ -693,13 +693,13 @@ public static Node ToBHoMObject(this INode INode)

/***************************************************/

public static Loadcase ToBHoMObject(this ILoadCase ILoadCase)
public static Loadcase ToBHoMObject(this ILoadCase ramLoadCase)
{

Loadcase Loadcase = new Loadcase();
Loadcase.Name = ILoadCase.strSymbol;
Loadcase.Number = ILoadCase.lUID;
ELoadCaseType LoadType = ILoadCase.eLoadType;
Loadcase.Name = ramLoadCase.strSymbol;
Loadcase.Number = ramLoadCase.lUID;
ELoadCaseType LoadType = ramLoadCase.eLoadType;
switch (LoadType)
{
case ELoadCaseType.NotionalDeadLCa:
Expand Down Expand Up @@ -737,31 +737,31 @@ public static Loadcase ToBHoMObject(this ILoadCase ILoadCase)

/***************************************************/

public static LoadCombination ToBHoMObject(IModel IModel,ILoadCombination ILoadCombination)
public static LoadCombination ToBHoMObject(IModel ramModel,ILoadCombination ramLoadCombination)
{

LoadCombination LoadCombination = new LoadCombination();
LoadCombination.Name = ILoadCombination.strDisplayString;
LoadCombination.Number = ILoadCombination.lLabelNo;
LoadCombination loadCombination = new LoadCombination();
loadCombination.Name = ramLoadCombination.strDisplayString;
loadCombination.Number = ramLoadCombination.lLabelNo;

ILoadCombinationTerms ILoadCombinationTerms = ILoadCombination.GetLoadCombinationTerms();
ILoadCombinationTerms iLoadCombinationTerms = ramLoadCombination.GetLoadCombinationTerms();

for (int i = 0; i < ILoadCombinationTerms.GetCount(); i++)
for (int i = 0; i < iLoadCombinationTerms.GetCount(); i++)
{
//Get LoadCombination Cases and Factors
ILoadCombinationTerm ILoadCombinationTerm = ILoadCombinationTerms.GetAt(i);
int caseID = ILoadCombinationTerm.lLoadCaseID;
ILoadCases ILoadCases = IModel.GetLoadCases(EAnalysisResultType.RAMFrameResultType);
ILoadCase ILoadCase = ILoadCases.Get(caseID);
ILoadCombinationTerm iLoadCombinationTerm = iLoadCombinationTerms.GetAt(i);
int caseID = iLoadCombinationTerm.lLoadCaseID;
ILoadCases iLoadCases = ramModel.GetLoadCases(EAnalysisResultType.RAMFrameResultType);
ILoadCase iLoadCase = iLoadCases.Get(caseID);

//Convert Loadcase from RAM to BHoM
Loadcase bhomLoadcase = ToBHoMObject(ILoadCase);
Loadcase bhomLoadcase = ToBHoMObject(iLoadCase);
//Add dict for load factor and loadcase
LoadCombination.LoadCases.Add(new Tuple<double, ICase>(ILoadCombinationTerm.dFactor, bhomLoadcase));
loadCombination.LoadCases.Add(new Tuple<double, ICase>(iLoadCombinationTerm.dFactor, bhomLoadcase));

}

return LoadCombination;
return loadCombination;
}

/***************************************************/
Expand Down Expand Up @@ -806,16 +806,16 @@ public static NodeReaction ToBHoMObject(this IMemberForce ramForce)

/***************************************************/

public static Grid ToBHoMObject(this IModelGrid IModelGrid, IGridSystem IGridSystem, int counter)
public static Grid ToBHoMObject(this IModelGrid ramModelGrid, IGridSystem ramGridSystem, int counter)
{
Grid myGrid = new Grid();
// Get the parameters of Gridsystem
string gridSystemLabel = IGridSystem.strLabel;// Set the name of the GridSystem from RAM
int gridSystemID = IGridSystem.lUID; //Set the lUID from RAM
string gridSystemType = IGridSystem.eOrientationType.ToString();// Set the orientation type
double gridXoffset = IGridSystem.dXOffset; // Set the offset of the GridSystem from 0 along the X axis
double gridYoffset = IGridSystem.dYOffset; // Set the offset of the GridSystem from 0 along the Y axis
double gridSystemRotation = IGridSystem.dRotation; // Set the rotation angle of the GridSystem
string gridSystemLabel = ramGridSystem.strLabel;// Set the name of the GridSystem from RAM
int gridSystemID = ramGridSystem.lUID; //Set the lUID from RAM
string gridSystemType = ramGridSystem.eOrientationType.ToString();// Set the orientation type
double gridXoffset = ramGridSystem.dXOffset; // Set the offset of the GridSystem from 0 along the X axis
double gridYoffset = ramGridSystem.dYOffset; // Set the offset of the GridSystem from 0 along the Y axis
double gridSystemRotation = ramGridSystem.dRotation; // Set the rotation angle of the GridSystem
double gridRotAngle = 0;

// Add the properties of the GridSystem as CustomData
Expand All @@ -827,13 +827,13 @@ public static Grid ToBHoMObject(this IModelGrid IModelGrid, IGridSystem IGridSys
myGrid.CustomData.Add("RamGridRotation", gridSystemRotation);

//Get info for each grid line
int gridLinelUID = IModelGrid.lUID; //unique ID od of the grid line object
string gridLineLabel = IModelGrid.strLabel; // label of the gridline
double gridLineCoord_Angle = IModelGrid.dCoordinate_Angle; // the grid coordinate or angle
string gridLineAxis = IModelGrid.eAxis.ToString(); // grid line axis , X/Radial Y/Circular
int gridLinelUID = ramModelGrid.lUID; //unique ID od of the grid line object
string gridLineLabel = ramModelGrid.strLabel; // label of the gridline
double gridLineCoord_Angle = ramModelGrid.dCoordinate_Angle; // the grid coordinate or angle
string gridLineAxis = ramModelGrid.eAxis.ToString(); // grid line axis , X/Radial Y/Circular

double dMaxLimit = IModelGrid.dMaxLimitValue; // maximum limit specified by the user to which gridline will be drawn from origin
double dMinLimit = IModelGrid.dMinLimitValue; // minimum limit specified by the user to which gridline will be drawn from origin
double dMaxLimit = ramModelGrid.dMaxLimitValue; // maximum limit specified by the user to which gridline will be drawn from origin
double dMinLimit = ramModelGrid.dMinLimitValue; // minimum limit specified by the user to which gridline will be drawn from origin
double GridLength = 3000; //default grid length value

//Set max and min limit values based on if they are used or if -1 is returned
Expand All @@ -844,7 +844,7 @@ public static Grid ToBHoMObject(this IModelGrid IModelGrid, IGridSystem IGridSys

//Set Grid start offset from system origin
double spacing = 0;
spacing = IModelGrid.dCoordinate_Angle;
spacing = ramModelGrid.dCoordinate_Angle;

Point gridCoordPoint1 = new Point();
Point gridCoordPoint2 = new Point();
Expand Down Expand Up @@ -933,26 +933,26 @@ public static Grid ToBHoMObject(this IModelGrid IModelGrid, IGridSystem IGridSys

/***************************************************/

public static Level ToBHoMObject(this IStory story)
public static Level ToBHoMObject(this IStory ramStory)
{
Level bhomLevel = new Level
{
Elevation = story.dElevation,
Name = story.strLabel
Elevation = ramStory.dElevation,
Name = ramStory.strLabel
};

return bhomLevel;
}

/***************************************************/

public static ContourLoadSet ToBHoMObject(this ISurfaceLoadSet srfLoadSet, IStory ramStory)
public static ContourLoadSet ToBHoMObject(this ISurfaceLoadSet ramSrfLoadSet, IStory ramStory)
{
// Get srf load outline
List<Point> srfLoadContourPts = new List<Point>();
double elev = ramStory.dElevation;

IPoints srfPolyPts = srfLoadSet.GetPoints();
IPoints srfPolyPts = ramSrfLoadSet.GetPoints();

Polyline srfLoadContour = ToPolyline(srfPolyPts, elev);

Expand All @@ -962,19 +962,19 @@ public static ContourLoadSet ToBHoMObject(this ISurfaceLoadSet srfLoadSet, IStor
};

// Unique RAM ID
srfLoad.CustomData[AdapterIdName] = srfLoadSet.lUID;
srfLoad.CustomData[AdapterIdName] = ramSrfLoadSet.lUID;

return srfLoad;
}

/***************************************************/

public static UniformLoadSet ToBHoMObject(this ISurfaceLoadPropertySet srfLoadPropSet)
public static UniformLoadSet ToBHoMObject(this ISurfaceLoadPropertySet ramSrfLoadPropSet)
{
Dictionary<string, double> loads = new Dictionary<string, double>();
ELoadCaseType liveType = ELoadCaseType.LiveReducibleLCa;

switch (srfLoadPropSet.eLiveLoadType)
switch (ramSrfLoadPropSet.eLiveLoadType)
{
case ELoadCaseType.LiveUnReducibleLCa:
liveType = ELoadCaseType.LiveUnReducibleLCa;
Expand All @@ -993,22 +993,22 @@ public static UniformLoadSet ToBHoMObject(this ISurfaceLoadPropertySet srfLoadPr
break;
}

loads.Add(ELoadCaseType.ConstructionDeadLCa.ToString(), srfLoadPropSet.dConstDeadLoad);
loads.Add(ELoadCaseType.ConstructionLiveLCa.ToString(), srfLoadPropSet.dConstLiveLoad);
loads.Add(ELoadCaseType.DeadLCa.ToString(), srfLoadPropSet.dDeadLoad);
loads.Add(liveType.ToString(), srfLoadPropSet.dConstLiveLoad);
loads.Add(ELoadCaseType.MassDeadLCa.ToString(), srfLoadPropSet.dMassDeadLoad);
loads.Add(ELoadCaseType.PartitionLCa.ToString(), srfLoadPropSet.dPartitionLoad);
loads.Add(ELoadCaseType.ConstructionDeadLCa.ToString(), ramSrfLoadPropSet.dConstDeadLoad);
loads.Add(ELoadCaseType.ConstructionLiveLCa.ToString(), ramSrfLoadPropSet.dConstLiveLoad);
loads.Add(ELoadCaseType.DeadLCa.ToString(), ramSrfLoadPropSet.dDeadLoad);
loads.Add(liveType.ToString(), ramSrfLoadPropSet.dConstLiveLoad);
loads.Add(ELoadCaseType.MassDeadLCa.ToString(), ramSrfLoadPropSet.dMassDeadLoad);
loads.Add(ELoadCaseType.PartitionLCa.ToString(), ramSrfLoadPropSet.dPartitionLoad);

UniformLoadSet uniformLoadSet = new UniformLoadSet
{
Loads = loads
};

uniformLoadSet.Name = srfLoadPropSet.strLabel;
uniformLoadSet.Name = ramSrfLoadPropSet.strLabel;

// Unique RAM ID
uniformLoadSet.CustomData[AdapterIdName] = srfLoadPropSet.lUID;
uniformLoadSet.CustomData[AdapterIdName] = ramSrfLoadPropSet.lUID;

return uniformLoadSet;
}
Expand Down
20 changes: 10 additions & 10 deletions RAM_Adapter/Convert/ToRAM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ public static partial class Convert
//}
/***************************************************/

public static ILayoutBeam ToRAM(this Bar bar, ILayoutBeams ILayoutBeams)
public static ILayoutBeam ToRAM(this Bar bar, ILayoutBeams iLayoutBeams)
{
ILayoutBeam ILayoutBeam = ILayoutBeams.GetAt(0);
ILayoutBeam iLayoutBeam = iLayoutBeams.GetAt(0);

double xStart = bar.StartNode.Position().X;
double yStart = bar.StartNode.Position().Y;
Expand All @@ -57,21 +57,21 @@ public static ILayoutBeam ToRAM(this Bar bar, ILayoutBeams ILayoutBeams)

//Set support coordinates and name
//CAUTION: different from actual end points and cantilevers hardcoded
ILayoutBeam.SetLayoutCoordinates(xStart, yStart, 0, xEnd, yEnd, 0, 0, 0);
ILayoutBeam.strSectionLabel = bar.SectionProperty.Name;
iLayoutBeam.SetLayoutCoordinates(xStart, yStart, 0, xEnd, yEnd, 0, 0, 0);
iLayoutBeam.strSectionLabel = bar.SectionProperty.Name;

return ILayoutBeam;
return iLayoutBeam;
}

/***************************************************/

public static SCoordinate ToRAM(this Point point)
{
SCoordinate Point = new SCoordinate();
Point.dXLoc = point.X;
Point.dYLoc = point.Y;
Point.dZLoc = point.Z;
return Point;
SCoordinate pt = new SCoordinate();
pt.dXLoc = point.X;
pt.dYLoc = point.Y;
pt.dZLoc = point.Z;
return pt;
}

/***************************************************/
Expand Down
8 changes: 2 additions & 6 deletions RAM_Adapter/RAMAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ public partial class RAMAdapter : BHoMAdapter
/***************************************************/

//Add any applicable constructors here, such as linking to a specific file or anything else as well as linking to that file through the (if existing) com link via the API
public RAMAdapter(string filePath = "", bool Active = false)
public RAMAdapter(string filePath = "", bool active = false)
{

if (Active)
if (active)
{
AdapterIdName = BH.Adapter.RAM.Convert.AdapterIdName; //Set the "AdapterId" to "SoftwareName_id". Generally stored as a constant string in the convert class in the SoftwareName_Engine

Expand Down Expand Up @@ -139,7 +139,6 @@ public RAMAdapter(string filePath = "", bool Active = false)
}

m_filePath = filePath;

}
}
}
Expand All @@ -156,7 +155,6 @@ private bool OpenDatabase()
int loadOutput = m_IDBIO.LoadDataBase2(m_filePath, "BHoM_UI"); //if 0 successful

//check if data base is properly loaded

switch (loadOutput)
{
case 0:
Expand Down Expand Up @@ -193,13 +191,11 @@ private bool CloseDatabase()
}

m_IDBIO.CloseDatabase();

m_IDBIO = null;
m_Model = null;

// Delete usr file
System.IO.File.Delete(m_filePath.Replace(".rss", ".usr"));

return true;
}

Expand Down

0 comments on commit 589d305

Please sign in to comment.