Read file csv with python in Houdini

   1245   6   2
User Avatar
Member
22 posts
Joined: Jan. 2023
Offline
Hi, I am trying to read a csv file using python with several columns of coordinates to position 3D models, in total there are more than 100 I would like to do it automatically, do you recommend any function or method to do it?

Thanks
User Avatar
Member
22 posts
Joined: Jan. 2023
Offline
Thank you for your help. Now how can I make it read the rows and the column "Species" as the identifier and the columns "X" and "Y" as the coordinates of the position of the species to place the 3D models of the species in that position in a Houdini scene?

Can I use the standard pyhton programming language for this ?
Edited by roedbo - Sept. 8, 2023 05:31:27

Attachments:
trable_import.png (272.0 KB)

User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
You'd better use a Vex Wrangle for that, as you have already have all the attribute on the points.

In a point wrangle
@P.x = f@X;
@P.z = f@Y;

then use a copy to points node to instance the 3d models.
Relevant documentation:
https://www.sidefx.com/docs/houdini/nodes/sop/copytopoints.html [www.sidefx.com]
https://www.sidefx.com/docs/houdini/copy/instanceattrs.html [www.sidefx.com]

User Avatar
Member
22 posts
Joined: Jan. 2023
Offline
Ok, and what do I have to do to iterate through the "Species" column to import the 3D models previously created in another folder and with the X and Y coordinates corresponding to each model automatically?

Thanks
Edited by roedbo - Sept. 11, 2023 10:11:41
User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
roedbo
Ok, and what do I have to do to iterate through the "Species" column to import the 3D models previously created in another folder and with the X and Y coordinates corresponding to each model automatically?

Thanks

I think you want to use the "variant attribute" workflow in this case, which is explained in the video above.
Use a file node to import each geometry into the scene and assign the corresponding "Species" attrib
User Avatar
Member
22 posts
Joined: Jan. 2023
Offline
Hello again, I am going to explain in detail what I intend to get which is to create a scenario simulating forest plots with 3D models.
First of all I have the data of the 3D models of trees and shrubs with their position in a csv, with the help of the Table Import node I have been able to import the table to Houdini (image 1) and with the VEX code "@P.x = f@X; @P.z = f@Y;" and the point wrangle node I have put the positions of each model (in total there are 486 3D models in a 30x30 plot) in their corresponding position (image 2). But I have not been able to import each model of the "Species" column of the 486 in its respective position, I imagine that it will be using the VEX programming language but I am a beginner in Houdini and I have never used that language before.
On the other hand, I have made a test with various tutorials with 500 random points and I have managed to import three 3D models of species as an example (image 3 and 4) using the copy to points node as shown in the image.
Finally what I would like to get is that the 3D models of each model in the column "Species" is placed in their respective position X and Y automatically either using the language VEX or python but the problem is that I am a beginner in Houdini, VEX and python, hahaha I'm learning sorry.

Attachments:
imagen1.png (913.2 KB)
imagen2.png (301.6 KB)
imagen3.png (1.6 MB)
imagen4.png (256.3 KB)

  • Quick Links