dymokomi/luced-3d
Source of release 0.11.4
0.11.4 / examples / scripts / csv_points.prisma
#prisma 4.0
def luced3d "scene" {
int display = 2
int next_id = 3
bool preview = true
int scope = -1
int selected = 2
int take = 0
float64[4] time = [1, 1, 240, 24]
str units = "mm"
int version = 1
def network "nodes" {
def Script "n2" {
int edit_count = 0
bool enabled = true
str frozen = ""
int guard = 0
str[0] hidden = []
int id = 2
float64[2] inputs = [-1, -1]
str name = "Script 2"
int output = 1
float64[64] parameters = [30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.040000000000000001, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
int parent = -1
float64[2] position = [0, 0]
float64[2] sources = [0, 0]
str[13] texts = ["", "## A CSV of x, y, z and mass (after a header) as a point cloud.\nimport strings\nfrom luce_std import files\nfrom luce_geocore.script import Cook, Geometry\n\npub func cook(k: Cook*) -> !:\n let data = try files.read_text(k.file(\"table\", \"points.csv\"))\n defer data.release()\n let size = k.f32(\"size\", 0.04)\n let lines = try strings.split(data.value, '\\n')\n var g = try Geometry.empty()\n for row in 1..<lines.length:\n if lines[row].length == 0:\n continue\n let cells = try strings.split(lines[row], ',')\n if cells.length < 4:\n k.warning(f\"row {row + 1} has {cells.length} columns\")\n continue\n let point = try g.add_point([try strings.parse_f32(cells[0]), try strings.parse_f32(cells[1]), try strings.parse_f32(cells[2]), 0.0])\n let mass = try strings.parse_f32(cells[3])\n try g.set_point_f32(point, \"mass\", mass)\n try g.set_point_f32(point, \"pscale\", size * (0.5 + mass))\n try g.set_point_vec3(point, \"Cd\", [mass, 0.3, 1.0 - mass, 0.0])\n print(f\"{g.point_count()} points\")\n try g.make_cloud()\n try k.set_geometry(g)\n", "", "table\t5\t0\t0\tfile\t\nsize\t16\t1\t0", "", "points.csv", "", "", "", "", "", "", ""]
bool time_dependent = false
bool visible = true
def recipes "edits" {
}
}
}
def takes "takes" {
def take "t0" {
str[1] cameras = [""]
float64[1] counts = [0]
float64[1] enabled = [1]
str[1] hidden = [""]
float64[1] ids = [2]
str name = "Main"
float64[0] transforms = []
float64[1] visible = [1]
}
}
def editor_view "view" {
float64[6] camera = [0.69999999999999996, 0.55000000000000004, 15.756395568400581, -0.052430391311645508, 1.4962500333786011, 0.051421046257019043]
float64[3] network = [1, 0, 0]
}
}