Skip to content

Repository files navigation

3DM Viewer logo

3DM Viewer — a read-only CAD and G-code viewer for Sailfish OS

3DM Viewer opens a CAD file on the phone, draws it, and lets you turn it around. It is a viewer and nothing else: there is no editing and no save path anywhere in the program, so it can never write over the file you opened. Everything runs on the device — no network, no telemetry, no cloud component.

Developed on a Sony Xperia 10 III (pdx213, Sailfish OS 5.1.0.11) and also verified on a Jolla J2 (Sailfish OS 5.2). Much of it should work on other Sailfish OS devices too, but those are the two it has been run on.

Turning a model, switching between solid, wireframe and see-through, opening the layer list, and dropping the model into the deep room

A shaded model The same model, see-through The same model as edges only The application on the home screen

Solid · see-through · wireframe · on the launcher

What it does

  • Five formats, all drawn by the same renderer:

    Format What it reads
    .3dm Rhino models, from the render meshes Rhino stores in the file
    .stp .step STEP solids — planes and cylinders, tessellated on the phone
    .stl Binary and ASCII
    .3mf Objects, instances and colours, as slicers save them
    .bgcode PrusaSlicer binary G-code, drawn as the toolpath it is
  • Turn it around — orbit with one finger, pinch to zoom, double tap to fit.

  • Locked views — X / Y / Z square-on, each further tap a quarter turn, plus a free 3D view.

  • Three ways of turning — one button cycles between turning about the centre of the screen, about a point you tap on the model, and freely in any direction with a two-finger roll. A further press restores the opening view.

  • Three display modes — solid, wireframe and see-through.

  • A switch per layer — Rhino layers, STEP solids, 3MF objects, or the extrusion types of a sliced file, starting from the visibility stored in the file.

  • A print-layer slider for sliced files: peel layers away from the top and the bottom, the way the slicer's own preview does.

  • Model info — counts, bounding size, and the application that wrote the file.

  • A drop simulation — turn the model into a falling rigid body that tumbles onto its real corners, with the phone's accelerometer steering gravity.

No sample models are shipped. Bring your own — that is what the file picker is for.

How STEP is drawn

Every other format hands over triangles, or a mesh the CAD system already computed. STEP hands over mathematics: a face is a surface plus the loops of curves that cut a piece out of it, and nothing in the file says where a triangle goes. So the app builds them itself, on the phone:

  1. sample each boundary curve into points,
  2. map those into the surface's own (u,v) coordinates with an exact inverse — where a cylinder is simply a flat rectangle,
  3. triangulate that flat polygon-with-holes by ear clipping,
  4. map the corners back to 3D and take exact normals there.

Only step 3 is generic, which is the point: one triangulator serves every surface type, and adding a cone or a sphere later means writing an evaluation and an inverse, not another mesher.

What it will not do

  • Rhino — surfaces come from the render meshes inside the file. A model saved with Save Small has none and cannot be shown. Block instances, curves, annotation and lights are not drawn.
  • STEP — faces on a plane or a cylinder are tessellated. Any other surface type is counted and reported, not drawn. That covers the great majority of mechanical parts, whose faces are flat or round, but it is not the whole standard.
  • 3MF — beam lattices, slice stacks and textures are skipped, and ZIP64 archives are not read.

Whatever cannot be shown is said out loud, never left silently missing.

Install

Download the RPM from the releases page and, on the phone:

pkcon install-local -y harbour-3dmviewer-0.1.1-1.aarch64.rpm

Building

Requires the Sailfish OS SDK. openNURBS is a submodule, so fetch it first:

git submodule update --init
mb2 --target SailfishOS-5.0.0.62-aarch64 build

That first build compiles openNURBS — roughly 250 source files — and takes a while. It is a static library, so later builds do not repeat it.

Status & responsible use

Proof of concept / work in progress, shared as is with no warranty of any kind (see the GPLv3). It may be incomplete, rough around the edges, or change without notice — use it at your own risk.

It is a viewer, not a measuring instrument. What you see is what it managed to read, and a shape that looks plausible is not a promise that it is right: the STEP tessellator is new code judged against a small number of real files, and Rhino geometry is only ever the render mesh the file happens to carry. Whatever cannot be drawn is reported rather than quietly dropped — but do not take a dimension off the screen and cut metal to it.

Verified on two devices — a Sony Xperia 10 III on Sailfish OS 5.1.0.11 and a Jolla J2 on 5.2. The startup crash reported against earlier versions is fixed in 0.1.3; it was openNURBS in the executable image killing the EGL setup before the first frame, so the Rhino reader is now loaded only when a .3dm is opened. If something still goes wrong, please open an issue with your device model and the output of harbour-3dmviewer launched from the Terminal on the phone (over ssh there is no Wayland session and the error you get is a different one).

Licence and credits

Licensed under the GNU General Public License v3.0 or later — see LICENSE.

.3dm is read with the openNURBS toolkit by Robert McNeel & Associates, included as a pinned submodule rather than a copy and compiled in statically, together with the zlib and uuid code it bundles. Why it is a submodule, and what its licence position actually is, is set out in lib/OPENNURBS.md.

The STEP, STL, 3MF and binary G-code readers are written for this application and use nothing beyond Qt. The .bgcode reader in particular is written from the published format description rather than derived from Prusa's own libbgcode, which is AGPL and would otherwise have set the licence of this whole program.

Not affiliated with or endorsed by Robert McNeel & Associates. "Rhinoceros", "Rhino3D" and "openNURBS" are their trademarks; this application's icon is an original drawing and is not their mark. Not affiliated with or endorsed by Prusa Research.

Releases

Packages

Contributors

Languages