|
| 1 | +using Microsoft.Extensions.Logging; |
| 2 | +using Microsoft.VisualStudio.TestTools.UnitTesting; |
| 3 | +using System; |
| 4 | +using System.Collections.Generic; |
| 5 | +using System.Diagnostics; |
| 6 | +using System.IO; |
| 7 | +using System.Linq; |
| 8 | +using System.Text; |
| 9 | +using System.Threading.Tasks; |
| 10 | +using Xbim.Ifc; |
| 11 | +using Xbim.Ifc4.Interfaces; |
| 12 | + |
| 13 | +namespace Xbim.Geometry.Engine.Interop.Tests |
| 14 | +{ |
| 15 | + [TestClass] |
| 16 | + public class RegressionTests |
| 17 | + { |
| 18 | + |
| 19 | + static private XbimGeometryEngine geomEngine; |
| 20 | + static private ILoggerFactory loggerFactory; |
| 21 | + static private ILogger logger; |
| 22 | + |
| 23 | + [ClassInitialize] |
| 24 | + static public void Initialise(TestContext context) |
| 25 | + { |
| 26 | + loggerFactory = new LoggerFactory().AddConsole(LogLevel.Trace); |
| 27 | + geomEngine = new XbimGeometryEngine(); |
| 28 | + logger = loggerFactory.CreateLogger<Ifc4GeometryTests>(); |
| 29 | + } |
| 30 | + [ClassCleanup] |
| 31 | + static public void Cleanup() |
| 32 | + { |
| 33 | + loggerFactory = null; |
| 34 | + geomEngine = null; |
| 35 | + logger = null; |
| 36 | + } |
| 37 | + |
| 38 | + [TestMethod] |
| 39 | + // // [DeploymentItem(@"TestFiles\Regression\FailingGeom.ifc", "FailingGeom.ifc")] |
| 40 | + public void IfcHalfspace_FailingGeom() |
| 41 | + { |
| 42 | + using (var m = IfcStore.Open("TestFiles\\Regression\\FailingGeom.ifc")) |
| 43 | + { |
| 44 | + var extSolid = m.Instances.OfType<IIfcExtrudedAreaSolid>().FirstOrDefault(hs => hs.EntityLabel == 185025); |
| 45 | + var solid = geomEngine.CreateSolid(extSolid, null); |
| 46 | + IfcCsgTests.GeneralTest(solid); |
| 47 | + |
| 48 | + var mlist = m.Instances.OfType<IIfcBooleanClippingResult>(); |
| 49 | + foreach (var eas in mlist) |
| 50 | + { |
| 51 | + Debug.WriteLine("Todo: " + eas.EntityLabel); |
| 52 | + } |
| 53 | + |
| 54 | + foreach (var eas in mlist) |
| 55 | + { |
| 56 | + // var eas = m.Instances.OfType<IIfcBooleanClippingResult>().FirstOrDefault(hs => hs.EntityLabel == 185249); |
| 57 | + Assert.IsTrue(eas != null, "No IfcBooleanClippingResult found"); |
| 58 | + var ret = geomEngine.CreateSolidSet(eas, logger); |
| 59 | + |
| 60 | + IfcCsgTests.GeneralTest(solid); |
| 61 | + |
| 62 | + Debug.WriteLine(eas.EntityLabel + " ok"); |
| 63 | + if (eas.EntityLabel == 185243) |
| 64 | + { |
| 65 | + File.WriteAllText(@"C:\Data\_tmp\185243.v5.brep", solid.ToBRep); |
| 66 | + } |
| 67 | + } |
| 68 | + } |
| 69 | + } |
| 70 | + } |
| 71 | +} |
0 commit comments