Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added hanging columns and stub cantilevers and fixed slanted wall bug #92

Merged
merged 12 commits into from
Sep 13, 2019
83 changes: 75 additions & 8 deletions RAM_Adapter/CRUD/Create.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,71 @@ private bool CreateCollection(IEnumerable<Bar> bhomBars)
foreach (Bar bar in barBeams)
{
string name = bar.Name;
ILayoutBeam ramBeam;

try
{
IStory barStory = bar.GetStory(StructuralUsage1D.Beam, ramStories);

double xStart = bar.StartNode.Position().X;
double yStart = bar.StartNode.Position().Y;
IFloorType ramFloorType = barStory.GetFloorType();
ILayoutBeams ramBeams = ramFloorType.GetLayoutBeams();

double zStart = bar.StartNode.Position().Z - barStory.dElevation;
double xEnd = bar.EndNode.Position().X;
double yEnd = bar.EndNode.Position().Y;
double zEnd = bar.EndNode.Position().Z - barStory.dElevation;

IFloorType ramFloorType = barStory.GetFloorType();
ILayoutBeams ramBeams = ramFloorType.GetLayoutBeams();
ILayoutBeam ramBeam = ramBeams.Add(bar.SectionProperty.Material.ToRAM(), xStart, yStart, 0, xEnd, yEnd, 0); // No Z offsets, beams flat on closest story
// Get critical cant values
object isStubCant;
bar.CustomData.TryGetValue("IsStubCantilever", out isStubCant);
isStubCant = isStubCant == null ? "" : isStubCant.ToString();
object startCantObj;
object endCantObj;
bar.CustomData.TryGetValue("StartCantilever", out startCantObj);
bar.CustomData.TryGetValue("EndCantilever", out endCantObj);
double startCant, endCant;
double.TryParse(startCantObj == null ? "" : startCantObj.ToString(), out startCant);
double.TryParse(endCantObj == null ? "" : endCantObj.ToString(), out endCant);

if (isStubCant.Equals("True") || isStubCant.Equals("1")) //Check bool per RAM or GH preferred boolean context
{
Point startPt, endPt;
if (startCant > 0) // Ensure startPt corresponds with support point
{
startPt = bar.EndNode.Position();
endPt = bar.StartNode.Position();
}
else
{
startPt = bar.StartNode.Position();
endPt = bar.EndNode.Position();
}


double xStart = startPt.X;
double yStart = startPt.Y;
double xEnd = endPt.X;
double yEnd = endPt.Y;

ramBeam = ramBeams.AddStubCantilever(bar.SectionProperty.Material.ToRAM(), xStart, yStart, 0, xEnd, yEnd, 0); // No Z offsets, beams flat on closest story
}
else
{
// Get support points
Vector barDir = bar.Tangent(true);
Point startSupPt = BH.Engine.Geometry.Modify.Translate(bar.StartNode.Position(), barDir * startCant);
Point endSupPt = BH.Engine.Geometry.Modify.Translate(bar.EndNode.Position(), -barDir * endCant);

ramBeam = ramBeams.Add(bar.SectionProperty.Material.ToRAM(), startSupPt.X, startSupPt.Y, 0, endSupPt.X, endSupPt.Y, 0); // No Z offsets, beams flat on closest story
if (startSupPt.X < endSupPt.X || (startSupPt.X == endSupPt.X && startSupPt.Y>endSupPt.Y))
{
ramBeam.dStartCantilever = startCant;
ramBeam.dEndCantilever = endCant;
}
else
{
ramBeam.dStartCantilever = endCant;
ramBeam.dEndCantilever = startCant;
}
}

// Add warning to report distance of snapping to level as required for RAM
if (zStart != 0 || zEnd != 0)
Expand Down Expand Up @@ -150,8 +200,15 @@ private bool CreateCollection(IEnumerable<Bar> bhomBars)
IFloorType ramFloorType = barStory.GetFloorType();
ILayoutColumns ramColumns = ramFloorType.GetLayoutColumns();
ILayoutColumn ramColumn;
object isHanging;
bar.CustomData.TryGetValue("IsHangingColumn", out isHanging);
isHanging = isHanging == null ? "" : isHanging.ToString();

if (bar.IsVertical())
if (isHanging.Equals("True") || isHanging.Equals("1")) //Check bool per RAM or GH preferred boolean context
{
ramColumn = ramColumns.Add3(bar.SectionProperty.Material.ToRAM(), xBtm, yBtm, xTop, yTop, 0, 0, 1); //No Z offsets, cols start and end at stories
}
else if (bar.IsVertical())
{
//Failing if no section property is provided
ramColumn = ramColumns.Add(bar.SectionProperty.Material.ToRAM(), xTop, yTop, 0, 0); //No Z offsets, cols start and end at stories
Expand Down Expand Up @@ -384,9 +441,19 @@ private bool CreateCollection(IEnumerable<Panel> bhomPanels)

// Find outline of planar panel
PolyCurve outline = BH.Engine.Structure.Query.Outline(wallPanel);
List<Point> wallPts = outline.DiscontinuityPoints();
List<Point> sortedWallPts = wallPts.OrderBy(p => p.X).ToList();
Point leftPt = sortedWallPts.First();
Point rtPt = sortedWallPts.Last();
bool downToRight = leftPt.Y > rtPt.Y;

BoundingBox wallBounds = BH.Engine.Geometry.Query.Bounds(outline);
Point wallMin = wallBounds.Min;
Point wallMax = wallBounds.Max;
double tempY = wallMin.Y;

wallMin.Y = downToRight ? wallMax.Y : wallMin.Y;
wallMax.Y = downToRight ? tempY : wallMax.Y;

for (int i = 0; i < ramStories.GetCount(); i++)
{
Expand Down
1 change: 1 addition & 0 deletions RAM_Adapter/RAMAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public RAMAdapter(string filePath = "", bool Active = false)
//modify file path to ensure its validity
string filePathMod = filePath.Replace("\\\\", "\\");
filePathMod = filePathMod.Replace("\r\n", "");
filePathMod = filePathMod.Replace("RSS", "rss");
filePath = filePathMod;

//check if after modification file exists
Expand Down
256 changes: 0 additions & 256 deletions RAM_Adapter/RAMAdapter.cs~RF33317fd.TMP

This file was deleted.

Loading