Grasshopper

algorithmic modeling for Rhino

Safe guarding against unwanted return spacing in Grasshopper python component inputs

I've just discovered that unwanted return spacing on grasshopper panels can cause chaos in grasshopper components

I guess the best way to ensure that this doesnt happen is to allow the user to only run the component if the input panel is set to Multiline data. 

Would this be possible? Does anyone know how to code this?

Views: 352

Replies to This Discussion

Hi Anton

I would just check if the string contains a new line. If your logic only accepts non-multiline data from panel, then no text will contain new lines.

Something like this would do.

Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

Attachments:

Hi Anton, Giulio's solution will avoid the component to fail but if the input is supposed to be single line with no return spacing, you can be more forgiving and use strip() to get it fixed.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service