Small, dependency-light Python tools that read Parasolid X_T (text) CAD files without a CAD kernel or schema catalog, extract measurements, and turn the geometry into SVG drawings, an interactive 3D wireframe and a shaded WebGL viewer. Every viewer is a single self-contained HTML file that opens offline in a browser. XT View wraps them in a local drag-and-drop app that also opens STL, DXF, STEP, IGES and BREP files.
🇹🇷 Parasolid X_T (metin) CAD dosyalarını CAD programı ya da şema kataloğu olmadan okuyan Python araçları: ölçü çıkarma, dört görünüşlü SVG, etkileşimli 3B tel kafes ve gölgeli WebGL görüntüleyici. Çıktılar sunucu gerektirmeyen tek HTML dosyalarıdır. XT View arayüzü ile X_T, STL, DXF, STEP, IGES ve BREP dosyaları sürükle-bırak ile açılır.
Viewing or measuring an X_T file normally needs a CAD license or a heavy kernel such as OCCT. These scripts read the transmit format directly: they find analytic geometry records, validate them (axis and reference vectors must be unit length) and rebuild edges and faces from them. That is enough for quick dimension checks and a visual preview on any machine with Python.
| Script | Input → Output | What it does |
|---|---|---|
xt_oku.py |
.x_t → report |
Bounding box and overall size in mm, counts of lines, circles, planes, cylinders, cones, spheres, tori and B-splines |
xt_gorunum.py |
.x_t → .svg |
Front / top / side / isometric drawing on one sheet |
xt_3b.py |
.x_t → .html |
Interactive 3D wireframe (rotate, zoom), single file |
xt_kati.py |
faces JSON → mesh JSON | Triangulates each face in its own (u,v) parameter space with ear clipping, then subdivides triangles that deviate from curved surfaces by more than 0.35 mm |
xt_goruntule.py |
mesh JSON → .html |
Shaded WebGL viewer. Positions are packed to 16 bit and normals to 8 bit, embedded as base64 |
xt_sema.py |
.x_t → report |
Infers record layouts for old files that carry no embedded schema (e.g. sch_8008) |
xt_kenar.py |
(library) | Trims curves at the vertices that lie on them to recover real edges |
viewer.py + XTView.cmd |
any supported file → browser | XT View: local drag-and-drop viewer app (see below) |
dxf_view.py |
.dxf → .html |
ASCII DXF model-space preview: lines, arcs, circles, polylines with bulges, 3D faces; pan and zoom |
Older Parasolid versions do not write the schema into the file, so field layouts are unknown. xt_sema.py takes
geometry records that pass the unit-vector check as fixed anchors and splits the gaps between anchors into record
sequences under two constraints: every record must start with a valid node type, and every entity index must be
unique in the stream. If exactly one split survives, the layout has been learned.
Requirements: Python 3.10+ and NumPy (xt_oku.py and xt_sema.py use only the standard library).
pip install numpy
python xt_oku.py part.x_t # measurements
python xt_gorunum.py part.x_t part.svg # 4-view drawing
python xt_3b.py part.x_t part_3d.html # wireframe viewer
python xt_sema.py old_part.x_t # layout inference
python xt_kati.py faces.json mesh.json # triangulate faces
python xt_goruntule.py mesh.json part.html "Part name" # shaded viewerxt_kati.py expects the faces of each body with their surface type, parameters and trimming loops:
{"bodies": [{"faces": [{"k": "cone", "s": 1, "b": [/* origin, axis, ref */], "r": [/* radii */],
"loops": [[x, y, z, x, y, z, ...]]}]}]}Surface types: plane, cylinder, cone, sphere, torus. Other surfaces (B-spline, offset, swept, spun,
blend) are approximated with the plane that best fits their boundary points.
A small local web app for opening CAD files by dragging them onto the window.
python viewer.py # or double-click XTView.cmd on WindowsIt starts a server on 127.0.0.1 with a random URL token, opens the browser, and renders each file with the shaded
WebGL viewer (DXF files get the 2D preview).
| Format | How it is read |
|---|---|
.x_t, .xmt_txt |
External face extractor (set XT_GEOM_TOOL) → xt_kati.py triangulation |
.dxf |
dxf_view.py, no extra dependencies |
.stl, .step/.stp, .iges/.igs, .brep |
OpenCASCADE through cadquery-ocp-novtk (pip install cadquery-ocp-novtk) |
Settings (optional environment variables): XT_GEOM_TOOL (path of the X_T face extractor that prints the faces JSON
described below), XT_VIEW_PORT (default: random free port), --no-browser to only print the URL.
Uploaded files are processed in a temporary folder that is deleted after each request; nothing leaves the machine.
On a 2.7 MB production part file (357,633 tokens):
- 1,496 vertices and 5,119 edges recovered, bounding box 55.43 × 55.43 × 53.50 mm
- 1,196 faces triangulated into 60,134 triangles; the shaded viewer is a single 2 MB HTML file
- Edge check: every edge is used exactly twice and every arc endpoint lies on its curve
- Text X_T only; binary X_B is not supported.
- Topology is not decoded, so edges are recovered geometrically from vertices lying on curves.
- Non-analytic surfaces are shown as best-fit planes in the shaded view.