Hi All,
I am trying to create a list and reverse the order of the list. but somehow the command returns error saying “1. Error (CS0029): Cannot implicitly convert type ‘void’ to ‘object’ (line 84)”.
Here is the Screenshot of the window:
Also here is the snippet of the Code:
using System;
using System.Collections;
using System.Collections.Generic;
using Rhino;
using Rhino.Geometry;
using Grasshopper;
using Grasshopper.Kernel;
using Grasshopper.Kernel.Data;
using Grasshopper.Kernel.Types;
///
/// This class will be instantiated on demand by the Script component.
///
public class Script_Instance : GH_ScriptInstance
{
#region Utility functions
/// Print a String to the [Out] Parameter of the Script component.
/// String to print.
private void Print(string text) { /* Implementation hidden. / }
/// Print a formatted String to the [Out] Parameter of the Script component.
/// String format.
/// Formatting parameters.
private void Print(string format, params object[] args) { / Implementation hidden. / }
/// Print useful information about an object instance to the [Out] Parameter of the Script component.
/// Object instance to parse.
private void Reflect(object obj) { / Implementation hidden. / }
/// Print the signatures of all the overloads of a specific method to the [Out] Parameter of the Script component.
/// Object instance to parse.
private void Reflect(object obj, string method_name) { / Implementation hidden. */ }
#endregion
#region Members
/// Gets the current Rhino document.
private readonly RhinoDoc RhinoDocument;
/// Gets the Grasshopper document that owns this script.
private readonly GH_Document GrasshopperDocument;
/// Gets the Grasshopper script component that owns this script.
private readonly IGH_Component Component;
///
/// Gets the current iteration count. The first call to RunScript() is associated with Iteration==0.
/// Any subsequent call within the same solution will increment the Iteration count.
///
private readonly int Iteration;
#endregion
///
/// This procedure contains the user code. Input parameters are provided as regular arguments,
/// Output parameters as ref arguments. You don’t have to assign output parameters,
/// they will have a default value.
///
private void RunScript(double moduleDepth, int floorCount, List setbackFloors, List setbackValues, ref object A)
{
List<double> setbackLists = new List<double>();
List<double> rsetbackLists = new List<double>();
//Create Loop to Extract the FloorCounts
/*
for (int i = 0; i < setbackFloors.Count; i++)
{
for (int j = 0; j < setbackFloors[i]; j++)
{
double value = setbackValues[i];
setbackLists.Add(value);
}
}
*/
for (int i = 0; i < setbackValues.Count; i++)
{
double newSetback = moduleDepth - setbackValues[i];
Print(newSetback.ToString());
setbackLists.Add(newSetback);
}
//rsetbackLists = setbackLists.Reverse();
A = setbackLists.Reverse(0, setbackLists.Count - 1);
}
Any idea why that is happening?