protected override void TrySolveInstance(IGH_DataAccess DA)
        {
            // get input
            Types.DataObject <DB.CurtainGrid> dataObj = default;
            if (!DA.GetData("Curtain Grid", ref dataObj))
            {
                return;
            }

            DB.CurtainGrid cgrid = dataObj.Value;

            DA.SetDataList("Cells", cgrid.GetCurtainCells().Select(x => new Types.DataObject <DB.CurtainCell>(x, srcDocument: dataObj.Document)));
            DA.SetDataList("Mullions", cgrid.GetMullionIds().Select(x => Types.Mullion.FromElement(dataObj.Document.GetElement(x))));
            DA.SetDataList("Panels", cgrid.GetPanelIds().Select(x => Types.Element.FromElement(dataObj.Document.GetElement(x))));

            // GetVGridLineIds returns grid lines perpendicular to V
            DA.SetDataList("Vertical Lines", cgrid.GetVGridLineIds().Select(x => Types.CurtainGridLine.FromElement(dataObj.Document.GetElement(x))));
            DA.SetData("Vertical Angle", cgrid.Grid1Angle);
            DA.SetData("Vertical Justification", cgrid.Grid1Justification);
            DA.SetData("Vertical Offset", cgrid.Grid1Offset * Revit.ModelUnits);

            // GetUGridLineIds returns grid lines perpendicular to U
            DA.SetDataList("Horizontal Lines", cgrid.GetUGridLineIds().Select(x => Types.CurtainGridLine.FromElement(dataObj.Document.GetElement(x))));
            DA.SetData("Horizontal Angle", cgrid.Grid2Angle);
            DA.SetData("Horizontal Justification", cgrid.Grid2Justification);
            DA.SetData("Horizontal Offset", cgrid.Grid2Offset * Revit.ModelUnits);
        }
Ejemplo n.º 2
0
        protected override void TrySolveInstance(IGH_DataAccess DA)
        {
            // get input
            Types.DataObject <DB.CompoundStructure> dataObj = default;
            if (!DA.GetData("Compound Structure", ref dataObj))
            {
                return;
            }

            var cstruct = dataObj.Value;

            // Deconstruct the data object into output params
            DA.SetData("Total Thickness", cstruct.GetWidth());
            DA.SetData("Sample Height", cstruct.SampleHeight);
            DA.SetData("Cutoff Height", cstruct.CutoffHeight);
            DA.SetData("Minimum Sample Height", cstruct.MinimumSampleHeight);
            DA.SetData("Minimum Layer Thickness", DB.CompoundStructure.GetMinimumLayerThickness());
            DA.SetDataList("Layers", cstruct.GetLayers().Select(x => new Types.DataObject <DB.CompoundStructureLayer>(apiObject: x, sourceDoc: dataObj.Document)));
            DA.SetData("First Core Layer Index", cstruct.GetFirstCoreLayerIndex());
            DA.SetData("Last Core Layer Index", cstruct.GetLastCoreLayerIndex());
            DA.SetData("Structural Material Index", cstruct.StructuralMaterialIndex);
            DA.SetData("Variable Layer Index", cstruct.VariableLayerIndex);
            DA.SetData("Wrapping At Inserts", cstruct.OpeningWrapping);
            DA.SetData("Wrapping At Ends", cstruct.EndCap);
            DA.SetData("Has Structural Deck", cstruct.HasStructuralDeck);
            DA.SetData("Is Vertically Compound", cstruct.IsVerticallyCompound);
            DA.SetData("Is Vertically Homogeneous", cstruct.IsVerticallyHomogeneous());
        }
Ejemplo n.º 3
0
        protected override void TrySolveInstance(IGH_DataAccess DA)
        {
            // get input
            Types.DataObject <DB.CurtainGrid> dataObj = default;
            if (!DA.GetData("Curtain Grid", ref dataObj))
            {
                return;
            }

            DB.CurtainGrid cgrid = dataObj.Value;

            DA.SetDataList("Curtain Grid Cells", cgrid.GetCurtainCells().Select(x => new Types.DataObject <DB.CurtainCell>(x, srcDocument: dataObj.Document)));
            DA.SetDataList("Curtain Grid Mullions", cgrid.GetMullionIds().Select(x => Types.CurtainGridMullion.FromElement(dataObj.Document.GetElement(x))));
            DA.SetDataList("Curtain Grid Panels", cgrid.GetPanelIds().Select(x => Types.Element.FromElement(dataObj.Document.GetElement(x))));

            // GetVGridLineIds returns grid lines perpendicular to V
            DA.SetDataList("Curtain Grid Lines Along U Axis", cgrid.GetVGridLineIds().Select(x => Types.CurtainGridLine.FromElement(dataObj.Document.GetElement(x))));
            DA.SetData("Curtain Grid Angle (U Axis / Grid 1)", cgrid.Grid1Angle);
            DA.SetData("Curtain Grid Alignment Type (U Axis / Grid 1)", new Types.CurtainGridAlignType(cgrid.Grid1Justification));
            DA.SetData("Curtain Grid Offset (U Axis / Grid 1)", cgrid.Grid1Offset);

            // GetUGridLineIds returns grid lines perpendicular to U
            DA.SetDataList("Curtain Grid Lines Along V Axis", cgrid.GetUGridLineIds().Select(x => Types.CurtainGridLine.FromElement(dataObj.Document.GetElement(x))));
            DA.SetData("Curtain Grid Angle (V Axis / Grid 2)", cgrid.Grid2Angle);
            DA.SetData("Curtain Grid Alignment Type (V Axis / Grid 2)", new Types.CurtainGridAlignType(cgrid.Grid2Justification));
            DA.SetData("Curtain Grid Offset (V Axis / Grid 2)", cgrid.Grid2Offset);
        }
        protected override void TrySolveInstance(IGH_DataAccess DA)
        {
            // get input
            Types.DataObject <DB.CompoundStructure> dataObj = default;
            if (!DA.GetData("Compound Structure", ref dataObj))
            {
                return;
            }

            DB.CompoundStructure cstruct = dataObj.Value;

            // Deconstruct the data object into output params
            DA.SetData("Width", cstruct.GetWidth());
            DA.SetDataList("Layers", cstruct.GetLayers().Select(x => new Types.DataObject <DB.CompoundStructureLayer>(apiObject: x, srcDocument: dataObj.Document)).ToList());
            DA.SetData("Layer Count", cstruct.LayerCount);
            DA.SetData("Cutoff Height", cstruct.CutoffHeight);
            DA.SetData("End Cap Condition", new Types.EndCapCondition(cstruct.EndCap));
            DA.SetData("Has Structural Deck", cstruct.HasStructuralDeck);
            DA.SetData("Is Vertically Compound", cstruct.IsVerticallyCompound);
            DA.SetData("Sample Height", cstruct.SampleHeight);
            DA.SetData("Minimum Sample Height", cstruct.MinimumSampleHeight);
            DA.SetData("Opening Wrapping Condition", new Types.OpeningWrappingCondition(cstruct.OpeningWrapping));
            DA.SetData("Structural Material Index", cstruct.StructuralMaterialIndex);
            DA.SetData("Variable Layer Index", cstruct.VariableLayerIndex);
            DA.SetData("First Core Layer Index", cstruct.GetFirstCoreLayerIndex());
            DA.SetData("Last Core Layer Index", cstruct.GetLastCoreLayerIndex());
            DA.SetData("Minimum Allowable Layer Thickness", DB.CompoundStructure.GetMinimumLayerThickness());
        }
        protected override void TrySolveInstance(IGH_DataAccess DA)
        {
            // get input
            Types.DataObject <DB.CompoundStructureLayer> dataObj = default;
            if (!DA.GetData("Compound Structure Layer", ref dataObj))
            {
                return;
            }

            DB.CompoundStructureLayer cslayer = dataObj.Value;

            // Deconstruct the data object into output params
            DA.SetData("Layer Id", cslayer.LayerId);
            DA.SetData("Layer Function", new Types.LayerFunction(cslayer.Function));
            DA.SetData("Layer Width", cslayer.Width);
            DA.SetData("Layer Cap Flag", cslayer.LayerCapFlag);
            DA.SetData("Layer Material", Types.Element.FromElement(dataObj.Document.GetElement(cslayer.MaterialId)));
            DA.SetData("Deck Profile", Types.Element.FromElement(dataObj.Document.GetElement(cslayer.DeckProfileId)));
            DA.SetData("Deck Embedding Type", new Types.DeckEmbeddingType(cslayer.DeckEmbeddingType));
        }
        protected override void TrySolveInstance(IGH_DataAccess DA)
        {
            // get input
            Types.DataObject <DB.CompoundStructureLayer> dataObj = default;
            if (!DA.GetData("Compound Structure Layer", ref dataObj))
            {
                return;
            }

            var cslayer = dataObj.Value;

            // Deconstruct the data object into output params
            DA.SetData("Index", cslayer.LayerId);
            DA.SetData("Function", cslayer.Function);
            DA.SetData("Material", Types.Element.FromElement(dataObj.Document.GetElement(cslayer.MaterialId)));
            DA.SetData("Thickness", cslayer.Width * Revit.ModelUnits);
            DA.SetData("Wraps", cslayer.LayerCapFlag);
            DA.SetData("Deck Profile", Types.Element.FromElement(dataObj.Document.GetElement(cslayer.DeckProfileId)));
            DA.SetData("Deck Embedding Type", cslayer.DeckEmbeddingType);
        }
        protected override void TrySolveInstance(IGH_DataAccess DA)
        {
            // get input
            Types.DataObject <DB.CurtainCell> dataObj = default;
            if (!DA.GetData("Curtain Grid Cell", ref dataObj))
            {
                return;
            }

            DB.CurtainCell cell = dataObj.Value;

            // Revit API throws errors with no message when .CurveLoops is accessed
            // Autodesk.Revit.Exceptions.InvalidOperationException at Autodesk.Revit.DB.CurtainCell.get_CurveLoops()
            // but .CurveLoops actually returns data
            // same might happen with .PlanarizedCurveLoops but not fully tested
            try
            {
                DA.SetDataList("Curves", cell.CurveLoops?.ToPolyCurves());
                DA.SetDataList("Planarized Curves", cell.PlanarizedCurveLoops?.ToPolyCurves());
            }
            // silence the empty exception
            catch { }
        }