Trying to enable C# components for my Add-on


#1

So, I’m trying to figure out how to let people write their own C# components against T-Splines. There is a lot more functionality exposed to C# than I’ve had time to write components for yet.

The very simple node I have tried to make has a single input T-Spline, and then it tries to output the number of verts in that T-Spline.

Here’s the code:

  private void RunScript(object TS, ref object A)
  {
    TSplines.Surf surf = TS.Value;
    A = surf.getVertCount();
  }

and the error message I get is:

Error: The type or namespace name ‘TSplines’ could not be found (are
you missing a using directive or an assembly reference?) (line 89)
Error: ‘object’ does not contain a definition for ‘Value’ (line 89)

So it seems like the way to fix it is to add #using TSplines up at the top. But there’s no way that I can figure out how to do that, since editing is disabled up there. Also, I’m not super familiar with how C# namespacing works, but it seems like there might need to be something else that happens, adding the reference or whatnot.

Is there any hope for this?


(Rajaa Issa) #2

Hi Tom,

In PanelingTools for GH, I expose PT library to be used in scripting components. See attached example.
I added a note to show how you can add the assemblies to the scripting component.

Is that what you are looking for?


#3

Looks like that does it. Thanks… :smile: