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

InsertLine(startPoint, endPoint, colorText=None, width=GeometryUtilities.DefaultWidth, updateCanvas=True)

startPoint/endPoint (list[float] x,y,z); colorText (str ARGB, e.g. '#FFAABBCC'); width (float); updateCanvas (bool)

LineData — ID, Message, Delete()

Inserts a single line segment.

InsertPolyline(points, colorText=None, width=GeometryUtilities.DefaultWidth, updateCanvas=True)

points (list of [x,y,z]); colorText; width; updateCanvas

Line data (probably LineData, as for InsertLine; not yet probed)

Inserts a connected polyline through the given points.

UpdateCanvas()

none

Result message

Forces a canvas redraw.

DeleteLine(lineID, updateCanvas=True)

lineID (str) — the ID from an insert result; updateCanvas (bool)

Result message

Deletes a previously inserted line by ID.

DeleteUserGeometry()

none

Result message (str)

Deletes all geometry created via the Scripting API.

InsertShell(points, faces, faceColor=None, updateCanvas=True, setFaces=True, setEdges=True, setLights=False, edgeColor=None, faceColors=None, faceVisibilities=None)

See below

ShellData — ID, Message, Delete()

Inserts a custom polygonal shell (mesh).

DeleteShell(shellID, updateCanvas=True)

shellID (str) — the ID from an insert result; updateCanvas (bool)

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 into points (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. InsertLine and InsertShell return an object whose ID is a 32-character hex string, such as 253b315df4374a6fabe44f451caddd01. Pass that to DeleteLine / DeleteShell. Its Message reads e.g. Line ‘<ID>’ was successfully inserted. This was confirmed by the probe. The result objects also have a Delete() 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=False to each insert and call UpdateCanvas() 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())