Skip to content

Commit

Permalink
Merge pull request #519 from xBimTeam/develop
Browse files Browse the repository at this point in the history
Merge Develop 5.1 to master
  • Loading branch information
andyward authored Dec 15, 2024
2 parents c1c2281 + 2f6e3a6 commit fb94c49
Show file tree
Hide file tree
Showing 2,999 changed files with 117,631 additions and 125,868 deletions.
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,39 @@

All notable changes to this project should be documented in this file

## [v5.1.785] 2024-12-15

Final 5.1 release before v6 (supporting netcore and IFC4.3)

### Changed
- Updated to OpenCascade 7.5.2
- Switched to v6 Essentials Dependency Injection & Logging
### Added
- Baseline support for IFC4.3 schema (not including new geometries and linear placement)
- BatchProcessor can now mesh single Breps
### Removed
### Fixed
- Better logging on unmanaged exceptions
- Fix for #281: Stackoverflow when precision is incorrect on Wires
- Fixed management of invalid normals
- Fix for collinear points in profiles
- Added null check when trimming faces
- Fix #388 : SurfaceCurveSweptAreaSolid regression
- Fix: Small scale errors would throw exception
- Fix managed objects lifetime (@daniilch)
- Fix: Handle OCC precision issue in BRepTools_WireExplorer (@FrozenKiwi)
- Fix #370: Premature garbage collection of objects holding native resources (@ChernyshevDS)
- Fix infinite loop in ShapeUpgrade_UnifySameDomain
- Security fix: Update Newtonsoft
- Added workaround for ArchiCAD precision issues
- Unique region names for many context w/geometries
- #492 Fix logging when warning about incorrect composite profile
- fixed up IfcCShapeProfileDef error when values of girth and thickness are the same (@okaharu0795)
- Fix #447 Incorrect curve parameters when creating XbimCurve for trimmed ellipse (@ChernyshevDS)
- #512 Fix Memory Access Violation issues (v4 regresion due to use of No_Exceptions)
- Fixes major disparity between Debug and Release builds as OCC was not raising Standard_Failure exceptions in Release build: often triggering unmanagaed 'access violation' exceptions
- #512 Handle invalid AdvancedBreps better when calculating regions

## [v5.1.239] 2019-06-03

Candidate release for 5.1
Expand Down
139 changes: 139 additions & 0 deletions Xbim.Geometry.Engine.Interop.Tests/GithubIssuesTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
using FluentAssertions;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Drawing;
using System.Linq;
using Xbim.Common.Configuration;
using Xbim.Common.Geometry;
using Xbim.Ifc4.Interfaces;
using Xbim.IO.Memory;
using Xbim.ModelGeometry.Scene;

namespace Xbim.Geometry.Engine.Interop.Tests
{
[TestClass]
public class GithubIssuesTests
{
[TestMethod]
public void Github_Issue_281()
{
// this file resulted in a stack-overflow exception due to precision issues in the data.
// We have added better exception management so that the stack-overflow is not thrown any more,
// however the voids in the wall are still not computed correctly.
//
using (var m = new MemoryModel(new Ifc2x3.EntityFactoryIfc2x3()))
{
m.LoadStep21("TestFiles\\Github\\Github_issue_281_minimal.ifc");
var c = new Xbim3DModelContext(m);
c.CreateContext(null, false);

// todo: 2021: add checks so that the expected openings are correctly computed.
}
}

[TestMethod]
public void Github_Issue_447()
{
// This file contains a trimmed curve based on ellipse which has semiaxis1 < semiaxis2
// and trimmed curve is parameterized with cartesian points.
// This test checks for a bug in XBimCurve geometry creation procedure when incorrect parameter values
// are calculated for these specific conditions described above.
using (var model = MemoryModel.OpenRead(@"TestFiles\Github\Github_issue_447.ifc"))
{
var shape = model.Instances.OfType<IIfcTrimmedCurve>().FirstOrDefault();
Assert.IsNotNull(shape);
var trimPoint1 = shape.Trim1.OfType<IIfcCartesianPoint>().FirstOrDefault();
Assert.IsNotNull(trimPoint1);
var trimPoint2 = shape.Trim2.OfType<IIfcCartesianPoint>().FirstOrDefault();
Assert.IsNotNull(trimPoint2);

var trimStart = new XbimPoint3D(trimPoint1.X, trimPoint1.Y, trimPoint1.Z);
var trimEnd = new XbimPoint3D(trimPoint2.X, trimPoint2.Y, trimPoint2.Z);

IXbimGeometryEngine geomEngine = new XbimGeometryEngine();
var geom = geomEngine.CreateCurve(shape);
Assert.IsNotNull(geom);

Assert.AreEqual(trimStart, geom.Start);
Assert.AreEqual(trimEnd, geom.End);
}
}

[TestMethod]
public void Github_Issue_512()
{
//var loggerFactory = new LoggerFactory().AddConsole(LogLevel.Trace);
//XbimServices.Current.ConfigureServices(s => s.AddXbimToolkit(b => b.AddLoggerFactory(loggerFactory)));
var ifcFile = @"TestFiles\Github\Github_issue_512.ifc";
// Triggers OCC Memory violation
using (var m = MemoryModel.OpenRead(ifcFile))
{
var c = new Xbim3DModelContext(m);
var result = c.CreateContext(null, true);

Assert.IsTrue(result, "Expect success");

Assert.IsFalse(m.GeometryStore.IsEmpty, "Store expected to be full");
}
}

[TestMethod]
public void Github_Issue_512b()
{
//var loggerFactory = new LoggerFactory().AddConsole(LogLevel.Trace);
//Common.Configuration.XbimServices.Current.ConfigureServices(s => s.AddXbimToolkit(b => b.AddLoggerFactory(loggerFactory)));
var ifcFile = @"TestFiles\Github\Github_issue_512b.ifc";
// Triggers OCC Memory violation
using (var m = MemoryModel.OpenRead(ifcFile))
{
var c = new Xbim3DModelContext(m);
var result = c.CreateContext(null, true);

Assert.IsTrue(result, "Expect success");

Assert.IsFalse(m.GeometryStore.IsEmpty, "Store expected to be full");

using (var reader = m.GeometryStore.BeginRead())
{
var regions = reader.ContextRegions.Where(cr => cr.MostPopulated() != null).Select(cr => cr.MostPopulated());

var region = regions.FirstOrDefault();

region.Size.Length.Should().BeApproximately(1.747, 0.001);
}
}
}

//[TestMethod]

//public void Github_Issue_512d()
//{

// var ifcFile = @"C:\Users\AndyWard\XBIM\Models - Documents\0400 Under NDA\TraceSoftware\CDO_EXE_240_ML04_S_1_01.extracted.ifc";
// // Triggers OCC Memory violation
// using (var m = MemoryModel.OpenRead(ifcFile))
// {
// var loggerFactory = new LoggerFactory().AddConsole(LogLevel.Trace);
// var geomEngine = new XbimGeometryEngine();
// var logger = loggerFactory.CreateLogger<GithubIssuesTests>();

// IIfcAdvancedBrep brep = m.Instances[9020] as IIfcAdvancedBrep;

// var geom = geomEngine.CreateSolidSet(brep, logger);

// geom.IsValid.Should().BeTrue();

// foreach(var shape in geom)
// {
// var bb = shape.BoundingBox;
// Console.WriteLine($"{shape.IsValid} {shape.IsPolyhedron} {shape.BoundingBox.Length()} {shape.BoundingBox} ");
// }
// // geom.SaveAsBrep("Foo.brep");

// geom.BoundingBox.Length().Should().BeLessOrEqualTo(1e10);
// }

//}
}
}
Loading

0 comments on commit fb94c49

Please sign in to comment.