Esempio n. 1
0
 public IXbimFace CreateFace(IIfcProfileDef profileDef, ILogger logger)
 {
     using (new Tracer(LogHelper.CurrentFunctionName(), this._logger, profileDef))
     {
         return(_engine.CreateFace(profileDef, logger));
     }
 }
 public void TestIfFaceIsPlanar()
 {
     using (var model = MemoryModel.OpenRead(@"TestFiles\non_planar_wire.ifc"))
     {
         var polyloop = model.Instances.OfType <IIfcPolyLoop>().FirstOrDefault();
         Assert.IsNotNull(polyloop);
         var face = geomEngine.CreateFace(polyloop);
         Assert.IsNotNull(face.OuterBound);
     }
 }
Esempio n. 3
0
        public void MirroredProfileDefTest()
        {
            using (var model = MemoryModel.OpenRead(@".\TestFiles\Ifc4TestFiles\IfcMirroredProfileDef.ifc"))
            {
                var derived  = model.Instances[50] as IIfcDerivedProfileDef;   //derived profile, mirrored by transform
                var mirrored = model.Instances[177] as IIfcMirroredProfileDef; //mirrored versio of above
                Assert.IsNotNull(derived);
                Assert.IsNotNull(mirrored);

                var dFace  = geomEngine.CreateFace(derived);
                var mFace  = geomEngine.CreateFace(mirrored);
                var brepD  = dFace.ToBRep;
                var brepM  = mFace.ToBRep;
                var differ = new Diff();
                var diffs  = differ.DiffText(brepM, brepD);
                Assert.IsTrue(mFace.Normal == dFace.Normal);
                Assert.IsTrue(diffs.Length == 3);
            }
        }
 public void SectionOfCylinderTest()
 {
     using (var m = new MemoryModel(new Ifc4.EntityFactoryIfc4()))
     {
         using (var txn = m.BeginTransaction(""))
         {
             var cylinder = IfcModelBuilder.MakeRightCircularCylinder(m, 20, 20);
             var solid    = geomEngine.CreateSolid(cylinder, logger);
             var 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 = geomEngine.CreateFace(plane, logger);
             var section  = solid.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 + 1, cylinder.Position.Location.Y, cylinder.Position.Location.Z), new XbimVector3D(0, 0, 1), new XbimVector3D(0, 1, 0));
             cutPlane = geomEngine.CreateFace(plane, logger);
             section  = solid.Section(cutPlane, m.ModelFactors.PrecisionBoolean);
             Assert.IsTrue(section.First != null, "Result should be a face");
             Assert.IsTrue(section.First.OuterBound.Edges.Count == 1, "1 edge is required for this section of a cylinder");
             Assert.IsTrue(section.First.InnerBounds.Count == 0, "0 inner wires are required for this section of a cylinder");
         }
     }
 }
Esempio n. 5
0
 public void Composite_curve_with_disconnection()
 {
     using (var er = new EntityRepository <IIfcCompositeCurve>(nameof(Composite_curve_with_disconnection)))
     {
         Assert.IsTrue(er.Entity != null, "No IIfcCompositeCurve found");
         var face = geomEngine.CreateFace(er.Entity, logger);
         Assert.AreEqual(22084775, face.Area, 1);
     }
 }
Esempio n. 6
0
 public IXbimFace CreateFace(IIfcProfileDef profileDef)
 {
     return(_engine.CreateFace(profileDef));
 }