Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Fix Core nullable warnings in importer and BRep helpers

Yuechen Liec9b4eba4d58
diff --git a/Aetheris.Kernel.Core/Brep/BrepBodyQueries.cs b/Aetheris.Kernel.Core/Brep/BrepBodyQueries.cs
index dcd9f585..aa863306 100644
--- a/Aetheris.Kernel.Core/Brep/BrepBodyQueries.cs
+++ b/Aetheris.Kernel.Core/Brep/BrepBodyQueries.cs
@@ -31,7 +31,7 @@ public static class BrepBodyQueries
public static IReadOnlyList<ShellId> GetShellIds(this BrepBody body, BodyId bodyId)
{
return body.TryGetShellIds(bodyId, out var shellIds)
- ? shellIds
+ ? shellIds!
: throw CreateMissingTopologyException("body", bodyId);
}
@@ -50,7 +50,7 @@ public static class BrepBodyQueries
public static IReadOnlyList<FaceId> GetFaceIds(this BrepBody body, ShellId shellId)
{
return body.TryGetFaceIds(shellId, out var faceIds)
- ? faceIds
+ ? faceIds!
: throw CreateMissingTopologyException("shell", shellId);
}
@@ -69,7 +69,7 @@ public static class BrepBodyQueries
public static IReadOnlyList<LoopId> GetLoopIds(this BrepBody body, FaceId faceId)
{
return body.TryGetLoopIds(faceId, out var loopIds)
- ? loopIds
+ ? loopIds!
: throw CreateMissingTopologyException("face", faceId);
}
@@ -88,7 +88,7 @@ public static class BrepBodyQueries
public static IReadOnlyList<CoedgeId> GetCoedgeIds(this BrepBody body, LoopId loopId)
{
return body.TryGetCoedgeIds(loopId, out var coedgeIds)
- ? coedgeIds
+ ? coedgeIds!
: throw CreateMissingTopologyException("loop", loopId);
}
diff --git a/Aetheris.Kernel.Core/Brep/EdgeFinishing/BrepBoundedChamfer.cs b/Aetheris.Kernel.Core/Brep/EdgeFinishing/BrepBoundedChamfer.cs
index 5eecdc9a..b10b6ae1 100644
--- a/Aetheris.Kernel.Core/Brep/EdgeFinishing/BrepBoundedChamfer.cs
+++ b/Aetheris.Kernel.Core/Brep/EdgeFinishing/BrepBoundedChamfer.cs
@@ -1038,7 +1038,9 @@ public static class BrepBoundedChamfer
return KernelResult<BrepBody>.Failure([Failure($"Bounded chamfer two-edge corner construction rejected: {reason}.", "firmament.chamfer-bounded")]);
}
- if (!TryResolveCanonicalIncidentEdgePair(sourceBody, cornerVertex, cornerPoint, selector, out var firstEdge, out var secondEdge, out reason))
+ if (!TryResolveCanonicalIncidentEdgePair(sourceBody, cornerVertex, cornerPoint, selector, out var firstEdge, out var secondEdge, out reason)
+ || firstEdge is null
+ || secondEdge is null)
{
return KernelResult<BrepBody>.Failure([Failure($"Bounded chamfer two-edge corner construction rejected: {reason}.", "firmament.chamfer-bounded")]);
}
@@ -1183,8 +1185,8 @@ public static class BrepBoundedChamfer
VertexId cornerVertex,
Point3D cornerPoint,
BrepBoundedChamferIncidentEdgePairSelector selector,
- out Edge first,
- out Edge second,
+ out Edge? first,
+ out Edge? second,
out string reason)
{
const double eps = 1e-8d;
diff --git a/Aetheris.Kernel.Core/Step242/Step242Importer.cs b/Aetheris.Kernel.Core/Step242/Step242Importer.cs
index bc23af03..f7ec6c22 100644
--- a/Aetheris.Kernel.Core/Step242/Step242Importer.cs
+++ b/Aetheris.Kernel.Core/Step242/Step242Importer.cs
@@ -3227,8 +3227,8 @@ public static class Step242Importer
private static KernelResult<double> FailureCircleTrimAngle(string message, string source) =>
Step242ImportSharedUtilities.ValidationFailure<double>(message, source);
- private static KernelResult<ParameterInterval> FailureEllipseTrim(string message, string source) =>
- Step242ImportSharedUtilities.ValidationFailure<ParameterInterval>(message, source);
+ private static KernelResult<ParameterInterval> FailureEllipseTrim(string message, string? source) =>
+ Step242ImportSharedUtilities.ValidationFailure<ParameterInterval>(message, source ?? "Importer.Geometry.EllipseTrim");
private static KernelResult<double> FailureEllipseTrimAngle(string message, string source) =>
Step242ImportSharedUtilities.ValidationFailure<double>(message, source);