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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ and the project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]

## [0.1.2] - 2026-11-19

### Added
- `SceneGridSystem.Paths` carries curved or multi-segment axes as ordered points with one label per axis.
Paths are optional in format 1. The validation checks that each path has at least two finite points.
- Optional preview projects for reading GLB and OBJ, writing GLB, measuring geometry, checking triangle surface intersections, comparing revisions, querying grids and exporting BCF.

### Changed
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</PropertyGroup>

<PropertyGroup>
<Version>0.1.1</Version>
<Version>0.1.2</Version>
<Authors>mahach666</Authors>
<Copyright>Copyright (c) 2026 mahach666</Copyright>
<Product>IOScene</Product>
Expand Down
9 changes: 6 additions & 3 deletions docs/contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ SceneValueKind Text = 0, Boolean = 1, Integer = 2, Number = 3 // open en
SceneUnits constants ("m", "m2", "m3", "rad", "kg", "s", "K") and IsValid(unit)

SceneLevel int Id; int ModelId; string Name; double? Elevation
SceneGridSystem int ModelId; string Name; List<SceneGridLine> Lines SceneGridLine Name, Start, End, Elevation
SceneGridSystem int ModelId; string Name; List<SceneGridLine> Lines; List<SceneGridPath>? Paths
SceneGridLine Name, Start, End, Elevation
SceneGridPath Name, Points
SceneViewpoint string? Id; string Name; SceneCamera Camera
SceneCamera Position, Target, Up, FieldOfView (vertical, radians), AspectRatio, NearDistance, FarDistance,
SceneProjection Projection (Perspective = 0, Orthographic = 1) // open enum
Expand Down Expand Up @@ -139,7 +141,7 @@ the right member. Each takes the display string; the library never invents one.
| Texture coordinates | `v = 0` is the bottom row of the image. The texture is sampled at `(u / ScaleX, v / ScaleY)` with repeat wrapping. Texture offset and rotation are baked into the UVs; they never become members. |
| Coordinate frame, georeference | Not in 0.1.0. `SceneModel.Frame`, `ToShared` and a geo reference are additive members. They are a precondition of any consumer that tests two models against each other. |
| Links, federation | The `Models` table plus `ModelId` on elements, levels, grids and schedules. `Models[0]` is the model of the file the producer was given; the others are its links or files federated with it. A merge helper that renumbers ids is added with the first federation consumer. No nested scenes. |
| Grids | `SceneGridLine.Elevation` is the Z, in scene coordinates, of the level the line is drawn on. `Start` and `End` are authoritative for drawing. |
| Grids | `SceneGridLine.Elevation` is the Z, in scene coordinates, of the level the line is drawn on. `Start` and `End` are authoritative for drawing. `SceneGridPath.Points` gives at least two ordered points in metres. Draw between consecutive points and label only the first and last points. Producers keep a straight axis in `Lines` and write each curved or multi-segment axis once in `Paths`. Older readers ignore the optional `Paths` member. |
| Viewpoints | In the scene: optional `Id` (a saved-viewpoint GUID or a BCF viewpoint GUID), name, camera. For an orthographic camera the visible height is `2 * |Target - Position| * tan(FieldOfView / 2)`. Clip planes and visibility lists are additive. |
| 4D | `SceneSchedule` in the scene. `SceneTask.Progress` is a fraction from 0 to 1. A `PlannedStart` or `PlannedEnd` at its default `0001-01-01T00:00:00+00:00` means "not given": a consumer leaves such a task out of time-based views. |
| Clash results | `SceneClashTest`, `SceneClashResult` and `SceneClashStatus` in the scene: results only. Rules, tolerances, the engine and the store of statuses across runs belong to the coordination tool. Further fields of a source (assignee, comments, dates) are additive. `Distance` is in metres: below 0 it is the penetration depth, from 0 up it is the clearance (the Navisworks convention). Null means the source did not report it. |
Expand Down Expand Up @@ -371,7 +373,8 @@ stable strings. Later versions may add codes.
| `index-range` | error | A geometry has an index outside its vertices. |
| `normal-count` | error | A geometry has normals, but not one per vertex. |
| `uv-count` | error | A geometry has texture coordinates, but not one per vertex. |
| `not-finite` | error | A number of the scene is NaN or infinite: in a geometry, an instance transform, a property value, a material, a texture scale, a level, a grid line, a camera, a task or a clash. |
| `not-finite` | error | A number of the scene is NaN or infinite: in a geometry, an instance transform, a property value, a material, a texture scale, a level, a grid axis, a camera, a task or a clash. |
| `grid-path-points` | error | A grid path has fewer than two points. |
| `value-payload` | error | A property value of kind `Number` has no `Number`, of kind `Integer` has no `Integer`, or of kind `Boolean` has an `Integer` other than 0 or 1. |
| `task-tree` | error | A schedule lists one task twice, or a task is inside its own sub-tasks. |
| `task-depth` | error | A schedule nests tasks deeper than 30 levels. Reported once per schedule. |
Expand Down
5 changes: 5 additions & 0 deletions src/IOScene/SceneDocument.Validate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ HashSet<T> Ids<T>(IEnumerable<T> ids, string what) where T : notnull
if (!models.Contains(g.ModelId)) Error("dangling-model", $"Grid system '{g.Name}' names model {g.ModelId}.");
if (!g.Lines.All(line => IsFinite(line.Start) && IsFinite(line.End) && double.IsFinite(line.Elevation)))
Error("not-finite", $"Grid system '{g.Name}' has a line with a number that is not finite.");
foreach (var path in g.Paths ?? [])
{
if (path.Points.Count < 2) Error("grid-path-points", $"Grid path '{path.Name}' has fewer than two points.");
if (!path.Points.All(IsFinite)) Error("not-finite", $"Grid path '{path.Name}' has a point that is not finite.");
}
}
foreach (var v in Viewpoints)
{
Expand Down
2 changes: 2 additions & 0 deletions src/IOScene/SceneJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ private static void Harden(JsonTypeInfo info)
var lists = new List<JsonPropertyInfo>();
foreach (var property in info.Properties)
{
if (info.Type == typeof(SceneGridSystem) && property.Name == nameof(SceneGridSystem.Paths))
property.ShouldSerialize = static (_, value) => value is List<SceneGridPath> { Count: > 0 };
// Kind and Format keep their values, null included: their setters reject a wrong one. A member that a
// holder marks required follows the rules below like any other.
if (info.Type == typeof(SceneDocument) && property.IsRequired)
Expand Down
13 changes: 13 additions & 0 deletions src/IOScene/SceneLevel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ public sealed class SceneGridSystem

/// <summary>The grid lines.</summary>
public List<SceneGridLine> Lines { get; set; } = [];

/// <summary>Curved and multi-segment axes. A path has one label at its two ends.</summary>
public List<SceneGridPath>? Paths { get; set; }
}

/// <summary>One grid axis drawn as a connected sequence of straight segments.</summary>
public sealed class SceneGridPath
{
/// <summary>Label of the axis.</summary>
public string Name { get; set; } = string.Empty;

/// <summary>At least two ordered points in scene coordinates, in metres.</summary>
public List<Vector3d> Points { get; set; } = [];
}

/// <summary>
Expand Down
21 changes: 21 additions & 0 deletions tests/IOScene.Tests/SceneJsonTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,27 @@ public class SceneJsonTests
{
private const string Head = "{\"Kind\":\"ioscene\",\"Format\":1";

[Fact]
public void GridPathsRoundTripAsOrderedPoints()
{
var scene = new SceneDocument();
scene.Models.Add(new SceneModel { Id = 1, Key = "test" });
var system = new SceneGridSystem { ModelId = 1 };
scene.Grids.Add(system);
string baseline = SceneJson.Write(scene);
Assert.DoesNotContain("\"Paths\"", baseline);
system.Paths = [];
Assert.Equal(baseline, SceneJson.Write(scene));
system.Paths.Add(new SceneGridPath { Name = "A", Points = [new(0, 0, 0), new(2, 1, 0), new(3, 3, 0)] });
var copy = SceneJson.Read(SceneJson.Write(scene));
var path = Assert.Single(Assert.Single(copy.Grids).Paths!);
Assert.Equal("A", path.Name);
Assert.Equal(system.Paths[0].Points, path.Points);
Assert.DoesNotContain(copy.Validate(), diagnostic => diagnostic.Code is "grid-path-points" or "not-finite");
path.Points.RemoveRange(1, 2);
Assert.Contains(copy.Validate(), diagnostic => diagnostic.Code == "grid-path-points");
}

[Theory]
[InlineData("{\"Title\":\"old\",\"Elements\":[]}")] // no Kind: a legacy viewer snapshot
[InlineData("{\"Kind\":\"ioscene\"}")] // no Format
Expand Down