Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<SkiaSharpVersion>4.157.0</SkiaSharpVersion>
</PropertyGroup>
<ItemGroup>
<!-- Patch = adds or fixes, minor = breaking while IOScene is 0.x; the -0.0 keeps out previews of the next breaking line
Expand All @@ -9,7 +10,10 @@
<PackageVersion Include="IOCoord" Version="0.1.0-preview.2" />
<PackageVersion Include="IfcIO.Scene" Version="0.11.1" />
<PackageVersion Include="NwcIO.Scene" Version="0.13.0" />
<PackageVersion Include="PclIO.Scene" Version="0.1.1" />
<PackageVersion Include="Microsoft.Data.Sqlite" Version="10.0.15" />
<PackageVersion Include="SkiaSharp" Version="$(SkiaSharpVersion)" />
<PackageVersion Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="$(SkiaSharpVersion)" />
<PackageVersion Include="PclIO.Scene" Version="0.1.2" />
<PackageVersion Include="RvtIO.Scene" Version="0.5.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.12.0" />
<PackageVersion Include="xunit" Version="2.9.3" />
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](https://opensource.org/licenses/MIT)
[![Platform](https://img.shields.io/badge/.NET-8.0%20%7C%2010.0-512BD4?style=flat-square&logo=dotnet)](https://dotnet.microsoft.com/)

IOViewer is a fast, 100% managed .NET library and command line tool that generates standalone interactive 3D WebGL / HTML BIM & CAD model viewers from code, glTF/GLB, Wavefront OBJ, or JSON. Builds of the `ioviewer` CLI from this repository also read IFC, Revit and Navisworks cache files (`.nwc`) through `IfcIO.Scene`, `RvtIO.Scene` and `NwcIO.Scene`. The IOViewer library accepts the `SceneDocument` these adapters produce and depends on [IOScene](https://github.com/IOExtend/IOScene) for the scene model.
IOViewer is a .NET library and command line tool that generates standalone interactive 3D WebGL / HTML BIM & CAD model viewers from code, glTF/GLB, Wavefront OBJ, or JSON. Builds of the `ioviewer` CLI from this repository also read IFC, Revit and Navisworks cache files (`.nwc`) through `IfcIO.Scene`, `RvtIO.Scene` and `NwcIO.Scene`. The IOViewer library accepts the `SceneDocument` these adapters produce and depends on [IOScene](https://github.com/IOExtend/IOScene) for the scene model.

The generated HTML is a single file with no external dependencies that works offline: it opens from disk (`file://`) in a current browser with WebGL 2 and makes no network requests. The viewer is built on [three.js](https://threejs.org/), which is embedded in the file (see [THIRD-PARTY-NOTICES.md](THIRD-PARTY-NOTICES.md)).

Expand All @@ -33,6 +33,7 @@ Built clean-room under the [IOExtend](https://github.com/IOExtend) organization.
- display modes (materials, textures, white, wireframe), viewport background color, grid lines and a global opacity slider;
- saved viewpoints with a viewpoint tour, clash results, a 4D schedule player and linked-file visibility, each shown only when the document has that data.
- Imports binary glTF 2.0 (`.glb`), Wavefront OBJ (`.obj`), and JSON: viewer JSON, IOScene scene files and IOViewer 0.1/0.2 snapshots.
- Displays point clouds with source RGB when available and a top-down minimap. The CLI includes Leica LGSX camera panoramas, FARO FLS colour panoramas and registered sets of E57 camera images. Select a station on the minimap to open its photograph.

### Mouse and keyboard

Expand Down Expand Up @@ -236,6 +237,12 @@ dotnet build IOViewer.slnx -c Release
dotnet test
```

To test local PclIO changes, build against a source checkout:

```sh
dotnet build IOViewer.slnx -c Release -p:PclIOSourceRoot=/path/to/PclIO
```

The viewer page is built from `src/IOViewer/Viewer` with Node.js 24; see [CONTRIBUTING.md](CONTRIBUTING.md). The built script `dist/viewer.js` is committed, so building the .NET solution does not need Node.js.

## Contributing
Expand Down
6 changes: 6 additions & 0 deletions THIRD-PARTY-NOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ library package references none of them.

| Component | Use | License |
|---|---|---|
| [PclIO and PclIO.Scene](https://github.com/IOExtend/PclIO) | read point clouds | MIT, copyright (c) 2026 mahach666 |
| [Microsoft.Data.Sqlite](https://github.com/dotnet/efcore) | read scanner project metadata | MIT, copyright (c) Microsoft Corporation |
| [SQLitePCLRaw](https://github.com/ericsink/SQLitePCL.raw) and [SQLite](https://sqlite.org/copyright.html) | SQLite bindings and database runtime | Apache-2.0, copyright (c) 2014–2024 SourceGear, LLC, and SQLite in the public domain |
| [SkiaSharp and native assets](https://github.com/mono/SkiaSharp) | decode and encode photographs | MIT, copyright (c) 2015–2016 Xamarin, Inc. and 2017–2018 Microsoft Corporation |
| [IOCoord](https://github.com/IOExtend/IOScene) 0.1.0-preview.1 | hard clash and clearance checks | MIT, copyright (c) 2026 mahach666 |
| [IfcIO](https://github.com/IOExtend/IfcIO) 0.11.1 and IfcIO.Scene 0.11.1 | read IFC files into a scene | MIT, copyright (c) 2026 IfcIO contributors |
| [NwcIO](https://github.com/IOExtend/NwcIO) 0.13.0 and NwcIO.Scene 0.13.0 | read Navisworks caches into a scene | MIT, copyright (c) 2026 mahach666 |
Expand All @@ -55,6 +59,8 @@ library package references none of them.
| [OpenMcdf](https://github.com/openmcdf/openmcdf) 3.4.0, used by RvtIO | reads the compound file container of Revit files | MPL-2.0, copyright (c) 2010-2026 Federico Blaseotto, Jeremy Powell |
| [SharpZipLib](https://github.com/icsharpcode/SharpZipLib) 1.4.2, used by RvtIO | stream decompression | MIT, copyright (c) 2000-2022 SharpZipLib Contributors |

SQLitePCLRaw uses the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). The CLI package includes the SkiaSharp native asset notices in `licenses/SkiaSharp-NOTICES.txt`.

OpenMcdf is distributed unmodified under the Mozilla Public License 2.0 (<https://mozilla.org/MPL/2.0/>); its source
code is available at <https://github.com/openmcdf/openmcdf>.

Expand Down
13 changes: 13 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,19 @@ what breaks the scene contract, such as an instance that names a missing element

The model's up axis is +Z. The interface is in Russian when the browser language is Russian and in English otherwise.

Point clouds have a collapsible minimap showing their XY footprint and the camera heading. Colored point cloud inputs keep their source RGB.
A viewer snapshot can also contain `PointColors`, a dictionary using scene geometry IDs and base64 RGB triplets in vertex order,
and `Panoramas`, a list with `ElementId`, XYZ `Position` in scene metres, and a base64 `Jpeg`. Use a 2:1 equirectangular JPEG with its
centre looking along +X, or set `YawDegrees` to turn the photo about +Z. Select a photo station on the minimap. Drag the image or use the
arrow keys to look around, and use the wheel to zoom. Arrows inside the photograph move to other scan stations and retain the current
heading. The minimap remains available while the photo panel is open. The generated HTML embeds the photographs.

Use **Enlarge** to expand a panorama. Pick a minimap size, drag the plan to pan it and use the wheel or the zoom buttons to change its scale.
The **+** beside the level list starts a level from two clicks in a panorama, lower elevation first. Each elevation comes from the
sampled scan point at that location. Selecting a level filters the map points and stations to that height range. Clear station groups
separated vertically by more than 2 m can create levels automatically. Use **All heights** to return to the full plan. Level ranges
are saved in the browser for that HTML file when local storage is available.

- Left click selects, Ctrl+click adds or removes, a click on empty space clears the selection.
- Left drag orbits around the point under the cursor; middle or right drag pans; the wheel zooms towards the cursor.
- Shift+left drag selects with a box: left to right selects objects fully inside, right to left selects objects it touches.
Expand Down
9 changes: 8 additions & 1 deletion src/IOViewer.Cli/IOViewer.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,19 @@
<PackageReference Include="IOCoord" />
<PackageReference Include="IfcIO.Scene" />
<PackageReference Include="NwcIO.Scene" />
<PackageReference Include="PclIO.Scene" />
<PackageReference Include="PclIO.Scene" Condition="'$(PclIOSourceRoot)' == ''" />
<ProjectReference Include="$(PclIOSourceRoot)/src/PclIO.Scene/PclIO.Scene.csproj" Condition="'$(PclIOSourceRoot)' != ''" />
<PackageReference Include="Microsoft.Data.Sqlite" />
<PackageReference Include="SkiaSharp" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" />
<PackageReference Include="RvtIO.Scene" />
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="IOViewer.Tests" />
<!-- Pack collects these files outside the target framework builds. -->
<None Include="$(NuGetPackageRoot)/skiasharp.nativeassets.linux.nodependencies/$(SkiaSharpVersion)/THIRD-PARTY-NOTICES.txt"
Pack="true" PackagePath="licenses/SkiaSharp-NOTICES.txt" Visible="false" />
</ItemGroup>

</Project>
49 changes: 46 additions & 3 deletions src/IOViewer.Cli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using IOViewer.Importers;
using IOViewer.Model;
using NwcIO.Scene;
using PclIO;
using PclIO.Scene;
using RvtIO.Scene;

Expand Down Expand Up @@ -379,9 +380,51 @@ private static ViewerDocument Load(string path, out IReadOnlyList<SceneDiagnosti

private static ViewerDocument FromPcl(string path, out IReadOnlyList<SceneDiagnostic> diagnostics)
{
var result = PclSceneReader.Read(path);
diagnostics = result.Diagnostics;
return FromScene(path, result.Document, diagnostics);
using var cloud = PclFile.Open(path);
int step = ScanPhotographs.SubsampleStep(cloud);
bool showIntensity = cloud.Kind is PclFileKind.LeicaLgsx or PclFileKind.LeicaLgs;
var captured = new Dictionary<int, List<byte>>();
var colored = new HashSet<int>();
var sceneOptions = new PclSceneOptions
{
SubsampleStep = step,
MaxDegreeOfParallelism = showIntensity && step > 1 ? Math.Min(Environment.ProcessorCount, 4) : 1,
PointObserver = CaptureColor,
};

var result = PclSceneReader.Read(cloud, sceneOptions);
var messages = result.Diagnostics.ToList();
diagnostics = messages;
var viewer = FromScene(path, result.Document, diagnostics);
foreach (int geometry in colored) viewer.PointColors.Add(geometry, captured[geometry].ToArray());
messages.RemoveAll(diagnostic => diagnostic.Code == "colours-dropped");
ScanPhotographs.Add(cloud, viewer, messages);
return viewer;

void CaptureColor(int geometry, PclPoint point)
{
if (!captured.TryGetValue(geometry, out var bytes)) captured[geometry] = bytes = [];
var color = DisplayColor(point, showIntensity, out bool present);
if (present) colored.Add(geometry);
bytes.Add(color.R);
bytes.Add(color.G);
bytes.Add(color.B);
}
}

internal static PclColor DisplayColor(PclPoint point, bool showIntensity, out bool present)
{
present = true;
if (point.Color is { } rgb) return rgb;
if (showIntensity && point.Intensity is { } intensity && float.IsFinite(intensity))
{
// Gamma correction keeps differences in low scanner intensity visible.
byte grey = (byte)MathF.Round(255 * MathF.Sqrt(Math.Clamp(intensity, 0, 1)));
return new PclColor(grey, grey, grey);
}

present = false;
return new PclColor(204, 204, 204);
}

private static ViewerDocument FromIfc(string path, out IReadOnlyList<SceneDiagnostic> diagnostics)
Expand Down
Loading