/// <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) { bool connect = new bool(); double viewAngle = new double(); double searchRadius = new double(); double alignValue = new double(); double separateValue = new double(); double cohesionValue = new double(); if (!DA.GetData(0, ref connect)) { return; } if (!DA.GetData(1, ref viewAngle)) { return; } if (!DA.GetData(2, ref searchRadius)) { return; } if (!DA.GetData(3, ref alignValue)) { return; } if (!DA.GetData(4, ref separateValue)) { return; } if (!DA.GetData(5, ref cohesionValue)) { return; } if (viewAngle > 360) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Angle cannot be higher than 360, please reduce value"); return; } if (viewAngle <= 0) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Angle cannot be less than or equal to 0, please increase value"); return; } if (connect) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Use this feature to visualize your search radius, however it drastically affects performance so use wisely"); } FlockingData flockData = new FlockingData((float)alignValue, (float)separateValue, (float)cohesionValue, (float)searchRadius, (float)viewAngle, connect); DA.SetData(0, flockData); }
/// <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) { bool connect = new bool(); double viewAngle = new double(); double searchRadius = new double(); double alignValue = new double(); double separateValue = new double(); double cohesionValue = new double(); Mesh mesh = null; bool mapAlign = new bool(); bool mapSep = new bool(); bool mapCoh = new bool(); if (!DA.GetData(0, ref connect)) { return; } if (!DA.GetData(1, ref viewAngle)) { return; } if (!DA.GetData(2, ref searchRadius)) { return; } if (!DA.GetData(3, ref alignValue)) { return; } if (!DA.GetData(4, ref separateValue)) { return; } if (!DA.GetData(5, ref cohesionValue)) { return; } if (!DA.GetData(6, ref mesh)) { return; } if (viewAngle > 360) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Angle cannot be higher than 360, please reduce value"); return; } if (viewAngle <= 0) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Angle cannot be less than or equal to 0, please increase value"); return; } if (mesh == null || mesh.VertexColors.Count == 0) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Input mesh must have vertex colors, please check your input"); return; } if (connect) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Use this feature to visualize your search radius, however it drastically affects performance so use wisely"); } if (!DA.GetData(7, ref mapAlign)) { return; } if (!DA.GetData(8, ref mapSep)) { return; } if (!DA.GetData(9, ref mapCoh)) { return; } FlockingData flockData = new FlockingData((float)alignValue, (float)separateValue, (float)cohesionValue, (float)searchRadius, (float)viewAngle, connect, mesh, mapAlign, mapSep, mapCoh); DA.SetData(0, flockData); }