From b5ea8df2cf0911e31bd6a5b1c54cebbd8acf8611 Mon Sep 17 00:00:00 2001 From: ncr-399 Date: Thu, 7 Mar 2024 14:39:13 +0530 Subject: [PATCH 01/12] updated package Newtonsoft.Json --- Xbim.Geometry.Regression/XbimRegression.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Xbim.Geometry.Regression/XbimRegression.csproj b/Xbim.Geometry.Regression/XbimRegression.csproj index 081dd8b3f..2690cae39 100644 --- a/Xbim.Geometry.Regression/XbimRegression.csproj +++ b/Xbim.Geometry.Regression/XbimRegression.csproj @@ -14,7 +14,7 @@ - + From d56329b5f677e46a63d3fc0ef150a291a792bcaa Mon Sep 17 00:00:00 2001 From: ncr-399 Date: Thu, 7 Mar 2024 14:42:14 +0530 Subject: [PATCH 02/12] removed duplicate package references --- .../Xbim.Geometry.Engine.Interop.csproj | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Xbim.Geometry.Engine.Interop/Xbim.Geometry.Engine.Interop.csproj b/Xbim.Geometry.Engine.Interop/Xbim.Geometry.Engine.Interop.csproj index 4a9856dd7..9916f9a4e 100644 --- a/Xbim.Geometry.Engine.Interop/Xbim.Geometry.Engine.Interop.csproj +++ b/Xbim.Geometry.Engine.Interop/Xbim.Geometry.Engine.Interop.csproj @@ -14,10 +14,6 @@ - - - - From 4f52e41a992cec307e50d3371595b901959feec6 Mon Sep 17 00:00:00 2001 From: ncr-399 Date: Thu, 7 Mar 2024 15:10:11 +0530 Subject: [PATCH 03/12] updated version to 5.1.437 --- .../Xbim.Geometry.Engine.Interop.csproj | 1 + Xbim.ModelGeometry.Scene/Xbim.ModelGeometry.Scene.csproj | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Xbim.Geometry.Engine.Interop/Xbim.Geometry.Engine.Interop.csproj b/Xbim.Geometry.Engine.Interop/Xbim.Geometry.Engine.Interop.csproj index 9916f9a4e..2a8f0941b 100644 --- a/Xbim.Geometry.Engine.Interop/Xbim.Geometry.Engine.Interop.csproj +++ b/Xbim.Geometry.Engine.Interop/Xbim.Geometry.Engine.Interop.csproj @@ -8,6 +8,7 @@ true Xbim.Geometry.Engine.Interop xbim-toolkit-icon.png + 5.1.437 diff --git a/Xbim.ModelGeometry.Scene/Xbim.ModelGeometry.Scene.csproj b/Xbim.ModelGeometry.Scene/Xbim.ModelGeometry.Scene.csproj index 0e5418dd7..0872784e3 100644 --- a/Xbim.ModelGeometry.Scene/Xbim.ModelGeometry.Scene.csproj +++ b/Xbim.ModelGeometry.Scene/Xbim.ModelGeometry.Scene.csproj @@ -8,7 +8,7 @@ true true xbim-toolkit-icon.png - 5.1.0.0-Dev + 5.1.437 5.1.0.1 5.1.0.1 From 106bce525f98e0a07ddb2e7df9907fd2894c1d46 Mon Sep 17 00:00:00 2001 From: ncr-399 Date: Thu, 7 Mar 2024 15:11:03 +0530 Subject: [PATCH 04/12] Added XbimEdgeGeometry implementation --- .../XbimEdgeGeometry.cs | 198 ++++++++++++++++++ 1 file changed, 198 insertions(+) create mode 100644 Xbim.Geometry.Engine.Interop/XbimEdgeGeometry.cs diff --git a/Xbim.Geometry.Engine.Interop/XbimEdgeGeometry.cs b/Xbim.Geometry.Engine.Interop/XbimEdgeGeometry.cs new file mode 100644 index 000000000..bb9644f0e --- /dev/null +++ b/Xbim.Geometry.Engine.Interop/XbimEdgeGeometry.cs @@ -0,0 +1,198 @@ +using System; +using System.IO; +using System.Reflection; +using Microsoft.Extensions.Logging; + + +using Xbim.Common; +using Xbim.Common.Geometry; +using Xbim.Ifc4.Interfaces; +using Xbim.Ifc4; + +namespace Xbim.Geometry.Engine.Interop +{ + + namespace Xbim.Geometry.Engine.Interop + { + + public class XbimEdgeGeometry : IXbimEdgeGeometry + { + private readonly IXbimEdgeGeometry _engine; + private readonly ILogger _logger; + static XbimEdgeGeometry() + { + + // We need to wire in a custom assembly resolver since Xbim.Geometry.Engine is + // not located using standard probing rules (due to way we deploy processor specific binaries) + AppDomain.CurrentDomain.AssemblyResolve += XbimCustomAssemblyResolver.ResolverHandler; + } + + public XbimEdgeGeometry() : this(null) + { + + } + + + public XbimEdgeGeometry(ILogger logger) + { + + // Warn if runtime for Engine is not present, this is not necessary any more as we are net472 + //XbimPrerequisitesValidator.Validate(); + + + _logger = logger ?? XbimLogging.CreateLogger(); + + var conventions = new XbimArchitectureConventions(); // understands the process we run under + string assemblyName = $"{conventions.ModuleName}.dll";// + conventions.Suffix; dropping the use of a suffix + _logger.LogDebug("Loading {assemblyName}", assemblyName); + try + { + var ass = Assembly.Load(assemblyName); + _logger.LogTrace("Loaded {fullName} from {codebase}", ass.GetName().FullName, ass.CodeBase); + var t = ass.GetType("Xbim.Geometry.XbimEdgeGeometry"); + var obj = Activator.CreateInstance(t); + _logger.LogTrace("Created Instance of {fullName}", obj.GetType().FullName); + if (obj == null) + { + throw new Exception("Failed to create Geometry Engine"); + } + + _engine = obj as IXbimEdgeGeometry; + + if (_engine == null) + { + throw new Exception("Failed to cast Geometry Engine to IXbimGeometryEngine"); + } + + _logger.LogDebug("XbimGeometryEngine constructed successfully"); + } + catch (Exception e) + { + _logger.LogError(0, e, "Failed to construct XbimGeometryEngine"); + throw new FileLoadException($"Failed to load Xbim.Geometry.Engine{conventions.Suffix}.dll", e); + } + + } + + public IXbimEdgeSet CreateEdge(IIfcBoundingBox ifcSolid, ILogger logger) + { + return _engine.CreateEdge(ifcSolid, logger); + } + + public IXbimEdgeSet CreateEdge(IIfcSweptDiskSolid ifcSolid, ILogger logger) + { + return _engine.CreateEdge(ifcSolid, logger); + } + + public IXbimEdgeSet CreateEdge(IIfcShellBasedSurfaceModel ifcSurface, ILogger logger) + { + return _engine.CreateEdge(ifcSurface, logger); + } + + public IXbimEdgeSet CreateEdge(IIfcSurfaceCurveSweptAreaSolid ifcSolid, ILogger logger) + { + return _engine.CreateEdge(ifcSolid, logger); + } + + public IXbimEdgeSet CreateEdge(IIfcBoxedHalfSpace ifcSolid, ILogger logger) + { + return _engine.CreateEdge(ifcSolid, logger); + } + + public IXbimEdgeSet CreateEdge(IIfcPolygonalBoundedHalfSpace ifcSolid, ILogger logger) + { + return _engine.CreateEdge(ifcSolid, logger); + } + + public IXbimEdgeSet CreateEdge(IIfcHalfSpaceSolid ifcSolid, ILogger logger) + { + return _engine.CreateEdge(ifcSolid, logger); + } + + public IXbimEdgeSet CreateEdge(IIfcFaceBasedSurfaceModel ifcSurface, ILogger logger) + { + return _engine.CreateEdge(ifcSurface, logger); + } + + public IXbimEdgeSet CreateEdge(IIfcTriangulatedFaceSet shell, ILogger logger) + { + return _engine.CreateEdge(shell, logger); + } + + public IXbimEdgeSet CreateEdge(IIfcSweptAreaSolid ifcSolid, ILogger logger) + { + return _engine.CreateEdge(ifcSolid, logger); + } + + public IXbimEdgeSet CreateEdge(IIfcExtrudedAreaSolid ifcSolid, ILogger logger) + { + return _engine.CreateEdge(ifcSolid, logger); + } + + public IXbimEdgeSet CreateEdge(IIfcCsgPrimitive3D ifcSolid, ILogger logger) + { + return _engine.CreateEdge(ifcSolid, logger); + } + + public IXbimEdgeSet CreateEdge(IIfcSphere ifcSolid, ILogger logger) + { + return _engine.CreateEdge(ifcSolid, logger); + } + + public IXbimEdgeSet CreateEdge(IIfcBlock ifcSolid, ILogger logger) + { + return _engine.CreateEdge(ifcSolid, logger); + } + + public IXbimEdgeSet CreateEdge(IIfcRightCircularCylinder ifcSolid, ILogger logger) + { + return _engine.CreateEdge(ifcSolid, logger); + } + + public IXbimEdgeSet CreateEdge(IIfcRevolvedAreaSolid ifcSolid, ILogger logger) + { + return _engine.CreateEdge(ifcSolid, logger); + } + + public IXbimEdgeSet CreateEdge(IIfcRectangularPyramid ifcSolid, ILogger logger) + { + return _engine.CreateEdge(ifcSolid, logger); + } + + public IXbimEdgeSet CreateEdge(IIfcRightCircularCone ifcSolid, ILogger logger) + { + return _engine.CreateEdge(ifcSolid, logger); + } + + public IXbimEdgeSet CreateEdge(IIfcRevolvedAreaSolidTapered ifcSolid, ILogger logger) + { + return _engine.CreateEdge(ifcSolid, logger); + } + + public IXbimEdgeSet CreateEdge(IIfcFixedReferenceSweptAreaSolid ifcSolid, ILogger logger) + { + return _engine.CreateEdge(ifcSolid, logger); + } + + public IXbimEdgeSet CreateEdge(IIfcAdvancedBrep ifcSolid, ILogger logger) + { + return _engine.CreateEdge(ifcSolid, logger); + } + + public IXbimEdgeSet CreateEdge(IIfcAdvancedBrepWithVoids ifcSolid, ILogger logger) + { + return _engine.CreateEdge(ifcSolid, logger); + } + + public IXbimEdgeSet CreateEdge(IIfcSectionedSpine ifcSolid, ILogger logger) + { + return _engine.CreateEdge(ifcSolid, logger); + } + + public IXbimEdgeSet CreateEdge(IIfcSweptDiskSolidPolygonal ifcSolid, ILogger logger) + { + return _engine.CreateEdge(ifcSolid, logger); + } + } + } +} From 1839f981572d48d41d477bc4f7c52c1782648753 Mon Sep 17 00:00:00 2001 From: ncr-399 Date: Thu, 7 Mar 2024 15:11:49 +0530 Subject: [PATCH 05/12] Addded XbimEdgeGeometry native implementation --- .../Xbim.Geometry.Engine.vcxproj | 7 + .../Xbim.Geometry.Engine.vcxproj.filters | 6 + Xbim.Geometry.Engine/XbimEdgeGeometry.cpp | 317 ++++++++++++++++++ Xbim.Geometry.Engine/XbimEdgeGeometry.h | 118 +++++++ 4 files changed, 448 insertions(+) create mode 100644 Xbim.Geometry.Engine/XbimEdgeGeometry.cpp create mode 100644 Xbim.Geometry.Engine/XbimEdgeGeometry.h diff --git a/Xbim.Geometry.Engine/Xbim.Geometry.Engine.vcxproj b/Xbim.Geometry.Engine/Xbim.Geometry.Engine.vcxproj index 166d083e5..a6d3fd402 100644 --- a/Xbim.Geometry.Engine/Xbim.Geometry.Engine.vcxproj +++ b/Xbim.Geometry.Engine/Xbim.Geometry.Engine.vcxproj @@ -183,6 +183,12 @@ Create Create + + true + true + true + true + true true @@ -200,6 +206,7 @@ + diff --git a/Xbim.Geometry.Engine/Xbim.Geometry.Engine.vcxproj.filters b/Xbim.Geometry.Engine/Xbim.Geometry.Engine.vcxproj.filters index 9fb9cfb6f..634709b22 100644 --- a/Xbim.Geometry.Engine/Xbim.Geometry.Engine.vcxproj.filters +++ b/Xbim.Geometry.Engine/Xbim.Geometry.Engine.vcxproj.filters @@ -9462,6 +9462,9 @@ Header Files + + Header Files + @@ -15365,6 +15368,9 @@ Source Files + + Source Files + diff --git a/Xbim.Geometry.Engine/XbimEdgeGeometry.cpp b/Xbim.Geometry.Engine/XbimEdgeGeometry.cpp new file mode 100644 index 000000000..3901b0310 --- /dev/null +++ b/Xbim.Geometry.Engine/XbimEdgeGeometry.cpp @@ -0,0 +1,317 @@ +#include "XbimEdgeGeometry.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "XbimSolid.h" +#include "XbimEdgeSet.h" +#include "XbimCompound.h" +#include "XbimSolidSet.h" + +using System::Runtime::InteropServices::Marshal; + +using namespace System::Threading; +using namespace System::Linq; + +using namespace System; +using namespace Xbim::Common::Geometry; +using namespace System::Collections::Generic; +using namespace Xbim::Ifc4::Interfaces; +using namespace Xbim::Ifc4; +using namespace Microsoft::Extensions::Logging; + +using namespace System; +using namespace System::IO; +using namespace Xbim::Common; +using namespace Xbim::Common::Geometry; + +using namespace System::Configuration; +using namespace System::Reflection; + + +namespace Xbim { + namespace Geometry { + void XbimEdgeGeometry::LogInfo(ILogger^ logger, Object^ entity, String^ format, ...array^ arg) + { + String^ msg = String::Format(format, arg); + IPersistEntity^ ifcEntity = dynamic_cast(entity); + if (logger != nullptr) + { + + if (ifcEntity != nullptr) + LoggerExtensions::LogInformation(logger, "GeomEngine: #{0}={1} [{2}]", ifcEntity->EntityLabel, ifcEntity->GetType()->Name, msg); + else + if (entity == nullptr) + LoggerExtensions::LogInformation(logger, "GeomEngine: [{0}]", msg); + else + LoggerExtensions::LogInformation(logger, "GeomEngine: {0} [{1}]", entity->GetType()->Name, msg); + } + } + + void XbimEdgeGeometry::LogWarning(ILogger^ logger, Object^ entity, String^ format, ...array^ arg) + { + String^ msg = String::Format(format, arg); + IPersistEntity^ ifcEntity = dynamic_cast(entity); + if (logger != nullptr) + { + if (ifcEntity != nullptr) + LoggerExtensions::LogWarning(logger, "GeomEngine: #{0}={1} [{2}]", ifcEntity->EntityLabel, ifcEntity->GetType()->Name, msg); + else + if (entity == nullptr) + LoggerExtensions::LogWarning(logger, "GeomEngine: [{0}]", msg); + else + LoggerExtensions::LogWarning(logger, "GeomEngine: {0} [{1}]", entity->GetType()->Name, msg); + } + } + + void XbimEdgeGeometry::LogDebug(ILogger^ logger, Object^ entity, String^ format, ...array^ arg) + { + String^ msg = String::Format(format, arg); + IPersistEntity^ ifcEntity = dynamic_cast(entity); + if (logger != nullptr) + { + if (ifcEntity != nullptr) + LoggerExtensions::LogDebug(logger, "GeomEngine: #{0}={1} [{2}]", ifcEntity->EntityLabel, ifcEntity->GetType()->Name, msg); + else + if (entity == nullptr) + LoggerExtensions::LogDebug(logger, "GeomEngine: [{0}]", msg); + else + LoggerExtensions::LogDebug(logger, "GeomEngine: {0} [{1}]", entity->GetType()->Name, msg); + } + } + + + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdgeGeometry(XbimSolid^ xSolid) { + //xBim solid derived from occshape -> compatible with BRepMesh_Incremental + //BRepMesh_IncrementalMesh Mesh(xSolid, LinearDeflectionInMM, Standard_False, AngularDeflectionInRadians, Standard_False); + + //Computes Triangulation + //Mesh.Perform(); + + //TopoDS_Shape + + //XbimEdge^ edge = gcnew XbimEdge(); + + + return xSolid->Edges; + + } + + void XbimEdgeGeometry::LogError(ILogger^ logger, Object^ entity, String^ format, ...array^ arg) + { + String^ msg = String::Format(format, arg); + IPersistEntity^ ifcEntity = dynamic_cast(entity); + if (logger != nullptr) + { + if (ifcEntity != nullptr) + LoggerExtensions::LogError(logger, "GeomEngine: #{0}={1} [{2}]", ifcEntity->EntityLabel, ifcEntity->GetType()->Name, msg); + else + if (entity == nullptr) + LoggerExtensions::LogError(logger, "GeomEngine: [{0}]", msg); + else + LoggerExtensions::LogError(logger, "GeomEngine: {0} [{1}]", entity->GetType()->Name, msg); + } + } + + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcSweptDiskSolidPolygonal^ ifcSolid, ILogger^ logger) + { + XbimSolid^ xSolid = gcnew XbimSolid(ifcSolid, logger); + return CreateEdgeGeometry(xSolid); + } + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcRevolvedAreaSolidTapered^ ifcSolid, ILogger^ logger) + { + XbimSolid^ xSolid = gcnew XbimSolid(ifcSolid, logger); + return CreateEdgeGeometry(xSolid); + + } + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcFixedReferenceSweptAreaSolid^ ifcSolid, ILogger^ logger) + { + XbimSolid^ xSolid = gcnew XbimSolid(ifcSolid, logger); + return CreateEdgeGeometry(xSolid); + } + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcAdvancedBrep^ ifcSolid, ILogger^ logger) + { + /*XbimCompound^ comp = gcnew XbimCompound((IIfcAdvancedBrep^)ifcSolid, logger); + if (comp->Solids->Count > 0) + XbimSolid^ xSolid = comp->Solids->First; + else + XbimSolid^ xSolid = gcnew XbimSolid();*/ + throw gcnew System::NotImplementedException(); + + } + + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcAdvancedBrepWithVoids^ ifcSolid, ILogger^ logger) + { + throw gcnew System::NotImplementedException(); + // TODO: insert return statement here + } + + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcSectionedSpine^ ifcSolid, ILogger^ logger) + { + XbimSolid^ xSolid = gcnew XbimSolid(ifcSolid, logger); + return CreateEdgeGeometry(xSolid); + } + + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcSweptAreaSolid^ IIfcSolid, ILogger^ logger) + { + /*XbimSolid^ xSolid; + IIfcExtrudedAreaSolid^ eas = dynamic_cast(IIfcSolid); + if (eas != nullptr) return CreateEdge(eas, logger); + IIfcRevolvedAreaSolid^ ras = dynamic_cast(IIfcSolid); + if (ras != nullptr) return CreateEdge(ras, logger); + IIfcSurfaceCurveSweptAreaSolid^ scas = dynamic_cast(IIfcSolid); + if (scas != nullptr) return CreateEdge(scas, logger);*/ + throw gcnew NotImplementedException(String::Format("Swept Solid of Type {0} in entity #{1} is not implemented", IIfcSolid->GetType()->Name, IIfcSolid->EntityLabel)); + + } + + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcTriangulatedFaceSet^ shell, ILogger^ logger) + { + XbimSolid^ xSolid = gcnew XbimSolid(shell, logger); + return CreateEdgeGeometry(xSolid); + } + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcShellBasedSurfaceModel^ ifcSurface, ILogger^ logger) + { + XbimSolid^ xSolid = gcnew XbimSolid(ifcSurface, logger); + return CreateEdgeGeometry(xSolid); + + } + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcFaceBasedSurfaceModel^ ifcSurface, ILogger^ logger) + { + XbimSolid^ xSolid = gcnew XbimSolid(ifcSurface, logger); + return CreateEdgeGeometry(xSolid); + + } + + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcExtrudedAreaSolid^ IIfcSolid, ILogger^ logger) + { + XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); + return CreateEdgeGeometry(xSolid); + + }; + + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcRevolvedAreaSolid^ IIfcSolid, ILogger^ logger) + { + XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); + return CreateEdgeGeometry(xSolid); + + } + + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcSweptDiskSolid^ IIfcSolid, ILogger^ logger) + { + XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); + return CreateEdgeGeometry(xSolid); + + } + + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcBoundingBox^ IIfcSolid, ILogger^ logger) + { + XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); + return CreateEdgeGeometry(xSolid); + + } + + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcSurfaceCurveSweptAreaSolid^ IIfcSolid, ILogger^ logger) + { + XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); + return CreateEdgeGeometry(xSolid); + } + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcBooleanResult^ ifcSolid, ILogger^ logger) + { + throw gcnew System::NotImplementedException(); + // TODO: insert return statement here + } + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcBooleanClippingResult^ ifcSolid, ILogger^ logger) + { + throw gcnew System::NotImplementedException(); + // TODO: insert return statement here + } + + + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcHalfSpaceSolid^ IIfcSolid, ILogger^ logger) + { + + XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); + return CreateEdgeGeometry(xSolid); + } + + + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcBoxedHalfSpace^ IIfcSolid, ILogger^ logger) + { + + XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); + return CreateEdgeGeometry(xSolid); + } + + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcPolygonalBoundedHalfSpace^ IIfcSolid, ILogger^ logger) + { + + XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); + return CreateEdgeGeometry(xSolid); + } + + + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcSphere^ IIfcSolid, ILogger^ logger) + { + XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); + return CreateEdgeGeometry(xSolid); + } + + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcBlock^ IIfcSolid, ILogger^ logger) + { + XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); + return CreateEdgeGeometry(xSolid); + } + + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcRightCircularCylinder^ IIfcSolid, ILogger^ logger) + { + XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); + return CreateEdgeGeometry(xSolid); + } + + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcRightCircularCone^ IIfcSolid, ILogger^ logger) + { + XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); + return CreateEdgeGeometry(xSolid); + } + + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcRectangularPyramid^ IIfcSolid, ILogger^ logger) + { + XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); + return CreateEdgeGeometry(xSolid); + } + + IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcCsgPrimitive3D^ IIfcSolid, ILogger^ logger) + { + XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); + return CreateEdgeGeometry(xSolid); + } + } + +} + +double __cdecl LoadEdgeGeometry(void) +{ + Xbim::Geometry::XbimEdgeGeometry^ gc = gcnew Xbim::Geometry::XbimEdgeGeometry(); + return gc->BooleanTimeOut; +} diff --git a/Xbim.Geometry.Engine/XbimEdgeGeometry.h b/Xbim.Geometry.Engine/XbimEdgeGeometry.h new file mode 100644 index 000000000..3225934d1 --- /dev/null +++ b/Xbim.Geometry.Engine/XbimEdgeGeometry.h @@ -0,0 +1,118 @@ +#include "XbimVertex.h" +#include "XbimVertex.h" +#include "XbimEdge.h" +#include "XbimSolid.h" + +using namespace System; +using namespace Xbim::Common::Geometry; +using namespace System::Collections::Generic; +using namespace Xbim::Ifc4::Interfaces; +using namespace Xbim::Ifc4; +using namespace Microsoft::Extensions::Logging; + +using namespace System; +using namespace System::IO; +using namespace Xbim::Common; +using namespace Xbim::Common::Geometry; + +using namespace System::Configuration; +using namespace System::Reflection; + +__declspec(dllexport) double __cdecl LoadEdgeGeometry(void); + + +namespace Xbim { + namespace Geometry { + + ref class XbimEdgeGeometry : IXbimEdgeGeometry { + + + private: + static XbimEdgeGeometry() + { + //AppDomain::CurrentDomain->AssemblyResolve += gcnew ResolveEventHandler(ResolveHandler); + /*Assembly::Load("Xbim.Ifc4"); + Assembly::Load("Xbim.Common"); + Assembly::Load("Xbim.Tessellator");*/ + + String^ timeOut = ConfigurationManager::AppSettings["BooleanTimeOut"]; + if (!int::TryParse(timeOut, BooleanTimeOut)) + BooleanTimeOut = 60; + String^ fuzzyString = ConfigurationManager::AppSettings["FuzzyFactor"]; + if (!double::TryParse(fuzzyString, FuzzyFactor)) + FuzzyFactor = 10; + + String^ linearDeflection = ConfigurationManager::AppSettings["LinearDeflectionInMM"]; + if (!double::TryParse(linearDeflection, LinearDeflectionInMM)) + LinearDeflectionInMM = 50; //max chord diff + + String^ angularDeflection = ConfigurationManager::AppSettings["AngularDeflectionInRadians"]; + if (!double::TryParse(angularDeflection, AngularDeflectionInRadians)) + AngularDeflectionInRadians = 0.5;// deflection of 28 degrees + + String^ ignoreIfcSweptDiskSolidParamsString = ConfigurationManager::AppSettings["IgnoreIfcSweptDiskSolidParams"]; + if (!bool::TryParse(ignoreIfcSweptDiskSolidParamsString, IgnoreIfcSweptDiskSolidParams)) + IgnoreIfcSweptDiskSolidParams = false; + + } + + public: + + static String^ SurfaceOfLinearExtrusion = "#SurfaceOfLinearExtrusion"; + static String^ PolylineTrimLengthOneForEntireLine = "#PolylineTrimLengthOneForEntireLine"; + + static Assembly^ ResolveHandler(Object^ /*Sender*/, ResolveEventArgs^ /*args*/) + { + + // Warning: this should check the args for the assembly name! + return nullptr; + } + + protected: + ~XbimEdgeGeometry() + { + } + + public: + static void LogInfo(ILogger^ logger, Object^ entity, String^ format, ... array^ arg); + static void LogWarning(ILogger^ logger, Object^ entity, String^ format, ... array^ arg); + static void LogError(ILogger^ logger, Object^ entity, String^ format, ... array^ arg); + static void LogDebug(ILogger^ logger, Object^ entity, String^ format, ... array^ arg); + + static int BooleanTimeOut; + static double FuzzyFactor; + static double LinearDeflectionInMM; + static double AngularDeflectionInRadians; + static bool IgnoreIfcSweptDiskSolidParams; + + virtual IXbimEdgeSet^ CreateEdgeGeometry(XbimSolid^ xSolid); + virtual IXbimEdgeSet^ CreateEdge(IIfcExtrudedAreaSolid^ ifcSolid, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcSweptAreaSolid^ ifcSolid, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcRevolvedAreaSolid^ ifcSolid, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcSweptDiskSolid^ ifcSolid, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcBoundingBox^ ifcSolid, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcSurfaceCurveSweptAreaSolid^ ifcSolid, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcBooleanResult^ ifcSolid, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcBooleanClippingResult^ ifcSolid, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcHalfSpaceSolid^ ifcSolid, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcPolygonalBoundedHalfSpace^ ifcSolid, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcBoxedHalfSpace^ ifcSolid, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcTriangulatedFaceSet^ shell, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcShellBasedSurfaceModel^ ifcSurface, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcFaceBasedSurfaceModel^ ifcSurface, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcCsgPrimitive3D^ ifcSolid, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcSphere^ ifcSolid, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcBlock^ ifcSolid, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcRightCircularCylinder^ ifcSolid, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcRightCircularCone^ ifcSolid, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcRectangularPyramid^ ifcSolid, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcSweptDiskSolidPolygonal^ ifcSolid, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcRevolvedAreaSolidTapered^ ifcSolid, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcFixedReferenceSweptAreaSolid^ ifcSolid, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcAdvancedBrep^ ifcSolid, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcAdvancedBrepWithVoids^ ifcSolid, ILogger^ logger); + virtual IXbimEdgeSet^ CreateEdge(IIfcSectionedSpine^ ifcSolid, ILogger^ logger); + + }; + } +} \ No newline at end of file From 374960889913769f84c1986d7e711334449fd88e Mon Sep 17 00:00:00 2001 From: ncr-399 Date: Fri, 8 Mar 2024 10:18:10 +0530 Subject: [PATCH 06/12] added documentation --- docs/README.md | 132 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 docs/README.md diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 000000000..b40f9b352 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,132 @@ +## Xbim Geometry Exploration + +- [Xbim Geometry Exploration](#xbim-geometry-exploration) + - [Case Study IXbimGeometryEngine Interface](#case-study-ixbimgeometryengine-interface) + - [How the IXbimGeometryEngine Interface is defined](#how-the-ixbimgeometryengine-interface-is-defined) + - [How XbimGeometryEngine calls the Native C++ Code](#how-xbimgeometryengine-calls-the-native-c-code) + - [How We Have Added a Custom Functionality to Extract Edges](#how-we-have-added-a-custom-functionality-to-extract-edges) + - [Adding New Classes to Xbim.Geometry.Engine Project](#adding-new-classes-to-xbimgeometryengine-project) + - [Building XbimEssentials Project](#building-xbimessentials-project) + - [Packaging the XbimEssentials Project](#packaging-the-xbimessentials-project) + - [Building XbimGeometry Project](#building-xbimgeometry-project) + - [Packaging XbimGeometry Project](#packaging-xbimgeometry-project) + - [Testing, Debugging, and Profiling Geometry Engine Projects](#testing-debugging-and-profiling-geometry-engine-projects) + - [Using the Generated Packages in Another Project](#using-the-generated-packages-in-another-project) + - [Risks](#risks) + - [Additional Resources and References](#additional-resources-and-references) + +### Case Study IXbimGeometryEngine Interface + +#### How the IXbimGeometryEngine Interface is defined + +1. The IXbimGeometryEngine Interface is defined in Xbim.Essentials.Ifc4 Module +2. IXbimGeometryEngine Interface is Implemented Xbim.Geometry.Engine.Interop > XbimGeometryEngine.cs Project as a Wrapper for the Native Code +3. XbimGeometryEngine class defined in XbimGeometryEngine.cs internally calls the Functions defined in Xbim.Geometry.Engine (Native C++ Project) which uses OCCT Code +4. Both XbimGeometryEngine classes defined in C# and C++ derive from the IXbimGeometryEngine interface defined in Xbim.Essentials.Ifc4 Module. + +#### How XbimGeometryEngine calls the Native C++ Code + +1. The XbimGeometryEngine's Constructor loads the Xbim.GeometryEngine32.dll or Xbim.GeometryEngine64.dll depending upon the platform architecture (x86 or x64) +2. It grabs the function XbimGeometryEngine class defined in native code and then creates an instance of it +3. To call the methods defined in the XbimGeometry's instance created loaded from the dll it has to be cast as IXbimGeometryEngine +4. This is why both XbimGeometryEngine classes defined in C# and C++ are derived from a Common Interface. If they don't implement the same interface the instance created at runtime cannot access the methods. +5. All the calls made to XbimGeometryEngine C# code then call the native methods defined in C++ through the instance loaded through the dll. + +#### How We Have Added a Custom Functionality to Extract Edges + +1. Add an Inteface called IXbimEdgeGeometry in Xbim.Essetials.Ifc4 Module +2. Build the Xbim.Essentials Project with the new IXbimEdgeGeometry interface and create custom packages +3. Import the Custom Packages in Xbim.Geometry Project +4. Add a class called XbimEdgeGeometry in Xbim.Geometry.Engine.Interop Project which **implements** Xbim.Essentials.Ifc4.IXbimEdgeGeometry interface +5. The XbimEdgeGeometry class has a member variable of type IXbimEdgeGeometry which will be used to acess native code loaded from the dll at runtime +6. Add a class called XbimEdgeGeometry in Xbim.Geometry.Engine which **extends** from Xbim.Essentials.Ifc4.IXbimEdgeGeometry and implement all the methods defined in the interface. Use OCCT to extract edges. +7. The Xbim.Geometry.Engine.Interop.XbimEdgeGeometry class then loads the Xbim.Geometry.Engine.XbimEdgeGeometry class from dll at runtime to access its functionality. +8. The Xbim.Geometry.Engine.Interop.XbimEdgeGeometry is just a wrapper class that forwards the calls to native code using OCCT. +9. Build the XbimGeometry and XbimEssentials Solutions and generate new packages +10. Install the newly generated packages into another project to use the new functionality.- [Xbim Geometry Exploration](#xbim-geometry-exploration) + +- [Xbim Geometry Exploration](#xbim-geometry-exploration) + - [Case Study IXbimGeometryEngine Interface](#case-study-ixbimgeometryengine-interface) + - [How the IXbimGeometryEngine Interface is defined](#how-the-ixbimgeometryengine-interface-is-defined) + - [How XbimGeometryEngine calls the Native C++ Code](#how-xbimgeometryengine-calls-the-native-c-code) + - [How We Have Added a Custom Functionality to Extract Edges](#how-we-have-added-a-custom-functionality-to-extract-edges) + - [Adding New Classes to Xbim.Geometry.Engine Project](#adding-new-classes-to-xbimgeometryengine-project) + - [Building XbimEssentials Project](#building-xbimessentials-project) + - [Packaging the XbimEssentials Project](#packaging-the-xbimessentials-project) + - [Building XbimGeometry Project](#building-xbimgeometry-project) + - [Packaging XbimGeometry Project](#packaging-xbimgeometry-project) + - [Testing, Debugging, and Profiling Geometry Engine Projects](#testing-debugging-and-profiling-geometry-engine-projects) + - [Using the Generated Packages in Another Project](#using-the-generated-packages-in-another-project) + - [Risks](#risks) + - [Additional Resources and References](#additional-resources-and-references) + +### Adding New Classes to Xbim.Geometry.Engine Project + +1. Right-click on the Xbim.Geometry.Engine Project in Visual Studio +2. Select Add from the Dropdown Menu +3. Create a .cpp and .h file +4. Right Click on the .cpp file and select properties +5. Go to C/C++ Section +6. Make Sure the **Common Language Runtime Support Option** is set to **Common Language Runtime Support (/clr)** otherwise the build will throw fatal errors if any C# Interop Code is Used in the File. + +### Building XbimEssentials Project + +1. Clone the XbimEssentials repo from [XbimEssentials](https://github.com/CCT-Mukund-Thakare/XbimEssentials) +2. Switch to Branch [issues/issue465](https://github.com/CCT-Mukund-Thakare/XbimEssentials/tree/issues/issue465) +3. Open the Solution using Visual Studio +4. Build the Solution (It will build 9 Projects) + +### Packaging the XbimEssentials Project + +1. After Successfully building the projects, right-click on the Project and Select the **Pack** option from the dropdown menu +2. Selecting the **Pack** option will generate a .nuget package with **version 5.1.341** e.g (Xbim.Common.5.1.341.nupkg) +3. Do this for all the Projects (Ignore the Test Projects) +4. **Make Sure to Build the Packages in Release Mode** +5. Go to Project Root Folder (C:\workspace\Xbim\XbimEssentials) +6. Search for .nupkg in the Search Bar. It will return all the packages +7. Copy all the Packages and place them in a new Folder called packages + +### Building XbimGeometry Project + +1. Clone the XbimGeometry repo from [XbimGeometry](https://github.com/CCT-Mukund-Thakare/XbimEssentials) +2. Switch to Branch [issues/issue465](https://github.com/CCT-Mukund-Thakare/XbimGeometry/tree/issues/issue465) +3. Open the Solution using Visual Studio +4. It will restore the required packages from nuget.org instead of our custom packages +5. Go Project > Manage Nuget Packages +6. Click on the Settings Icon on the Right Most Corner next to Package Sources. It will open up the menu to configure package sources +7. Click on the + Sign to Add a new Package Source and Set the Path to the new Package Folder created while building XbimEssential packages (See Packaging XbimEssentials Project Step 7) +8. Uncheck the nuget.org as Package Source in the Config Menu. +9. Go to C:\Users\\{UserName}\\.nuget\packages and remove all the xbim packages +10. Restart Visual Studio +11. New Custom Packages are restored from the local source created in Building XbimGeometry Project > Step 7 +12. Build the Xbim.Geometry.Engine.Interop Project First and then build the rest of the projects +13. **Directly Building the Solution May Fail and Throw a Lot of Errors** + +### Packaging XbimGeometry Project + +1. Once all the Projects are Built, Right Click on the **C#** Projects and Click on **Pack** from the dropdown menu to generate the nuget packages (Ignore the Regression and Tests Projects). It will generate a nupkg file with **version 5.1.437** +2. Place the generated packages into the local package folder. + +### Testing, Debugging, and Profiling Geometry Engine Projects + +1. To Test, Debug, or Profile the Xbim.Geometry.Engine and Xbim.Geometry.Engine.Interop projects use the **Xbim.Regression** Project +2. Modify the **Xbim.Regression > Program.cs** and add custom logic to test and debug the changes + +### Using the Generated Packages in Another Project + +1. Follow the Steps mentioned in Building Xbim Geometry Project to add a Custom Package Source for nuget packages. +2. Install the Custom Packages from the Local folder to use the custom functionality in another project + +### Risks + +1. Difficult to Maintain the Custom Packages +2. Need to Push the Packages on some remote source to reduce a few steps while building the projects. +3. The Current Solution is based on XbimGeometry 5.1.437 and XbimEssentials 5.1.341 which no longer contain the latest changes. These Projects have been migrated to netcore version 6.0 + +### Additional Resources and References + +1. [Xbim Ticket](https://github.com/xBimTeam/XbimGeometry/issues/465) +2. [Quick-C-CLI-Learn-C-CLI-in-less-than-10-minutes](https://www.codeproject.com/Articles/19354/Quick-C-CLI-Learn-C-CLI-in-less-than-10-minutes) +3. [How Geometry is Created with OCC](https://dev.opencascade.org/doc/refman/html/class_b_rep_prim_a_p_i___make_prism.html) +4. [Xbim Toolkit Overview](https://github.com/xBimTeam/XbimEssentials?tab=readme-ov-file#toolkit-overview) +5. [Open Cascade CAD Assistant Viewer](https://www.opencascade.com/products/cad-assistant/) From 3e0984a44b84ac1c0c57adb7c36cef6aa34e83f5 Mon Sep 17 00:00:00 2001 From: ncr-399 Date: Fri, 8 Mar 2024 10:26:56 +0530 Subject: [PATCH 07/12] removed duplicate index --- docs/README.md | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/docs/README.md b/docs/README.md index b40f9b352..cb52add01 100644 --- a/docs/README.md +++ b/docs/README.md @@ -45,21 +45,6 @@ 9. Build the XbimGeometry and XbimEssentials Solutions and generate new packages 10. Install the newly generated packages into another project to use the new functionality.- [Xbim Geometry Exploration](#xbim-geometry-exploration) -- [Xbim Geometry Exploration](#xbim-geometry-exploration) - - [Case Study IXbimGeometryEngine Interface](#case-study-ixbimgeometryengine-interface) - - [How the IXbimGeometryEngine Interface is defined](#how-the-ixbimgeometryengine-interface-is-defined) - - [How XbimGeometryEngine calls the Native C++ Code](#how-xbimgeometryengine-calls-the-native-c-code) - - [How We Have Added a Custom Functionality to Extract Edges](#how-we-have-added-a-custom-functionality-to-extract-edges) - - [Adding New Classes to Xbim.Geometry.Engine Project](#adding-new-classes-to-xbimgeometryengine-project) - - [Building XbimEssentials Project](#building-xbimessentials-project) - - [Packaging the XbimEssentials Project](#packaging-the-xbimessentials-project) - - [Building XbimGeometry Project](#building-xbimgeometry-project) - - [Packaging XbimGeometry Project](#packaging-xbimgeometry-project) - - [Testing, Debugging, and Profiling Geometry Engine Projects](#testing-debugging-and-profiling-geometry-engine-projects) - - [Using the Generated Packages in Another Project](#using-the-generated-packages-in-another-project) - - [Risks](#risks) - - [Additional Resources and References](#additional-resources-and-references) - ### Adding New Classes to Xbim.Geometry.Engine Project 1. Right-click on the Xbim.Geometry.Engine Project in Visual Studio @@ -120,7 +105,7 @@ ### Risks 1. Difficult to Maintain the Custom Packages -2. Need to Push the Packages on some remote source to reduce a few steps while building the projects. +2. Need to Push the Packages on some remote sources to reduce a few steps while building the projects. 3. The Current Solution is based on XbimGeometry 5.1.437 and XbimEssentials 5.1.341 which no longer contain the latest changes. These Projects have been migrated to netcore version 6.0 ### Additional Resources and References From 53d2c0827298e2173e72f59734eee1762fbb083f Mon Sep 17 00:00:00 2001 From: ncr-399 Date: Fri, 8 Mar 2024 13:22:04 +0530 Subject: [PATCH 08/12] updated doc with triangulation and geometry generation section --- docs/README.md | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/docs/README.md b/docs/README.md index cb52add01..33f539a4e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -5,6 +5,9 @@ - [How the IXbimGeometryEngine Interface is defined](#how-the-ixbimgeometryengine-interface-is-defined) - [How XbimGeometryEngine calls the Native C++ Code](#how-xbimgeometryengine-calls-the-native-c-code) - [How We Have Added a Custom Functionality to Extract Edges](#how-we-have-added-a-custom-functionality-to-extract-edges) + - [How Xbim.Geometry.Engine computes Geometry and Tesselation](#how-xbimgeometryengine-computes-geometry-and-tesselation) + - [Overview](#overview) + - [Geometry and Triangulation Computation Case Study for a Simple Wall (IfcExtrudedAreaSolid)](#geometry-and-triangulation-computation-case-study-for-a-simple-wall-ifcextrudedareasolid) - [Adding New Classes to Xbim.Geometry.Engine Project](#adding-new-classes-to-xbimgeometryengine-project) - [Building XbimEssentials Project](#building-xbimessentials-project) - [Packaging the XbimEssentials Project](#packaging-the-xbimessentials-project) @@ -34,7 +37,7 @@ #### How We Have Added a Custom Functionality to Extract Edges -1. Add an Inteface called IXbimEdgeGeometry in Xbim.Essetials.Ifc4 Module +1. Add an Inteface called IXbimEdgeGeometry in Xbim.Essentials.Ifc4 Module 2. Build the Xbim.Essentials Project with the new IXbimEdgeGeometry interface and create custom packages 3. Import the Custom Packages in Xbim.Geometry Project 4. Add a class called XbimEdgeGeometry in Xbim.Geometry.Engine.Interop Project which **implements** Xbim.Essentials.Ifc4.IXbimEdgeGeometry interface @@ -43,7 +46,32 @@ 7. The Xbim.Geometry.Engine.Interop.XbimEdgeGeometry class then loads the Xbim.Geometry.Engine.XbimEdgeGeometry class from dll at runtime to access its functionality. 8. The Xbim.Geometry.Engine.Interop.XbimEdgeGeometry is just a wrapper class that forwards the calls to native code using OCCT. 9. Build the XbimGeometry and XbimEssentials Solutions and generate new packages -10. Install the newly generated packages into another project to use the new functionality.- [Xbim Geometry Exploration](#xbim-geometry-exploration) +10. Install the newly generated packages into another project to use the new functionality. + +### How Xbim.Geometry.Engine computes Geometry and Tesselation + +#### Overview + +1. Consider a Simple Wall having IfcShapeRepresentationType as IfcExtrudedAreaSolid +2. All processes related to Geometry Generation and Triangulation are carried out in **Xbim.ModelGeometry.Scene.Xbim3DModelContext** class's CreateContext method +3. Xbim.Geometry.Engine Module and Xbim.Tesselator Modules are used for generating Geometry and Triangulation +4. The Tesselation is either generated by Xbim.Tesselator or Xbim.Geometry.Engine Module depending upon the type of the module (See Table Below) +5. For ShapeRepresentation like IfcExtrudedArea where the shape is not defined the Xbim.Geometry.Engine first generates a Geometry Model and based on the model, the tesselation is computed. +6. Xbim.Geometry.Engine uses OCCT to generate Geometry Model and Triangulation. +7. In the case of simple shape representation types like IfcFacetedBrep the tesselation is computed by Xbim.Tesselator module. + +#### Geometry and Triangulation Computation Case Study for a Simple Wall (IfcExtrudedAreaSolid) + +1. Load the Model using Xbim SDK, and create an instance of Xbim.ModelGeometry.Scene class using the model and call the `CreateContext()` method. +2. Inside `CreateContext()` method, first the Shape is queried using ShapeId and stored as IIfcGeometricRepresentationItem +3. Using this Shape of type IIfcGeometricRepresentationItem we check if its triangulation can be computed using Xbim.Tesselator method using `Xbim.Tesselator.CanMesh()` method. +4. In this case, since the type of IIfcGeometricReprsentationItem is of type IfcExtrudedArea it cannot be computed using Xbim.Tesselator module. +5. Next, we use Xbim.Geometry.Engine module to generate a Geometry Model for the ShapeRepresentation IfcExtrudedArea. +6. For ShapeRepresentation of type IfcExtrudedArea, to create a geometry model we need a Base Shape and a Direction. +7. Xbim.Geometry.Engine creates an XbimSolid the ShapeRepresentation using OCCT. Using the **SweptArea** property of the ShapeRepresentation creates an object of type XbimFace which can be used as a Base Shape along with the **ExtrudeDirection** property of ShapeRepresentation to create a geometry model. Thsese two parameters are then passed to **OCCT: BRepPrimAPI_MakePrism** api which returns a Shape using the inputs. +8. **XbimSolid is derived from TopDS_Shape so it can be used with Meshing Algorithms** +9. At this point, we have a geometry model which we can use to generate Triangulation. We use the XbimSolid created in the previous step and pass it **Xbim.Geometry.Engine.CreateShapeGeometry** method to compute tesselation and return a buffer containing the tesselated data. +10. Internally, **Xbim.Geometry.Engine.CreateShapeGeometry** calls **Xbim.Geometry.Engine.WriteTriangulation** method to compute the tesselation using OCCT and writes it back into a buffer. This buffer is then stored in Xbim.Model.GeometryStor ### Adding New Classes to Xbim.Geometry.Engine Project From 5065af8516e406061f54712e33963fa1eb6768a5 Mon Sep 17 00:00:00 2001 From: ncr-399 Date: Fri, 8 Mar 2024 17:05:40 +0530 Subject: [PATCH 09/12] updated geometry and triangulation section --- docs/README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index 33f539a4e..a6a411dae 100644 --- a/docs/README.md +++ b/docs/README.md @@ -60,11 +60,21 @@ 6. Xbim.Geometry.Engine uses OCCT to generate Geometry Model and Triangulation. 7. In the case of simple shape representation types like IfcFacetedBrep the tesselation is computed by Xbim.Tesselator module. +| Shape Representation | Module Used | +| -------------------------- | -------------------- | +| IfcFacetedBrep | Xbim.Tesselator | +| IIfcFaceBasedSurfaceModel | Xbim.Tesselator | +| IIfcShellBasedSurfaceModel | Xbim.Tesselator | +| IIfcConnectedFaceSet | Xbim.Tesselator | +| IIfcTessellatedFaceSet | Xbim.Tesselator | +| IfcExtrudedArea | Xbim.Geometry.Engine | +| All Other | Xbim.Geometry.Engine | + #### Geometry and Triangulation Computation Case Study for a Simple Wall (IfcExtrudedAreaSolid) 1. Load the Model using Xbim SDK, and create an instance of Xbim.ModelGeometry.Scene class using the model and call the `CreateContext()` method. 2. Inside `CreateContext()` method, first the Shape is queried using ShapeId and stored as IIfcGeometricRepresentationItem -3. Using this Shape of type IIfcGeometricRepresentationItem we check if its triangulation can be computed using Xbim.Tesselator method using `Xbim.Tesselator.CanMesh()` method. +3. Using this Shape of type IIfcGeometricRepresentationItem we check if its triangulation can be computed using Xbim.Tesselator method using `Xbim.Tesselator.CanMesh()` method. 4. In this case, since the type of IIfcGeometricReprsentationItem is of type IfcExtrudedArea it cannot be computed using Xbim.Tesselator module. 5. Next, we use Xbim.Geometry.Engine module to generate a Geometry Model for the ShapeRepresentation IfcExtrudedArea. 6. For ShapeRepresentation of type IfcExtrudedArea, to create a geometry model we need a Base Shape and a Direction. From 0fe06964c82d6c40595aa662e19cc0cf8f6d25b4 Mon Sep 17 00:00:00 2001 From: ncr-399 Date: Fri, 8 Mar 2024 17:14:06 +0530 Subject: [PATCH 10/12] moved doc to wiki page --- docs/README.md | 155 ------------------------------------------------- 1 file changed, 155 deletions(-) delete mode 100644 docs/README.md diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index a6a411dae..000000000 --- a/docs/README.md +++ /dev/null @@ -1,155 +0,0 @@ -## Xbim Geometry Exploration - -- [Xbim Geometry Exploration](#xbim-geometry-exploration) - - [Case Study IXbimGeometryEngine Interface](#case-study-ixbimgeometryengine-interface) - - [How the IXbimGeometryEngine Interface is defined](#how-the-ixbimgeometryengine-interface-is-defined) - - [How XbimGeometryEngine calls the Native C++ Code](#how-xbimgeometryengine-calls-the-native-c-code) - - [How We Have Added a Custom Functionality to Extract Edges](#how-we-have-added-a-custom-functionality-to-extract-edges) - - [How Xbim.Geometry.Engine computes Geometry and Tesselation](#how-xbimgeometryengine-computes-geometry-and-tesselation) - - [Overview](#overview) - - [Geometry and Triangulation Computation Case Study for a Simple Wall (IfcExtrudedAreaSolid)](#geometry-and-triangulation-computation-case-study-for-a-simple-wall-ifcextrudedareasolid) - - [Adding New Classes to Xbim.Geometry.Engine Project](#adding-new-classes-to-xbimgeometryengine-project) - - [Building XbimEssentials Project](#building-xbimessentials-project) - - [Packaging the XbimEssentials Project](#packaging-the-xbimessentials-project) - - [Building XbimGeometry Project](#building-xbimgeometry-project) - - [Packaging XbimGeometry Project](#packaging-xbimgeometry-project) - - [Testing, Debugging, and Profiling Geometry Engine Projects](#testing-debugging-and-profiling-geometry-engine-projects) - - [Using the Generated Packages in Another Project](#using-the-generated-packages-in-another-project) - - [Risks](#risks) - - [Additional Resources and References](#additional-resources-and-references) - -### Case Study IXbimGeometryEngine Interface - -#### How the IXbimGeometryEngine Interface is defined - -1. The IXbimGeometryEngine Interface is defined in Xbim.Essentials.Ifc4 Module -2. IXbimGeometryEngine Interface is Implemented Xbim.Geometry.Engine.Interop > XbimGeometryEngine.cs Project as a Wrapper for the Native Code -3. XbimGeometryEngine class defined in XbimGeometryEngine.cs internally calls the Functions defined in Xbim.Geometry.Engine (Native C++ Project) which uses OCCT Code -4. Both XbimGeometryEngine classes defined in C# and C++ derive from the IXbimGeometryEngine interface defined in Xbim.Essentials.Ifc4 Module. - -#### How XbimGeometryEngine calls the Native C++ Code - -1. The XbimGeometryEngine's Constructor loads the Xbim.GeometryEngine32.dll or Xbim.GeometryEngine64.dll depending upon the platform architecture (x86 or x64) -2. It grabs the function XbimGeometryEngine class defined in native code and then creates an instance of it -3. To call the methods defined in the XbimGeometry's instance created loaded from the dll it has to be cast as IXbimGeometryEngine -4. This is why both XbimGeometryEngine classes defined in C# and C++ are derived from a Common Interface. If they don't implement the same interface the instance created at runtime cannot access the methods. -5. All the calls made to XbimGeometryEngine C# code then call the native methods defined in C++ through the instance loaded through the dll. - -#### How We Have Added a Custom Functionality to Extract Edges - -1. Add an Inteface called IXbimEdgeGeometry in Xbim.Essentials.Ifc4 Module -2. Build the Xbim.Essentials Project with the new IXbimEdgeGeometry interface and create custom packages -3. Import the Custom Packages in Xbim.Geometry Project -4. Add a class called XbimEdgeGeometry in Xbim.Geometry.Engine.Interop Project which **implements** Xbim.Essentials.Ifc4.IXbimEdgeGeometry interface -5. The XbimEdgeGeometry class has a member variable of type IXbimEdgeGeometry which will be used to acess native code loaded from the dll at runtime -6. Add a class called XbimEdgeGeometry in Xbim.Geometry.Engine which **extends** from Xbim.Essentials.Ifc4.IXbimEdgeGeometry and implement all the methods defined in the interface. Use OCCT to extract edges. -7. The Xbim.Geometry.Engine.Interop.XbimEdgeGeometry class then loads the Xbim.Geometry.Engine.XbimEdgeGeometry class from dll at runtime to access its functionality. -8. The Xbim.Geometry.Engine.Interop.XbimEdgeGeometry is just a wrapper class that forwards the calls to native code using OCCT. -9. Build the XbimGeometry and XbimEssentials Solutions and generate new packages -10. Install the newly generated packages into another project to use the new functionality. - -### How Xbim.Geometry.Engine computes Geometry and Tesselation - -#### Overview - -1. Consider a Simple Wall having IfcShapeRepresentationType as IfcExtrudedAreaSolid -2. All processes related to Geometry Generation and Triangulation are carried out in **Xbim.ModelGeometry.Scene.Xbim3DModelContext** class's CreateContext method -3. Xbim.Geometry.Engine Module and Xbim.Tesselator Modules are used for generating Geometry and Triangulation -4. The Tesselation is either generated by Xbim.Tesselator or Xbim.Geometry.Engine Module depending upon the type of the module (See Table Below) -5. For ShapeRepresentation like IfcExtrudedArea where the shape is not defined the Xbim.Geometry.Engine first generates a Geometry Model and based on the model, the tesselation is computed. -6. Xbim.Geometry.Engine uses OCCT to generate Geometry Model and Triangulation. -7. In the case of simple shape representation types like IfcFacetedBrep the tesselation is computed by Xbim.Tesselator module. - -| Shape Representation | Module Used | -| -------------------------- | -------------------- | -| IfcFacetedBrep | Xbim.Tesselator | -| IIfcFaceBasedSurfaceModel | Xbim.Tesselator | -| IIfcShellBasedSurfaceModel | Xbim.Tesselator | -| IIfcConnectedFaceSet | Xbim.Tesselator | -| IIfcTessellatedFaceSet | Xbim.Tesselator | -| IfcExtrudedArea | Xbim.Geometry.Engine | -| All Other | Xbim.Geometry.Engine | - -#### Geometry and Triangulation Computation Case Study for a Simple Wall (IfcExtrudedAreaSolid) - -1. Load the Model using Xbim SDK, and create an instance of Xbim.ModelGeometry.Scene class using the model and call the `CreateContext()` method. -2. Inside `CreateContext()` method, first the Shape is queried using ShapeId and stored as IIfcGeometricRepresentationItem -3. Using this Shape of type IIfcGeometricRepresentationItem we check if its triangulation can be computed using Xbim.Tesselator method using `Xbim.Tesselator.CanMesh()` method. -4. In this case, since the type of IIfcGeometricReprsentationItem is of type IfcExtrudedArea it cannot be computed using Xbim.Tesselator module. -5. Next, we use Xbim.Geometry.Engine module to generate a Geometry Model for the ShapeRepresentation IfcExtrudedArea. -6. For ShapeRepresentation of type IfcExtrudedArea, to create a geometry model we need a Base Shape and a Direction. -7. Xbim.Geometry.Engine creates an XbimSolid the ShapeRepresentation using OCCT. Using the **SweptArea** property of the ShapeRepresentation creates an object of type XbimFace which can be used as a Base Shape along with the **ExtrudeDirection** property of ShapeRepresentation to create a geometry model. Thsese two parameters are then passed to **OCCT: BRepPrimAPI_MakePrism** api which returns a Shape using the inputs. -8. **XbimSolid is derived from TopDS_Shape so it can be used with Meshing Algorithms** -9. At this point, we have a geometry model which we can use to generate Triangulation. We use the XbimSolid created in the previous step and pass it **Xbim.Geometry.Engine.CreateShapeGeometry** method to compute tesselation and return a buffer containing the tesselated data. -10. Internally, **Xbim.Geometry.Engine.CreateShapeGeometry** calls **Xbim.Geometry.Engine.WriteTriangulation** method to compute the tesselation using OCCT and writes it back into a buffer. This buffer is then stored in Xbim.Model.GeometryStor - -### Adding New Classes to Xbim.Geometry.Engine Project - -1. Right-click on the Xbim.Geometry.Engine Project in Visual Studio -2. Select Add from the Dropdown Menu -3. Create a .cpp and .h file -4. Right Click on the .cpp file and select properties -5. Go to C/C++ Section -6. Make Sure the **Common Language Runtime Support Option** is set to **Common Language Runtime Support (/clr)** otherwise the build will throw fatal errors if any C# Interop Code is Used in the File. - -### Building XbimEssentials Project - -1. Clone the XbimEssentials repo from [XbimEssentials](https://github.com/CCT-Mukund-Thakare/XbimEssentials) -2. Switch to Branch [issues/issue465](https://github.com/CCT-Mukund-Thakare/XbimEssentials/tree/issues/issue465) -3. Open the Solution using Visual Studio -4. Build the Solution (It will build 9 Projects) - -### Packaging the XbimEssentials Project - -1. After Successfully building the projects, right-click on the Project and Select the **Pack** option from the dropdown menu -2. Selecting the **Pack** option will generate a .nuget package with **version 5.1.341** e.g (Xbim.Common.5.1.341.nupkg) -3. Do this for all the Projects (Ignore the Test Projects) -4. **Make Sure to Build the Packages in Release Mode** -5. Go to Project Root Folder (C:\workspace\Xbim\XbimEssentials) -6. Search for .nupkg in the Search Bar. It will return all the packages -7. Copy all the Packages and place them in a new Folder called packages - -### Building XbimGeometry Project - -1. Clone the XbimGeometry repo from [XbimGeometry](https://github.com/CCT-Mukund-Thakare/XbimEssentials) -2. Switch to Branch [issues/issue465](https://github.com/CCT-Mukund-Thakare/XbimGeometry/tree/issues/issue465) -3. Open the Solution using Visual Studio -4. It will restore the required packages from nuget.org instead of our custom packages -5. Go Project > Manage Nuget Packages -6. Click on the Settings Icon on the Right Most Corner next to Package Sources. It will open up the menu to configure package sources -7. Click on the + Sign to Add a new Package Source and Set the Path to the new Package Folder created while building XbimEssential packages (See Packaging XbimEssentials Project Step 7) -8. Uncheck the nuget.org as Package Source in the Config Menu. -9. Go to C:\Users\\{UserName}\\.nuget\packages and remove all the xbim packages -10. Restart Visual Studio -11. New Custom Packages are restored from the local source created in Building XbimGeometry Project > Step 7 -12. Build the Xbim.Geometry.Engine.Interop Project First and then build the rest of the projects -13. **Directly Building the Solution May Fail and Throw a Lot of Errors** - -### Packaging XbimGeometry Project - -1. Once all the Projects are Built, Right Click on the **C#** Projects and Click on **Pack** from the dropdown menu to generate the nuget packages (Ignore the Regression and Tests Projects). It will generate a nupkg file with **version 5.1.437** -2. Place the generated packages into the local package folder. - -### Testing, Debugging, and Profiling Geometry Engine Projects - -1. To Test, Debug, or Profile the Xbim.Geometry.Engine and Xbim.Geometry.Engine.Interop projects use the **Xbim.Regression** Project -2. Modify the **Xbim.Regression > Program.cs** and add custom logic to test and debug the changes - -### Using the Generated Packages in Another Project - -1. Follow the Steps mentioned in Building Xbim Geometry Project to add a Custom Package Source for nuget packages. -2. Install the Custom Packages from the Local folder to use the custom functionality in another project - -### Risks - -1. Difficult to Maintain the Custom Packages -2. Need to Push the Packages on some remote sources to reduce a few steps while building the projects. -3. The Current Solution is based on XbimGeometry 5.1.437 and XbimEssentials 5.1.341 which no longer contain the latest changes. These Projects have been migrated to netcore version 6.0 - -### Additional Resources and References - -1. [Xbim Ticket](https://github.com/xBimTeam/XbimGeometry/issues/465) -2. [Quick-C-CLI-Learn-C-CLI-in-less-than-10-minutes](https://www.codeproject.com/Articles/19354/Quick-C-CLI-Learn-C-CLI-in-less-than-10-minutes) -3. [How Geometry is Created with OCC](https://dev.opencascade.org/doc/refman/html/class_b_rep_prim_a_p_i___make_prism.html) -4. [Xbim Toolkit Overview](https://github.com/xBimTeam/XbimEssentials?tab=readme-ov-file#toolkit-overview) -5. [Open Cascade CAD Assistant Viewer](https://www.opencascade.com/products/cad-assistant/) From 9163eb94c9a8a69f23531f6028353a8420bad1af Mon Sep 17 00:00:00 2001 From: ncr-399 Date: Tue, 12 Mar 2024 11:43:26 +0530 Subject: [PATCH 11/12] updated Xbim3DModelContext to write edge data in the geometry store --- .../XbimEdgeGeometry.cs | 198 ----------- Xbim.Geometry.Engine/XbimEdgeGeometry.cpp | 317 ------------------ Xbim.Geometry.Engine/XbimEdgeGeometry.h | 118 ------- .../Xbim3DModelContext.cs | 19 +- 4 files changed, 18 insertions(+), 634 deletions(-) delete mode 100644 Xbim.Geometry.Engine.Interop/XbimEdgeGeometry.cs delete mode 100644 Xbim.Geometry.Engine/XbimEdgeGeometry.cpp delete mode 100644 Xbim.Geometry.Engine/XbimEdgeGeometry.h diff --git a/Xbim.Geometry.Engine.Interop/XbimEdgeGeometry.cs b/Xbim.Geometry.Engine.Interop/XbimEdgeGeometry.cs deleted file mode 100644 index bb9644f0e..000000000 --- a/Xbim.Geometry.Engine.Interop/XbimEdgeGeometry.cs +++ /dev/null @@ -1,198 +0,0 @@ -using System; -using System.IO; -using System.Reflection; -using Microsoft.Extensions.Logging; - - -using Xbim.Common; -using Xbim.Common.Geometry; -using Xbim.Ifc4.Interfaces; -using Xbim.Ifc4; - -namespace Xbim.Geometry.Engine.Interop -{ - - namespace Xbim.Geometry.Engine.Interop - { - - public class XbimEdgeGeometry : IXbimEdgeGeometry - { - private readonly IXbimEdgeGeometry _engine; - private readonly ILogger _logger; - static XbimEdgeGeometry() - { - - // We need to wire in a custom assembly resolver since Xbim.Geometry.Engine is - // not located using standard probing rules (due to way we deploy processor specific binaries) - AppDomain.CurrentDomain.AssemblyResolve += XbimCustomAssemblyResolver.ResolverHandler; - } - - public XbimEdgeGeometry() : this(null) - { - - } - - - public XbimEdgeGeometry(ILogger logger) - { - - // Warn if runtime for Engine is not present, this is not necessary any more as we are net472 - //XbimPrerequisitesValidator.Validate(); - - - _logger = logger ?? XbimLogging.CreateLogger(); - - var conventions = new XbimArchitectureConventions(); // understands the process we run under - string assemblyName = $"{conventions.ModuleName}.dll";// + conventions.Suffix; dropping the use of a suffix - _logger.LogDebug("Loading {assemblyName}", assemblyName); - try - { - var ass = Assembly.Load(assemblyName); - _logger.LogTrace("Loaded {fullName} from {codebase}", ass.GetName().FullName, ass.CodeBase); - var t = ass.GetType("Xbim.Geometry.XbimEdgeGeometry"); - var obj = Activator.CreateInstance(t); - _logger.LogTrace("Created Instance of {fullName}", obj.GetType().FullName); - if (obj == null) - { - throw new Exception("Failed to create Geometry Engine"); - } - - _engine = obj as IXbimEdgeGeometry; - - if (_engine == null) - { - throw new Exception("Failed to cast Geometry Engine to IXbimGeometryEngine"); - } - - _logger.LogDebug("XbimGeometryEngine constructed successfully"); - } - catch (Exception e) - { - _logger.LogError(0, e, "Failed to construct XbimGeometryEngine"); - throw new FileLoadException($"Failed to load Xbim.Geometry.Engine{conventions.Suffix}.dll", e); - } - - } - - public IXbimEdgeSet CreateEdge(IIfcBoundingBox ifcSolid, ILogger logger) - { - return _engine.CreateEdge(ifcSolid, logger); - } - - public IXbimEdgeSet CreateEdge(IIfcSweptDiskSolid ifcSolid, ILogger logger) - { - return _engine.CreateEdge(ifcSolid, logger); - } - - public IXbimEdgeSet CreateEdge(IIfcShellBasedSurfaceModel ifcSurface, ILogger logger) - { - return _engine.CreateEdge(ifcSurface, logger); - } - - public IXbimEdgeSet CreateEdge(IIfcSurfaceCurveSweptAreaSolid ifcSolid, ILogger logger) - { - return _engine.CreateEdge(ifcSolid, logger); - } - - public IXbimEdgeSet CreateEdge(IIfcBoxedHalfSpace ifcSolid, ILogger logger) - { - return _engine.CreateEdge(ifcSolid, logger); - } - - public IXbimEdgeSet CreateEdge(IIfcPolygonalBoundedHalfSpace ifcSolid, ILogger logger) - { - return _engine.CreateEdge(ifcSolid, logger); - } - - public IXbimEdgeSet CreateEdge(IIfcHalfSpaceSolid ifcSolid, ILogger logger) - { - return _engine.CreateEdge(ifcSolid, logger); - } - - public IXbimEdgeSet CreateEdge(IIfcFaceBasedSurfaceModel ifcSurface, ILogger logger) - { - return _engine.CreateEdge(ifcSurface, logger); - } - - public IXbimEdgeSet CreateEdge(IIfcTriangulatedFaceSet shell, ILogger logger) - { - return _engine.CreateEdge(shell, logger); - } - - public IXbimEdgeSet CreateEdge(IIfcSweptAreaSolid ifcSolid, ILogger logger) - { - return _engine.CreateEdge(ifcSolid, logger); - } - - public IXbimEdgeSet CreateEdge(IIfcExtrudedAreaSolid ifcSolid, ILogger logger) - { - return _engine.CreateEdge(ifcSolid, logger); - } - - public IXbimEdgeSet CreateEdge(IIfcCsgPrimitive3D ifcSolid, ILogger logger) - { - return _engine.CreateEdge(ifcSolid, logger); - } - - public IXbimEdgeSet CreateEdge(IIfcSphere ifcSolid, ILogger logger) - { - return _engine.CreateEdge(ifcSolid, logger); - } - - public IXbimEdgeSet CreateEdge(IIfcBlock ifcSolid, ILogger logger) - { - return _engine.CreateEdge(ifcSolid, logger); - } - - public IXbimEdgeSet CreateEdge(IIfcRightCircularCylinder ifcSolid, ILogger logger) - { - return _engine.CreateEdge(ifcSolid, logger); - } - - public IXbimEdgeSet CreateEdge(IIfcRevolvedAreaSolid ifcSolid, ILogger logger) - { - return _engine.CreateEdge(ifcSolid, logger); - } - - public IXbimEdgeSet CreateEdge(IIfcRectangularPyramid ifcSolid, ILogger logger) - { - return _engine.CreateEdge(ifcSolid, logger); - } - - public IXbimEdgeSet CreateEdge(IIfcRightCircularCone ifcSolid, ILogger logger) - { - return _engine.CreateEdge(ifcSolid, logger); - } - - public IXbimEdgeSet CreateEdge(IIfcRevolvedAreaSolidTapered ifcSolid, ILogger logger) - { - return _engine.CreateEdge(ifcSolid, logger); - } - - public IXbimEdgeSet CreateEdge(IIfcFixedReferenceSweptAreaSolid ifcSolid, ILogger logger) - { - return _engine.CreateEdge(ifcSolid, logger); - } - - public IXbimEdgeSet CreateEdge(IIfcAdvancedBrep ifcSolid, ILogger logger) - { - return _engine.CreateEdge(ifcSolid, logger); - } - - public IXbimEdgeSet CreateEdge(IIfcAdvancedBrepWithVoids ifcSolid, ILogger logger) - { - return _engine.CreateEdge(ifcSolid, logger); - } - - public IXbimEdgeSet CreateEdge(IIfcSectionedSpine ifcSolid, ILogger logger) - { - return _engine.CreateEdge(ifcSolid, logger); - } - - public IXbimEdgeSet CreateEdge(IIfcSweptDiskSolidPolygonal ifcSolid, ILogger logger) - { - return _engine.CreateEdge(ifcSolid, logger); - } - } - } -} diff --git a/Xbim.Geometry.Engine/XbimEdgeGeometry.cpp b/Xbim.Geometry.Engine/XbimEdgeGeometry.cpp deleted file mode 100644 index 3901b0310..000000000 --- a/Xbim.Geometry.Engine/XbimEdgeGeometry.cpp +++ /dev/null @@ -1,317 +0,0 @@ -#include "XbimEdgeGeometry.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "XbimSolid.h" -#include "XbimEdgeSet.h" -#include "XbimCompound.h" -#include "XbimSolidSet.h" - -using System::Runtime::InteropServices::Marshal; - -using namespace System::Threading; -using namespace System::Linq; - -using namespace System; -using namespace Xbim::Common::Geometry; -using namespace System::Collections::Generic; -using namespace Xbim::Ifc4::Interfaces; -using namespace Xbim::Ifc4; -using namespace Microsoft::Extensions::Logging; - -using namespace System; -using namespace System::IO; -using namespace Xbim::Common; -using namespace Xbim::Common::Geometry; - -using namespace System::Configuration; -using namespace System::Reflection; - - -namespace Xbim { - namespace Geometry { - void XbimEdgeGeometry::LogInfo(ILogger^ logger, Object^ entity, String^ format, ...array^ arg) - { - String^ msg = String::Format(format, arg); - IPersistEntity^ ifcEntity = dynamic_cast(entity); - if (logger != nullptr) - { - - if (ifcEntity != nullptr) - LoggerExtensions::LogInformation(logger, "GeomEngine: #{0}={1} [{2}]", ifcEntity->EntityLabel, ifcEntity->GetType()->Name, msg); - else - if (entity == nullptr) - LoggerExtensions::LogInformation(logger, "GeomEngine: [{0}]", msg); - else - LoggerExtensions::LogInformation(logger, "GeomEngine: {0} [{1}]", entity->GetType()->Name, msg); - } - } - - void XbimEdgeGeometry::LogWarning(ILogger^ logger, Object^ entity, String^ format, ...array^ arg) - { - String^ msg = String::Format(format, arg); - IPersistEntity^ ifcEntity = dynamic_cast(entity); - if (logger != nullptr) - { - if (ifcEntity != nullptr) - LoggerExtensions::LogWarning(logger, "GeomEngine: #{0}={1} [{2}]", ifcEntity->EntityLabel, ifcEntity->GetType()->Name, msg); - else - if (entity == nullptr) - LoggerExtensions::LogWarning(logger, "GeomEngine: [{0}]", msg); - else - LoggerExtensions::LogWarning(logger, "GeomEngine: {0} [{1}]", entity->GetType()->Name, msg); - } - } - - void XbimEdgeGeometry::LogDebug(ILogger^ logger, Object^ entity, String^ format, ...array^ arg) - { - String^ msg = String::Format(format, arg); - IPersistEntity^ ifcEntity = dynamic_cast(entity); - if (logger != nullptr) - { - if (ifcEntity != nullptr) - LoggerExtensions::LogDebug(logger, "GeomEngine: #{0}={1} [{2}]", ifcEntity->EntityLabel, ifcEntity->GetType()->Name, msg); - else - if (entity == nullptr) - LoggerExtensions::LogDebug(logger, "GeomEngine: [{0}]", msg); - else - LoggerExtensions::LogDebug(logger, "GeomEngine: {0} [{1}]", entity->GetType()->Name, msg); - } - } - - - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdgeGeometry(XbimSolid^ xSolid) { - //xBim solid derived from occshape -> compatible with BRepMesh_Incremental - //BRepMesh_IncrementalMesh Mesh(xSolid, LinearDeflectionInMM, Standard_False, AngularDeflectionInRadians, Standard_False); - - //Computes Triangulation - //Mesh.Perform(); - - //TopoDS_Shape - - //XbimEdge^ edge = gcnew XbimEdge(); - - - return xSolid->Edges; - - } - - void XbimEdgeGeometry::LogError(ILogger^ logger, Object^ entity, String^ format, ...array^ arg) - { - String^ msg = String::Format(format, arg); - IPersistEntity^ ifcEntity = dynamic_cast(entity); - if (logger != nullptr) - { - if (ifcEntity != nullptr) - LoggerExtensions::LogError(logger, "GeomEngine: #{0}={1} [{2}]", ifcEntity->EntityLabel, ifcEntity->GetType()->Name, msg); - else - if (entity == nullptr) - LoggerExtensions::LogError(logger, "GeomEngine: [{0}]", msg); - else - LoggerExtensions::LogError(logger, "GeomEngine: {0} [{1}]", entity->GetType()->Name, msg); - } - } - - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcSweptDiskSolidPolygonal^ ifcSolid, ILogger^ logger) - { - XbimSolid^ xSolid = gcnew XbimSolid(ifcSolid, logger); - return CreateEdgeGeometry(xSolid); - } - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcRevolvedAreaSolidTapered^ ifcSolid, ILogger^ logger) - { - XbimSolid^ xSolid = gcnew XbimSolid(ifcSolid, logger); - return CreateEdgeGeometry(xSolid); - - } - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcFixedReferenceSweptAreaSolid^ ifcSolid, ILogger^ logger) - { - XbimSolid^ xSolid = gcnew XbimSolid(ifcSolid, logger); - return CreateEdgeGeometry(xSolid); - } - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcAdvancedBrep^ ifcSolid, ILogger^ logger) - { - /*XbimCompound^ comp = gcnew XbimCompound((IIfcAdvancedBrep^)ifcSolid, logger); - if (comp->Solids->Count > 0) - XbimSolid^ xSolid = comp->Solids->First; - else - XbimSolid^ xSolid = gcnew XbimSolid();*/ - throw gcnew System::NotImplementedException(); - - } - - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcAdvancedBrepWithVoids^ ifcSolid, ILogger^ logger) - { - throw gcnew System::NotImplementedException(); - // TODO: insert return statement here - } - - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcSectionedSpine^ ifcSolid, ILogger^ logger) - { - XbimSolid^ xSolid = gcnew XbimSolid(ifcSolid, logger); - return CreateEdgeGeometry(xSolid); - } - - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcSweptAreaSolid^ IIfcSolid, ILogger^ logger) - { - /*XbimSolid^ xSolid; - IIfcExtrudedAreaSolid^ eas = dynamic_cast(IIfcSolid); - if (eas != nullptr) return CreateEdge(eas, logger); - IIfcRevolvedAreaSolid^ ras = dynamic_cast(IIfcSolid); - if (ras != nullptr) return CreateEdge(ras, logger); - IIfcSurfaceCurveSweptAreaSolid^ scas = dynamic_cast(IIfcSolid); - if (scas != nullptr) return CreateEdge(scas, logger);*/ - throw gcnew NotImplementedException(String::Format("Swept Solid of Type {0} in entity #{1} is not implemented", IIfcSolid->GetType()->Name, IIfcSolid->EntityLabel)); - - } - - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcTriangulatedFaceSet^ shell, ILogger^ logger) - { - XbimSolid^ xSolid = gcnew XbimSolid(shell, logger); - return CreateEdgeGeometry(xSolid); - } - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcShellBasedSurfaceModel^ ifcSurface, ILogger^ logger) - { - XbimSolid^ xSolid = gcnew XbimSolid(ifcSurface, logger); - return CreateEdgeGeometry(xSolid); - - } - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcFaceBasedSurfaceModel^ ifcSurface, ILogger^ logger) - { - XbimSolid^ xSolid = gcnew XbimSolid(ifcSurface, logger); - return CreateEdgeGeometry(xSolid); - - } - - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcExtrudedAreaSolid^ IIfcSolid, ILogger^ logger) - { - XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); - return CreateEdgeGeometry(xSolid); - - }; - - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcRevolvedAreaSolid^ IIfcSolid, ILogger^ logger) - { - XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); - return CreateEdgeGeometry(xSolid); - - } - - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcSweptDiskSolid^ IIfcSolid, ILogger^ logger) - { - XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); - return CreateEdgeGeometry(xSolid); - - } - - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcBoundingBox^ IIfcSolid, ILogger^ logger) - { - XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); - return CreateEdgeGeometry(xSolid); - - } - - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcSurfaceCurveSweptAreaSolid^ IIfcSolid, ILogger^ logger) - { - XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); - return CreateEdgeGeometry(xSolid); - } - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcBooleanResult^ ifcSolid, ILogger^ logger) - { - throw gcnew System::NotImplementedException(); - // TODO: insert return statement here - } - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcBooleanClippingResult^ ifcSolid, ILogger^ logger) - { - throw gcnew System::NotImplementedException(); - // TODO: insert return statement here - } - - - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcHalfSpaceSolid^ IIfcSolid, ILogger^ logger) - { - - XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); - return CreateEdgeGeometry(xSolid); - } - - - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcBoxedHalfSpace^ IIfcSolid, ILogger^ logger) - { - - XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); - return CreateEdgeGeometry(xSolid); - } - - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcPolygonalBoundedHalfSpace^ IIfcSolid, ILogger^ logger) - { - - XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); - return CreateEdgeGeometry(xSolid); - } - - - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcSphere^ IIfcSolid, ILogger^ logger) - { - XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); - return CreateEdgeGeometry(xSolid); - } - - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcBlock^ IIfcSolid, ILogger^ logger) - { - XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); - return CreateEdgeGeometry(xSolid); - } - - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcRightCircularCylinder^ IIfcSolid, ILogger^ logger) - { - XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); - return CreateEdgeGeometry(xSolid); - } - - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcRightCircularCone^ IIfcSolid, ILogger^ logger) - { - XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); - return CreateEdgeGeometry(xSolid); - } - - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcRectangularPyramid^ IIfcSolid, ILogger^ logger) - { - XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); - return CreateEdgeGeometry(xSolid); - } - - IXbimEdgeSet^ XbimEdgeGeometry::CreateEdge(IIfcCsgPrimitive3D^ IIfcSolid, ILogger^ logger) - { - XbimSolid^ xSolid = gcnew XbimSolid(IIfcSolid, logger); - return CreateEdgeGeometry(xSolid); - } - } - -} - -double __cdecl LoadEdgeGeometry(void) -{ - Xbim::Geometry::XbimEdgeGeometry^ gc = gcnew Xbim::Geometry::XbimEdgeGeometry(); - return gc->BooleanTimeOut; -} diff --git a/Xbim.Geometry.Engine/XbimEdgeGeometry.h b/Xbim.Geometry.Engine/XbimEdgeGeometry.h deleted file mode 100644 index 3225934d1..000000000 --- a/Xbim.Geometry.Engine/XbimEdgeGeometry.h +++ /dev/null @@ -1,118 +0,0 @@ -#include "XbimVertex.h" -#include "XbimVertex.h" -#include "XbimEdge.h" -#include "XbimSolid.h" - -using namespace System; -using namespace Xbim::Common::Geometry; -using namespace System::Collections::Generic; -using namespace Xbim::Ifc4::Interfaces; -using namespace Xbim::Ifc4; -using namespace Microsoft::Extensions::Logging; - -using namespace System; -using namespace System::IO; -using namespace Xbim::Common; -using namespace Xbim::Common::Geometry; - -using namespace System::Configuration; -using namespace System::Reflection; - -__declspec(dllexport) double __cdecl LoadEdgeGeometry(void); - - -namespace Xbim { - namespace Geometry { - - ref class XbimEdgeGeometry : IXbimEdgeGeometry { - - - private: - static XbimEdgeGeometry() - { - //AppDomain::CurrentDomain->AssemblyResolve += gcnew ResolveEventHandler(ResolveHandler); - /*Assembly::Load("Xbim.Ifc4"); - Assembly::Load("Xbim.Common"); - Assembly::Load("Xbim.Tessellator");*/ - - String^ timeOut = ConfigurationManager::AppSettings["BooleanTimeOut"]; - if (!int::TryParse(timeOut, BooleanTimeOut)) - BooleanTimeOut = 60; - String^ fuzzyString = ConfigurationManager::AppSettings["FuzzyFactor"]; - if (!double::TryParse(fuzzyString, FuzzyFactor)) - FuzzyFactor = 10; - - String^ linearDeflection = ConfigurationManager::AppSettings["LinearDeflectionInMM"]; - if (!double::TryParse(linearDeflection, LinearDeflectionInMM)) - LinearDeflectionInMM = 50; //max chord diff - - String^ angularDeflection = ConfigurationManager::AppSettings["AngularDeflectionInRadians"]; - if (!double::TryParse(angularDeflection, AngularDeflectionInRadians)) - AngularDeflectionInRadians = 0.5;// deflection of 28 degrees - - String^ ignoreIfcSweptDiskSolidParamsString = ConfigurationManager::AppSettings["IgnoreIfcSweptDiskSolidParams"]; - if (!bool::TryParse(ignoreIfcSweptDiskSolidParamsString, IgnoreIfcSweptDiskSolidParams)) - IgnoreIfcSweptDiskSolidParams = false; - - } - - public: - - static String^ SurfaceOfLinearExtrusion = "#SurfaceOfLinearExtrusion"; - static String^ PolylineTrimLengthOneForEntireLine = "#PolylineTrimLengthOneForEntireLine"; - - static Assembly^ ResolveHandler(Object^ /*Sender*/, ResolveEventArgs^ /*args*/) - { - - // Warning: this should check the args for the assembly name! - return nullptr; - } - - protected: - ~XbimEdgeGeometry() - { - } - - public: - static void LogInfo(ILogger^ logger, Object^ entity, String^ format, ... array^ arg); - static void LogWarning(ILogger^ logger, Object^ entity, String^ format, ... array^ arg); - static void LogError(ILogger^ logger, Object^ entity, String^ format, ... array^ arg); - static void LogDebug(ILogger^ logger, Object^ entity, String^ format, ... array^ arg); - - static int BooleanTimeOut; - static double FuzzyFactor; - static double LinearDeflectionInMM; - static double AngularDeflectionInRadians; - static bool IgnoreIfcSweptDiskSolidParams; - - virtual IXbimEdgeSet^ CreateEdgeGeometry(XbimSolid^ xSolid); - virtual IXbimEdgeSet^ CreateEdge(IIfcExtrudedAreaSolid^ ifcSolid, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcSweptAreaSolid^ ifcSolid, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcRevolvedAreaSolid^ ifcSolid, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcSweptDiskSolid^ ifcSolid, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcBoundingBox^ ifcSolid, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcSurfaceCurveSweptAreaSolid^ ifcSolid, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcBooleanResult^ ifcSolid, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcBooleanClippingResult^ ifcSolid, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcHalfSpaceSolid^ ifcSolid, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcPolygonalBoundedHalfSpace^ ifcSolid, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcBoxedHalfSpace^ ifcSolid, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcTriangulatedFaceSet^ shell, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcShellBasedSurfaceModel^ ifcSurface, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcFaceBasedSurfaceModel^ ifcSurface, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcCsgPrimitive3D^ ifcSolid, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcSphere^ ifcSolid, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcBlock^ ifcSolid, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcRightCircularCylinder^ ifcSolid, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcRightCircularCone^ ifcSolid, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcRectangularPyramid^ ifcSolid, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcSweptDiskSolidPolygonal^ ifcSolid, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcRevolvedAreaSolidTapered^ ifcSolid, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcFixedReferenceSweptAreaSolid^ ifcSolid, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcAdvancedBrep^ ifcSolid, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcAdvancedBrepWithVoids^ ifcSolid, ILogger^ logger); - virtual IXbimEdgeSet^ CreateEdge(IIfcSectionedSpine^ ifcSolid, ILogger^ logger); - - }; - } -} \ No newline at end of file diff --git a/Xbim.ModelGeometry.Scene/Xbim3DModelContext.cs b/Xbim.ModelGeometry.Scene/Xbim3DModelContext.cs index a3a54337a..19cc27ca8 100644 --- a/Xbim.ModelGeometry.Scene/Xbim3DModelContext.cs +++ b/Xbim.ModelGeometry.Scene/Xbim3DModelContext.cs @@ -14,6 +14,7 @@ using Xbim.Common.Exceptions; using Xbim.Common.Geometry; using Xbim.Geometry.Engine.Interop; +using Xbim.Ifc4; using Xbim.Ifc4.Interfaces; using Xbim.ModelGeometry.Scene.Clustering; using Xbim.ModelGeometry.Scene.Extensions; @@ -155,6 +156,7 @@ private struct GeometryReference { public XbimRect3D BoundingBox; public int GeometryId; + public int EdgeId; public int StyleLabel; public XbimVector3D? LocalShapeDisplacement; } @@ -951,6 +953,7 @@ private HashSet WriteProductsWithFeatures(XbimCreateContextHelper contextHe { using (var bw = new BinaryWriter(memStream)) { + Engine.WriteTriangulation(bw, geom, mf.Precision, thisDeflectionDistance, thisDeflectionAngle); } @@ -1320,6 +1323,7 @@ private void WriteShapeGeometries(XbimCreateContextHelper contextHelper, ReportP { BoundingBox = (shapeGeom).BoundingBox, GeometryId = geometryStore.AddShapeGeometry(shapeGeom), + // if shape had large coordinates these might be reduced. This represents the // local displacement of the shape. It needs to be applied to shape (and bounding box) placement in the product. LocalShapeDisplacement = shapeGeom.LocalShapeDisplacement @@ -1367,16 +1371,19 @@ private void WriteShapeGeometries(XbimCreateContextHelper contextHelper, ReportP // Console.WriteLine(shape.GetType().Name); XbimShapeGeometry shapeGeom = null; + IXbimSolid xSolid = null; IXbimGeometryObject geomModel = null; if (!isFeatureElementShape && !isVoidedProductShape && xbimTessellator.CanMesh(shape)) // if we can mesh the shape directly just do it { shapeGeom = xbimTessellator.Mesh(shape); + } else //we need to create a geometry object { try { geomModel = Engine.Create(shape, _logger); + } catch (XbimGeometryFaceSetTooLargeException fse) { @@ -1389,8 +1396,14 @@ private void WriteShapeGeometries(XbimCreateContextHelper contextHelper, ReportP } if (geomModel != null && geomModel.IsValid) { + if(!geomModel.IsSet) + { + xSolid = geomModel as IXbimSolid; + } shapeGeom = Engine.CreateShapeGeometry(geomModel, precision, deflection, deflectionAngle, geomStorageType, _logger); + + if (isFeatureElementShape) { var geomSet = geomModel as IXbimGeometryObjectSet; @@ -1413,10 +1426,13 @@ private void WriteShapeGeometries(XbimCreateContextHelper contextHelper, ReportP else { shapeGeom.IfcShapeLabel = shapeId; + var geomId = geometryStore.AddShapeGeometry(shapeGeom); + var reference = new GeometryReference { BoundingBox = shapeGeom.BoundingBox, - GeometryId = geometryStore.AddShapeGeometry(shapeGeom), + GeometryId = geomId, + EdgeId = xSolid != null ? geometryStore.AddEdgeGeometry(Model.Instances[shapeId].EntityLabel, xSolid.Edges) : -1, // if shape had large coordinates these might be reduced. This represents the // local displacement of the shape. It needs to be applied to shape (and bounding box) placement in the product. // This is often the case for already triangulated geometry from infrastructure tools like Bentley. @@ -1432,6 +1448,7 @@ private void WriteShapeGeometries(XbimCreateContextHelper contextHelper, ReportP //keep a record of the IFC label and database record mapping contextHelper.GeometryShapeLookup.TryAdd(shapeGeom.ShapeLabel, shapeGeom.IfcShapeLabel); } + // shapeGeometries.Add(shapeGeom); } From 2d633b787c5bde473cfb27ba6e237784ca729b5c Mon Sep 17 00:00:00 2001 From: ncr-399 Date: Tue, 12 Mar 2024 14:46:26 +0530 Subject: [PATCH 12/12] updated project filters --- Xbim.Geometry.Engine/Xbim.Geometry.Engine.vcxproj | 7 ------- Xbim.Geometry.Engine/Xbim.Geometry.Engine.vcxproj.filters | 6 ------ 2 files changed, 13 deletions(-) diff --git a/Xbim.Geometry.Engine/Xbim.Geometry.Engine.vcxproj b/Xbim.Geometry.Engine/Xbim.Geometry.Engine.vcxproj index a6d3fd402..166d083e5 100644 --- a/Xbim.Geometry.Engine/Xbim.Geometry.Engine.vcxproj +++ b/Xbim.Geometry.Engine/Xbim.Geometry.Engine.vcxproj @@ -183,12 +183,6 @@ Create Create - - true - true - true - true - true true @@ -206,7 +200,6 @@ - diff --git a/Xbim.Geometry.Engine/Xbim.Geometry.Engine.vcxproj.filters b/Xbim.Geometry.Engine/Xbim.Geometry.Engine.vcxproj.filters index 634709b22..9fb9cfb6f 100644 --- a/Xbim.Geometry.Engine/Xbim.Geometry.Engine.vcxproj.filters +++ b/Xbim.Geometry.Engine/Xbim.Geometry.Engine.vcxproj.filters @@ -9462,9 +9462,6 @@ Header Files - - Header Files - @@ -15368,9 +15365,6 @@ Source Files - - Source Files -