Call Clayoo command from script in GH

Hi All,

I posted this question under script category, but maybe it’s more suitable to be posted under GH topics.

There are two features of Clayoo in Rhino that I would like to use in my definition; unfortunately, there is no GH components for them.
I am talking about:
Convert Surface and Convert to NURBS.

Basically I just want to convert breps in and out Clayoo, without leaving my GH definition.

Is it possible to call these convert commands from a script and get the output geometry into GH definition?

Thanks in advance for your support!!

Doesn’t RhinoApp.RunScript("your Clayoo command") work?

// Rolf

Hello Rolf,

thanks for answering me again.

I have seen the page you sent me, but It is not clear to me how to use it: you said it s sends the command as text to rhino command line, but then rhino will prompt me to select the geometry I want to convert.

I have to take a geometry from the definition, convert it and then get the output back into GH.

Maybe if there’s an example to look at I would better figure out the thing to do.

Could you show me something similar? Thanks!

You can do the selections (from RhinoCommon/GH) before calling the RunScript command.

If you can type the command on the command line manually, use a similar string when calling RunScript.

Any preparations when calling your Clayoo commands manually (like selecting objects) can also be done through GH code before calling RunScript.

The linked documentation page says this, among other things:

Remarks:
Rhino acts as if each character in the script string had been typed in the command prompt. When RunScript is called from a “script runner” command, it completely runs the script before returning. …

// Rolf

Ok… I know I am not into coding… but I will try to figure out asking some simple questions.

The command in Rhino is _ClayConvertSurface.

From what I read on the linked documentation, this is what I come out with:

public static bool RunScript(
string _ClayConvertSurface,
bool echo
)

Now, opening the C# script component in GH, I see I can’t write in public function but I can enter the code in script function. There, I am asked to supply my script (x, boolean).

I assume that x is the input geometry I want to run the script on…

Or do I have first to create a new function from the .Runscript method, like
My script {
RhinoApp.RunScript(_ClayConvertSurface)
}

It is clear that I have no idea about where to start from and I am sorry to bother.

I may figure out better the syntax in Python, otherwise I feel totally lost.

I forgot to say that I am on Rhino 5 for Windows.

Giaco