Grasshopper

algorithmic modeling for Rhino

I'm working on a component to send commands to processing by grasshopper. When working on the text part I had a problem! How can we add "enter" in a string to get a neat piece of code instead of having the code in just a line!

Any clues

Thanks in advance

Views: 5092

Attachments:

Replies to This Discussion

You just want to insert newline characters? Or do you want to create a list of strings, where each element is a single command?

Inserting newline characters is easy but it depends on how your code is already structured. I recommend making your output string using a System.Text.StringBuilder, that's both the most memory efficient and the easiest.

--

David Rutten

david@mcneel.com

ps. I moved this discussion into the VB/C#/Python forum.

--

David Rutten

david@mcneel.com

Thanks for the suggestions David. But because I'm trying to model the Processing logic in grasshopper I want to use only grasshopper components and at the end the code will be composed and be copied and paste in the processing canvas. That's why I decided to get newline by grasshopper objects. Can you please tell me how I can insert newline characters? I'm composing the codes by "Text join".

Thanks :)

I don't recognize those two components though. If you didn't write them, what are they?

--

David Rutten

david@mcneel.com

They are two clusters I have made!

http://www.food4rhino.ir/prograss.jpg

prograss.jpg (1303×449)

I attached a VB script which outputs 3 special text constants. A NewLine string, a Tab character and a Space character.

--

David Rutten

david@mcneel.com

Attachments:

Oh Thank you David :) That will really help.

David is it possible to have a component which will replicate your upper VB script? Of course I mean for future versions of GH 2. I am interested in the "NewLine" feature.

Or maybe implementing it into the "Text Split" itself:

?

Or in any other way.
I just see it as a convenient option, and it would be great if we would be able to use it from a native component instead of VB/C#/Python script.

Yeah I figured either that or allow some sort of C# string parsing so you can add \t, \n, \r etc. to indicate special characters.

That would work for me also.
Thank you for the quick reply.

btw. I am subscribed to follow this topic, and I never got an email about your reply. It looks like something went wrong a couple of days ago since the forum was down.

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