Luce packages
LuceLuce BaseLuciaOS

dymokomi/luced-3d

Source of release 0.11.6

0.11.6 / examples / scripts / csv_points.prisma

#prisma 4.0
def luced3d "scene" {
    int display = 3
    int next_id = 4
    int scope = 2
    int selected = 3
    int take = 0
    float64[4] time = [1, 1, 240, 24]
    str units = "mm"
    int version = 1
    def network "nodes" {
        def Geo "n2" {
            int edit_count = 0
            bool enabled = true
            str frozen = ""
            int guard = 0
            str[0] hidden = []
            int id = 2
            float64[0] inputs = []
            str name = "Geo 2"
            float64[48] parameters = [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 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 = [40, 70]
            float64[0] sources = []
            str[3] texts = ["", "weight", "renamed"]
            bool time_dependent = false
            bool visible = true
            def recipes "edits" {
            }
        }
        def Script "n3" {
            int edit_count = 0
            bool enabled = true
            str frozen = ""
            int guard = 0
            str[0] hidden = []
            int id = 3
            float64[2] inputs = [-1, -1]
            str name = "Script 3"
            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 = 2
            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[2] cameras = ["", ""]
            float64[2] counts = [12, 0]
            float64[2] enabled = [1, 1]
            str[2] hidden = ["", ""]
            float64[2] ids = [2, 3]
            str name = "Main"
            float64[12] transforms = [0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0]
            float64[2] visible = [1, 1]
        }
    }
    def editor_view "view" {
        float64[3] network = [1, 0, 0]
        float64[46] panes = [0, 1, 1, -1, 0, 1.5707963267948966, 9, 0, 0.80000000000000004, 0, 0, 1, 45, 0, -1, 0.69999999999999996, 0.55000000000000004, 15.756395568400581, -0.052430391311645508, 1.4962500333786011, 0.051421046257019043, 0, 0, 45, 3, -1, 0, 0, 9, 0, 0.80000000000000004, 0, 0, 1, 45, 6, -1, 1.5707963267948966, 0, 9, 0, 0.80000000000000004, 0, 0, 1, 45]
    }
}