Exemplo n.º 1
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Rhino.Geometry.Curve axis = null;
            DA.GetData("Axis", ref axis);

            WallType wallType = null;

            if (!DA.GetData("Type", ref wallType) && Params.Input[1].Sources.Count == 0)
            {
                wallType = Revit.ActiveDBDocument.GetElement(Revit.ActiveDBDocument.GetDefaultElementTypeId(ElementTypeGroup.WallType)) as WallType;
            }

            Autodesk.Revit.DB.Level level = null;
            DA.GetData("Level", ref level);
            if (level == null && axis != null)
            {
                level = Revit.ActiveDBDocument.FindLevelByElevation(axis.PointAtStart.Z / Revit.ModelUnits);
            }

            bool structural = true;

            DA.GetData("Structural", ref structural);

            double height = 0.0;

            if (!DA.GetData("Height", ref height))
            {
                height = LiteralLengthValue(3.0);
            }

            DA.DisableGapLogic();
            int Iteration = DA.Iteration;

            Revit.EnqueueAction((doc) => CommitInstance(doc, DA, Iteration, axis, wallType, level, structural, height));
        }
Exemplo n.º 2
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Rhino.Geometry.Curve axis = null;
            DA.GetData("Axis", ref axis);

            FamilySymbol familySymbol = null;

            if (!DA.GetData("Type", ref familySymbol) && Params.Input[1].Sources.Count == 0)
            {
                familySymbol = Revit.ActiveDBDocument.GetElement(Revit.ActiveDBDocument.GetDefaultFamilyTypeId(new ElementId(BuiltInCategory.OST_StructuralFraming))) as FamilySymbol;
            }

            if (familySymbol == null)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, string.Format("Parameter '{0}' There is no default structural framing family loaded.", Params.Input[1].Name));
                DA.AbortComponentSolution();
                return;
            }

            if (!familySymbol.IsActive)
            {
                familySymbol.Activate();
            }

            Autodesk.Revit.DB.Level level = null;
            DA.GetData("Level", ref level);

            DA.DisableGapLogic();
            int Iteration = DA.Iteration;

            Revit.EnqueueAction((doc) => CommitInstance(doc, DA, Iteration, axis, familySymbol, level));
        }
Exemplo n.º 3
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            var location = new Rhino.Geometry.Plane(new Rhino.Geometry.Point3d(double.NaN, double.NaN, double.NaN), new Rhino.Geometry.Vector3d(double.NaN, double.NaN, double.NaN));

            DA.GetData("Position", ref location);

            FamilySymbol familySymbol = null;

            DA.GetData("Type", ref familySymbol);

            Autodesk.Revit.DB.Level level = null;
            DA.GetData("Level", ref level);
            if (level == null)
            {
                level = Revit.ActiveDBDocument.FindLevelByElevation(location.Origin.Z / Revit.ModelUnits);
            }

            Autodesk.Revit.DB.HostObject host = null;
            DA.GetData("Host", ref host);

            DA.DisableGapLogic();
            int Iteration = DA.Iteration;

            Revit.EnqueueAction((doc) => CommitInstance(doc, DA, Iteration, location, familySymbol, host, level));
        }
Exemplo n.º 4
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Rhino.Geometry.Curve axis = null;
            DA.GetData("Axis", ref axis);

            FamilySymbol familySymbol = null;

            if (!DA.GetData("FamilyType", ref familySymbol) && Params.Input[1].Sources.Count == 0)
            {
                familySymbol = Revit.ActiveDBDocument.GetElement(Revit.ActiveDBDocument.GetDefaultFamilyTypeId(new ElementId(BuiltInCategory.OST_StructuralFraming))) as FamilySymbol;
            }

            if (!familySymbol.IsActive)
            {
                familySymbol.Activate();
            }

            Autodesk.Revit.DB.Level level = null;
            DA.GetData("Level", ref level);

            DA.DisableGapLogic();
            int Iteration = DA.Iteration;

            Revit.EnqueueAction((doc) => CommitInstance(doc, DA, Iteration, axis, familySymbol, level));
        }
Exemplo n.º 5
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            var boundaries = new List <Rhino.Geometry.Curve>();

            if (!DA.GetDataList("Boundaries", boundaries))
            {
                return;
            }

            Autodesk.Revit.DB.BuildingPadType buildingPadType = null;
            if (!DA.GetData("Type", ref buildingPadType) && Params.Input[1].Sources.Count == 0)
            {
                buildingPadType = Revit.ActiveDBDocument.GetElement(Revit.ActiveDBDocument.GetDefaultElementTypeId(ElementTypeGroup.BuildingPadType)) as BuildingPadType;
            }

            Autodesk.Revit.DB.Level level = null;
            DA.GetData("Level", ref level);
            if (level == null && boundaries.Count != 0)
            {
                var boundaryBBox = Rhino.Geometry.BoundingBox.Empty;
                foreach (var boundary in boundaries.OfType <Rhino.Geometry.Curve>())
                {
                    boundaryBBox.Union(boundary.GetBoundingBox(true));
                }

                level = Revit.ActiveDBDocument.FindLevelByElevation(boundaryBBox.Min.Z / Revit.ModelUnits);
            }

            DA.DisableGapLogic();
            int Iteration = DA.Iteration;

            Revit.EnqueueAction((doc) => CommitInstance(doc, DA, Iteration, boundaries, buildingPadType, level));
        }
Exemplo n.º 6
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            LevelType levelType = null;

            if (!DA.GetData("Type", ref levelType) && Params.Input[1].Sources.Count == 0)
            {
                levelType = Revit.ActiveDBDocument.GetElement(Revit.ActiveDBDocument.GetDefaultElementTypeId(ElementTypeGroup.LevelType)) as LevelType;
            }

            if (levelType == null)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, string.Format("Parameter '{0}' There is no default level type loaded.", Params.Input[1].Name));
                DA.AbortComponentSolution();
                return;
            }

            double elevation = 0.0;

            DA.GetData("Elevation", ref elevation);

            DA.DisableGapLogic();
            int Iteration = DA.Iteration;

            Revit.EnqueueAction((doc) => CommitInstance(doc, DA, Iteration, elevation, levelType));
        }
Exemplo n.º 7
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Rhino.Geometry.Curve boundary = null;
            DA.GetData("Boundary", ref boundary);

            Autodesk.Revit.DB.FloorType floorType = null;
            if (!DA.GetData("Type", ref floorType) && Params.Input[1].Sources.Count == 0)
            {
                floorType = Revit.ActiveDBDocument.GetElement(Revit.ActiveDBDocument.GetDefaultElementTypeId(ElementTypeGroup.FloorType)) as FloorType;
            }

            Autodesk.Revit.DB.Level level = null;
            DA.GetData("Level", ref level);
            if (level == null && boundary != null)
            {
                var boundaryBBox = boundary.GetBoundingBox(true);
                level = Revit.ActiveDBDocument.FindLevelByElevation(boundaryBBox.Min.Z / Revit.ModelUnits);
            }

            bool structural = true;

            DA.GetData("Structural", ref structural);

            DA.DisableGapLogic();
            int Iteration = DA.Iteration;

            Revit.EnqueueAction((doc) => CommitInstance(doc, DA, Iteration, boundary, floorType, level, structural));
        }
Exemplo n.º 8
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Rhino.Geometry.Curve axis = null;
            DA.GetData("Curve", ref axis);

            GridType gridType = null;

            if (!DA.GetData("Type", ref gridType) && Params.Input[1].Sources.Count == 0)
            {
                gridType = Revit.ActiveDBDocument.GetElement(Revit.ActiveDBDocument.GetDefaultElementTypeId(ElementTypeGroup.GridType)) as GridType;
            }

            if (gridType == null)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, string.Format("Parameter '{0}' There is no default level type loaded.", Params.Input[1].Name));
                DA.AbortComponentSolution();
                return;
            }

            string name = null;

            DA.GetData("Name", ref name);

            DA.DisableGapLogic();
            int Iteration = DA.Iteration;

            Revit.EnqueueAction((doc) => CommitInstance(doc, DA, Iteration, axis, gridType));
        }
Exemplo n.º 9
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Rhino.Geometry.Curve axis = null;
            DA.GetData("Axis", ref axis);

            WallType wallType = null;

            if (!DA.GetData("FamilyType", ref wallType) && Params.Input[1].Sources.Count == 0)
            {
                wallType = Revit.ActiveDBDocument.GetElement(Revit.ActiveDBDocument.GetDefaultElementTypeId(ElementTypeGroup.WallType)) as WallType;
            }

            Autodesk.Revit.DB.Level level = null;
            DA.GetData("Level", ref level);
            if (level == null && axis != null)
            {
                using (var collector = new FilteredElementCollector(Revit.ActiveDBDocument))
                {
                    foreach (var levelN in collector.OfClass(typeof(Level)).ToElements().Cast <Level>().OrderBy(c => c.Elevation))
                    {
                        if (level == null)
                        {
                            level = levelN;
                        }
                        else if (axis.PointAtStart.Z >= levelN.Elevation)
                        {
                            level = levelN;
                        }
                    }
                }
            }

            bool structural = true;

            DA.GetData("Structural", ref structural);

            double height = 0.0;

            if (!DA.GetData("Height", ref height))
            {
                switch (Rhino.RhinoDoc.ActiveDoc.ModelUnitSystem)
                {
                case Rhino.UnitSystem.None:
                case Rhino.UnitSystem.Inches:
                case Rhino.UnitSystem.Feet:
                    height = 10.0 * Rhino.RhinoMath.UnitScale(Rhino.UnitSystem.Feet, Rhino.RhinoDoc.ActiveDoc.ModelUnitSystem);
                    break;

                default:
                    height = 3.0 * Rhino.RhinoMath.UnitScale(Rhino.UnitSystem.Meters, Rhino.RhinoDoc.ActiveDoc.ModelUnitSystem);
                    break;
                }
            }

            DA.DisableGapLogic();
            int Iteration = DA.Iteration;

            Revit.EnqueueAction((doc) => CommitInstance(doc, DA, Iteration, axis, wallType, level, structural, height));
        }
Exemplo n.º 10
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            var plane = default(Rhino.Geometry.Plane);

            DA.GetData("Plane", ref plane);

            DA.DisableGapLogic();
            int Iteration = DA.Iteration;

            Revit.EnqueueAction((doc) => CommitInstance(doc, DA, Iteration, plane));
        }
Exemplo n.º 11
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Rhino.Geometry.Brep brep = null;
            if (!DA.GetData("Brep", ref brep))
            {
                return;
            }

            DA.DisableGapLogic();
            int Iteration = DA.Iteration;

            Revit.EnqueueAction((doc) => CommitInstance(doc, DA, Iteration, brep));
        }
Exemplo n.º 12
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Rhino.Geometry.Curve axis = null;
            DA.GetData("Curve", ref axis);

            Autodesk.Revit.DB.SketchPlane plane = null;
            DA.GetData("SketchPlane", ref plane);

            DA.DisableGapLogic();
            int Iteration = DA.Iteration;

            Revit.EnqueueAction((doc) => CommitInstance(doc, DA, Iteration, axis, plane));
        }
Exemplo n.º 13
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Rhino.Geometry.Mesh mesh = null;
            if (!DA.GetData("Mesh", ref mesh))
            {
                return;
            }

            DA.DisableGapLogic();
            int Iteration = DA.Iteration;

            Revit.EnqueueAction((doc) => CommitInstance(doc, DA, Iteration, (Rhino.Geometry.Mesh)mesh?.DuplicateShallow()));
        }
Exemplo n.º 14
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            var point = new Rhino.Geometry.Point3d(double.NaN, double.NaN, double.NaN);

            if (!DA.GetData("Point", ref point))
            {
                return;
            }

            DA.DisableGapLogic();
            int Iteration = DA.Iteration;

            Revit.EnqueueAction((doc) => CommitInstance(doc, DA, Iteration, point));
        }
Exemplo n.º 15
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            var points = new List <Rhino.Geometry.Point3d>();

            if (!DA.GetDataList("Points", points))
            {
                return;
            }

            DA.DisableGapLogic();
            int Iteration = DA.Iteration;

            Revit.EnqueueAction((doc) => CommitInstance(doc, DA, Iteration, points));
        }
Exemplo n.º 16
0
        private static void UpdateViewConstructionPlanes(Rhino.RhinoDoc rhinoDoc, Document revitDoc)
        {
            if (!string.IsNullOrEmpty(rhinoDoc.TemplateFileUsed))
            {
                return;
            }

            if (rhinoDoc.IsCreating)
            {
                Revit.EnqueueAction(doc => UpdateViewConstructionPlanes(rhinoDoc, doc));
                return;
            }

            bool imperial = rhinoDoc.ModelUnitSystem == Rhino.UnitSystem.Feet || rhinoDoc.ModelUnitSystem == Rhino.UnitSystem.Inches;

            var modelGridSpacing = imperial ?
                                   1.0 * Rhino.RhinoMath.UnitScale(Rhino.UnitSystem.Yards, rhinoDoc.ModelUnitSystem) :
                                   1.0 * Rhino.RhinoMath.UnitScale(Rhino.UnitSystem.Meters, rhinoDoc.ModelUnitSystem);

            var modelSnapSpacing = imperial ?
                                   1 / 16.0 * Rhino.RhinoMath.UnitScale(Rhino.UnitSystem.Inches, rhinoDoc.ModelUnitSystem) :
                                   1.0 * Rhino.RhinoMath.UnitScale(Rhino.UnitSystem.Millimeters, rhinoDoc.ModelUnitSystem);

            var modelThickLineFrequency = imperial ? 6 : 5;

            // Views
            {
                foreach (var view in rhinoDoc.Views)
                {
                    var cplane = view.MainViewport.GetConstructionPlane();

                    cplane.GridSpacing        = modelGridSpacing;
                    cplane.SnapSpacing        = modelSnapSpacing;
                    cplane.ThickLineFrequency = modelThickLineFrequency;

                    view.MainViewport.SetConstructionPlane(cplane);

                    var min  = cplane.Plane.PointAt(-cplane.GridSpacing * cplane.GridLineCount, -cplane.GridSpacing * cplane.GridLineCount, 0.0);
                    var max  = cplane.Plane.PointAt(+cplane.GridSpacing * cplane.GridLineCount, +cplane.GridSpacing * cplane.GridLineCount, 0.0);
                    var bbox = new Rhino.Geometry.BoundingBox(min, max);

                    // Zoom to grid
                    view.MainViewport.ZoomBoundingBox(bbox);

                    // Adjust to extens in case There is anything in the viewports like Grasshopper previews.
                    view.MainViewport.ZoomExtents();
                }
            }
        }
Exemplo n.º 17
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            var axis = Rhino.Geometry.Line.Unset;

            if (DA.GetData("Axis", ref axis))
            {
                if (axis.FromZ > axis.ToZ)
                {
                    axis.Flip();
                }
            }

            FamilySymbol familySymbol = null;

            if (!DA.GetData("Type", ref familySymbol) && Params.Input[1].Sources.Count == 0)
            {
                familySymbol = Revit.ActiveDBDocument.GetElement(Revit.ActiveDBDocument.GetDefaultFamilyTypeId(new ElementId(BuiltInCategory.OST_StructuralColumns))) as FamilySymbol;
            }

            if (!familySymbol.IsActive)
            {
                familySymbol.Activate();
            }

            Autodesk.Revit.DB.Level level = null;
            DA.GetData("Level", ref level);
            if (level == null)
            {
                using (var collector = new FilteredElementCollector(Revit.ActiveDBDocument))
                {
                    foreach (var levelN in collector.OfClass(typeof(Level)).ToElements().Cast <Level>().OrderBy(c => c.Elevation))
                    {
                        if (level == null)
                        {
                            level = levelN;
                        }
                        else if (axis.FromZ > levelN.Elevation)
                        {
                            level = levelN;
                        }
                    }
                }
            }

            DA.DisableGapLogic();
            int Iteration = DA.Iteration;

            Revit.EnqueueAction((doc) => CommitInstance(doc, DA, Iteration, axis, familySymbol, level));
        }
Exemplo n.º 18
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Rhino.Geometry.Curve axis = null;
            DA.GetData("Axis", ref axis);

            WallType wallType = null;

            if (!DA.GetData("Type", ref wallType) && Params.Input[1].Sources.Count == 0)
            {
                wallType = Revit.ActiveDBDocument.GetElement(Revit.ActiveDBDocument.GetDefaultElementTypeId(ElementTypeGroup.WallType)) as WallType;
            }

            Autodesk.Revit.DB.Level level = null;
            DA.GetData("Level", ref level);
            if (level == null && axis != null)
            {
                level = Revit.ActiveDBDocument.FindLevelByElevation(axis.PointAtStart.Z / Revit.ModelUnits);
            }

            bool structural = true;

            DA.GetData("Structural", ref structural);

            double height = 0.0;

            if (!DA.GetData("Height", ref height))
            {
                height = LiteralLengthValue(3.0);
            }

            var locationLine      = WallLocationLine.WallCenterline;
            int locationLineValue = (int)locationLine;

            if (DA.GetData("LocationLine", ref locationLineValue))
            {
                if ((int)WallLocationLine.WallCenterline > locationLineValue || locationLineValue > (int)WallLocationLine.CoreInterior)
                {
                    AddRuntimeMessage(GH_RuntimeMessageLevel.Error, string.Format("Parameter '{0}' range is [0, 5].", Params.Input[5].Name));
                    return;
                }

                locationLine = (WallLocationLine)locationLineValue;
            }

            DA.DisableGapLogic();
            int Iteration = DA.Iteration;

            Revit.EnqueueAction((doc) => CommitInstance(doc, DA, Iteration, axis, wallType, level, structural, height, locationLine));
        }
    /// <summary>
    /// This procedure contains the user code. Input parameters are provided as regular arguments,
    /// Output parameters as ref arguments. You don't have to assign output parameters,
    /// they will have a default value.
    /// </summary>
    private void RunScript(bool Update, ref object A)
    {
        if (!Update)
        {
            A = ghbreps;
        }
        else
        {
            Revit.EnqueueAction((uido) => UpdateTopographySurface(uido));
            A = ghbreps;

            foreach (string s in outVals)
            {
                Print(s);
            }
        }
    }
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object can be used to retrieve data from input parameters and
        /// to store data in output parameters.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            var ifLoad = true;

            DA.GetData(0, ref ifLoad);
            //var outputGeos = new List<Brep>();


            if (!ifLoad)
            {
                DA.SetDataList(0, ghbreps);
            }

            else
            {
                Revit.EnqueueAction((uido) => GetSelectedRevitElements(uido));
            }
        }
Exemplo n.º 21
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            var boundaries = new List <Rhino.Geometry.Curve>();

            if (!DA.GetDataList("Boundaries", boundaries))
            {
                return;
            }

            Autodesk.Revit.DB.BuildingPadType buildingPadType = null;
            if (!DA.GetData("Type", ref buildingPadType) && Params.Input[1].Sources.Count == 0)
            {
                buildingPadType = Revit.ActiveDBDocument.GetElement(Revit.ActiveDBDocument.GetDefaultElementTypeId(ElementTypeGroup.BuildingPadType)) as BuildingPadType;
            }

            Autodesk.Revit.DB.Level level = null;
            DA.GetData("Level", ref level);
            if (level == null && boundaries.Count != 0)
            {
                foreach (var boundary in boundaries.OfType <Rhino.Geometry.Curve>())
                {
                    var boundaryBBox = boundary.GetBoundingBox(true);
                    using (var collector = new FilteredElementCollector(Revit.ActiveDBDocument))
                    {
                        foreach (var levelN in collector.OfClass(typeof(Level)).ToElements().Cast <Level>().OrderBy(c => c.Elevation))
                        {
                            if (level == null)
                            {
                                level = levelN;
                            }
                            else if (boundaryBBox.Min.Z >= levelN.Elevation)
                            {
                                level = levelN;
                            }
                        }
                    }
                }
            }

            DA.DisableGapLogic();
            int Iteration = DA.Iteration;

            Revit.EnqueueAction((doc) => CommitInstance(doc, DA, Iteration, boundaries, buildingPadType, level));
        }
Exemplo n.º 22
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Rhino.Geometry.Curve boundary = null;
            DA.GetData("Boundary", ref boundary);

            Autodesk.Revit.DB.FloorType floorType = null;
            if (!DA.GetData("Type", ref floorType) && Params.Input[1].Sources.Count == 0)
            {
                floorType = Revit.ActiveDBDocument.GetElement(Revit.ActiveDBDocument.GetDefaultElementTypeId(ElementTypeGroup.FloorType)) as FloorType;
            }

            Autodesk.Revit.DB.Level level = null;
            DA.GetData("Level", ref level);
            if (level == null && boundary != null)
            {
                var boundaryBBox = boundary.GetBoundingBox(true);
                using (var collector = new FilteredElementCollector(Revit.ActiveDBDocument))
                {
                    foreach (var levelN in collector.OfClass(typeof(Level)).ToElements().Cast <Level>().OrderBy(c => c.Elevation))
                    {
                        if (level == null)
                        {
                            level = levelN;
                        }
                        else if (boundaryBBox.Min.Z >= levelN.Elevation)
                        {
                            level = levelN;
                        }
                    }
                }
            }

            bool structural = true;

            DA.GetData("Structural", ref structural);

            DA.DisableGapLogic();
            int Iteration = DA.Iteration;

            Revit.EnqueueAction((doc) => CommitInstance(doc, DA, Iteration, boundary, floorType, level, structural));
        }
Exemplo n.º 23
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            var geometry = new List <Rhino.Geometry.GeometryBase>();

            DA.GetDataList("Geometry", geometry);

            Autodesk.Revit.DB.Category category = null;
            if (!DA.GetData("Category", ref category) && Params.Input[1].Sources.Count == 0)
            {
                category = Autodesk.Revit.DB.Category.GetCategory(Revit.ActiveDBDocument, BuiltInCategory.OST_GenericModel);
            }

            string name = string.Empty;

            DA.GetData("Name", ref name);

            DA.DisableGapLogic();
            int Iteration = DA.Iteration;

            Revit.EnqueueAction((doc) => CommitInstance(doc, DA, Iteration, geometry, category, name));
        }
Exemplo n.º 24
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            var geometry = new List <IGH_GeometricGoo>();

            DA.GetDataList("Geometry", geometry);

            Autodesk.Revit.DB.Category category = null;
            if (!DA.GetData("Category", ref category) && Params.Input[1].Sources.Count == 0)
            {
                category = Autodesk.Revit.DB.Category.GetCategory(Revit.ActiveDBDocument, BuiltInCategory.OST_GenericModel);
            }

            string name = null;

            if (!DA.GetData("Name", ref name) && geometry.Count == 1 && (geometry[0]?.IsReferencedGeometry ?? false))
            {
                name = Rhino.RhinoDoc.ActiveDoc.Objects.FindId(geometry[0].ReferenceID)?.Name;
            }

            DA.DisableGapLogic();
            int Iteration = DA.Iteration;

            Revit.EnqueueAction((doc) => CommitInstance(doc, DA, Iteration, geometry, category, name));
        }
Exemplo n.º 25
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            var axis = Rhino.Geometry.Line.Unset;

            if (DA.GetData("Axis", ref axis))
            {
                if (axis.FromZ > axis.ToZ)
                {
                    axis.Flip();
                }
            }

            FamilySymbol familySymbol = null;

            if (!DA.GetData("Type", ref familySymbol) && Params.Input[1].Sources.Count == 0)
            {
                familySymbol = Revit.ActiveDBDocument.GetElement(Revit.ActiveDBDocument.GetDefaultFamilyTypeId(new ElementId(BuiltInCategory.OST_StructuralColumns))) as FamilySymbol;
            }

            if (!familySymbol.IsActive)
            {
                familySymbol.Activate();
            }

            Autodesk.Revit.DB.Level level = null;
            DA.GetData("Level", ref level);
            if (level == null)
            {
                level = Revit.ActiveDBDocument.FindLevelByElevation(axis.FromZ / Revit.ModelUnits);
            }

            DA.DisableGapLogic();
            int Iteration = DA.Iteration;

            Revit.EnqueueAction((doc) => CommitInstance(doc, DA, Iteration, axis, familySymbol, level));
        }