PathReinforcement createPathReinforcementWithHook(Document doc, Wall wall, XYZ point1, XYZ point2, ElementId hookId, bool face) { List <Curve> curves = new List <Curve>(); curves.Add(Line.CreateBound(point1, point2)); ElementId defaultRebarBarTypeId = doc.GetDefaultElementTypeId(ElementTypeGroup.RebarBarType); ElementId defaultPathReinforcementTypeId = doc.GetDefaultElementTypeId(ElementTypeGroup.PathReinforcementType); ElementId defaultHookTypeId = hookId; // Begin to create the path reinforcement PathReinforcement rein = PathReinforcement.Create(doc, wall, curves, true, defaultPathReinforcementTypeId, defaultRebarBarTypeId, defaultHookTypeId, defaultHookTypeId); if (null == rein) { throw new Exception("Create path reinforcement failed."); } IList <Parameter> pars = rein.GetOrderedParameters(); foreach (Parameter par in pars) { if (par.Id.ToString() == "-1018307") { par.SetValueString("500"); } if (par.Id.ToString() == "-1018301" & face) { par.Set(1); } if (par.Id.ToString() == "-1018302") { double var1 = Convert.ToDouble(Shared.hSpacing); double var2 = var1 + getThisValueInMeters(deltaInAxis, kA); par.SetValueString("400"); } } return(rein); }
PathReinforcement creatPathReinforcement(Document document, Wall wall, XYZ point1, XYZ point2, ElementId hookId, bool horizontal, bool last, double lastSpacing, bool face, double additionalSpaceForVerticalBars, double concreteSpace) { if (Shared.hSpacing == null) { Shared.hSpacing = "400"; } if (Shared.vSpacing == null) { Shared.vSpacing = "400"; } List <Curve> curves = new List <Curve>(); curves.Add(Line.CreateBound(point1, point2)); ElementId defaultRebarBarTypeId = document.GetDefaultElementTypeId(ElementTypeGroup.RebarBarType); ElementId defaultPathReinforcementTypeId = document.GetDefaultElementTypeId(ElementTypeGroup.PathReinforcementType); ElementId defaultHookTypeId = ElementId.InvalidElementId; if (hookId != null) { defaultHookTypeId = hookId; } PathReinforcement rein = PathReinforcement.Create(document, wall, curves, true, defaultPathReinforcementTypeId, defaultRebarBarTypeId, defaultHookTypeId, defaultHookTypeId); if (null == rein) { throw new Exception("Create path reinforcement failed."); } IList <Parameter> parameters = rein.GetOrderedParameters(); foreach (Parameter par in parameters) { if (par.Id.ToString() == "-1018301" & face) { par.Set(1); } if (par.Id.ToString() == "-1018302") { if (!last && horizontal) { par.SetValueString(Shared.hSpacing); } else if (!last && !horizontal) { par.SetValueString(Shared.vSpacing); } else { par.SetValueString(lastSpacing.ToString()); } } if (horizontal) { if (par.Id.ToString() == "-1018307") { par.SetValueString((getLengthOf(wall) - getThisValueInMeters(deltaInAxis * 2, kA)).ToString()); } } else { if (par.Id.ToString() == "-1018307") { par.SetValueString((getHeightOf(wall) + additionalSpaceForVerticalBars).ToString()); } } if (concreteSpace != 0) { if (par.Id.ToString() == "-1018307") { par.SetValueString(concreteSpace.ToString()); } } if (par.Id.ToString() == "-1018322") { par.SetValueString(Convert.ToString(getThisValueInMeters(deltaInAxis, kA)) + "mm"); } } return(rein); }