Export Cross Section data to CSV

Hi. Reasonably long time user, first time poster. I’m looking for an extension to export line data to CSV coordinates. In my case I want to extract watercourse cross sections into Excel, where I can then undertake hydraulic analysis, e.g. estimate the channel’s flow capacity.

I scan the watercourse with my iPad’s LiDAR scanner, then import that to SU on my desktop, as a DAE file.
then I draw a plane across the channel (having created new axes aligned to the channel)
then I draw the cross section on that plane

I want the (ideally local, i.e. relative to the plane) X & Z coordinates of each vertex on the cross section line, in CSV format or similar. I’ve searched high and low to no avail. The closest thing I’ve found is “XYZ Exporter” by Demaerd, but it’s not compatible with my version :(.

Can anyone help me?

Thanks in advance!


First save your file and with your edges selected try to copy & paste this into the ruby console:

mod = Sketchup.active_model
sel = mod.selection

ed = sel.grep(Sketchup::Edge)
stpoint = ed.map(&:start)
enpoint = ed.map(&:end)
points = stpoint + enpoint
crossPoints = points.uniq

aa = crossPoints.map {|p| p.position[0].to_m.round(2).to_s + "," + p.position[2].to_m.round(2).to_s + "\n" }


#crea archivo csv con la informacion
def self.guardaCsv(texto)
  #escribe en un txt en en mismo folder que el archivo el...
  #lee la ruta del archivo y parte en la extensión
  myarray = Sketchup.active_model.path.split('.')
  #quita la extensión
  status = myarray.delete_at(-1)
  #añade extension csv
  path = myarray[0]+'.csv'
  #escribe en el archivo
  File.open(path, "w+") do |f|
    f.puts texto

A csv file will be created into the same folder as your file with your vertex points (x,z)
I suposed your points coordinates are in meters ans I rounded to 2 decimals, if it’s not correct please write me with the right units.