srn-parser
Parse Sarine .srn gemstone scan files and export to Wavefront OBJ.
SRN files are produced by Sarine Technologies diamond scanning systems (DiaMension, DiaScan). They contain stone metadata (weight, color, clarity, dimensions, etc.) and a 3D mesh of the scanned gemstone. The format stores geometry only — no texture coordinates, UVs, or per-face colors. Face normals are computed from the mesh geometry during export, using flat shading which is appropriate for gemstone facets. A generic gemstone material can optionally be included via --mtl.
Install
python3 -m venv .venv
source .venv/bin/activate
pip install .
For development:
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
No dependencies — pure Python stdlib. Dev extras install ruff, pytest, and pre-commit.
CLI Usage
View stone metadata
srn-parser info stone.srn
srn-parser info stone.srn --json
Convert to OBJ
srn-parser convert stone.srn -o output.obj
srn-parser convert stone.srn -o output.obj --mtl # include material file
srn-parser convert stone.srn -o output.obj --high-res # use high-resolution mesh
srn-parser convert stone.srn -o output.obj --scale 0.001 # custom scale factor
srn-parser convert stone.srn -o output.obj --no-normals # skip normal computation
SRN coordinates are in micrometers. The default --scale of 1e-6 converts to meters.
Python API
from srn_parser import parse_srn, export_obj
# Parse an SRN file
srn = parse_srn("stone.srn")
# Access metadata
print(srn.metadata.name) # "b15306"
print(srn.metadata.weight) # 1.58 (carats)
print(srn.metadata.color) # "Blue"
print(srn.metadata.clarity) # "IF"
print(srn.metadata.shape_group) # "ROUND"
# Access mesh data
print(len(srn.mesh.vertices)) # 682
print(len(srn.mesh.faces)) # 343
# High-resolution mesh (from ConcSculptorData, when available)
if srn.high_res_mesh:
print(len(srn.high_res_mesh.vertices)) # 983
# Export to OBJ
export_obj(srn.mesh, "output.obj", name=srn.metadata.name)
# Export with material file and custom scale
export_obj(srn.mesh, "output.obj", name="diamond", scale=0.001, mtl=True)
# Export high-res mesh
export_obj(srn.high_res_mesh, "output_hires.obj", name="diamond_hires")
SRN Format
The SRN format is a proprietary binary container (SPF) with three sections:
| Section | Content |
|---|---|
stone.hdr |
Key-value metadata (name, weight, color, clarity, dimensions, etc.) |
extdata.dat |
Binary measurement data, including a high-resolution mesh (ConcSculptorData) |
smesh.dat |
DirectX .X text-format 3D mesh (vertices and faces) |
Tests
pytest -v
Sample Data
The samples/ directory contains an example SRN file from Sarine DiaScan measurements.
Metadata
Release files for srn-parser 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| srn_parser-1.0.2.tar.gz | 12.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| srn_parser-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.3 kB
Release files / srn_parser-1.0.2.tar.gz
| Download URL | srn_parser-1.0.2.tar.gz |
|---|---|
| Size | 12.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
61bf1e3347250229fd96fdfd01f5d295369b1b10445792ea451900beed2ffcb8
|
|
BLAKE2b-256 checksum How to use checksums |
ef4480b2caa1f01e0375a4a1592b3a245a81575243b17954b42230457e118bb1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / srn_parser-1.0.2-py3-none-any.whl
| Download URL | srn_parser-1.0.2-py3-none-any.whl |
|---|---|
| Size | 10.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
24ba9b387b037f07d6997d97994f4aa0d32e9ad384bb847e4dd9145d2d439da9
|
|
BLAKE2b-256 checksum How to use checksums |
1717887c8b27c72592292d3645625b1ff9b5a4a91da7c4543e12d2b3f05ba48d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|