L3D.Net
0.12.0
See the version list below for details.
dotnet add package L3D.Net --version 0.12.0
NuGet\Install-Package L3D.Net -Version 0.12.0
<PackageReference Include="L3D.Net" Version="0.12.0" />
paket add L3D.Net --version 0.12.0
#r "nuget: L3D.Net, 0.12.0"
// Install L3D.Net as a Cake Addin #addin nuget:?package=L3D.Net&version=0.12.0 // Install L3D.Net as a Cake Tool #tool nuget:?package=L3D.Net&version=0.12.0
L3D .NET library
Intro
.NET Standard 2.0 library for the Luminaire 3D L3D
With the library it is possible to read and build L3D container files. For that the library exposes two classes 'Builder' and 'Reader'. The Builder has a fluent API for defining all the luminaire parts and build the target container file. With the Reader is is possible to read the content of a L3D container and to parse the containing .obj files at once. So there is no other .obj parser needed.
How to get started
Requirements
- .NET Standard 2.0 compatible project
Nuget package
Add the package within your IDE or using the CLI
dotnet add package L3D.Net
Building a L3D container
Simple builder exmaple.
var luminaire = new Luminaire();
luminaire.Header = new Header
{
CreatedWithApplication = "Example-Tool"
};
var geometryDefinition = new GeometryFileDefinition
{
GeometryId = "PN." + Guid.NewGuid(),
Units = GeometricUnits.m,
Model = ObjParser.Parse(cubeObjPath, NullLogger.Instance),
FileName = cubeObjPath
};
luminaire.GeometryDefinitions = new List<GeometryFileDefinition>
{
geometryDefinition
};
luminaire.Parts = new List<GeometryPart>
{
new()
{
Name = "luminaire",
LightEmittingObjects = new List<LightEmittingPart>
{
new()
{
Name = "leo",
Shape = new Rectangle
{
SizeX = 0.5,
SizeY = 0.25
}
}
},
LightEmittingSurfaces = new List<LightEmittingSurfacePart>
{
new()
{
Name = "les",
FaceAssignments = new List<FaceAssignment>
{
new SingleFaceAssignment
{
FaceIndex = 3
}
},
LightEmittingPartIntensityMapping = new Dictionary<string, double>
{
["leo"] = 1
}
}
},
GeometryReference = geometryDefinition
}
};
IWriter writer = new Writer();
var bytes = writer.WriteToByteArray(luminaire);
Reading a L3D container
Read an L3D container from disk:
var reader = new Reader();
var container = reader.ReadContainer("path/to/container.l3d");
foreach (var geometryPartDto in container.Parts)
{
// ...
var model = geometryPartDto.GeometryDefinition.Model;
foreach (var vertex in model.Vertices)
{
// .obj-Model vertices
}
// ...
foreach (var lightEmittingPartDto in geometryPartDto.LightEmittingObjects)
{
// do something for light emitting part
}
// ...
}
Read an L3D container already read from disk in byte array (byte[]) format:
var reader = new Reader();
byte[] l3dContainer = // Get a byte[] representation of an L3D container;
var container = reader.ReadContainer(l3dContainer);
foreach (var geometryPartDto in container.Parts)
{
// From here on out everything is identical to the reading an L3D container from disk example,
// see the code sample above.
}
Validating a L3D container
Validation of an L3D container from disk:
var validator = new Validator();
var validationResult = validator.ValidateContainer("path/to/container.l3d");
if (validationResult)
// Container validation successful
else
// Container validation unsuccessful
Validation of an L3D container already read from disk in byte array (byte[]) format:
var validator = new Validator();
byte[] l3dContainer = // Get a byte[] representation of an L3D container;
var validationResult = validator.ValidateContainer(l3dContainer);
if (validationResult)
// Container validation successful
else
// Container validation unsuccessful
Compatibility
L3D.NET is able to read old and new unknown versions, with the exception of a new major version.
When a new minor version is read, it is possible that optional information is not read. If the L3D is saved again, this information is not written either and the version is set to the latest version of the L3D.NET component.
The following table explains this behaviour summarized:
File version | L3D.NET version | Can read | Can write | Read and write changes the file |
---|---|---|---|---|
1.0.0.0 | 0.9.0.0 | no | no | N/A |
0.9.0.0 | 1.0.0.0 | yes | yes* | yes - the version is updated and the content accordingly too |
1.0.0.0 | 1.0.0.0 | yes | yes | no |
0.9.2.0 | 0.9.0.0 | yes* | yes* | yes - some optional information may not be read or written |
0.9.0.0 | 0.9.2.0 | yes | yes* | yes - the version is updated and the content accordingly too |
Questions, Issues & Contribution
Please use the discussion section for questions or create issues, when something seems to be wrong. PRs are welcome.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- JeremyAnsel.Media.WavefrontObj (>= 3.0.27)
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.15.1 | 131 | 5/6/2024 |
0.15.1-alpha.0.8 | 69 | 5/6/2024 |
0.15.0 | 287 | 6/1/2023 |
0.14.0 | 161 | 5/9/2023 |
0.13.0 | 196 | 4/5/2023 |
0.12.0 | 229 | 4/3/2023 |
0.11.0 | 247 | 3/7/2023 |
0.10.0 | 270 | 2/15/2023 |
0.9.3-preview.1.51 | 84 | 7/19/2023 |
0.9.3-preview.1 | 112 | 11/9/2022 |
0.9.2 | 442 | 5/25/2022 |
0.9.0 | 357 | 8/30/2021 |