C#_ Class(Method error)

I made a custom class and created method. On using the method it is throwing me an error. when i am using it just as a method not inside a class, its working fine.
Anything I am missing? attached script and error picture

  Building bB = new Building();
    List<Extrusion> eX = bB.InnerSkin(x);
    A = eX;
  }

  // <Custom additional code> 
  class Building{
    
    //Constructor
    public Building()
    {
    }  
    public List<Extrusion> InnerSkin(List<Curve>crvs)
    {
      List<Extrusion> iSkn = new List<Extrusion>();

      for(int i = 0; i < crvs.Count;i++){
        var cT = crvs[i].Offset(Plane.WorldXY, -3000, RhinoDocument.ModelAbsoluteTolerance,
          CurveOffsetCornerStyle.Sharp)[0];
        //c2.Add(cT);
        iSkn.Add(Extrusion.Create(cT, -4000 + 300, false));
      }
      return iSkn;
    }
  }

Capture

Make your class public. In C# are private by default I guess.

public class Building { (...) }

I changed it to public …still the same error

Oh sure, and this?:

List eX = bB.InnerSkin(x);

change List by var or List< Extrusion >

I dont know why it didnt show their when i pasted the code, but its there
List eX = bB.InnerSkin(x);
and when I change it to var eX its giving same error.

Ok, I take the code and solved, replace RhinoDocument by RhinoDoc.ActiveDoc

yeah it works now. I didn’t get this, what was the issue?

Open the non editable code of Members region in Script_Instance class. RhinoDocument is a private field, so can not be accessed outside of the class (in Building class).

1 Like