graphics.py — Graphics Module
Wraps SpinFire.Scripting.API.Utilities.GraphicsUtilities. Covers screenshots/image export, file import/save, coordinate systems, item visibility and standard views.
Screenshots, Import & Save
Function |
Parameters |
Returns |
Description |
|---|---|---|---|
|
|
Result message |
Copies a screenshot of the view to the clipboard. |
|
|
Result message |
Exports the view as an image (.bmp, .emf, .exif, .gif, .jpg, .jpeg, .png, .tiff, .wmf). |
|
|
Result message |
Imports a file. |
|
none |
Result message |
Saves to the current file path. |
|
|
Result message |
Saves to the given file path. |
Coordinate Systems
Function |
Parameters |
Returns |
Description |
|---|---|---|---|
|
none |
|
Gets all coordinate systems. |
|
|
|
Gets a coordinate system, optionally relative to a base. |
|
|
|
Creates a new coordinate system, optionally with interactive picking. |
|
Same as above; any argument may be |
|
Updates an existing coordinate system. |
|
|
|
Convenience wrapper — updates only the name. |
|
|
|
Convenience wrapper — updates only the position. |
|
|
|
Convenience wrapper — updates only the orientation. |
|
|
|
Convenience wrapper — updates only the rotation. |
|
|
Result message |
Shows/hides a coordinate system. |
|
|
Result message |
Makes a coordinate system the active one. |
Visibility & Views
Function |
Parameters |
Returns |
Description |
|---|---|---|---|
|
none |
Result message |
Zooms to fit all visible items. |
|
none |
Result message |
Shows, hides, or toggles visibility of all selected items. |
|
|
Result message |
Applies a standard camera view to the active 3D view. |
Usage
1import spinfirescript as sfs
2from SpinFire.Scripting.API.Geometry import StandardView
3import SpinFire.Scripting.API.Geometry as sfgeom
4
5sfs.ExportImage("screenshot.png")
6sfs.ApplyStandardView(StandardView.TopRight)
7
8# Pick a coordinate system origin/axis interactively, then rotate 150 degrees about X.
9systemData = sfs.CreateCoordinateSystem(
10 0, "New coordinate system",
11 sfgeom.CSPositionParams(pickType=sfgeom.CSPositionParams.PositionPickType.Point),
12 sfgeom.CSOrientationParams(sfgeom.AxisType.Z, pickType=sfgeom.CSOrientationParams.OrientationPickType.Axis),
13 sfgeom.CSRotationParams(sfgeom.AxisType.X, 150))
14print(systemData.CoordinateSystem.MatrixArray)