public void EscapeHeaderTests() { const string path = @"x:\path1\path2\filename.ifc"; const string umlaut = "name with umlaut ü"; using (var model = XbimModel.CreateTemporaryModel()) { model.Initialise("Creating Author", " Creating Organisation", "This Application", "This Developer", "v1.1"); using (var txn = model.BeginTransaction()) { model.IfcProject.Name = "Project Name"; txn.Commit(); } model.Header.FileName.Name = path; model.Header.FileName.Organization.Add(umlaut); model.SaveAs("testOutput.ifc"); } using (var model = new XbimModel()) { model.CreateFrom("testOutput.ifc", null, null, true); Assert.IsTrue(model.Header.FileName.Name == path); Assert.IsTrue(model.Header.FileName.Organization.FirstOrDefault() == umlaut); model.Close(); } }
public void CopyAllEntitiesTest() { using (var source = new XbimModel()) { PropertyTranformDelegate propTransform = delegate(IfcMetaProperty prop, object toCopy) { var value = prop.PropertyInfo.GetValue(toCopy, null); return(value); }; source.Open("BIM Logo-LetterM.xBIM"); source.SaveAs("WithGeometry.ifc"); using (var target = XbimModel.CreateTemporaryModel()) { target.AutoAddOwnerHistory = false; using (var txn = target.BeginTransaction()) { var copied = new XbimInstanceHandleMap(source, target); foreach (var item in source.Instances) { target.InsertCopy(item, copied, txn, propTransform); } txn.Commit(); } target.SaveAs("WithoutGeometry.ifc"); } source.Close(); //the two files should be 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 CutFacetedSolidFromFacetedSolid() { using (var m = XbimModel.CreateTemporaryModel()) { using (var txn = m.BeginTransaction()) { IfcBlock ifcBlock1 = IfcModelBuilder.MakeBlock(m, 1000, 2000, 3000); IfcBlock ifcBlock2 = IfcModelBuilder.MakeBlock(m, 200, 200, 3000); IfcBlock ifcBlock3 = IfcModelBuilder.MakeBlock(m, 200, 200, 3000); ifcBlock2.Position.Location.X += 200; ifcBlock2.Position.Location.Y += 200; ifcBlock3.Position.Location.X += 200; ifcBlock3.Position.Location.Y += 600; var solid1 = XbimGeometryCreator.CreateSolid(ifcBlock1); var solid2 = XbimGeometryCreator.CreateSolid(ifcBlock2); var faceted1 = XbimGeometryCreator.CreateFacetedSolid(XbimGeometryCreator.CreateSolid(ifcBlock3), m.ModelFactors.Precision, m.ModelFactors.DeflectionTolerance); var geom1 = solid1.Cut(solid2, m.ModelFactors.Precision); var solidSet = (IXbimSolidSet)geom1; Assert.IsTrue(solidSet.Count == 1, "Cutting these two solids should return a single solid"); var faceted2 = XbimGeometryCreator.CreateFacetedSolid(solidSet.First, m.ModelFactors.Precision, m.ModelFactors.DeflectionTolerance); var geom2 = faceted2.Cut(faceted1, m.ModelFactors.Precision); solidSet = (IXbimSolidSet)geom2; Assert.IsTrue(solidSet.Count == 1, "Cutting these two solids should return a single solid"); var faceted3 = solidSet.First; var solid6 = XbimGeometryCreator.CreateSolid(faceted3); Assert.IsTrue(Math.Abs(solid1.BoundingBox.SizeX - solid6.BoundingBox.SizeX) < m.ModelFactors.Precision * 3, "BoundingBox size X error"); Assert.IsTrue(Math.Abs(solid1.BoundingBox.SizeY - solid6.BoundingBox.SizeY) < m.ModelFactors.Precision * 3, "BoundingBox size Y error"); Assert.IsTrue(Math.Abs(solid1.BoundingBox.SizeZ - solid6.BoundingBox.SizeZ) < m.ModelFactors.Precision * 3, "BoundingBox size Z error"); Assert.IsTrue(Math.Abs(solid6.Volume - faceted3.Volume) <= m.ModelFactors.Precision, "Error in volume calc"); Assert.IsTrue(Math.Abs(solid6.Volume - faceted3.Volume) <= m.ModelFactors.Precision, "Error in volume calc"); } } }
public void CreateXbimFacetedSolidFromIfcRectangleHollowProfileDef() { using (var m = XbimModel.CreateTemporaryModel()) { using (var txn = m.BeginTransaction()) { var profile = IfcModelBuilder.MakeRectangleHollowProfileDef(m, 20, 10, 1); var extrude = IfcModelBuilder.MakeExtrudedAreaSolid(m, profile, 40); var solid = XbimGeometryCreator.CreateSolid(extrude); var faceted = XbimGeometryCreator.CreateFacetedSolid(solid, m.ModelFactors.Precision, m.ModelFactors.DeflectionTolerance); foreach (var face in faceted.Faces) { Assert.IsTrue(face.OuterBound.Edges.Count == 4, "Each face should have four outer edges"); } int hasInnerCount = 0; foreach (var face in faceted.Faces) { if (face.InnerBounds.Count == 1) { hasInnerCount++; Assert.IsTrue(face.InnerBounds.First.Edges.Count == 4, "Each face should have four inner edges"); } } Assert.IsTrue(hasInnerCount == 2, "There should be two faces with an innerbound"); Assert.IsTrue(faceted.Shells.Count == 1, "Should only be one shell"); Assert.IsTrue(faceted.Vertices.Count == faceted.Shells.First.Vertices.Count, "Should be one shell with the same number of vertices"); } } }
public void IntersectFacetedSolidFromFacetedSolid() { using (var m = XbimModel.CreateTemporaryModel()) { using (var txn = m.BeginTransaction()) { var ifcBlock1 = IfcModelBuilder.MakeBlock(m, 1000, 2000, 3000); var ifcBlock2 = IfcModelBuilder.MakeBlock(m, 200, 200, 3000); var ifcBlock3 = IfcModelBuilder.MakeBlock(m, 200, 200, 3000); ifcBlock2.Position.Location.X -= 180; ifcBlock2.Position.Location.Y += 200; ifcBlock3.Position.Location.X -= 180; ifcBlock3.Position.Location.Y += 600; var solid1 = XbimGeometryCreator.CreateSolid(ifcBlock1); var solid2 = XbimGeometryCreator.CreateSolid(ifcBlock2); var faceted1 = XbimGeometryCreator.CreateFacetedSolid(XbimGeometryCreator.CreateSolid(ifcBlock3), m.ModelFactors.Precision, m.ModelFactors.DeflectionTolerance); var geom1 = solid1.Union(solid2, m.ModelFactors.Precision); var solidSet = (IXbimSolidSet)geom1; Assert.IsTrue(solidSet.Count == 1, "Cutting these two solids should return a single solid"); var faceted2 = XbimGeometryCreator.CreateFacetedSolid(solidSet.First, m.ModelFactors.Precision, m.ModelFactors.DeflectionTolerance); var geom2 = faceted2.Intersection(faceted1, m.ModelFactors.Precision); solidSet = (IXbimSolidSet)geom2; Assert.IsTrue(solidSet.Count == 1, "Cutting these two solids should return a single solid"); var faceted3 = solidSet.First; var solid6 = XbimGeometryCreator.CreateSolid(faceted3); //var w = new XbimOccWriter(); //w.Write(solid6, "d:\\xbim\\s"); Assert.IsTrue(Math.Abs(solid6.BoundingBox.SizeX - 20) < m.ModelFactors.Precision * 3, "BoundingBox size X error"); Assert.IsTrue(Math.Abs(solid6.BoundingBox.SizeY - 200) < m.ModelFactors.Precision * 3, "BoundingBox size Y error"); Assert.IsTrue(Math.Abs(solid6.BoundingBox.SizeZ - 3000) < m.ModelFactors.Precision * 3, "BoundingBox size Z error"); Assert.IsTrue(Math.Abs(solid6.Volume - 20 * 3000 * 200) <= m.ModelFactors.Precision, "Error in volume calc"); } } }
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"); } } }
void XplorerMainWindow_Loaded(object sender, RoutedEventArgs e) { XbimModel model = XbimModel.CreateTemporaryModel(); model.Initialise(); ModelProvider.ObjectInstance = model; ModelProvider.Refresh(); }
public void CanOpenTemporaryModel() { var model = XbimModel.CreateTemporaryModel(); model.Initialise(); var helper = new CoBieLiteHelper(model, "UniClass"); helper.GetFacilities(); }
public static XbimModel CreateandInitModel() { var model = XbimModel.CreateTemporaryModel();; //create an empty model //Begin a transaction as all changes to a model are transacted using (XbimReadWriteTransaction txn = model.BeginTransaction("Initialise Model")) { //do once only initialisation of model application and editor values model.DefaultOwningUser.ThePerson.GivenName = "John"; model.DefaultOwningUser.ThePerson.FamilyName = "Bloggs"; model.DefaultOwningUser.TheOrganization.Name = "Department of Building"; model.DefaultOwningApplication.ApplicationIdentifier = "Construction Software inc."; model.DefaultOwningApplication.ApplicationDeveloper.Name = "Construction Programmers Ltd."; model.DefaultOwningApplication.ApplicationFullName = "Ifc sample programme"; model.DefaultOwningApplication.Version = "2.0.1"; //set up a project and initialise the defaults var project = model.Instances.New <IfcProject>(); project.Initialize(ProjectUnits.SIUnitsUK); model.ReloadModelFactors(); project.Name = "testProject"; project.OwnerHistory.OwningUser = model.DefaultOwningUser; project.OwnerHistory.OwningApplication = model.DefaultOwningApplication; //create a building var building = model.Instances.New <IfcBuilding>(); building.Name = "Building"; building.OwnerHistory.OwningUser = model.DefaultOwningUser; building.OwnerHistory.OwningApplication = model.DefaultOwningApplication; //building.ElevationOfRefHeight = elevHeight; building.CompositionType = IfcElementCompositionEnum.ELEMENT; building.ObjectPlacement = model.Instances.New <IfcLocalPlacement>(); var localPlacement = building.ObjectPlacement as IfcLocalPlacement; if (localPlacement != null && localPlacement.RelativePlacement == null) { localPlacement.RelativePlacement = model.Instances.New <IfcAxis2Placement3D>(); } if (localPlacement != null) { var placement = localPlacement.RelativePlacement as IfcAxis2Placement3D; placement.SetNewLocation(0.0, 0.0, 0.0); } model.IfcProject.AddBuilding(building); //validate and commit changes Assert.IsTrue(model.Validate(txn.Modified(), Console.Out) == 0, "Invalid Model"); txn.Commit(); } return(model); }
public bool Convert(FacilityType facility, XbimModel model = null) { if (model == null) { _model = XbimModel.CreateTemporaryModel(); } else { _model = model; } return(WriteFacility(facility)); }
public void CircleProfileDefTest() { using (var m = XbimModel.CreateTemporaryModel()) { using (var txn = m.BeginTransaction()) { IfcProfileDef prof = IfcModelBuilder.MakeCircleProfileDef(m, 20); var face = _xbimGeometryCreator.CreateFace(prof); Assert.IsTrue(face.Area > 0); } } }
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 RectangleHollowProfileDefTest() { using (var m = XbimModel.CreateTemporaryModel()) { using (var txn = m.BeginTransaction()) { var prof = IfcModelBuilder.MakeRectangleHollowProfileDef(m, 20, 30, 5); var face = _xbimGeometryCreator.CreateFace(prof); Assert.IsTrue(face.Area > 0); } } }
public void IfcCenterLineProfileDefTest() { using (var m = XbimModel.CreateTemporaryModel()) { using (var txn = m.BeginTransaction()) { var semiCircle = IfcModelBuilder.MakeSemiCircle(m, 20); var cl = IfcModelBuilder.MakeCenterLineProfileDef(m, semiCircle, 5); var face = _xbimGeometryCreator.CreateFace(cl); Assert.IsNotNull(face as IXbimFace, "Wrong type returned"); Assert.IsTrue(((IXbimFace)face).IsValid, "Invalid face returned"); } } }
public void IfcSurfaceOfLinearExtrusionTest() { using (var m = XbimModel.CreateTemporaryModel()) { using (var txn = m.BeginTransaction()) { var semiCircle = IfcModelBuilder.MakeSemiCircle(m, 20); var def = IfcModelBuilder.MakeArbitraryOpenProfileDef(m, semiCircle); var cl = IfcModelBuilder.MakeSurfaceOfLinearExtrusion(m, def, 50, new XbimVector3D(0, 0, 1)); var face = _xbimGeometryCreator.CreateFace(cl); Assert.IsNotNull(face as IXbimFace, "Wrong type returned"); Assert.IsTrue(((IXbimFace)face).IsValid, "Invalid face returned"); } } }
public void IfcSurfaceOfRevolutionTest() { using (var m = XbimModel.CreateTemporaryModel()) { using (var txn = m.BeginTransaction()) { var cc = IfcModelBuilder.MakeRationalBezierCurve(m); var def = IfcModelBuilder.MakeArbitraryOpenProfileDef(m, cc); var rev = IfcModelBuilder.MakeSurfaceOfRevolution(m, def); var face = _xbimGeometryCreator.CreateFace(rev); Assert.IsNotNull(face as IXbimFace, "Wrong type returned"); Assert.IsTrue(((IXbimFace)face).IsValid, "Invalid face returned"); } } }
public void IfcBlockTest() { using (var m = XbimModel.CreateTemporaryModel()) { using (var txn = m.BeginTransaction()) { var block = IfcModelBuilder.MakeBlock(m, 10, 15, 20); var solid = _xbimGeometryCreator.CreateSolid(block); Assert.IsTrue(solid.Faces.Count == 6, "6 faces are required of a block"); Assert.IsTrue(solid.Vertices.Count == 8, "8 vertices are required of a block"); } } }
public void IfcSphereTest() { using (var m = XbimModel.CreateTemporaryModel()) { using (var txn = m.BeginTransaction()) { const double r = 10; var sphere = IfcModelBuilder.MakeSphere(m, r); var solid = _xbimGeometryCreator.CreateSolid(sphere); Assert.IsTrue(solid.Faces.Count == 1, "1 face is required of a sphere"); Assert.IsTrue(solid.Vertices.Count == 2, "2 vertices are required of a sphere"); } } }
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"); } } }
public void ConvertCobieLiteToIfc() { var data = File.ReadAllText("COBieLite.json"); var facility = JsonConvert.DeserializeObject <FacilityType>(data); using (var model = XbimModel.CreateTemporaryModel()) { using (var txn = model.BeginTransaction("Convert from COBieLite")) { var exchanger = new CoBieLiteToIfcExchanger(facility, model); exchanger.Convert(); txn.Commit(); } model.SaveAs(@"ConvertedFromCOBieLite.ifc", XbimStorageType.IFC); } }
public void CreateFederation() { using (var fedModel = XbimModel.CreateTemporaryModel()) { fedModel.Initialise("Federation Creating Author", "Federation Creating Organisation", "This Application", "This Developer", "v1.1"); using (var txn = fedModel.BeginTransaction()) { fedModel.IfcProject.Name = "Federation Project Name"; txn.Commit(); } //now add federated models fedModel.AddModelReference(ModelA, "The Architects Name", IfcRole.Architect); fedModel.AddModelReference(ModelB, "The Owners Name", IfcRole.BuildingOwner); // fedModel.AddModelReference(ModelC, "The Cost Consultants Name", IfcRole.UserDefined, "Cost Consultant"); fedModel.SaveAs("Federated Model", XbimStorageType.IFC); } //close and automatically delete the temporary database //Now open the Ifc file and see what we have using (var fed = new XbimModel()) { fed.CreateFrom("Federated Model.ifc", "Federated Model.xBIMF"); //use xBIMF to help us distinguish fed.Open("Federated Model.xBIMF", XbimExtensions.XbimDBAccess.Read); //check the various ways of access objects give consistent results. var localInstances = fed.InstancesLocal.Count; var totalInstances = fed.Instances.Count; long refInstancesCount = 0; foreach (var refModel in fed.ReferencedModels) { refInstancesCount += refModel.Model.Instances.Count; } Assert.IsTrue(totalInstances == refInstancesCount + localInstances); long enumeratingInstancesCount = 0; foreach (var item in fed.Instances) { enumeratingInstancesCount++; } Assert.IsTrue(totalInstances == enumeratingInstancesCount); long fedProjectCount = fed.Instances.OfType <IfcProject>().Count(); long localProjectCount = fed.InstancesLocal.OfType <IfcProject>().Count(); Assert.IsTrue(fedProjectCount == 3); Assert.IsTrue(localProjectCount == 1); } }
public void ConvertIfcBlockToBRepTest() { using (var m = XbimModel.CreateTemporaryModel()) { using (var txn = m.BeginTransaction()) { var block = IfcModelBuilder.MakeBlock(m, 10, 15, 20); var solid = _xbimGeometryCreator.CreateSolid(block); var brep = _xbimGeometryCreator.CreateFacetedBrep(m, solid); var xrep = _xbimGeometryCreator.CreateSolidSet(brep); Assert.IsTrue(xrep.Count == 1, "Expected one solid"); Assert.IsTrue(solid.Volume - xrep.First.Volume <= m.ModelFactors.Precision, "Volume of round tripped block is not the same"); IfcCsgTests.GeneralTest(xrep.First); } } }
private void Init(XbimModel model) { if (model == null) { model = XbimModel.CreateTemporaryModel(); } _scanner = new Scanner(); _parser = new Parser(_scanner, model); _parser.OnModelChanged += delegate(object sender, ModelChangedEventArgs e) { ModelChanged(e.NewModel); }; _parser.OnFileReportCreated += delegate(object sender, FileReportCreatedEventArgs e) { FileReportCreated(e.FilePath); }; }
public void CreateXbimFacetedSolidFromIfcBlock() { using (var m = XbimModel.CreateTemporaryModel()) { using (var txn = m.BeginTransaction()) { var ifcBlock = IfcModelBuilder.MakeBlock(m, 1000, 2000, 3000); var solid = XbimGeometryCreator.CreateSolid(ifcBlock); var faceted = XbimGeometryCreator.CreateFacetedSolid(solid, m.ModelFactors.Precision, m.ModelFactors.DeflectionTolerance); Assert.IsTrue(faceted.Faces.First.OuterBound.Edges.Count == 4, "Should have four edges"); Assert.IsTrue(faceted.Vertices.Count == 8, "there should be 8 points in a block"); Assert.IsTrue(Math.Abs(faceted.BoundingBox.SizeX - 1000) <= m.ModelFactors.Precision, "Error in X value"); Assert.IsTrue(Math.Abs(faceted.BoundingBox.SizeY - 2000) <= m.ModelFactors.Precision, "Error in Y value"); Assert.IsTrue(Math.Abs(faceted.BoundingBox.SizeZ - 3000) <= m.ModelFactors.Precision, "Error in Z value"); Assert.IsTrue(Math.Abs(solid.Volume - faceted.Volume) <= m.ModelFactors.Precision, "Error in volume calc"); } } }
public void ConvertCobieLiteToIfc() { var facility = FacilityType.ReadJson("COBieLite.json"); using (var model = XbimModel.CreateTemporaryModel()) { model.Initialise("Xbim Tester", "XbimTeam", "Xbim.Exchanger", "Xbim Development Team", "3.0"); model.ReloadModelFactors(); using (var txn = model.BeginTransaction("Convert from COBieLite")) { var exchanger = new CoBieLiteToIfcExchanger(facility, model); exchanger.Convert(); txn.Commit(); //var err = model.Validate(model.Instances, Console.Out); } model.SaveAs(@"ConvertedFromCOBieLite.ifc", XbimStorageType.IFC); } }
public void ReadWriteTriangulationOfNonPlanarSolidTest() { using (var m = XbimModel.CreateTemporaryModel()) { using (var txn = m.BeginTransaction()) { var profile = IfcModelBuilder.MakeCircleHollowProfileDef(m, 20, 1); var extrude = IfcModelBuilder.MakeExtrudedAreaSolid(m, profile, 40); var solid = XbimGeometryCreator.CreateSolid(extrude); TextWriter tw = new StringWriter(); XbimGeometryCreator.WriteTriangulation(tw, solid, m.ModelFactors.Precision, m.ModelFactors.DeflectionTolerance, 0.5); TextReader tr = new StringReader(tw.ToString()); IXbimGeometryObject geom = XbimGeometryCreator.ReadTriangulation(tr); var triangulatedSold = geom as IXbimSolid; Assert.IsNotNull(triangulatedSold, "Invalid solid returned"); Assert.IsTrue(Math.Abs(solid.Volume - triangulatedSold.Volume) < 5, "Volume differs too much"); } } }
public void TShapeProfileDefTest() { using (var m = XbimModel.CreateTemporaryModel()) { using (var txn = m.BeginTransaction()) { var prof = IfcModelBuilder.MakeTShapeProfileDef(m, 150, 90, 13, 20, 6, 3, 4, 0.05, 0.1, -30); var face = _xbimGeometryCreator.CreateFace(prof); double area = face.Area; Assert.IsTrue(face.Area > 0); m.ModelFactors.ProfileDefLevelOfDetail = 1; face = _xbimGeometryCreator.CreateFace(prof); Assert.IsTrue(face.Area > 0); Assert.IsTrue(face.OuterBound.Edges.Count == 14, "Incorrect edge count"); Assert.IsTrue(face.Area < area, "Detailed profile should be less than normal profile"); } } }
public void LShapeProfileDefTest() { using (var m = XbimModel.CreateTemporaryModel()) { using (var txn = m.BeginTransaction()) { var prof = IfcModelBuilder.MakeLShapeProfileDef(m, 150, 90, 10, 6.0, 4.8, 0.05, -30, -20); var face = _xbimGeometryCreator.CreateFace(prof); double area = face.Area; Assert.IsTrue(face.Area > 0); m.ModelFactors.ProfileDefLevelOfDetail = 1; face = _xbimGeometryCreator.CreateFace(prof); Assert.IsTrue(face.Area > 0); Assert.IsTrue(face.OuterBound.Edges.Count == 9, "Incorrect edge count"); Assert.IsTrue(face.Area > area, "Detailed profile hsould be bigger than normal"); } } }
public void ConvertXbimSolidFromXbimFacetedSolidPlanarTest() { using (var m = XbimModel.CreateTemporaryModel()) { using (var txn = m.BeginTransaction()) { var profile = IfcModelBuilder.MakeRectangleHollowProfileDef(m, 20, 10, 1); var extrude = IfcModelBuilder.MakeExtrudedAreaSolid(m, profile, 40); var solid = XbimGeometryCreator.CreateSolid(extrude); var faceted = XbimGeometryCreator.CreateFacetedSolid(solid, m.ModelFactors.Precision, m.ModelFactors.DeflectionTolerance); var solid2 = XbimGeometryCreator.CreateSolid(faceted); Assert.IsTrue(solid.Shells.Count == solid2.Shells.Count, "Shell count differs"); Assert.IsTrue(solid.Faces.Count == solid2.Faces.Count, "Face count differs"); Assert.IsTrue(solid.Edges.Count == solid2.Edges.Count, "Edge count differs"); Assert.IsTrue(solid.Vertices.Count == solid2.Vertices.Count, "Vertex count differs"); Assert.IsTrue(Math.Abs(solid.Volume - solid2.Volume) < 0.001, "Volume differs"); } } }