Beispiel #1
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIDocument uidoc = commandData.Application.ActiveUIDocument;
            Document   doc   = uidoc.Document;

            if ((uidoc.ActiveView as View3D) == null)
            {
                message = "Por favor, rode este comando em uma vista 3d";
                return(Result.Failed);
            }


            ISelectionFilter ridgeSelectionFilter = new RoofClasses.SelectionFilters.StraightLinesAndFacesRidgeSelectionFilter(doc);
            Reference        currentReference     = uidoc.Selection.PickObject(ObjectType.Edge, ridgeSelectionFilter);

            FootPrintRoof currentFootPrintRoof = doc.GetElement(currentReference) as FootPrintRoof;
            Edge          edge = Support.GetEdgeFromReference(currentReference, currentFootPrintRoof);

            IList <PlanarFace> pfaces = new List <PlanarFace>();

            Support.IsListOfPlanarFaces(HostObjectUtils.GetBottomFaces(currentFootPrintRoof)
                                        , currentFootPrintRoof, out pfaces);

            IList <RoofClasses.EdgeInfo> currentEdgeInfoList = Support.GetRoofEdgeInfoList(currentFootPrintRoof, false);
            Curve currentCurve = Support.GetMostSimilarCurve(edge.AsCurve(), currentEdgeInfoList);

            RoofClasses.EdgeInfo currentInfo = Support.GetCurveInformation(currentFootPrintRoof, currentCurve, pfaces);
            TaskDialog.Show("fac", currentInfo.RoofLineType.ToString());

            Element tTypeElement = new FilteredElementCollector(doc).OfClass(typeof(FamilySymbol)).Where(fsy => fsy is TrussType).ToList().FirstOrDefault();

            if (tTypeElement == null)
            {
                message = "Nenhum tipo de treliça foi encontrada no projeto, por favor, carregue um tipo e rode este comando novamente";
                return(Result.Failed);
            }

            TrussType tType = tTypeElement as TrussType;

            Managers.TrussRidgeManager    currentTrussManager  = new Managers.TrussRidgeManager();
            IList <RoofClasses.TrussInfo> currentTrussInfoList = currentTrussManager.CreateTrussesFromRidgeInfo(currentInfo, tType);

            TaskDialog tDialog = new TaskDialog("Trusses");

            tDialog.MainInstruction = currentTrussInfoList.Count.ToString();
            tDialog.Show();

            return(Result.Succeeded);
        }
Beispiel #2
0
        static internal EdgeInfo GetMostSimilarEdgeInfo(Reference currentReference, Document targetDoc)
        {
            FootPrintRoof currentFootPrintRoof = targetDoc.GetElement(currentReference) as FootPrintRoof;
            Edge          edge = Support.GetEdgeFromReference(currentReference, currentFootPrintRoof);

            IList <PlanarFace> pfaces = new List <PlanarFace>();

            Support.IsListOfPlanarFaces(HostObjectUtils.GetBottomFaces(currentFootPrintRoof)
                                        , currentFootPrintRoof, out pfaces);

            IList <RoofClasses.EdgeInfo> currentEdgeInfoList = GetRoofEdgeInfoList(currentFootPrintRoof, false);

            Curve currentCurve = GetMostSimilarCurve(edge.AsCurve(), currentEdgeInfoList);

            RoofClasses.EdgeInfo currentRidgeInfo = GetCurveInformation(currentFootPrintRoof, currentCurve, pfaces);

            return(currentRidgeInfo);
        }
Beispiel #3
0
            public bool AllowReference(Reference reference, XYZ position)
            {
                if (doc == null)
                {
                    return(false);
                }

                Element currentFootPrintElem = doc.GetElement(reference);

                if (currentFootPrintElem == null)
                {
                    return(false);
                }

                FootPrintRoof currentFootPrintRoof = currentFootPrintElem as FootPrintRoof;

                if (currentFootPrintRoof == null)
                {
                    return(false);
                }

                Edge currentEdge = Support.GetEdgeFromReference(reference, currentFootPrintRoof);

                IList <PlanarFace> pfaces = new List <PlanarFace>();

                Support.IsListOfPlanarFaces(HostObjectUtils.GetTopFaces(currentFootPrintRoof), currentFootPrintRoof, out pfaces);

                EdgeInfo currentInfo = Support.GetCurveInformation(currentFootPrintRoof, currentEdge.AsCurve(), pfaces);

                System.Diagnostics.Debug.WriteLine(currentInfo.RoofLineType.ToString());

                if (currentInfo.RoofLineType != RoofLineType.Ridge && currentInfo.RoofLineType != RoofLineType.RidgeSinglePanel)
                {
                    return(false);
                }

                return(true);
            }
Beispiel #4
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIDocument uidoc = commandData.Application.ActiveUIDocument;
            Document   doc   = uidoc.Document;

            if ((uidoc.ActiveView as View3D) == null)
            {
                message = "Por favor, rode este comando em uma vista 3d";
                return(Result.Failed);
            }

            Reference     currentReference     = uidoc.Selection.PickObject(ObjectType.Edge);
            FootPrintRoof currentFootPrintRoof = doc.GetElement(currentReference.ElementId) as FootPrintRoof;
            Edge          edge = currentFootPrintRoof.GetGeometryObjectFromReference(currentReference) as Edge;

            IList <PlanarFace> pfaces = new List <PlanarFace>();

            Support.IsListOfPlanarFaces(HostObjectUtils.GetBottomFaces(currentFootPrintRoof).Union(HostObjectUtils.GetTopFaces(currentFootPrintRoof)).ToList()
                                        , currentFootPrintRoof, out pfaces);

            RoofClasses.EdgeInfo currentInfo = Support.GetCurveInformation(currentFootPrintRoof, edge.AsCurve(), pfaces);

            using (Transaction t = new Transaction(doc, "Test"))
            {
                t.Start();

                FamilySymbol fs = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_GenericModel).WhereElementIsElementType().Where(type => type.Name.Contains("DebugPoint")).FirstOrDefault() as FamilySymbol;
                fs.Activate();
                doc.Create.NewFamilyInstance((currentInfo.Curve as Line).Direction, fs, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
                doc.Create.NewFamilyInstance(((currentInfo.Curve as Line).Direction).Rotate(-90), fs, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
                doc.Create.NewFamilyInstance(((currentInfo.Curve as Line).Direction).Rotate(45), fs, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
                t.Commit();
            }

            return(Result.Succeeded);
        }
Beispiel #5
0
        static public TrussInfo BuildTrussAtRidge(XYZ currentPointOnRidge, EdgeInfo currentEdgeInfo, IList <XYZ> currentSupportPoints)
        {
            TrussInfo trussInfo = null;

            XYZ currentTopPoint = currentEdgeInfo.GetTrussTopPoint(currentPointOnRidge);

            //If we cant get the point that means that the projection failed
            if (currentTopPoint == null)
            {
                return(trussInfo);
            }

            if (currentSupportPoints == null || currentSupportPoints.Count == 0)
            {
                currentSupportPoints = currentEdgeInfo.ProjectSupportPointsOnRoof(currentPointOnRidge);
            }

            if (currentSupportPoints.Count == 0)
            {
                if (currentEdgeInfo.RoofLineType != RoofLineType.Ridge)
                {
                    return(trussInfo);
                }

                IList <EdgeInfo> endConditionList = currentEdgeInfo.GetEndConditions(1);

                if (endConditionList.Count != 2)
                {
                    return(trussInfo);
                }

                EdgeInfo edge0 = endConditionList[0];
                EdgeInfo edge1 = endConditionList[1];

                if ((edge0.RoofLineType != RoofLineType.Valley && edge0.RoofLineType != RoofLineType.Gable) ||
                    edge1.RoofLineType != RoofLineType.Valley && edge1.RoofLineType != RoofLineType.Gable)
                {
                    return(trussInfo);
                }

                Line line0 = edge0.Curve as Line;
                Line line1 = edge1.Curve as Line;

                if (line0 == null || line1 == null)
                {
                    return(trussInfo);
                }

                double height = currentEdgeInfo.GetCurrentRoofHeight();

                Line currentRigeLine  = currentEdgeInfo.Curve as Line;
                XYZ  rigePointFlatten = new XYZ(currentTopPoint.X, currentTopPoint.Y, height);
                XYZ  intersectingPointValleyOrGable0 = GeometrySupport.GetRoofIntersectionFlattenLines(currentRigeLine, currentTopPoint, line0, height);
                XYZ  intersectingPointValleyOrGable1 = GeometrySupport.GetRoofIntersectionFlattenLines(currentRigeLine, currentTopPoint, line1, height);

                if (intersectingPointValleyOrGable0 == null || intersectingPointValleyOrGable1 == null)
                {
                    return(trussInfo);
                }

                //TODO Change this to the double of max distance between Trusses
                double maxDistance   = 20;
                XYZ    supportPoint0 = currentEdgeInfo.GetSupportPoint(intersectingPointValleyOrGable0, currentRigeLine.Direction, maxDistance);
                XYZ    supportPoint1 = currentEdgeInfo.GetSupportPoint(intersectingPointValleyOrGable1, currentRigeLine.Direction, maxDistance);

                if (supportPoint0 == null || supportPoint1 == null)
                {
                    return(trussInfo);
                }

                currentTopPoint = GeometrySupport.AdjustTopPointToRoofAngle(currentTopPoint, new List <XYZ> {
                    supportPoint0, supportPoint1
                }, currentEdgeInfo);
                trussInfo = GeometrySupport.GetTrussInfo(currentTopPoint, supportPoint0, supportPoint1);

                if (trussInfo == null)
                {
                    return(trussInfo);
                }

                return(trussInfo);
            }
            else if (currentSupportPoints.Count == 1)
            {
                if (currentEdgeInfo.RoofLineType != RoofLineType.RidgeSinglePanel)
                {
                    return(trussInfo);
                }

                XYZ projectedPointOnEave  = currentSupportPoints[0];
                XYZ projectedPointOnRidge = new XYZ(currentTopPoint.X, currentTopPoint.Y, projectedPointOnEave.Z);

                currentTopPoint = GeometrySupport.AdjustTopPointToRoofAngle(currentTopPoint, new List <XYZ> {
                    projectedPointOnEave
                }, currentEdgeInfo);
                double height = currentTopPoint.DistanceTo(projectedPointOnRidge);

                trussInfo = new TrussInfo(projectedPointOnEave, projectedPointOnRidge, height);
                trussInfo.TopChords.Append(Line.CreateBound(currentTopPoint, projectedPointOnEave));
                trussInfo.BottomChords.Append(Line.CreateBound(projectedPointOnRidge, projectedPointOnEave));
                //Document doc = CurrentRoof.Document;
                //FamilySymbol fs = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_GenericModel).WhereElementIsElementType().Where(type => type.Name.Contains("DebugPoint2")).FirstOrDefault() as FamilySymbol;
                //doc.Create.NewFamilyInstance(projectedPointOnEave, fs, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
                //doc.Create.NewFamilyInstance(projectedPointOnRidge, fs, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
                //doc.Create.NewFamilyInstance(currentTopPoint, fs, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);

                return(trussInfo);
            }
            else if (currentSupportPoints.Count == 2)
            {
                if (currentEdgeInfo.RoofLineType != RoofLineType.Ridge)
                {
                    return(trussInfo);
                }

                XYZ firstPointOnEave  = currentSupportPoints[0];
                XYZ secondPointOnEave = currentSupportPoints[1];

                if (firstPointOnEave == null || secondPointOnEave == null)
                {
                    return(trussInfo);
                }

                currentTopPoint = GeometrySupport.AdjustTopPointToRoofAngle(currentTopPoint, new List <XYZ> {
                    firstPointOnEave, secondPointOnEave
                }, currentEdgeInfo);
                trussInfo = GeometrySupport.GetTrussInfo(currentTopPoint, firstPointOnEave, secondPointOnEave);

                if (trussInfo == null)
                {
                    return(trussInfo);
                }
                //Document doc = CurrentRoof.Document;
                //FamilySymbol fs = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_GenericModel).WhereElementIsElementType().Where(type => type.Name.Contains("DebugPoint2")).FirstOrDefault() as FamilySymbol;
                //doc.Create.NewFamilyInstance(firstPointOnEave, fs, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
                //doc.Create.NewFamilyInstance(secondPointOnEave, fs, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
                //doc.Create.NewFamilyInstance(currentTopPoint, fs, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);

                return(trussInfo);
            }

            return(trussInfo);
        }
Beispiel #6
0
        static public TrussInfo BuildTrussAtHip(XYZ currentPointOnHip, EdgeInfo currentEdgeInfo, Element firstSupport, Element secondSupport)
        {
            TrussInfo trussInfoToReturn = null;

            if (!(firstSupport.Location is LocationCurve) || !(secondSupport.Location is LocationCurve))
            {
                return(trussInfoToReturn);
            }

            Line hipLine = currentEdgeInfo.Curve as Line;
            Line firstSupportLocationLine  = (firstSupport.Location as LocationCurve).Curve as Line;
            Line secondSupportLocationLine = (secondSupport.Location as LocationCurve).Curve as Line;

            if (firstSupportLocationLine == null || secondSupportLocationLine == null || hipLine == null)
            {
                return(trussInfoToReturn);
            }


            //Relocate the placement of the truss to the center of the Hip subtracting the intersection of the supports
            XYZ intersectiongOfSupports = firstSupportLocationLine.GetFlattenIntersection(secondSupportLocationLine);

            if (intersectiongOfSupports == null)
            {
                return(trussInfoToReturn);
            }

            XYZ higherHipPoint = currentEdgeInfo.Curve.GetEndPoint(0);
            XYZ lowerHipPoint  = currentEdgeInfo.Curve.GetEndPoint(1);

            if (higherHipPoint.Z < lowerHipPoint.Z)
            {
                higherHipPoint = lowerHipPoint;
            }

            Line newHipLine = Line.CreateBound(higherHipPoint, intersectiongOfSupports).Flatten();

            //TODO get this offset by the UI, if no offset is applied, the trusses from two hips will collide
            double TRUSS_HIP_OFFSET     = Utils.Utils.ConvertM.cmToFeet(15);
            double centerParameter      = newHipLine.ComputeRawParameter(0.5);
            XYZ    newLineTrussPosition = newHipLine.Evaluate(centerParameter + TRUSS_HIP_OFFSET, false);

            //DEBUG.CreateDebugPoint(currentEdgeInfo.CurrentRoof.Document, newLineTrussPosition);

            IntersectionResultArray iResultArr = null;

            currentEdgeInfo.Curve.Intersect(Line.CreateUnbound(newLineTrussPosition, XYZ.BasisZ), out iResultArr);

            if (iResultArr == null || iResultArr.Size < 1)
            {
                return(trussInfoToReturn);
            }

            currentPointOnHip = iResultArr.get_Item(0).XYZPoint;
            //DEBUG.CreateDebugPoint(currentEdgeInfo.CurrentRoof.Document, currentPointOnHip);
            ///////////////////////


            Line currentPointCrossLine = Line.CreateBound(currentPointOnHip, currentPointOnHip.Add(hipLine.Flatten().Direction.CrossProduct(XYZ.BasisZ)));

            //DEBUG.CreateDebugFlattenLine(currentEdgeInfo.CurrentRoof.Document, currentPointCrossLine);
            //DEBUG.CreateDebugFlattenLine(currentEdgeInfo.CurrentRoof.Document, firstSupportLocationLine);
            //DEBUG.CreateDebugFlattenLine(currentEdgeInfo.CurrentRoof.Document, secondSupportLocationLine);

            XYZ firstSupportPoint  = currentPointCrossLine.GetFlattenIntersection(firstSupportLocationLine, true, false);
            XYZ secondSupportPoint = currentPointCrossLine.GetFlattenIntersection(secondSupportLocationLine, true, false);

            if (firstSupportPoint == null || secondSupportPoint == null)
            {
                return(trussInfoToReturn);
            }

            double roofHeight = currentEdgeInfo.GetCurrentRoofHeight();

            firstSupportPoint  = new XYZ(firstSupportPoint.X, firstSupportPoint.Y, roofHeight);
            secondSupportPoint = new XYZ(secondSupportPoint.X, secondSupportPoint.Y, roofHeight);
            //DEBUG.CreateDebugPoint(currentEdgeInfo.CurrentRoof.Document, firstSupportPoint);
            //DEBUG.CreateDebugPoint(currentEdgeInfo.CurrentRoof.Document, secondSupportPoint);
            if (currentEdgeInfo.RoofLineType != RoofLineType.Hip)
            {
                return(trussInfoToReturn);
            }

            // currentTopPoint = GeometrySupport.AdjustTopPointToRoofAngle(currentTopPoint, new List<XYZ> { firstPointOnEave, secondPointOnEave }, currentEdgeInfo);
            trussInfoToReturn = GeometrySupport.GetTrussInfo(currentPointOnHip, firstSupportPoint, secondSupportPoint);

            return(trussInfoToReturn);
        }
Beispiel #7
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIDocument uidoc = commandData.Application.ActiveUIDocument;
            Document   doc   = uidoc.Document;
            Selection  sel   = uidoc.Selection;

            try
            {
                Element tTypeElement = new FilteredElementCollector(doc).OfClass(typeof(FamilySymbol)).Where(fsy => fsy is TrussType).ToList().FirstOrDefault();
                if (tTypeElement == null)
                {
                    message = "Nenhum tipo de treliça foi encontrada no projeto, por favor, carregue um tipo e rode este comando novamente";
                    return(Result.Failed);
                }
                TrussType tType = tTypeElement as TrussType;

                ISelectionFilter ridgeSelectionFilter = new RoofClasses.SelectionFilters.StraightLinesAndFacesRidgeSelectionFilter(doc);
                Reference        currentReference     = sel.PickObject(ObjectType.Edge, ridgeSelectionFilter);

                FootPrintRoof        currentFootPrintRoof = doc.GetElement(currentReference) as FootPrintRoof;
                RoofClasses.EdgeInfo currentRidgeInfo     = Support.GetMostSimilarEdgeInfo(currentReference, doc);

                if (currentRidgeInfo == null)
                {
                    message = "Nenhuma linha inferior pode ser obtida a partir da seleção";
                    return(Result.Failed);
                }

                //                #region DEBUG ONLY
                //#if DEBUG
                //                using (Transaction ta = new Transaction(doc, "Line test"))
                //                {
                //                    ta.Start();

                //                    Frame fr = new Frame(currentRidgeInfo.Curve.Evaluate(0.5, true), XYZ.BasisX, XYZ.BasisY, XYZ.BasisZ);
                //                    SketchPlane skp = SketchPlane.Create(doc, Plane.Create(fr));
                //                    doc.Create.NewModelCurve(currentRidgeInfo.Curve, skp);


                //                    ta.Commit();
                //                }
                //#endif
                //                #endregion

                Line currentRidgeLine = currentRidgeInfo.Curve as Line;

                if (currentRidgeLine == null)
                {
                    message = "Ridge must be a straight line";
                    return(Result.Failed);
                }

                ISelectionFilter currentTrussBaseSupportFilter = new RoofClasses.SelectionFilters.SupportsSelectionFilter(currentRidgeLine.Direction.CrossProduct(XYZ.BasisZ));
                XYZ baseSupportPoint = null;
                try
                {
                    Reference currentTrussBaseRef  = sel.PickObject(ObjectType.Element, currentTrussBaseSupportFilter, "Selecione uma base para a treliça ou (ESC) para ignorar");
                    Element   currentTrussBaseElem = doc.GetElement(currentTrussBaseRef.ElementId);

                    //We can safely convert because the selection filter does not select anything that is not a curve locatated
                    Curve currentElementCurve = (currentTrussBaseElem.Location as LocationCurve).Curve;

                    if (currentRidgeLine != null)
                    {
                        if (currentElementCurve is Line)
                        {
                            Line   currentSupportLine = currentElementCurve as Line;
                            double height             = currentRidgeInfo.GetCurrentRoofHeight();
                            currentRidgeLine   = currentRidgeLine.Flatten(height);
                            currentSupportLine = currentSupportLine.Flatten(height);

                            IntersectionResultArray iResutArr  = new IntersectionResultArray();
                            SetComparisonResult     compResult = currentRidgeLine.Intersect(currentSupportLine, out iResutArr);

                            if (iResutArr.Size == 1)
                            {
                                IntersectionResult iResult = iResutArr.get_Item(0);
                                if (iResult != null)
                                {
                                    baseSupportPoint = currentRidgeInfo.Curve.Project(iResult.XYZPoint).XYZPoint;
                                }
                            }
                        }
                    }
                }
                catch
                {
                }

                if (baseSupportPoint == null)
                {
                    baseSupportPoint = currentRidgeLine.Project(currentReference.GlobalPoint).XYZPoint;
                }


                Managers.TrussRidgeManager currentTrussManager = new Managers.TrussRidgeManager();

                Line currentSupport0ElemLine = null;
                Line currentSupport1ElemLine = null;

                currentTrussBaseSupportFilter = new RoofClasses.SelectionFilters.SupportsSelectionFilter(currentRidgeLine.Direction);

                if (currentRidgeInfo.RoofLineType == RoofClasses.RoofLineType.Ridge)
                {
                    try
                    {
                        Reference currentSupport0Ref       = sel.PickObject(ObjectType.Element, currentTrussBaseSupportFilter, "O primeiro suporte para a treliça");
                        Element   currentSupport0Elem      = doc.GetElement(currentSupport0Ref.ElementId);
                        Curve     currentSupport0ElemCurve = (currentSupport0Elem.Location as LocationCurve).Curve;
                        currentSupport0ElemLine = currentSupport0ElemCurve as Line;

                        Reference currentSupport1Ref       = sel.PickObject(ObjectType.Element, currentTrussBaseSupportFilter, "O segundo suporte para a treliça");
                        Element   currentSupport1Elem      = doc.GetElement(currentSupport1Ref.ElementId);
                        Curve     currentSupport1ElemCurve = (currentSupport1Elem.Location as LocationCurve).Curve;
                        currentSupport1ElemLine = currentSupport1ElemCurve as Line;
                    }
                    catch
                    {
                        currentSupport0ElemLine = null;
                        currentSupport1ElemLine = null;
                    }
                }
                else if (currentRidgeInfo.RoofLineType == RoofClasses.RoofLineType.RidgeSinglePanel)
                {
                    try
                    {
                        Reference currentSupport0Ref       = sel.PickObject(ObjectType.Element, currentTrussBaseSupportFilter, "O suporte para a treliça");
                        Element   currentSupport0Elem      = doc.GetElement(currentSupport0Ref.ElementId);
                        Curve     currentSupport0ElemCurve = (currentSupport0Elem.Location as LocationCurve).Curve;
                        currentSupport0ElemLine = currentSupport0ElemCurve as Line;
                    }
                    catch
                    {
                        currentSupport0ElemLine = null;
                    }
                }

                RoofClasses.TrussInfo currentTrussInfo = currentTrussManager.CreateTrussFromRidgeWithSupports(baseSupportPoint, currentRidgeInfo, tType, currentSupport0ElemLine, currentSupport1ElemLine);

                //#region DEBUG ONLY

                //if (currentReference != null)
                //    DEBUG.CreateDebugPoint(doc, baseSupportPoint);

                //#endregion
            }
            catch (Exception e)
            {
                if (!(e is Autodesk.Revit.Exceptions.OperationCanceledException))
                {
                    throw e;
                }
            }

            return(Result.Succeeded);
        }
Beispiel #8
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIDocument uidoc = commandData.Application.ActiveUIDocument;
            Document   doc   = uidoc.Document;
            Selection  sel   = uidoc.Selection;

            ISelectionFilter hipSelFilter  = new RoofClasses.SelectionFilters.StraightLinesAndFacesHipSelectionFilter(doc);
            Reference        currentHipRef = sel.PickObject(ObjectType.Edge, hipSelFilter, "Selecione um rincão para posicionar as treliças");

            RoofClasses.EdgeInfo currentEdgeInfo = Support.GetMostSimilarEdgeInfo(currentHipRef, doc);

            //if (currentHipRef.GlobalPoint != null)
            //    DEBUG.CreateDebugPoint(doc, currentHipRef.GlobalPoint);

            //DEBUG.CreateDebugPoint(doc, currentEdgeInfo.Curve.Evaluate(0.5, true));

            if (currentEdgeInfo == null)
            {
                message = "Nenhuma linha inferior pode ser obtida a partir da seleção";
                return(Result.Failed);
            }

            if (currentEdgeInfo.Curve as Line == null)
            {
                message = "Rincão deve ser uma linha reta";
                return(Result.Failed);
            }

            Line             currentHipLine      = currentEdgeInfo.Curve as Line;
            ISelectionFilter firstSupportFilter  = new RoofClasses.SelectionFilters.SupportsSelectionFilter(currentHipLine.Flatten().Direction.Rotate(45));
            ISelectionFilter secondSupportFilter = new RoofClasses.SelectionFilters.SupportsSelectionFilter(currentHipLine.Flatten().Direction.Rotate(-45));
            Element          firstSupport        = null;
            Element          secondSupport       = null;

            try
            {
                Reference firstSupportRef  = sel.PickObject(ObjectType.Element, firstSupportFilter);
                Reference SecondSupportRef = sel.PickObject(ObjectType.Element, secondSupportFilter);

                firstSupport  = doc.GetElement(firstSupportRef);
                secondSupport = doc.GetElement(SecondSupportRef);
            }
            catch
            {
            }

            if (firstSupport == null || secondSupport == null)
            {
                message = "Nenhum suporte foi selecionado";
                return(Result.Failed);
            }

            Element tTypeElement = new FilteredElementCollector(doc).OfClass(typeof(FamilySymbol)).Where(fsy => fsy is TrussType).ToList().FirstOrDefault();

            if (tTypeElement == null)
            {
                message = "Nenhum tipo de treliça foi encontrada no projeto, por favor, carregue um tipo e rode este comando novamente";
                return(Result.Failed);
            }
            TrussType tType = tTypeElement as TrussType;

            Managers.TrussHipManager trussHipManager = new Managers.TrussHipManager();
            trussHipManager.CreateTrussInfo(doc, currentHipLine.Evaluate(0.5, true), currentEdgeInfo, firstSupport, secondSupport, tType);

            return(Result.Succeeded);
        }