Exemplo n.º 1
0
        protected override void OnAfterStart(DB.Document document, string strTransactionName)
        {
            base.OnAfterStart(document, strTransactionName);

            // Reset all previous beams joins
            if (PreviousStructure is object)
            {
                var beamsToUnjoin = PreviousStructure.OfType <Types.Element>().
                                    Select(x => document.GetElement(x)).
                                    OfType <DB.FamilyInstance>().
                                    Where(x => x.Pinned);

                foreach (var unjoinedBeam in beamsToUnjoin)
                {
                    if (DB.Structure.StructuralFramingUtils.IsJoinAllowedAtEnd(unjoinedBeam, 0))
                    {
                        DB.Structure.StructuralFramingUtils.DisallowJoinAtEnd(unjoinedBeam, 0);
                        DB.Structure.StructuralFramingUtils.AllowJoinAtEnd(unjoinedBeam, 0);
                    }

                    if (DB.Structure.StructuralFramingUtils.IsJoinAllowedAtEnd(unjoinedBeam, 1))
                    {
                        DB.Structure.StructuralFramingUtils.DisallowJoinAtEnd(unjoinedBeam, 1);
                        DB.Structure.StructuralFramingUtils.AllowJoinAtEnd(unjoinedBeam, 1);
                    }
                }
            }
        }
Exemplo n.º 2
0
        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);
                    }
                }
            }
        }
Exemplo n.º 3
0
        protected override void OnAfterStart(Document document, string strTransactionName)
        {
            base.OnAfterStart(document, strTransactionName);

            // Disable all previous walls joins
            if (PreviousStructure != null)
            {
                foreach
                (
                    var unjoinedWall in PreviousStructure.OfType <Types.Element>().
                    Select(x => document.GetElement(x)).
                    OfType <Wall>().
                    Where(x => x.Pinned)
                )
                {
                    WallUtils.DisallowWallJoinAtEnd(unjoinedWall, 0);
                    WallUtils.DisallowWallJoinAtEnd(unjoinedWall, 1);
                }

                document.Regenerate();
            }
        }