Grasshopper

algorithmic modeling for Rhino

Hi I'm Alexandru and I would need some help as soon as possible :

I created a hull for a ship as in the picture attached; and now I have to obtain a table of offsets with the points represented thereof. The result should be a .txt file as the one enclosed.

The problems are:

1.I have to remove the brackets"{}" and comma "," from the point coordinates.

2.I have to add a numerical item  

Thank you in advance for any clue 

Views: 4638

Attachments:

Replies to This Discussion

Hi Georgescu,

You did not attach your files, and I couldn't exactly understand what you would like to do from the given screenshots.

Nevertheless try this:

The final Panel (far right) steams the content into a Excel spreadsheet. Once you open the .xlsx file you can just select all four columns, copy and past the content into empty .txt file:

Attachments:

Thank you djordje. But I need to have about 5000 points at least, so it will take a long time to copy them.

I attached 2 more files and hope to be clearer this time.

Attachments:

I do not understand. You have 825 points, and to those 825 you want to add the 10923 numerical items (those zeros and one)?
How is that possible?

Number of points and number of numerical items should be the same?

No that txt.(model.txt) file is an example of what I want to achieve.
As I said before :
-I created a hull
-Now I need points on this hull as in the example file to insert them in "Shipflow"

Actually you never precisely mentioned the "off_model.txt" is an example file.
Check you previous replies.

Do what Sridevi told you.

The components you need are:

1. Replace text (to remove the brackets and to replace comma with a space)

2. Concatenate (to add the numerical item at the end)

3. Panel (to stream the end result to a text file)

Yes this is what I need but i can't manage step: 1. Replace text (to remove the brackets and to replace comma with a space)

And thank's a lot 

Tada!

To answer the original question.

1.I have to remove the brackets"{}" and comma "," from the point coordinates.

There two options here. Firstly use [Replace Text] (formerly Replace String) to remove "{" have the Find input as "{" and the Replace input as nothing. Similarly with "}"

To replace the commas as tabs you will need to have the Find input as "," and have a panel containing a TAB (I needed to paste a tab in from another program as there is a bit of a bug with the panel (which I will report)

The other way is to use [Expression] which has an inbuilt Format function for the point you can separate the components by writing x.x, x.y and x.z where x is the first input to [Expression] and .x .y .z are the components of the point

Similarly you will need to paste Tab into the expression editor from another program

Erm...I just pressed the space bar once for the blank space, no tabs. Seems to work fine.

But nice, I didn't think of Expression component!

Tab is for the Tab Delimted tables that a lot of legacy software uses when importing text files. I assume Georgescu is needing to import the file into a hydrostatics package for stability curves or something similar.

Interesting...

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service