public void ConvertIfcCylinderToBRepTest() { using (var m = XbimModel.CreateTemporaryModel()) { using (var txn = m.BeginTransaction()) { var cylinder = IfcModelBuilder.MakeRightCircularCylinder(m, 10, 20); var solid = _xbimGeometryCreator.CreateSolid(cylinder); var brep = _xbimGeometryCreator.CreateFacetedBrep(m, solid); var solid2 = _xbimGeometryCreator.CreateSolidSet(brep); txn.Commit(); try { //Uncomment below to see the results in Ifc //m.SaveAs("brep.ifc", XbimStorageType.IFC); } catch (Exception) { Assert.IsTrue(false, "Failed to save the results to Ifc"); } Assert.IsTrue(solid2.Count == 1, "Expected one solid"); IfcCsgTests.GeneralTest(solid2.First); Assert.IsTrue(brep.Outer.CfsFaces.Count == solid2.First.Faces.Count, "Number of faces in round tripped solid is not the same"); } } }
public void SectionFacetedSolidFromCylinderTest() { using (var m = XbimModel.CreateTemporaryModel()) { using (var txn = m.BeginTransaction()) { var cylinder = IfcModelBuilder.MakeRightCircularCylinder(m, 20, 20); var solid = XbimGeometryCreator.CreateSolid(cylinder); var faceted1 = XbimGeometryCreator.CreateFacetedSolid(solid, m.ModelFactors.Precision, m.ModelFactors.DeflectionTolerance); IfcPlane plane = IfcModelBuilder.MakePlane(m, new XbimPoint3D(cylinder.Position.Location.X + 1, cylinder.Position.Location.Y, cylinder.Position.Location.Z), new XbimVector3D(0, -1, 0), new XbimVector3D(1, 0, 0)); var cutPlane = XbimGeometryCreator.CreateFace(plane); var section = faceted1.Section(cutPlane, m.ModelFactors.PrecisionBoolean); Assert.IsTrue(section.First != null, "Result should be a face"); Assert.IsTrue(section.First.OuterBound.Edges.Count == 4, "4 edges are required for this section of a cylinder"); //repeat with section through cylinder plane = IfcModelBuilder.MakePlane(m, new XbimPoint3D(cylinder.Position.Location.X, cylinder.Position.Location.Y, cylinder.Position.Location.Z + 1), new XbimVector3D(0, 0, 1), new XbimVector3D(1, 0, 0)); cutPlane = XbimGeometryCreator.CreateFace(plane); section = faceted1.Section(cutPlane, m.ModelFactors.PrecisionBoolean); Assert.IsTrue(section.First != null, "Result should be a face"); Assert.IsTrue(Math.Abs(section.First.Area - Math.PI * 20 * 20) < 5, "Area of cylinder seems incorrect"); Assert.IsTrue(section.First.InnerBounds.Count == 0, "0 inner wires are required for this section of a cylinder"); } } }
public void CreateXbimFacetedSolidFromIfcRightCircularCylinder() { using (var m = XbimModel.CreateTemporaryModel()) { using (var txn = m.BeginTransaction()) { var cylinder = IfcModelBuilder.MakeRightCircularCylinder(m, 1, 4); //1 metre by 4 metre var solid = XbimGeometryCreator.CreateSolid(cylinder); var faceted = XbimGeometryCreator.CreateFacetedSolid(solid, m.ModelFactors.Precision, m.ModelFactors.DeflectionTolerance); } } }
public void IfcRightCircularCylinderTest() { using (var m = XbimModel.CreateTemporaryModel()) { using (var txn = m.BeginTransaction()) { const double h = 20; const double r = 10; var cylinder = IfcModelBuilder.MakeRightCircularCylinder(m, r, h); var solid = _xbimGeometryCreator.CreateSolid(cylinder); Assert.IsTrue(solid.Faces.Count == 3, "3 faces are required of a cylinder"); Assert.IsTrue(solid.Vertices.Count == 2, "2 vertices are required of a cylinder"); } } }