Ejemplo n.º 1
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            GsaBool6 mybool  = new GsaBool6();
            GsaBool6 gsabool = new GsaBool6();

            if (DA.GetData(0, ref gsabool))
            {
                mybool = gsabool.Duplicate();
            }
            if (mybool != null)
            {
                //inputs
                bool x = new bool();
                if (DA.GetData(1, ref x))
                {
                    mybool.X = x;
                }
                bool y = new bool();
                if (DA.GetData(2, ref y))
                {
                    mybool.Y = y;
                }
                bool z = new bool();
                if (DA.GetData(3, ref z))
                {
                    mybool.Z = z;
                }
                bool xx = new bool();
                if (DA.GetData(4, ref xx))
                {
                    mybool.XX = xx;
                }
                bool yy = new bool();
                if (DA.GetData(5, ref yy))
                {
                    mybool.YY = yy;
                }
                bool zz = new bool();
                if (DA.GetData(6, ref zz))
                {
                    mybool.ZZ = zz;
                }

                //outputs
                DA.SetData(0, new GsaBool6Goo(mybool));
                DA.SetData(1, mybool.X);
                DA.SetData(2, mybool.Y);
                DA.SetData(3, mybool.Z);
                DA.SetData(4, mybool.XX);
                DA.SetData(5, mybool.YY);
                DA.SetData(6, mybool.ZZ);
            }
        }
Ejemplo n.º 2
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            GH_Boolean ghBolX = new GH_Boolean();

            if (DA.GetData(0, ref ghBolX))
            {
                GH_Convert.ToBoolean(ghBolX, out x, GH_Conversion.Both); //use Grasshopper to convert, these methods covers many cases and are consistent
            }
            GH_Boolean ghBolY = new GH_Boolean();

            if (DA.GetData(1, ref ghBolY))
            {
                GH_Convert.ToBoolean(ghBolY, out y, GH_Conversion.Both);
            }
            GH_Boolean ghBolZ = new GH_Boolean();

            if (DA.GetData(2, ref ghBolZ))
            {
                GH_Convert.ToBoolean(ghBolZ, out z, GH_Conversion.Both);
            }
            GH_Boolean ghBolXX = new GH_Boolean();

            if (DA.GetData(3, ref ghBolXX))
            {
                GH_Convert.ToBoolean(ghBolXX, out xx, GH_Conversion.Both);
            }
            GH_Boolean ghBolYY = new GH_Boolean();

            if (DA.GetData(4, ref ghBolYY))
            {
                GH_Convert.ToBoolean(ghBolYY, out yy, GH_Conversion.Both);
            }
            GH_Boolean ghBolZZ = new GH_Boolean();

            if (DA.GetData(5, ref ghBolZZ))
            {
                GH_Convert.ToBoolean(ghBolZZ, out zz, GH_Conversion.Both);
            }
            GsaBool6 bool6 = new GsaBool6
            {
                X  = x,
                Y  = y,
                Z  = z,
                XX = xx,
                YY = yy,
                ZZ = zz
            };

            DA.SetData(0, new GsaBool6Goo(bool6.Duplicate())); // output as Goo-type for consistency.
        }
Ejemplo n.º 3
0
        public void TestDuplicateBool6()
        {
            // create new bool6
            GsaBool6 origB6 = new GsaBool6();

            origB6.X  = true;
            origB6.Y  = false;
            origB6.Z  = true;
            origB6.XX = false;
            origB6.YY = true;
            origB6.ZZ = false;

            // duplicate
            GsaBool6 dup = origB6.Duplicate();

            // make some changes to original
            origB6.X  = false;
            origB6.Y  = true;
            origB6.Z  = false;
            origB6.XX = true;
            origB6.YY = false;
            origB6.ZZ = true;

            Assert.IsTrue(dup.X);
            Assert.IsFalse(dup.Y);
            Assert.IsTrue(dup.Z);
            Assert.IsFalse(dup.XX);
            Assert.IsTrue(dup.YY);
            Assert.IsFalse(dup.ZZ);

            Assert.IsFalse(origB6.X);
            Assert.IsTrue(origB6.Y);
            Assert.IsFalse(origB6.Z);
            Assert.IsTrue(origB6.XX);
            Assert.IsFalse(origB6.YY);
            Assert.IsTrue(origB6.ZZ);
        }