Exemplo n.º 1
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            GH_String name = new GH_String();
            GH_String phase = new GH_String();
            GH_String number = new GH_String();
            List<Parameter> parameters = new List<Parameter>();
            if (!DA.GetDataList<Parameter>("Parameters", parameters)) parameters = new List<Parameter>();

            DA.GetData<GH_String>("Name", ref name);
            DA.GetData<GH_String>("Number", ref number);
            DA.GetData<GH_String>("Phase", ref phase);

            Room room = new Room(name.Value,number.Value,phase.Value,parameters);

            room.GID = this.InstanceGuid.ToString();
           
            DA.SetData("GrevitComponent", room);
        }
Exemplo n.º 2
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            GH_Boolean assoc = new GH_Boolean(false);
            GH_String name = new GH_String();
            GH_String layer = new GH_String("");
            GH_String style = new GH_String("");
            GH_String number = new GH_String();
            List<Parameter> param = new List<Parameter>();
            List<GH_Point> points = new List<GH_Point>();
            if (!DA.GetDataList<Parameter>("Parameters", param)) param = new List<Parameter>();

            if (!DA.GetDataList<GH_Point>("Points", points)) points = new List<GH_Point>();

            DA.GetData<GH_String>("Name", ref name);
            DA.GetData<GH_Boolean>("Assoc", ref assoc);
            DA.GetData<GH_String>("Number", ref number);
            DA.GetData<GH_String>("Style", ref style);
            DA.GetData<GH_String>("Layer", ref layer);

            Room ac = new Room(name.Value,number.Value,"",param);

            IEnumerable<GH_Point> nodups = points.Distinct(new GH_PointComparer());
            ac.points = new List<Grevit.Types.Point>();
            foreach (var p in nodups)
            {
                ac.points.Add(p.ToGrevitPoint());
            }

            ac.associative = assoc.Value;
            ac.FamilyOrStyle = style.Value;
            ac.TypeOrLayer = layer.Value;
            ac.GID = this.InstanceGuid.ToString();

            DA.SetData("GrevitComponent", ac);
        }