Пример #1
0
        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");
                }
            }
        }
Пример #2
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);
         }
     }
 }