private bool[] getWallJoinEndStates(Wall _wall) { bool b0 = WallUtils.IsWallJoinAllowedAtEnd(_wall, 0); bool b1 = WallUtils.IsWallJoinAllowedAtEnd(_wall, 1); return(new bool[2] { b0, b1 }); }
public WallEndJoinCtrl(List <Wall> _walls) { this.walls = _walls; foreach (var w in _walls) { var j0 = WallUtils.IsWallJoinAllowedAtEnd(w, 0); var j1 = WallUtils.IsWallJoinAllowedAtEnd(w, 1); original[w.Id] = new bool[] { j0, j1 }; } }
protected override void OnAfterStart(Document document, string strTransactionName) { if (!run) { return; } base.OnAfterStart(document, strTransactionName); // Disable all previous walls joins if (PreviousStructure is object) { var unjoinedWalls = PreviousStructure.OfType <RhinoInside.Revit.GH.Types.Element>(). Select(x => x.Value). OfType <Wall>(). Where(x => x.Pinned). Select ( x => Tuple.Create ( x, (x.Location as LocationCurve).get_JoinType(0), (x.Location as LocationCurve).get_JoinType(1) ) ). ToArray(); foreach (var unjoinedWall in unjoinedWalls) { var location = unjoinedWall.Item1.Location as LocationCurve; if (WallUtils.IsWallJoinAllowedAtEnd(unjoinedWall.Item1, 0)) { WallUtils.DisallowWallJoinAtEnd(unjoinedWall.Item1, 0); WallUtils.AllowWallJoinAtEnd(unjoinedWall.Item1, 0); location.set_JoinType(0, unjoinedWall.Item2); } if (WallUtils.IsWallJoinAllowedAtEnd(unjoinedWall.Item1, 1)) { WallUtils.DisallowWallJoinAtEnd(unjoinedWall.Item1, 1); WallUtils.AllowWallJoinAtEnd(unjoinedWall.Item1, 1); location.set_JoinType(1, unjoinedWall.Item3); } } } }
/// <summary> /// Get wall's one end IsWallJoinAllowedAtEnd API method's result /// </summary> /// <param name="wall">The wall to be checked</param> /// <param name="end">The index indicates the start or end of this wall</param> /// <returns>The check result</returns> private XElement GetIsWallJoinAllowedAtEnd(Wall wall, int end) { return(new XElement("IsWallJoinAllowedAtEnd", new XAttribute("Value", WallUtils.IsWallJoinAllowedAtEnd(wall, end)))); }
// inputs: n=shape List <List <Wall> > Create_House_Shapes(Document doc, string n, bool a, bool b, bool c, bool d, double _heigth_) { //list walls output List <Wall> output_wall_Rigth = new List <Wall>(); List <Wall> output_wall_Left = new List <Wall>(); List <List <Wall> > output = new List <List <Wall> >(); //inputs //level Level level = GetLevel(doc, "Nivel 1"); // coord XYZ(x,y,z) XYZ stPoint = new XYZ(0, 0, 0); //Door & windows bool door_RightWall = a; bool wind_RigthWall = b; bool door_LeftWall = c; bool wind_LeftWall = d; Transaction trans = new Transaction(doc); trans.Start("Create House"); if (n == "square") { #region square //TaskDialog.Show("ALERTA", "--------------------------------------------------------------------------"); double heigth_double = _heigth_; // Crear Wall Primer XYZ endPoint = new XYZ(30, 0, 0); XYZ endPoint_2 = new XYZ(30, 30, 0); XYZ endPoint_3 = new XYZ(0, 30, 0); Line newLineN = Line.CreateBound(stPoint, endPoint); Line newLineN_2 = Line.CreateBound(endPoint, endPoint_2); Line newLineN_3 = Line.CreateBound(endPoint_2, endPoint_3); Line newLineN_4 = Line.CreateBound(endPoint_3, stPoint); Wall wall = Wall.Create(doc, newLineN, level.Id, false); Wall wall_2 = Wall.Create(doc, newLineN_2, level.Id, false); Wall wall_3 = Wall.Create(doc, newLineN_3, level.Id, false); Wall wall_4 = Wall.Create(doc, newLineN_4, level.Id, false); List <Wall> lista_walls = new List <Wall>(); lista_walls.Add(wall); lista_walls.Add(wall_2); lista_walls.Add(wall_3); lista_walls.Add(wall_4); output_wall_Rigth.Add(wall_2); output_wall_Rigth.Add(wall_4); output_wall_Left.Add(wall); output_wall_Left.Add(wall_3); output.Add(output_wall_Rigth); output.Add(output_wall_Left); foreach (Wall e in lista_walls) { Parameter height = e.get_Parameter(BuiltInParameter.WALL_USER_HEIGHT_PARAM); if (!height.IsReadOnly) { height.Set(heigth_double); } if (WallUtils.IsWallJoinAllowedAtEnd(e, 1)) { WallUtils.DisallowWallJoinAtEnd(e, 1); } if (WallUtils.IsWallJoinAllowedAtEnd(e, 0)) { WallUtils.DisallowWallJoinAtEnd(e, 0); } } #endregion } else if (n == "rectangle") { #region rectangle double heigth_double = _heigth_; // Crear Wall Primer XYZ endPoint = new XYZ(20, 0, 0); XYZ endPoint_2 = new XYZ(20, 10, 0); XYZ endPoint_3 = new XYZ(0, 10, 0); Line newLineN = Line.CreateBound(stPoint, endPoint); Line newLineN_2 = Line.CreateBound(endPoint, endPoint_2); Line newLineN_3 = Line.CreateBound(endPoint_2, endPoint_3); Line newLineN_4 = Line.CreateBound(endPoint_3, stPoint); Wall wall = Wall.Create(doc, newLineN, level.Id, false); Wall wall_2 = Wall.Create(doc, newLineN_2, level.Id, false); Wall wall_3 = Wall.Create(doc, newLineN_3, level.Id, false); Wall wall_4 = Wall.Create(doc, newLineN_4, level.Id, false); List <Wall> lista_walls = new List <Wall>(); lista_walls.Add(wall); lista_walls.Add(wall_2); lista_walls.Add(wall_3); lista_walls.Add(wall_4); output_wall_Rigth.Add(wall_2); output_wall_Rigth.Add(wall_4); output_wall_Left.Add(wall); output_wall_Left.Add(wall_3); output.Add(output_wall_Rigth); output.Add(output_wall_Left); foreach (Wall e in lista_walls) { Parameter height = e.get_Parameter(BuiltInParameter.WALL_USER_HEIGHT_PARAM); if (!height.IsReadOnly) { height.Set(heigth_double); } if (WallUtils.IsWallJoinAllowedAtEnd(e, 1)) { WallUtils.DisallowWallJoinAtEnd(e, 1); } if (WallUtils.IsWallJoinAllowedAtEnd(e, 0)) { WallUtils.DisallowWallJoinAtEnd(e, 0); } } #endregion } else if (n == "triangle") { #region triangle double heigth_double = _heigth_; // Crear Wall Primer XYZ endPoint = new XYZ(20, 0, 0); XYZ endPoint_2 = new XYZ(10, 10 * 1.7320508075, 0); Line newLineN = Line.CreateBound(stPoint, endPoint); Line newLineN_2 = Line.CreateBound(endPoint, endPoint_2); Line newLineN_3 = Line.CreateBound(endPoint_2, stPoint); Wall wall = Wall.Create(doc, newLineN, level.Id, false); Wall wall_2 = Wall.Create(doc, newLineN_2, level.Id, false); Wall wall_3 = Wall.Create(doc, newLineN_3, level.Id, false); List <Wall> lista_walls = new List <Wall>(); lista_walls.Add(wall); lista_walls.Add(wall_2); lista_walls.Add(wall_3); output_wall_Rigth.Add(wall); output_wall_Rigth.Add(wall_2); output_wall_Rigth.Add(wall_3); output.Add(output_wall_Rigth); foreach (Wall e in lista_walls) { Parameter height = e.get_Parameter(BuiltInParameter.WALL_USER_HEIGHT_PARAM); if (!height.IsReadOnly) { height.Set(heigth_double); } if (WallUtils.IsWallJoinAllowedAtEnd(e, 1)) { WallUtils.DisallowWallJoinAtEnd(e, 1); } if (WallUtils.IsWallJoinAllowedAtEnd(e, 0)) { WallUtils.DisallowWallJoinAtEnd(e, 0); } } #endregion } trans.Commit(); return(output); }