internal static int CompareStoreysByElevation(IfcBuildingStorey x, IfcBuildingStorey y)
        {
            double a = x.Elevation ?? 0;
            double b = y.Elevation ?? 0;

            return(a.CompareTo(b));
        }
Esempio n. 2
0
        //[System.Xml.Serialization.XmlIgnoreAttribute()]
        //private IfcBuildingStorey _ifcBuildingStorey;

   
        public FloorType(IfcBuildingStorey ifcBuildingStorey, CoBieLiteHelper helper)
            : this()
        {
         //   _ifcBuildingStorey = ifcBuildingStorey;
            externalEntityName = helper.ExternalEntityName(ifcBuildingStorey);
            externalID = helper.ExternalEntityIdentity(ifcBuildingStorey);
            externalSystemName = helper.ExternalSystemName(ifcBuildingStorey);
            FloorName = ifcBuildingStorey.Name;
            FloorCategory = helper.GetClassification(ifcBuildingStorey);
            FloorDescription = ifcBuildingStorey.Description;
            //set the fall backs
            
            if (ifcBuildingStorey.Elevation.HasValue)
            {
                FloorElevationValue = new DecimalValueType
                {
                    DecimalValue = ifcBuildingStorey.Elevation.Value,
                    DecimalValueSpecified = true
                };
                //TODO: work out if the units can change
                //FloorElevationValue.UnitName = 
            }
            FloorHeightValue = helper.GetCoBieAttribute<DecimalValueType>("FloorHeightValue", ifcBuildingStorey);
            //var heightProperty = ifcBuildingStorey.GetTotalHeightProperty();
            //if (heightProperty != null)
            //{
            //    FloorHeightValue = new DecimalValueType
            //    {
            //        DecimalValue = heightProperty.LengthValue,
            //        DecimalValueSpecified = true,
            //        UnitName = heightProperty.Unit.GetName()
            //    };
            //}
           
            var spaces = ifcBuildingStorey.GetSpaces();
            var ifcSpaces = spaces as IList<IfcSpace> ?? spaces.ToList();
            if (ifcSpaces.Any())
            {
                Spaces = new SpaceCollectionType {Space = new List<SpaceType>(ifcSpaces.Count)};
                for (var i = 0; i < ifcSpaces.Count; i++)
                {
                    Spaces.Add(new SpaceType(ifcSpaces[i], helper));
                }
            }

            //Attributes
            var ifcAttributes = helper.GetAttributes(ifcBuildingStorey);
            if (ifcAttributes != null && ifcAttributes.Any())
                FloorAttributes = new AttributeCollectionType { Attribute = ifcAttributes };

            //TODO:
            //Space Issues
            //Space Documents
        }
 public static int CompareStoreysByElevation(IfcBuildingStorey x, IfcBuildingStorey y)
 {
     double a = x.Elevation ?? 0;
     double b = y.Elevation ?? 0;
     return a.CompareTo(b);
 }
Esempio n. 4
0
 private void ChangeRelProducts(XbimModel model, IfcBuildingStorey bs, IfcProduct _product)
 {
     //var products = model.Instances.OfType<IfcBuildingElement>();
     using (XbimReadWriteTransaction txn = model.BeginTransaction("ChangeRelProducts"))
     {
         var ifcRel = model.Instances.New<IfcRelContainedInSpatialStructure>();
         ifcRel.RelatingStructure = bs;
         ifcRel.RelatedElements.Add(_product);
         if (model.Validate(txn.Modified(), Console.Out) == 0)
         {
             txn.Commit();
         }
     }
 }
Esempio n. 5
0
        private IfcBuildingStorey CopyBuildingStorey(XbimModel model, IfcBuildingStorey _buildingStory, IfcBuilding _building)
        {
            using (XbimReadWriteTransaction txn = model.BeginTransaction("Create Building Story"))
            {
                var buildingStory = model.Instances.New<IfcBuildingStorey>();
                buildingStory.GlobalId = _buildingStory.GlobalId;
                buildingStory.Name = _buildingStory.Name;
                buildingStory.OwnerHistory.OwningUser = model.DefaultOwningUser;
                buildingStory.OwnerHistory.OwningApplication = model.DefaultOwningApplication;
                buildingStory.CompositionType = _buildingStory.CompositionType;
                buildingStory.ObjectPlacement = model.Instances.New<IfcLocalPlacement>();

                var localPlacement = buildingStory.ObjectPlacement as IfcLocalPlacement;
                var _localPlacement = _buildingStory.ObjectPlacement as IfcLocalPlacement;

                if (localPlacement != null && localPlacement.RelativePlacement == null)
                {

                    localPlacement.RelativePlacement = model.Instances.New<IfcAxis2Placement3D>();
                    //IfcAxis2Placement axis = _localPlacement.RelativePlacement;
                    var placement = localPlacement.RelativePlacement as IfcAxis2Placement3D;
                    var _placement = _localPlacement.RelativePlacement as IfcAxis2Placement3D;
                    //placement.Axis = _placement.Axis;
                    //placement.Location = _placement.Location;
                    //placement.RefDirection = _placement.RefDirection;
                    placement.SetNewLocation(_placement.Location.X, _placement.Location.Y, _placement.Location.Z);
                }

                var ifcRel = model.Instances.New<IfcRelAggregates>();
                ifcRel.RelatingObject = _building;//.RelatingMaterial = material;
                ifcRel.RelatedObjects.Add(buildingStory);
                //_building.AddElement(buildingStory);

                if (model.Validate(txn.Modified(), Console.Out) == 0)
                {
                    txn.Commit();
                    return buildingStory;
                }

            }
            return null;
        }
Esempio n. 6
0
        private void AddProductInBuildingStorey(XbimModel model, IfcBuildingStorey _buildingStorey, IfcProduct _prod)
        {
            if (model.IsTransacting)
                return;
            using (XbimReadWriteTransaction txn = model.BeginTransaction("AddProductToBuildingStorey"))
            {
                //if (_prod is IfcSpatialStructureElement)
                try
                {
                    _buildingStorey.AddElement(_prod);
                    if (model.Validate(txn.Modified(), Console.Out) == 0)
                    {
                        txn.Commit();
                    }
                }
                catch(Exception ex)
                {
                    AddMessages("Error in AddProductInBuildingStorey: " + ex.Message);
                    Debug.WriteLine("Error in AddProductInBuildingStorey: " + ex.Message);
                }

            }
        }
 internal XbimBuildingStoreyQuantities(IfcBuildingStorey storey) : base(storey, "StoreyQuantities") { }
 internal XbimBuildingStoreyCommonProperties(IfcBuildingStorey storey) : base(storey, "Pset_BuildingStoreyCommon") { }
Esempio n. 9
0
 //internal constructor for creation from XbimDocument (parsing data into the document)
 internal XbimBuildingStorey(XbimDocument document, IfcBuildingStorey buildingStorey) : base(document, buildingStorey) { }
Esempio n. 10
0
        /// <summary>
        /// Add the Building Story (Floor) height
        /// </summary>
        /// <param name="floorHeight">the floor height</param>
        /// <param name="ifcBuildingStorey">IfcBuildingStorey object to add height property too</param>
        private void AddFloorHeight(string floorHeight, IfcBuildingStorey ifcBuildingStorey)
        {
            if (ValidateString(floorHeight))
            {
                double? height = GetDoubleFromString(floorHeight);
                if (height != null)
                {
                    //IfcPropertySingleValue ifcPropertySingleValue = ifcBuildingStorey.SetPropertySingleValue("Pset_BuildingStory_COBie", "StoreyHeight", new IfcLengthMeasure((double)height));
                    //ifcPropertySingleValue.Description = "Building Story Floor Height";
                    ////set description for the property set, nice to have but optional
                    //SetPropertySetDescription(ifcBuildingStorey, "Pset_BuildingStory_COBie", "Building Story Properties From COBie");
                    AddPropertySingleValue(ifcBuildingStorey, "Pset_BuildingStory_COBie", "Building Story Properties From COBie", "StoreyHeight", "Building Story Floor Height From Datum", new IfcLengthMeasure((double)height));
                }

            }
        }