Parse Sarine .srn gemstone files and export to Wavefront OBJ
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file srn_parser-1.0.2.tar.gz.
File metadata
- Download URL: srn_parser-1.0.2.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61bf1e3347250229fd96fdfd01f5d295369b1b10445792ea451900beed2ffcb8
|
|
| MD5 |
e90f1fd238ba707082f17c4832277ec9
|
|
| BLAKE2b-256 |
ef4480b2caa1f01e0375a4a1592b3a245a81575243b17954b42230457e118bb1
|
File details
Details for the file srn_parser-1.0.2-py3-none-any.whl.
File metadata
- Download URL: srn_parser-1.0.2-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24ba9b387b037f07d6997d97994f4aa0d32e9ad384bb847e4dd9145d2d439da9
|
|
| MD5 |
717eea624d0e8848e2220da4d9f69a81
|
|
| BLAKE2b-256 |
1717887c8b27c72592292d3645625b1ff9b5a4a91da7c4543e12d2b3f05ba48d
|