using FileIO
using MeshIO

using stlProcess

using CSV
using DataFrames

using LinearAlgebra

# local path to https://gitlab.com/orbital-debris-research/fake-satellite-dataset
dataset_path = raw"C:\Coding\fake-satellite-dataset"

folders = ["1_5U", "assembly1", "cubesat"]

# for folder in folders
# dataset_path * "\\" * folder |> 

# end
df = DataFrame(; volume=Float64[], cx=Float64[],cy=Float64[],cz=Float64[], Ix=Float64[], Iy=Float64[], Iz=Float64[])

for path in dataset_path * "\\" .* folders
    for file in readdir(path)
        props = get_mass_properties(load(path * "\\" * file))

        cx, xy, xz = props.center_of_gravity
        Ix, Iy, Iz = eigvals(props.inertia)

        push!(df, [props.volume, cx, xy, xz, Ix, Iy, Iz])
    end
end


CSV.write("dataset.csv",df)