예제 #1
0
 public void MoveAndCopyTest()
 {
     //this test checks that a object is correctly copied and moved
     //create a box
     using (
         var m = IfcStore.Create(new XbimEditorCredentials(), IfcSchemaVersion.Ifc4, XbimStoreType.InMemoryModel)
         )
     {
         using (var txn = m.BeginTransaction())
         {
             var block = IfcModelBuilder.MakeBlock(m, 10, 10, 10);
             var solid = _geomEngine.CreateSolid(block);
             var ax3D  = IfcModelBuilder.MakeAxis2Placement3D(m);
             ax3D.Location.Y = 100;
             var solidA = _geomEngine.Moved(solid, ax3D) as IXbimSolid;
             Assert.IsNotNull(solidA, "Should be the same type as the master");
             Assert.IsTrue(Math.Abs(solidA.Volume - solid.Volume) < 1e-9, "Volume has changed");
             var displacement = solidA.BoundingBox.Centroid() - solid.BoundingBox.Centroid();
             Assert.IsTrue(displacement == new XbimVector3D(0, 100, 0));
             var bbA    = solidA.BoundingBox;
             var solidB = _geomEngine.Moved(solid, ax3D);
             Assert.IsTrue(bbA.Centroid() - solidB.BoundingBox.Centroid() == new XbimVector3D(0, 0, 0));
         }
     }
 }