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);
        }
Exemple #2
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);
        }