Point distribution,csv export

Hello,

I would like to export a number of existing points from rhino as csv file and then reuse it as a scatter csv file to distribute objects in octane.
Unfortunately I was unable to export the points with the correct syntax using the normal csv format option, octane csv files must contain 12 values in this format:
https://docs.otoy.com/Standalone_2_0/?page_id=495

is there a way to do this in RHino?

thank you for any feedback

Andreas

Hi Andreas,

Did you get it to work already?

I think the script below should do an export with the coordinates of the point as translation:

import rhinoscriptsyntax as rs


def ExportNodes():
    
    
    points = rs.GetObjects('Get points to export as nodes',filter = 1)
    if not points: return
    file_name = rs.SaveFileName('save nodes',filter = 'node csv|*.csv')
    if not file_name: return
    
    file = open(file_name, 'w')
    node_base = '1 0 0 {0.X} 0 1 0 {0.Y} 0 0 1 {0.Z}\n'
    
    for point in points:
        file.write(node_base.format(rs.PointCoordinates(point)))

    file.close()


ExportNodes()

export_points_to_octane_csv.py (501 Bytes)

HTH
-Willem

Hello Willem,

thank you very much for your effort! I just tried your script but sadly, as it turned out it does not work for octane.

I created a simple setup with 4 points, 2x2 matrix , 2m apart ( see attached pic A) I looked at the csv file your script created (see picB)

Octane needs a format of a 12 comma separated values, pic C shows the first rows of a working csv file which created the instances in pic d.

A script which would be able to export a large number of points with scale and rotation values as an octane compatible csv file would make my life a lot easier …
I would be happy to pay for such a thing …

best

Andreas

Pic A

Pic B

Pic C

Pic D

Hi Andreas,

I took the info from the site you linked and assumes a space being the separator.
Try to change this line:

node_base = '1 0 0 {0.X} 0 1 0 {0.Y} 0 0 1 {0.Z}\n'

to this:

node_base = '1,0,0,{0.X},0,1,0,{0.Y},0,0,1,{0.Z}\n'

Where would the scale and rotation values come from?
Currently you talk about points, but how would rotation and scale be defined?

I don’t have experience deep enough to know for sure, but I can only assume the 12 values are defining the transformation matrix. Can you provide an example csv file for me to test, I can write ?

If so it would be straighforward to write an importer/exporter for those files.
Import: Import transformations and assign to a block in Rhino
Export: Get blocks in Rhino and export csv file with the transformationdata.

If this get more complicated that a few lines and no-one over at scripting would like to pick it up, I can surely can help you out. Might be a good excuse for me to drive to Aachen. :car: it’s only a 30 min drive anyway.

-Willem

Thank you for your answer Willem,
I will try out your suggestions on monday,
Meanwhile I managed to do an export by using the rhino grow plugin, however the necessary work flow is not ideal and a bit cumbersome so I am still looking for another solution…
I will send you a working csv file on monday.
If you like, just give me a call and we can meet in Aachen, I invite you to a business lunch☺
I attached a picture I did today with octane using a csv file, this stuff is really great!
Best

Andreas

Great. I’ll keep an eye out for the example file.
Maybe it’s wise to make a new topic at the scripting discourse, as your need is a script.

I’ll take you up on the lunch!
Probably not very soon but somewhere in the near future so to say.

-Willem

Nice script Willem - thanks for posting.

Paul

1 Like

If you export your scene from Rhino with the items you want in the scatter node as blocks “OctaneExportSceneToORBX” and use the .ocs option it will generate the scatter node required in Octane standalone. I usually just open the .ocs file and copy the scatter node over to the standalone file I’m using.