Importing excel to SU
-
Hi,
I'm searching the net for a plugin that can read in sizes of components from excel file and create them in SU. Couldn't get DST Manager to work in SU2015.
Does anyone here have some solution? I'm going to create 1k-2k different small pieces and it would speed up the process because I have them in excel. -
@qub3 said:
Hi,
I'm searching the net for a plugin that can read in sizes of components from excel file and create them in SU. Couldn't get DST Manager to work in SU2015.
Does anyone here have some solution? I'm going to create 1k-2k different small pieces and it would speed up the process because I have them in excel.Export the excel file as a .csv and post it. It is simple enough for a plugin to read that file and create the objects when the exact values and there order are know.
-
Hi,
Then I will upload it here. Pretty basic but it will be much more parts and different names. What I would like to to is to iterate trough the file and create components with the given values.
-
You've used a ';' as your value-separator rather than a ','
However you can readily read your file and extract the data from each of the lines - whatever the separator, provided you know what it is and there is no individual-entry value likely to confuse things [even that is fixable, but...]Cod-code...
lines = IO.read(path_to_the_csv_file) bits = [] lines.each{|line| data = line.split(';') ### or ANY other separator bits << data }
The array 'bits' now has each of the csv's lines, represented as an array of each lines values...
-
Hi,
Then it must be possible to combine reading in a csv file and drawing with box.rb from Sketchup examples right? I'm really new to this so I have some problem to figure out how to do. Someone who has the possibility?
-
Ley's assume from my earlier example 'bits' consists of separate values in the form
0.0,0.0,1.0
And that those represent the X,Y,Z values of a point...points=[] bits.each{|bit| xyz=bit.split(',') xyz.clone.each_with_index{|e, i| xyz[i] = xyz[i].to_f } points << Geom;;Point3d.new(xyz) }
'points' is now an array of Point3d values based on converting the CSV lines' strings into three floats, representing XYZ values.
Assuming that the points are logically ordered you need four for each face of a cube, so you need to have 4 lines x 6 faces, you read the first 4 then the next 4 etc and make a face for each 'set' in turn.
Points will need to be duplicated doing it this way.
If you known it's a simple cube then you only need to define the 4 points making the base and in code pushpull that into a 3d form...
Advertisement