Grasshopper

algorithmic modeling for Rhino

Hi all,

I am doing some string formatting in the python grasshopper component. Inside my code is:

script = " "

l = "the fox jumps over the dog"

script += "\t" + l + "\n"

When i plug the output (script) to the panel, why is there no tab indentation, but carriage return works?

i.e i should get "        the fox jumps over the dog"

thanks!

Views: 824

Replies to This Discussion

Hi Jason

I'd say Grasshopper panels only recognize spaces and newline characters (\n), leaving other non-printable chars invisible. See the attached file for a more comprehensive example. Invisible chars are still present, though.

I hope this helps,

- Giulio
_______________
giulio@mcneel.com

Attachments:

Hi Giulio, good to hear from you! Thanks for the help as always. I have a further question, I understand that you are in charge of the development of the Python for Grasshopper component. I am interested in developing a simple script editor for Grasshopper to parse a custom script language that is python like. I would like to build it off/modify the python componnet for this purpose. Is this do-able and any suggestions for how to go about it?

Thanks a bunch.

Hi Jason

the GhPython component source is on GitHub. The last commits there are not published in a compiled form yet. Feel free to fork it or build a new project from it. The license is stated on the front page and permits that. Code parsing and execution is done directly by Rhino 5 through IronPython -- writing a new parser will be a fairly big assignment. Maybe expressions and "macros" can be approachable for a start.

Cheers,

- Giulio
________________
giulio@mcneel.com

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