예제 #1
0
        private XPreviewBuilding CreateGarageStructure(XParameters parameters)
        {
            XbimPoint3D location  = parameters.Perimeter.First();
            XPolygon    perimeter = parameters.Perimeter.Normalized(location);
            // Create the building
            XPreviewBuilding garage = new XPreviewBuilding()
            {
                Name               = parameters.BuildingName,
                Location           = location,
                ReferenceDirection = new XbimVector3D(1, 0, 0),
                Axis               = new XbimVector3D(0, 0, 1)
            };

            // Building stories
            for (int i = 0; i < parameters.NumberOfFloors; i++)
            {
                XPreviewBuildingStory story = new XPreviewBuildingStory
                {
                    Name               = "Floor " + (i + 1).ToString(),
                    Location           = new XbimPoint3D(0, 0, i * parameters.FloorToFloor),
                    ReferenceDirection = new XbimVector3D(1, 0, 0),
                    Axis               = new XbimVector3D(0, 0, 1),
                    Container          = garage,
                    StoryNumber        = (i + 1),
                };
            }

            return(garage);
        }
예제 #2
0
        public void CreateBuilding(XParameters parameters, string projectId)
        {
            string path = GetFolderPath(projectId) + projectId + ".ifc";

            model = IfcStore.Open(path);
            CreateBuildingP(parameters);
            model.SaveAs(path, StorageType.Ifc);
            model.Close();
        }
예제 #3
0
        public void CreateBuilding(XParameters parameters)
        {
            string json = JsonConvert.SerializeObject(parameters);
            string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\pegasus.json";

            System.IO.File.WriteAllText(path, json);

            CreateBuildingP(parameters);
        }
예제 #4
0
        private void CreateBuildingP(XParameters parameters)
        {
            this.parameters = parameters;

            parameters.ReferenceLine = new XLine(new XbimPoint3D(BaseUnit(parameters.ReferenceLine.sp.X), BaseUnit(parameters.ReferenceLine.sp.Y), BaseUnit(parameters.ReferenceLine.sp.Z)),
                                                 new XbimPoint3D(BaseUnit(parameters.ReferenceLine.ep.X), BaseUnit(parameters.ReferenceLine.ep.Y), BaseUnit(parameters.ReferenceLine.ep.Z)));

            // Scale the import data (mm) to base units
            parameters.CorridorWidth          = BaseUnit(parameters.CorridorWidth);
            parameters.FloorToFloor           = BaseUnit(parameters.FloorToFloor);
            parameters.ExteriorWallThickness  = BaseUnit(parameters.ExteriorWallThickness);
            parameters.GroundSlabThickness    = BaseUnit(parameters.GroundSlabThickness);
            parameters.InteriorWallThickness  = BaseUnit(parameters.InteriorWallThickness);
            parameters.InterzoneSlabThickness = BaseUnit(parameters.InterzoneSlabThickness);
            foreach (var unit in parameters.UnitDefinitions)
            {
                unit.UnitWidth = BaseUnit(unit.UnitWidth);
                unit.UnitDepth = BaseUnit(unit.UnitDepth);
                unit.CreateProfile(parameters.InteriorWallThickness);
                foreach (var window in unit.Windows)
                {
                    window.Offset       = BaseUnit(window.Offset);
                    window.Width        = BaseUnit(window.Width);
                    window.Height       = BaseUnit(window.Height);
                    window.TopElevation = BaseUnit(window.TopElevation);
                }

                foreach (var door in unit.Doors)
                {
                    door.Offset = BaseUnit(door.Offset);
                    door.Width  = BaseUnit(door.Width);
                    door.Height = BaseUnit(door.Height);
                }
            }

            string json = JsonConvert.SerializeObject(parameters);

            System.IO.File.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\pegasus.json", json);
            XParameters test = JsonConvert.DeserializeObject <XParameters>(json);

            // Make the building
            CreateBuildingStructure();
            AdjustCorridorLength();
            CreateBuildingEnvelope();
            CreateBuildingInterior();
            building.CommitAll(model);
        }
예제 #5
0
        private void CreateGarageP(XParameters parameters)
        {
            XPreviewBuilding garage = CreateGarageStructure(parameters);

            garage.CommitAll(model);
        }
예제 #6
0
        /// <summary>
        /// Creates the building
        /// </summary>
        public void CreateBuilding(string jsonstring)
        {
            XParameters parameters = JsonConvert.DeserializeObject <XParameters>(jsonstring);

            CreateBuildingP(parameters);
        }