geometry.py — Geometry Module
Wraps SpinFire.Scripting.API.Utilities.GeometryUtilities. Provides creation and deletion of user (script-authored) geometry — lines, polylines and shells — plus canvas control.
Function |
Parameters |
Returns |
Description |
|---|---|---|---|
|
|
|
Inserts a single line segment. |
|
|
Line data (probably |
Inserts a connected polyline through the given points. |
|
none |
Result message |
Forces a canvas redraw. |
|
|
Result message |
Deletes a previously inserted line by ID. |
|
none |
Result message ( |
Deletes all geometry created via the Scripting API. |
|
See below |
|
Inserts a custom polygonal shell (mesh). |
|
|
Result message |
Deletes a previously inserted shell by ID. |
InsertShell Parameter Detail
points— list of [x, y, z] coordinates.faces— flat integer array; each face starts with its vertex count followed by that many indices intopoints(e.g.[3, 0, 1, 2]= a triangle from points 0, 1, 2).faceColor/edgeColor— ARGB color text, e.g.'#FFAA00BB'.faceColors— optional per-face ARGB color list.faceVisibilities— optional per-face boolean visibility list.setFaces/setEdges/setLights— booleans controlling which rendering attributes are applied.
Notes
IDs.
InsertLineandInsertShellreturn an object whoseIDis a 32-character hex string, such as253b315df4374a6fabe44f451caddd01. Pass that toDeleteLine/DeleteShell. ItsMessagereads e.g. Line ‘<ID>’ was successfully inserted. This was confirmed by the probe. The result objects also have aDelete()method, which hasn’t been tried yet.Colors. Colors are ARGB, with alpha first. The
'#AARRGGBB'form is confirmed to work: samples 05, 06 and 08 use it. The source examples also show the form without#(e.g.'FFAA00BB'), but that hasn’t been confirmed, so use the#form.Batch drawing. Pass
updateCanvas=Falseto each insert and callUpdateCanvas()once at the end, rather than redrawing after every shape.
Usage
1import spinfirescript as sfs
2
3line = sfs.InsertLine([0, 0, 10.5], [100, 100.3, -90], "#FFAABBCC", 2)
4print(line.Message)
5print(sfs.InsertPolyline([[0, 0, 10.5], [10, 10.5, -7], [100, 75, 83.7]], "#FFAABBCC", 3))
6
7points = [[100, 100, 100], [100, 100, -100], [100, -100, -100], [100, -100, 100],
8 [-100, -100, 100], [-100, -100, -100], [-100, 100, -100], [-100, 100, 100]]
9faces = [4, 0, 1, 2, 3, 4, 4, 5, 6, 7, 4, 5, 4, 3, 2, 4, 7, 6, 1, 0, 4, 6, 5, 2, 1, 4, 0, 3, 4, 7]
10shell = sfs.InsertShell(points, faces, "#FFAA00BB", edgeColor="#FF00AA77")
11print(shell.Message)
12
13print(sfs.DeleteLine(line.ID))
14print(sfs.DeleteShell(shell.ID))
15print(sfs.DeleteUserGeometry())