String input for Rhino Compute Appserver

Hi!
I’ve set a Rhino Compute server, an appserver and it works fine. The thing is, i have set a text input in my GH file (Get String from Hops component) that i would like to act as a Value List, so i filled its presets.

Rhino Appserver project is, if i’m not mistaken, only dealing with Range, Number and Boolean inputs for now. I’ve been trying to write custom code for String Input but here’s what i get.

{
  description: '',
  atLeast: 1,
  atMost: 1,
  treeAccess: false,
  default: {
    isValid: true,
    isValidWhyNot: '',
    typeDescription: 'A piece of text',
    typeName: 'Text',
    qcType: 3,
    value: 'A value'
  },
  minimum: null,
  maximum: null,
  name: 'My component name',
  nickname: null,
  paramType: 'Text'
}

Is there a way to collect the presets? Or event better has somebody already implemented a way to deal with String Components in Rhino Compute Appserver?
Thanks in advance!

String input should work fine. I don’t understand from your post what is not working.

Hi, thanks for your reply.

Here you see two components in my GH file, as well as the Presets for my String Input.

In my instance of Rhino.compute.appserver, I log my inputs as they are sent to my Rhino Compute server:

  for (const input of definition.inputs) {
    const name = input.name
    const id = name
    console.log(input)

What i get as a result is this:

{
  description: '',
  atLeast: 1,
  atMost: 1,
  treeAccess: false,
  default: 5,
  minimum: 1,
  maximum: 10,
  name: 'Number of cubes',
  nickname: null,
  paramType: 'Number'
}
{
  description: ' ',
  atLeast: 1,
  atMost: 1,
  treeAccess: true,
  default: {
    isValid: true,
    isValidWhyNot: '',
    typeDescription: 'A piece of text',
    typeName: 'Text',
    qcType: 3,
    value: 'B value'
  },
  minimum: null,
  maximum: null,
  name: 'My component name',
  nickname: null,
  paramType: 'Text'
}

What we see is i get everything i need (for example max and min for number input) BUT the presets for the String Input.

Not sure if this makes sense?

Thanks in advance!

(Just if somebody is interested, i found a walkaround by filling the “Prompt…” with a list of my values (eg: “Value A,Value B,Value C”) which is accessed in ‘description’ and parsing it. I guess there may be a cleaner way but it works.

1 Like