/// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            double thresh     = new double();
            double ratio      = new double();
            bool   rebuild    = new bool();
            int    pointCount = new int();
            int    weldCount  = new int();
            Mesh   colorMesh  = new Mesh();
            bool   enable     = new bool();

            if (!DA.GetData(0, ref thresh))
            {
                return;
            }
            if (!DA.GetData(1, ref ratio))
            {
                return;
            }
            if (!DA.GetData(2, ref rebuild))
            {
                return;
            }
            if (!DA.GetData(3, ref pointCount))
            {
                return;
            }
            if (!DA.GetData(4, ref weldCount))
            {
                return;
            }
            if (!DA.GetData(5, ref colorMesh))
            {
                return;
            }
            if (!DA.GetData(6, ref enable))
            {
                return;
            }

            if (colorMesh == null || colorMesh.VertexColors.Count == 0)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Input mesh must have vertex colors, please check your input");
                return;
            }
            if (pointCount <= (weldCount / 2))
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Your point count cant be less than half of the weldcount, please increase point count or decrease weld count");
                return;
            }

            BundlingData bundling = new BundlingData(thresh, ratio, rebuild, pointCount, weldCount, colorMesh, enable);

            DA.SetData(0, bundling);
        }
Пример #2
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            double thresh     = new double();
            double ratio      = new double();
            bool   rebuild    = new bool();
            int    pointCount = new int();
            int    weldCount  = new int();

            if (!DA.GetData(0, ref thresh))
            {
                return;
            }
            if (!DA.GetData(1, ref ratio))
            {
                return;
            }
            if (!DA.GetData(2, ref rebuild))
            {
                return;
            }
            if (!DA.GetData(3, ref pointCount))
            {
                return;
            }
            if (!DA.GetData(4, ref weldCount))
            {
                return;
            }

            if (pointCount <= (weldCount / 2))
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Your point count cant be less than half of the weldcount, please increase point count or decrease weld count");
                return;
            }

            BundlingData bundling = new BundlingData(thresh, ratio, rebuild, pointCount, weldCount);

            DA.SetData(0, bundling);
        }