Пример #1
0
        public Wall CreateWall(IfcWall ifcWall, int floorId)
        {
            var dbwall = _mapper.Map <Wall>(ifcWall);

            dbwall.FloorId = floorId;

            dbwall.SerializedShapeGeometry = JsonConvert.SerializeObject(_ifcGeometryService.GetShape2DGeometryFromMeshTriangles(ifcWall));

            // extract openings
            dbwall.Openings = new List <Opening>();
            foreach (var opening in ifcWall.HasOpenings)
            {
                var dbOpening       = _mapper.Map <Opening>(opening.RelatedOpeningElement);
                var openingGeometry = _ifcGeometryService.GetShape2DGeometryFromMeshTriangles(opening.RelatedOpeningElement);
                dbOpening.SerializedShapeGeometry = JsonConvert.SerializeObject(openingGeometry);
                dbwall.Openings.Add(dbOpening);
            }

            //var wallId = _wallRepository.Create(dbwall);
            //var wallShapesBoundries = _ifcGeometryService.GetShapeBoundry(model, (IfcProduct)wall);

            //foreach(var wallShape in wallShapes)
            //{
            //    wallShape.ProductId = wallId;
            //    wallShape.ShapeType = ProductShapeType.Wall;
            //    _productShapeRepository.Create(wallShape);
            //}

            //dbwall.SerializedShapeGeometry = JsonConvert.SerializeObject(_ifcGeometryService.GetShapeGeometry(ifcWall));


            return(dbwall);
        }
        public void CollectionRemoval()
        {
            // arrange
            using (var model = new MemoryModel(new Ifc2x3.EntityFactoryIfc2x3()))
                using (var txn = model.BeginTransaction(""))
                {
                    IfcWall wall1 = model.Instances.New <IfcWall>();
                    IfcWall wall2 = model.Instances.New <IfcWall>();

                    var propertySet = model.Instances.New <Ifc2x3.Kernel.IfcPropertySet>();
                    propertySet.HasProperties.Add(model.Instances.New <Ifc2x3.PropertyResource.IfcPropertySingleValue>());

                    // Changing the type of the rel variable from interface to IfcRelDefinesByProperties solves the issue.
                    IIfcRelDefinesByProperties rel = model.Instances.New <Ifc2x3.Kernel.IfcRelDefinesByProperties>();

                    rel.RelatingPropertyDefinition = propertySet;
                    rel.RelatedObjects.Add(wall1);
                    rel.RelatedObjects.Add(wall2);

                    // act
                    rel.RelatedObjects.Remove(wall1);

                    // assert failed. Expected: 1, actual: 2 (null, wall2).
                    Assert.AreEqual(1, rel.RelatedObjects.Count);

                    txn.Commit();
                }
        }
Пример #3
0
        private static IfcWall ToIfc(this Wall wall,
                                     IfcLocalPlacement localPlacement, IfcProductDefinitionShape shape)
        {
            var ifcWall = new IfcWall(IfcGuid.ToIfcGuid(Guid.NewGuid()),
                                      null, wall.Name, null, null, localPlacement, shape, null);

            return(ifcWall);
        }
Пример #4
0
        public void EqualityTest()
        {
            var model  = new MemoryModel(new EntityFactory());
            var model2 = new MemoryModel(new EntityFactory());

            //use entity factory to create objects outside of transaction or anything
            var f = new EntityFactory();

            var     wall1 = f.New <IfcWall>(model, 1, true);
            var     wall2 = f.New <IfcWall>(model, 1, true);
            var     wall3 = f.New <IfcWall>(model2, 1, true);
            var     wall4 = f.New <IfcWall>(model2, 2, true);
            IfcWall wall0 = null;

            Assert.IsTrue(wall0 == null);
            Assert.IsTrue(null == wall0);

            //different objects with the same label and the same model should be treated as being the same
            Assert.IsFalse(ReferenceEquals(wall1, wall2));
            Assert.IsTrue(wall1 == wall2);
            Assert.IsTrue(wall2 == wall1);
            Assert.IsTrue(wall1.Equals(wall2));
            Assert.IsTrue(((IEquatable <IfcWall>)wall1).Equals(wall2));
            Assert.AreEqual(wall2, wall1);

            //different model
            Assert.IsFalse(wall2 == wall3);
            Assert.IsFalse(((IEquatable <IfcWall>)wall2).Equals(wall3));

            //different label
            Assert.IsFalse(wall3 == wall4);
            Assert.IsFalse(wall3.Equals(wall4));

            //second wall should be excluded from distinct list
            var walls = new List <IfcWall> {
                wall1, wall2, wall3, wall4
            };
            var distinct = walls.Distinct().ToList();

            Assert.AreEqual(3, distinct.Count);
            //but it "contains" the object as far as the list is concerned
            Assert.IsTrue(distinct.Contains(wall1));
            Assert.IsTrue(distinct.Contains(wall2));

            //it should also work on interface list
            var entities = new List <IPersistEntity> {
                wall1, wall2, wall3, wall4
            };
            var distinctEntities = entities.Distinct().ToList();

            Assert.AreEqual(3, distinctEntities.Count);
            //but it "contains" the object as far as the list is concerned
            Assert.IsTrue(distinctEntities.Contains(wall1));
            Assert.IsTrue(distinctEntities.Contains(wall2));
        }
Пример #5
0
        /// <summary>
        /// True if the wall is external
        /// </summary>
        /// <param name="wall"></param>
        /// <returns></returns>
        public static IfcBoolean?GetIsExternal(this IfcWall wall)
        {
            IfcValue val = wall.GetPropertySingleNominalValue("Pset_WallCommon", "IsExternal");

            if (val != null && val is IfcBoolean)
            {
                return((IfcBoolean)val);
            }
            else
            {
                return(null);
            }
        }
Пример #6
0
        /// <summary>
        /// Gets the area of the wall in elevation
        /// </summary>
        /// <param name="wall"></param>
        /// <returns></returns>
        public static IfcAreaMeasure?GetWallSideArea(this IfcWall wall)
        {
            IfcQuantityArea qArea = wall.GetQuantity <IfcQuantityArea>("BaseQuantities", "GrossSideArea");

            if (qArea == null)
            {
                qArea = wall.GetQuantity <IfcQuantityArea>("GrossSideArea");               //just look for any area
            }
            if (qArea != null)
            {
                return(qArea.AreaValue);
            }
            return(null);
        }
Пример #7
0
        private static IfcWall ToIfc(this Wall wall, Guid id,
                                     IfcLocalPlacement localPlacement, IfcProductDefinitionShape shape)
        {
            var ifcWall = new IfcWall(IfcGuid.ToIfcGuid(id),
                                      null,
                                      wall.Name,
                                      null,
                                      null,
                                      localPlacement,
                                      shape,
                                      null,
                                      IfcWallTypeEnum.NOTDEFINED);

            return(ifcWall);
        }
Пример #8
0
        public void SerializeProject()
        {
            var id = new IfcGloballyUniqueId("12345");

            var p1 = new IfcProject(id);

            p1.Name        = "Test Project";
            p1.Description = "A test of IFC-dotnet.";

            var p2 = JsonConvert.DeserializeObject <IfcProject>(p1.ToJSON());
            //Assert.Equal(p1.Name.Value, p2.Name.Value);
            //Assert.Equal(p1.Description.Value, p2.Description.Value);

            var wall = new IfcWall(new IfcGloballyUniqueId("wall1"));
        }
Пример #9
0
        bool HasPropertyLikeExternalTrue(IfcWall wall)
        {
            //get relations property
            IEnumerable <IfcRelDefinesByProperties> rels = wall.IsDefinedByProperties;

            foreach (var rel in rels)
            {
                //get property set
                IfcPropertySet pSet = rel.RelatingPropertyDefinition as IfcPropertySet;
                if (pSet == null)
                {
                    continue;
                }
                foreach (IfcProperty prop in pSet.HasProperties)
                {
                    //get properties
                    IfcPropertySingleValue singleVal = prop as IfcPropertySingleValue;
                    if (singleVal == null)
                    {
                        continue;
                    }
                    if (singleVal.Name == "Wall Function")
                    {
                        //check value of the property
                        IfcValue val = singleVal.NominalValue;
                        if (val.UnderlyingSystemType == typeof(int))
                        {
                            if ((int)val.Value == 1)
                            {
                                return(true);
                            }
                        }
                        else if (val.UnderlyingSystemType == typeof(int?))
                        {
                            if ((int?)val.Value == 1)
                            {
                                return(true);
                            }
                        }
                    }
                }
            }
            return(false);
        }
Пример #10
0
 bool HasPropertyLikeExternalTrue(IfcWall wall)
 {
     //get relations property
     IEnumerable<IfcRelDefinesByProperties> rels = wall.IsDefinedByProperties;
     foreach (var rel in rels)
     {
      //get property set
     IfcPropertySet pSet = rel.RelatingPropertyDefinition as IfcPropertySet;
     if (pSet == null) continue;
     foreach (IfcProperty prop in pSet.HasProperties)
     {
      //get properties
     IfcPropertySingleValue singleVal = prop as IfcPropertySingleValue;
     if (singleVal == null) continue;
     if (singleVal.Name == "Wall Function")
     {
      //check value of the property
         IfcValue val = singleVal.NominalValue;
         if (val.UnderlyingSystemType == typeof(int))
         {
             if ((int)val.Value == 1) return true;
         }
         else if (val.UnderlyingSystemType == typeof(int?))
         {
             if ((int?)val.Value == 1) return true;
         }
     }
     }
     }
     return false;
 }
Пример #11
0
 /// <summary>
 ///   Set Material set usage with typical values and creates it if it doesn't exist.
 ///   LayerSetDirection = IfcLayerSetDirectionEnum.AXIS1
 ///   DirectionSense = IfcDirectionSenseEnum.POSITIVE
 ///   OffsetFromReferenceLine = 0
 /// </summary>
 /// <param name = "forLayerSet">Material layer set for the usage</param>
 public static void SetTypicalMaterialLayerSetUsage(this IfcWall wall, IfcMaterialLayerSet forLayerSet)
 {
     wall.SetMaterialLayerSetUsage(forLayerSet, IfcLayerSetDirectionEnum.AXIS1, IfcDirectionSenseEnum.POSITIVE, 0);
 }
 internal XbimWallCommonProperties(IfcWall Wall) : base(Wall, "Pset_WallCommon") { }
Пример #13
0
 internal XbimWall(XbimDocument document, IfcWall wall)
     : base(document)
 {
     _ifcBuildingElement = wall;
 }
Пример #14
0
 internal XbimWallQuantities(IfcWall wall) : base(wall, "WallQuantities") { }
Пример #15
0
        /// <summary>
        /// You can give the name of the TestCase -> to build only them
        /// </summary>
        /// <param name="args">Testcases to expoert</param>
        /// <help> Testcases: Spatial_simple\n
        /// Railway_spatial\n Spatial_01\nPlacement_Local"\nGeomRepresentation_01\n
        /// \nGeomRepresentation_02\nGeomRepresentation_03\nGeomRepresentation_04
        /// \nLocalPlacement_01\nLinearPlacement_02
        ///
        /// </help>
        static void Main(string[] args)
        {
            //Var declaration

            string folder       = "Unittest";
            var    testcasename = new List <string>();

            testcasename.Add("Spatial_simple");
            testcasename.Add("Railway_spatial");
            testcasename.Add("Spatial_01");
            testcasename.Add("Placement_Local");
            testcasename.Add("GeomRepresentation_01");
            testcasename.Add("GeomRepresentation_02");
            testcasename.Add("GeomRepresentation_03");
            testcasename.Add("GeomRepresentation_04");
            //testcasename.Add("GeomRepresentation_05");
            testcasename.Add("LocalPlacement_01");
            testcasename.Add("LinearPlacement_02");
            System.IO.Directory.CreateDirectory(".\\" + folder);


            //Help handling + single selection
            if (args.Length != 0)
            {
                //Help handling
                if (args.First().Equals("-?"))
                {
                    foreach (var i in testcasename)
                    {
                        Console.WriteLine(i);
                    }
                    return;
                }

                //Select only selected ones
                testcasename = new List <string>();
                foreach (var i in args)
                {
                    testcasename.Add(i);
                }
            }


            foreach (var proname in testcasename)
            {
                var db = new DatabaseIfc(ModelView.Ifc4NotAssigned);
                db.Factory.Options.GenerateOwnerHistory = false;

                var site = new IfcSite(db, "site")
                {
                    Guid = new Guid("aa4019f8-2584-44a1-a132-c17dfff69c41")
                };
                var project = new IfcProject(db, proname)
                {
                    Guid = new Guid("94d4ddac-9120-4fb9-bea0-7a414ee725d4")
                };

                new IfcRelAggregates(project, new List <IfcObjectDefinition>()
                {
                    site
                })
                {
                    Guid = new Guid("5e1fd0e5-b005-fe11-501e-5caff01dc1ad")
                };
                //Some placements
                IfcAxis2Placement3D placement1       = new IfcAxis2Placement3D(new IfcCartesianPoint(db, 2, 5, 1));
                IfcLocalPlacement   objectPlacement1 = new IfcLocalPlacement(site.ObjectPlacement, placement1);
                IfcAxis2Placement3D placement2       = new IfcAxis2Placement3D(new IfcCartesianPoint(db, 10, 5, 1));
                IfcLocalPlacement   objectPlacement2 = new IfcLocalPlacement(site.ObjectPlacement, placement2);
                IfcAxis2Placement3D placement3       = new IfcAxis2Placement3D(new IfcCartesianPoint(db, 15, 3, 6));
                IfcLocalPlacement   objectPlacement3 = new IfcLocalPlacement(site.ObjectPlacement, placement3);
                IfcAxis2Placement3D placement4       = new IfcAxis2Placement3D(new IfcCartesianPoint(db, 5, 8, 3));
                IfcLocalPlacement   objectPlacement4 = new IfcLocalPlacement(site.ObjectPlacement, placement4);
                IfcAxis2Placement3D originaxis2place = new IfcAxis2Placement3D(db.Factory.Origin);
                IfcLocalPlacement   origionobjplace  = new IfcLocalPlacement(site.ObjectPlacement, originaxis2place);


                //Select the Testcases and fill them into the container
                switch (proname)
                {
                case "Spatial_simple":
                    //initial File
                    IfcBuilding building1 = new IfcBuilding(db, "building1")
                    {
                        Guid = new Guid("fbc7f4b2-177d-4875-88bb-d3b44115bb42")
                    };
                    building1.ObjectPlacement = objectPlacement1;


                    IfcBuilding building2 = new IfcBuilding(db, "building2")
                    {
                        Guid = new Guid("fbc7f4b2-177d-4875-88bb-d3b441151337")
                    };
                    building2.ObjectPlacement = objectPlacement2;

                    //Write inital File
                    db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc");
                    db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml");

                    //continue with the updated version


                    IfcBuilding building3 = new IfcBuilding(db, "building3")
                    {
                        Guid            = new Guid("fbc7f4b2-177d-4875-88bb-d3b441153531"),
                        ObjectPlacement = objectPlacement3
                    };
                    break;

                case "Railway_spatial":
                    //initial
                    IfcSpatialZone spazone1 = new IfcSpatialZone(db, "Spatialzone1")
                    {
                        Guid            = new Guid("42c7f4b2-177d-4875-88bb-d3b441153531"),
                        ObjectPlacement = objectPlacement1
                    };

                    IfcSpatialZone spazone2 = new IfcSpatialZone(db, "Spatialzone2")
                    {
                        Guid            = new Guid("42c7f4b2-1337-4875-88bb-d3b441153531"),
                        ObjectPlacement = objectPlacement2
                    };
                    db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc");
                    db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml");

                    //Update
                    IfcSpatialZone spazone3 = new IfcSpatialZone(db, "Spatialzone3")
                    {
                        Guid            = new Guid("42c7f4b2-1337-4422-88bb-d3b441153531"),
                        ObjectPlacement = objectPlacement3
                    };
                    IfcSpatialZone spazone4 = new IfcSpatialZone(db, "Spatialzone4")
                    {
                        Guid            = new Guid("42c7f4b2-1337-4875-4242-d3b441153531"),
                        ObjectPlacement = objectPlacement4
                    };

                    break;

                case "Spatial_01":
                    //creating building and add parts to it
                    building1 = new IfcBuilding(db, "building1")
                    {
                        Guid            = new Guid("fbc7f4b2-177d-4875-88bb-d3b44115bb42"),
                        ObjectPlacement = objectPlacement1
                    };

                    IfcBuildingStorey buildingsto1 = new IfcBuildingStorey(building1, "Level1", 0)
                    {
                        Guid            = new Guid("42c74222-1337-4875-4242-d3b441153531"),
                        ObjectPlacement = objectPlacement2
                    };

                    building1.IsDecomposedBy.First().Guid = new Guid("42abcd22-1337-4875-4242-abcd41153531");

                    var profile1 = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6);
                    IfcExtrudedAreaSolid      extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35);
                    IfcProductDefinitionShape shape1             = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1));

                    IfcWall wall = new IfcWall(buildingsto1, objectPlacement3, shape1)
                    {
                        Guid = new Guid("42aa4222-1337-aaaa-4242-d3aa41153531"),
                        Name = "Wall1"
                    };
                    wall.ContainedInStructure.Guid = new Guid("42c74222-1337-4875-4242-d3b44abcd531");


                    db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc");
                    db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml");

                    //update
                    IfcBuildingStorey buildingsto2 = new IfcBuildingStorey(building1, "Level2", 0)
                    {
                        Guid            = new Guid("42c74222-1337-4875-4242-bbbb41153531"),
                        ObjectPlacement = objectPlacement4
                    };
                    // Reassign Wall to Storey2
                    wall.ContainedInStructure.RelatingStructure = buildingsto2;

                    break;

                case "Placement_Local":
                    //Initial set
                    profile1           = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6);
                    extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35);
                    shape1             = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1));

                    //Wall at origin
                    IfcWall wall2 = new IfcWall(site, origionobjplace, shape1)
                    {
                        Guid = new Guid("42aa4222-1337-aaaa-4242-d3aa41153531"),
                        Name = "Wall1"
                    };
                    wall2.ContainedInStructure.Guid = new Guid("42cab222-1337-4875-4242-d3b44abcd531");

                    db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc");
                    db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml");

                    //Update
                    IfcAxis2Placement3D wallaxisplace = new IfcAxis2Placement3D(new IfcCartesianPoint(db, 2, 3, 0));
                    wall2.ObjectPlacement = new IfcLocalPlacement(site.ObjectPlacement, wallaxisplace);


                    break;

                case "GeomRepresentation_01":
                    //init
                    profile1           = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6);
                    extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35);
                    shape1             = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1));

                    IfcRectangleProfileDef    profile2           = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6);
                    IfcExtrudedAreaSolid      extrudedAreaSolid2 = new IfcExtrudedAreaSolid(profile2, 1.35);
                    IfcProductDefinitionShape shape2             = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid2));


                    var proxy1 = new IfcBuildingElementProxy(site, objectPlacement1, shape1)
                    {
                        Name = "Cuboid1",
                        Guid = new Guid("fbc7f4b2-177d-4875-88bb-d3abed15bbaa")
                    };
                    proxy1.ContainedInStructure.Guid = new Guid("000ab222-1337-4875-4242-d3b44abcd531");

                    var proxy2 = new IfcBuildingElementProxy(site, objectPlacement2, shape2)
                    {
                        Name = "Cuboid2",
                        Guid = new Guid("f8e196cb-c7d9-4d53-9885-0f687706abcd")
                    };
                    proxy2.ContainedInStructure.Guid = new Guid("42cab222-1337-4875-4242-00004abcd531");


                    db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc");
                    db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml");
                    //Update


                    proxy2.Representation = shape1;
                    shape2.Dispose(true);     //Remove orphaned entries


                    break;

                case "GeomRepresentation_02":
                    //init
                    profile1           = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6);
                    extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35);
                    shape1             = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1));

                    profile2           = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6);
                    extrudedAreaSolid2 = new IfcExtrudedAreaSolid(profile2, 1.35);
                    shape2             = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid2));

                    proxy1 = new IfcBuildingElementProxy(site, objectPlacement1, shape1)
                    {
                        Name = "Cuboid1",
                        Guid = new Guid("fbcba4b2-1c7d-4875-88bb-d3abed15bbaa")
                    };
                    proxy1.ContainedInStructure.Guid = new Guid("000ab222-1337-4875-4242-d3b00abcd531");
                    proxy2 = new IfcBuildingElementProxy(site, objectPlacement2, shape2)
                    {
                        Name = "Cuboid2",
                        Guid = new Guid("f821963b-c7d9-4d53-9885-0f87cd6abcda")
                    };
                    proxy1.ContainedInStructure.Guid = new Guid("000ab222-1337-4875-4242-d3414abcd531");
                    db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc");
                    db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml");

                    //Update
                    extrudedAreaSolid2.Depth = 3;
                    break;

                case "GeomRepresentation_03":
                    //init
                    profile1           = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6);
                    extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35);
                    shape1             = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1));

                    proxy1 = new IfcBuildingElementProxy(site, objectPlacement1, shape1)
                    {
                        Name = "Cuboid_extrudedArea",
                        Guid = new Guid("fbcba4b2-1c7d-0000-88bb-d3abed15bbaa")
                    };
                    proxy1.ContainedInStructure.Guid = new Guid("00011222-1337-4875-4242-d1114abcd531");
                    db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc");
                    db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml");

                    //Update
                    profile1.Dispose(false);     // Remove profile
                    var profile3 = new IfcCircleProfileDef(db, "CylinderProfileDef", 4);
                    extrudedAreaSolid1.SweptArea = profile3;
                    proxy1.Name = "Cylinder_extrudedArea";



                    break;

                case "GeomRepresentation_04":
                    //init
                    profile1           = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6);
                    extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35);
                    shape1             = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1));

                    proxy1 = new IfcBuildingElementProxy(site, objectPlacement1, shape1)
                    {
                        Name = "Cuboid_extrudedArea",
                        Guid = new Guid("fbcba4b2-1c7d-0000-88bb-d3abed15bbaa")
                    };
                    proxy1.ContainedInStructure.Guid = new Guid("00011222-1337-4875-4242-d1114abcd531");

                    db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc");
                    db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml");

                    //Update

                    var points = new List <IfcCartesianPoint>();
                    points.Add(new IfcCartesianPoint(db, -2, -3, 0));
                    points.Add(new IfcCartesianPoint(db, -2, 3, 0));
                    points.Add(new IfcCartesianPoint(db, 2, 3, 0));
                    points.Add(new IfcCartesianPoint(db, 2, -3, 0));
                    points.Add(new IfcCartesianPoint(db, -2, -3, 1.35));
                    points.Add(new IfcCartesianPoint(db, -2, 3, 1.35));
                    points.Add(new IfcCartesianPoint(db, 2, 3, 1.35));
                    points.Add(new IfcCartesianPoint(db, 2, -3, 1.35));

                    var polyloop = new List <IfcPolyLoop>();
                    polyloop.Add(new IfcPolyLoop(points[0], points[1], points[2], points[3]));
                    polyloop.Add(new IfcPolyLoop(points[0], points[4], points[5], points[1]));
                    polyloop.Add(new IfcPolyLoop(points[0], points[4], points[7], points[3]));
                    polyloop.Add(new IfcPolyLoop(points[4], points[5], points[6], points[7]));
                    polyloop.Add(new IfcPolyLoop(points[1], points[5], points[6], points[2]));
                    polyloop.Add(new IfcPolyLoop(points[3], points[7], points[6], points[2]));

                    var faceouter = new List <IfcFaceOuterBound>();
                    foreach (var i in polyloop)
                    {
                        faceouter.Add(new IfcFaceOuterBound(i, true));
                    }

                    var face = new List <IfcFace>();
                    foreach (var j in faceouter)
                    {
                        face.Add(new IfcFace(j));
                    }

                    var closedshell = new IfcClosedShell(face);
                    var brep        = new IfcFacetedBrep(closedshell);

                    shape2 = new IfcProductDefinitionShape(new IfcShapeRepresentation(brep));
                    proxy1.Representation = shape2;
                    break;

                case "GeomRepresentation_05":
                    var points1 = new List <IfcCartesianPoint>();
                    points1.Add(new IfcCartesianPoint(db, -2, -3, 0));
                    points1.Add(new IfcCartesianPoint(db, -2, 3, 0));
                    points1.Add(new IfcCartesianPoint(db, 2, 3, 0));
                    points1.Add(new IfcCartesianPoint(db, 2, -3, 0));
                    var points2 = new List <IfcCartesianPoint>();
                    points2.Add(new IfcCartesianPoint(db, -2, -3, 1.35));
                    points2.Add(new IfcCartesianPoint(db, -2, 3, 1.35));
                    points2.Add(new IfcCartesianPoint(db, 2, 3, 1.35));
                    points2.Add(new IfcCartesianPoint(db, 2, -3, 1.35));

                    polyloop = new List <IfcPolyLoop>();
                    polyloop.Add(new IfcPolyLoop(points1));
                    polyloop.Add(new IfcPolyLoop(points2));


                    break;


                case "LocalPlacement_01":
                    //init
                    profile1           = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6);
                    extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35);
                    shape1             = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1));

                    profile2           = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6);
                    extrudedAreaSolid2 = new IfcExtrudedAreaSolid(profile2, 1.35);
                    shape2             = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid2));

                    proxy1 = new IfcBuildingElementProxy(site, objectPlacement1, shape1)
                    {
                        Name = "Cuboid1",
                        Guid = new Guid("fbcba4b2-1c7d-4815-88bb-d3abed15bbaa")
                    };
                    proxy1.ContainedInStructure.Guid = new Guid("000ab222-1337-4875-4242-d3b00abcd531");
                    proxy2 = new IfcBuildingElementProxy(site, objectPlacement2, shape2)
                    {
                        Name = "Cuboid2",
                        Guid = new Guid("f821963b-c7d9-4d53-9825-0f87cd6abcda")
                    };
                    proxy1.ContainedInStructure.Guid = new Guid("000ab242-1337-4875-4242-d3414abcd531");
                    db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc");
                    db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml");

                    //update
                    var point1 = new IfcCartesianPoint(db, 2, 2, 2);
                    placement1.Location = point1;


                    break;

                case "LinearPlacement_02":

                    profile1           = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6);
                    extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35);
                    shape1             = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1));

                    profile2           = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6);
                    extrudedAreaSolid2 = new IfcExtrudedAreaSolid(profile2, 1.35);
                    shape2             = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid2));


                    IfcLine line1 = new IfcLine(new IfcCartesianPoint(db, 1, 1, 1)
                                                , new IfcVector(new IfcDirection(db, 1, 1), 20));

                    IfcLine line2 = new IfcLine(new IfcCartesianPoint(db, 1, -1, -1)
                                                , new IfcVector(new IfcDirection(db, -1, 1), 20));

                    var alignment1 = new IfcAlignment(site, line1)
                    {
                        Name = "Alignment1",
                        Guid = new Guid("fbcba4b2-1cdd-48d5-88bb-d3aced15bbaa")
                    };
                    var alignment2 = new IfcAlignment(site, line2)
                    {
                        Name = "Alignment2",
                        Guid = new Guid("f111a4b2-1c7d-4815-88bb-d3aced15bbaa")
                    };

                    var distn1 = new IfcPointByDistanceExpression(4, line1);
                    var distn2 = new IfcPointByDistanceExpression(2, line2);

                    //Deprecated but should be right for IFC4
                    var linearplace1 = new IfcLinearPlacement(line1, distn1)
                    {
                        Orientation = new IfcOrientationExpression(new IfcDirection(db, 0.5, 0.24),
                                                                   new IfcDirection(db, -0.24, 0.5))
                    };
                    var linearplace2 = new IfcLinearPlacement(line2, distn2)
                    {
                        Orientation = new IfcOrientationExpression(new IfcDirection(db, 0.75, 0.24),
                                                                   new IfcDirection(db, -0.24, 0.66))
                    };

                    proxy1 = new IfcBuildingElementProxy(site, linearplace1, shape1)
                    {
                        Name = "Cuboid1",
                        Guid = new Guid("fbcba4b2-1c7d-4815-88bb-d3aced15bbaa")
                    };
                    proxy1.ContainedInStructure.Guid = new Guid("000cc222-1337-4875-4242-d3b00abcd531");
                    proxy2 = new IfcBuildingElementProxy(site, linearplace2, shape2)
                    {
                        Name = "Cuboid2",
                        Guid = new Guid("f821963b-c7d9-4d53-98a5-0f8ccd6abcda")
                    };
                    proxy1.ContainedInStructure.Guid = new Guid("000ccc42-1337-4875-4242-d3414abcd531");
                    db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc");
                    db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml");

                    //Update

                    IfcLine line3 = new IfcLine(new IfcCartesianPoint(db, 0, 1, 0)
                                                , new IfcVector(new IfcDirection(db, 0, 5, 2), 15));
                    var distn3 = new IfcPointByDistanceExpression(4, line3);

                    linearplace1.PlacementMeasuredAlong = line3;
                    linearplace1.Distance = distn3;


                    break;


                default:
                    //exit
                    return;
                }

                db.WriteFile(".\\" + folder + "\\Update_" + proname + ".ifc");
                db.WriteXmlFile(".\\" + folder + "\\Update_" + proname + ".ifcxml");
            }
        }