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;
/// <summary>
/// This class will be instantiated on demand by the Script component.
/// </summary>
public class Script_Instance : GH_ScriptInstance
{
#region Utility functions
/// <summary>Print a String to the [Out] Parameter of the Script component.</summary>
/// <param name="text">String to print.</param>
private void Print(string text) { /* Implementation hidden. */ }
/// <summary>Print a formatted String to the [Out] Parameter of the Script component.</summary>
/// <param name="format">String format.</param>
/// <param name="args">Formatting parameters.</param>
private void Print(string format, params object[] args) { /* Implementation hidden. */ }
/// <summary>Print useful information about an object instance to the [Out] Parameter of the Script component. </summary>
/// <param name="obj">Object instance to parse.</param>
private void Reflect(object obj) { /* Implementation hidden. */ }
/// <summary>Print the signatures of all the overloads of a specific method to the [Out] Parameter of the Script component. </summary>
/// <param name="obj">Object instance to parse.</param>
private void Reflect(object obj, string method_name) { /* Implementation hidden. */ }
#endregion
#region Members
/// <summary>Gets the current Rhino document.</summary>
private readonly RhinoDoc RhinoDocument;
/// <summary>Gets the Grasshopper document that owns this script.</summary>
private readonly GH_Document GrasshopperDocument;
/// <summary>Gets the Grasshopper script component that owns this script.</summary>
private readonly IGH_Component Component;
/// <summary>
/// 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.
/// </summary>
private readonly int Iteration;
#endregion
/// <summary>
/// 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.
/// </summary>
private void RunScript(double moduleDepth, int floorCount, List<int> setbackFloors, List<double> 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?