public static int CompareStoreysByElevation(IfcBuildingStorey x, IfcBuildingStorey y) { double a = x.Elevation ?? 0; double b = y.Elevation ?? 0; return(a.CompareTo(b)); }
/// <summary> /// Add floor placement point /// </summary> /// <param name="row">COBieCoordinateRow holding the data</param> private void AddFloorPlacement(COBieCoordinateRow row) { IfcBuildingStorey ifcBuildingStorey = null; if (ValidateString(row.ExtIdentifier)) { IfcGloballyUniqueId id = new IfcGloballyUniqueId(row.ExtIdentifier); ifcBuildingStorey = Model.FederatedInstances.Where <IfcBuildingStorey>(bs => bs.GlobalId == id).FirstOrDefault(); } if ((ifcBuildingStorey == null) && (ValidateString(row.RowName))) { ifcBuildingStorey = Model.FederatedInstances.Where <IfcBuildingStorey>(bs => bs.Name == row.RowName).FirstOrDefault(); } if (ifcBuildingStorey != null) { var placementRelToIfcProduct = ifcBuildingStorey.GetContainingStructuralElement(); IfcLocalPlacement objectPlacement = CalcObjectPlacement(row, placementRelToIfcProduct); if (objectPlacement != null) { //using statement will set the Model.OwnerHistoryAddObject to IfcRoot.OwnerHistory as OwnerHistoryAddObject is used upon any property changes, //then swaps the original OwnerHistoryAddObject back in the dispose, so set any properties within the using statement using (COBieXBimEditScope context = new COBieXBimEditScope(Model, ifcBuildingStorey.OwnerHistory)) { ifcBuildingStorey.ObjectPlacement = objectPlacement; } } } }
/// <summary> /// Returns all spaces that are sub-spaces of this storey /// </summary> /// <returns></returns> public static IEnumerable <IfcSpace> GetSpaces(this IfcBuildingStorey buildingStorey) { IEnumerable <IfcRelDecomposes> decomp = buildingStorey.IsDecomposedBy; IEnumerable <IfcObjectDefinition> objs = decomp.SelectMany(s => s.RelatedObjects); return(objs.OfType <IfcSpace>()); }
private void ExtractWindows(IfcBuildingStorey storey, int floorId) { foreach (var window in storey.ContainsElements.SelectMany(rel => rel.RelatedElements).OfType <IfcWindow>() .OrderBy(o => o.GetType().Name)) { var dbWindow = _ifcWindowService.CreateWindow(window, floorId); _windowRepository.Create(dbWindow); } }
public void CreateProductIfc(ProductIfcRequest request, Stream outputStream) { IfcPerson person = IfcInit.CreatePerson(request.owner.person.givenName, request.owner.person.familyName, request.owner.person.identifier); IfcOrganization organization = IfcInit.CreateOrganization(request.owner.organization.name, request.owner.organization.description, request.owner.organization.identifier); IfcOrganization applicationOrganization = IfcInit.CreateOrganization(request.owner.application.organization.name, request.owner.application.organization.description, request.owner.application.organization.identifier); IfcApplication application = IfcInit.CreateApplication(applicationOrganization, request.owner.application.version, request.owner.application.name, request.owner.application.identifier); IfcOwnerHistory ownerHistory = IfcInit.CreateOwnerHistory(person, organization, application); IfcProject project = IfcInit.CreateProject(request.project.name, request.project.description, ownerHistory); IfcSite site = IfcInit.CreateSite(null, null, ownerHistory); project.Aggregate(site, ownerHistory); IfcBuilding building = IfcInit.CreateBuilding(null, null, ownerHistory, site.ObjectPlacement); site.Aggregate(building, ownerHistory); IfcBuildingStorey storey = IfcInit.CreateBuildingStorey(null, null, ownerHistory, building.ObjectPlacement); building.Aggregate(storey, ownerHistory); IfcProduct product; switch (request.product.type) { default: product = IfcInit.CreateProxy(request.product.name, request.product.description, ownerHistory, storey.ObjectPlacement, null); break; } List <IfcRepresentationContext> contextList = new List <IfcRepresentationContext> (project.RepresentationContexts); product.Representation = CreateProductRepresentation(contextList, request.product.representations); storey.Contains(product, ownerHistory); project.SerializeToStep(outputStream, request.schema.ToString(), null); return; }
public static IfcQuantityLength GetTotalHeightProperty(this IfcBuildingStorey buildingStorey) { var qLen = buildingStorey.GetQuantity <IfcQuantityLength>("BaseQuantities", "TotalHeight"); if (qLen == null) { qLen = buildingStorey.GetQuantity <IfcQuantityLength>("TotalHeight"); //just look for any height } return(qLen); }
public IfcBuildingStorey AddBuildingStorey(IfcBuilding building, double elevation, string name = "") { var s = new IfcBuildingStorey(IfcGuid.IfcGuid.ToIfcGuid(Guid.NewGuid())); s.Elevation = elevation; s.Name = name; storage.AddInstance(s); CreateAggregationRelationship(building, s); return(s); }
private void ExtractSpaces(IfcBuildingStorey storey, int floorId) { foreach (IfcSpace space in ((IfcBuildingStorey)storey).Spaces .Where(p => !p.GetType().IsSubclassOf(typeof(IfcFeatureElementSubtraction))) // Ignore Openings .OrderBy(o => o.GetType().Name)) { var dbSpace = _ifcSpaceService.CreateSpace(space, floorId); _spaceRepository.Create(dbSpace); } }
private void ExtractWalls(IfcBuildingStorey storey, int floorId) { foreach (var wall in storey.ContainsElements.SelectMany(rel => rel.RelatedElements).OfType <IfcWall>() .Where(p => !p.GetType().IsSubclassOf(typeof(IfcFeatureElementSubtraction))) // Ignore Openings .OrderBy(o => o.GetType().Name)) { var dbWall = _ifcWallService.CreateWall(wall, floorId); _wallRepository.Create(dbWall); } }
public IfcBuildingElementProxy AddBuildingElement(IfcBuildingStorey storey, string name = "", string description = "") { var e = new IfcBuildingElementProxy(IfcGuid.IfcGuid.ToIfcGuid(Guid.NewGuid())); e.Name = name; e.Description = description; storage.AddInstance(e); CreateAggregationRelationship(storey, e); return(e); }
public XPreviewBuildingStory(IfcBuildingStorey ifcBuildingStory) : base(ifcBuildingStory) { Name = ifcBuildingStory.Name; foreach (IfcSpace ifcSpace in ifcBuildingStory.Spaces) { XPreviewSpace space = new XPreviewSpace(ifcSpace); space.Container = this; } }
public void ExtrudeAndRevolveTest() { //Set up project hierarchy IfcProject project = IfcInit.CreateProject(null, null, null); IfcSite site = IfcInit.CreateSite(null, null, null); project.Aggregate(site, null); IfcBuilding building = IfcInit.CreateBuilding(null, null, null, null); site.Aggregate(building, null); IfcBuildingStorey storey = IfcInit.CreateBuildingStorey(null, null, null, null); building.Aggregate(storey, null); //Create shape representation // -- extruded profile shape IfcPolyline outerCurve = IfcGeom.CreatePolyLine(new List <double[]>() { new double[] { -0.5, -0.5 }, new double[] { -0.5, 0.5 }, new double[] { 0.5, 0.5 }, new double[] { 0.5, -0.5 }, new double[] { -0.5, -0.5 } }); IfcProfileDef profileDef = new IfcArbitraryClosedProfileDef(IfcProfileTypeEnum.AREA, null, outerCurve); IfcRepresentationItem extrudedRepresentation = profileDef.Extrude(1).Rotate(new double[] { 45, 0, 45 }).Translate(new double[] { -2, 0, 0 }); // -- revolved profile shape IfcRepresentationItem revolvedRepresentation = profileDef.Revolve(-45, new IfcAxis1Placement(new IfcCartesianPoint(1, 0, 0), new IfcDirection(0, 1, 0)), null); //Create product with representation and place in storey var contextEnum = project.RepresentationContexts.GetEnumerator(); contextEnum.MoveNext(); IfcShapeRepresentation shapeRepresentation = new IfcShapeRepresentation(contextEnum.Current, new IfcLabel("extruded square"), new IfcLabel("SweptSolid"), new IfcRepresentationItem[] { extrudedRepresentation, revolvedRepresentation }); IfcProxy product = IfcInit.CreateProxy(null, null, null, storey.ObjectPlacement, null); product.Representation = new IfcProductDefinitionShape(null, null, new IfcRepresentation[] { shapeRepresentation });; storey.Contains(product, null); //Write to IFC file using (FileStream fs = File.Create("./swept_geom_test.ifc")) { project.SerializeToStep(fs, "IFC2X3", null); } }
/// <summary> /// Adds the space to the space map if the storey name plus the space name is not unique returns false /// </summary> /// <param name="storey"></param> /// <param name="space"></param> /// <returns></returns> public bool AddToSpaceMap(IfcBuildingStorey storey, IfcSpace space) { var key = storey.Name + "&" + space.Name; if (_spaceLookup.ContainsKey(key)) { return(false); } _spaceLookup.Add(key, space); return(true); }
public static IfcAreaMeasure?GetGrossFloorArea(IfcBuildingStorey buildingStorey) { var qArea = GetQuantity <IfcQuantityArea>(buildingStorey, "BaseQuantities", "GrossFloorArea") ?? GetQuantity <IfcQuantityArea>(buildingStorey, "GrossFloorArea"); if (qArea != null) { return(qArea.AreaValue); } return(null); }
/// <summary> /// Add element relationship to a parent object /// </summary> /// <param name="ifcElement">IfcElement object</param> /// <param name="spaceNames">Name used as key to find parent object</param> private void AddElementRelationship(IfcElement ifcElement, string spaceNames) { spaceNames = spaceNames.ToLower().Trim(); IfcSpace ifcSpace = null; IfcBuildingStorey ifcBuildingStorey = null; //see if the full name is in spaces ifcSpace = IfcSpaces.Where(space => space.Name.ToString().ToLower().Trim() == spaceNames).FirstOrDefault(); if (ifcSpace != null) { ifcSpace.AddElement(ifcElement); } else //not in spaces so try Floors { ifcBuildingStorey = IfcBuildingStoreys.Where(bs => bs.Name.ToString().ToLower().Trim() == spaceNames).FirstOrDefault(); if (ifcBuildingStorey != null) { ifcBuildingStorey.AddElement(ifcElement); } else //not in floors so see if the space names is a delimited list { var splitKey = GetSplitChar(spaceNames); var spaceArray = spaceNames.Split(splitKey); if (spaceArray.Count() > 1) //if one we have already tried above, if more than one then try each item { foreach (var spaceitem in spaceArray) { var spaceName = spaceitem.Trim(); ifcSpace = IfcSpaces.Where(space => space.Name.ToString().ToLower().Trim() == spaceName).FirstOrDefault(); if (ifcSpace != null) { ifcSpace.AddElement(ifcElement); } else { ifcBuildingStorey = IfcBuildingStoreys.Where(bs => bs.Name.ToString().ToLower().Trim() == spaceName).FirstOrDefault(); if (ifcBuildingStorey != null) { ifcBuildingStorey.AddElement(ifcElement); } else { GetBuilding().AddElement(ifcElement); //default to building, probably give incorrect bounding box as we do not know what the element parent was } } } } else { GetBuilding().AddElement(ifcElement); //default to building, probably give incorrect bounding box as we do not know what the element parent was } } } }
/// <summary> /// Add the data to the BuildingStory object /// </summary> /// <param name="row">COBieFloorRow holding the data</param> private void AddBuildingStory(COBieFloorRow row) { //we are merging so check for an existing item name, assume the same item as should be the same building, maybe should do a check on that if (CheckIfExistOnMerge <IfcBuildingStorey>(row.Name)) { return;//we have it so no need to create } IfcBuildingStorey ifcBuildingStorey = Model.Instances.New <IfcBuildingStorey>(); //Set the CompositionType to Element as it is a required field ifcBuildingStorey.CompositionType = IfcElementCompositionEnum.ELEMENT; //Add Created By, Created On and ExtSystem to Owner History. SetUserHistory(ifcBuildingStorey, row.ExtSystem, row.CreatedBy, row.CreatedOn); //using statement will set the Model.OwnerHistoryAddObject to ifcBuildingStorey.OwnerHistory as OwnerHistoryAddObject is used upon any property changes, //then swaps the original OwnerHistoryAddObject back in the dispose, so set any properties within the using statement using (COBieXBimEditScope context = new COBieXBimEditScope(Model, ifcBuildingStorey.OwnerHistory)) { //Add Name if (ValidateString(row.Name)) { ifcBuildingStorey.Name = row.Name; } //Add Category AddCategory(row.Category, ifcBuildingStorey); //Add GlobalId AddGlobalId(row.ExtIdentifier, ifcBuildingStorey); //Add Elevation if (ValidateString(row.Elevation)) { ifcBuildingStorey.Elevation = GetDoubleFromString(row.Elevation); } //Add Floor Height AddFloorHeight(row.Height, ifcBuildingStorey); //add Description if (ValidateString(row.Description)) { ifcBuildingStorey.Description = row.Description; } //create relationship between building and building story GetBuilding().AddToSpatialDecomposition(ifcBuildingStorey); } }
/// <summary> /// Returns the Gross Floor Area, if the element base quantity GrossFloorArea is defined /// </summary> /// <param name="buildingStorey"></param> /// <returns></returns> public static IfcAreaMeasure?GetGrossFloorArea(this IfcBuildingStorey buildingStorey) { IfcQuantityArea qArea = buildingStorey.GetQuantity <IfcQuantityArea>("BaseQuantities", "GrossFloorArea"); if (qArea == null) { qArea = buildingStorey.GetQuantity <IfcQuantityArea>("GrossFloorArea"); //just look for any area } if (qArea != null) { return(qArea.AreaValue); } return(null); }
public static IfcLengthMeasure?GetTotalHeight(this IfcBuildingStorey buildingStorey) { IfcQuantityLength qLen = buildingStorey.GetQuantity <IfcQuantityLength>("BaseQuantities", "TotalHeight"); if (qLen == null) { qLen = buildingStorey.GetQuantity <IfcQuantityLength>("TotalHeight"); //just look for any height } if (qLen != null) { return(qLen.LengthValue); } return(null); }
/// <summary> /// Get the floor height /// </summary> /// <param name="ifcBuildingStorey">IfcBuildingStory object</param> /// <param name="allPropertyValues">COBieDataPropertySetValues object holds all the properties for all the IfcBuildingStory </param> /// <returns></returns> private string GetFloorHeight(IfcBuildingStorey ifcBuildingStorey, COBieDataPropertySetValues allPropertyValues) { //try for a IfcQuantityLength related property to this building story IEnumerable <IfcQuantityLength> qLen = ifcBuildingStorey.IsDefinedByProperties.Select(p => p.RelatedObjects.OfType <IfcQuantityLength>()).FirstOrDefault(); if (qLen != null && qLen.FirstOrDefault() != null) { return(qLen.FirstOrDefault().LengthValue.ToString()); } //Fall back properties //get the property single values for this building story if (ifcBuildingStorey != allPropertyValues.CurrentObject) { allPropertyValues.SetAllPropertyValues(ifcBuildingStorey); } //try and find it in the attached properties of the building story string value = allPropertyValues.GetPropertySingleValueValue("StoreyHeight", true); if (value == DEFAULT_STRING) { value = allPropertyValues.GetPropertySingleValueValue("Storey Height", true); } if (value == DEFAULT_STRING) { value = allPropertyValues.GetPropertySingleValueValue("FloorHeight", true); } if (value == DEFAULT_STRING) { value = allPropertyValues.GetPropertySingleValueValue("Floor Height", true); } if (value == DEFAULT_STRING) { return(DEFAULT_NUMERIC); } else { //check it is a number and then format it double dblvalue = 0; if (double.TryParse(value, out dblvalue)) { return(string.Format("{0}", dblvalue)); } } return(DEFAULT_NUMERIC); }
/// <summary> /// This sample demonstrates the minimum steps to create a compliant IFC model that contains a single standard case wall /// </summary> static int Main() { //first create and initialise a model called Hello Wall Console.WriteLine("Initialising the IFC Project...."); using (var model = CreateandInitModel("HelloWall")) { if (model != null) { IfcBuilding building = CreateBuilding(model, "Default Building"); IfcBuildingStorey storey = CreateStorey(building); IfcWallStandardCase wall = CreateWall(model, 4000, 300, 2400); if (wall != null) { AddPropertiesToWall(model, wall); } using (var txn = model.BeginTransaction("Add Wall")) { building.AddToSpatialDecomposition(storey); storey.AddElement(wall); txn.Commit(); } if (wall != null) { try { Console.WriteLine("Standard Wall successfully created...."); //write the Ifc File model.SaveAs("HelloWallIfc4.ifc", IfcStorageType.Ifc); Console.WriteLine("HelloWallIfc4.ifc has been successfully written"); } catch (Exception e) { Console.WriteLine("Failed to save HelloWall.ifc"); Console.WriteLine(e.Message); } } } else { Console.WriteLine("Failed to initialise the model"); } } Console.WriteLine("Press any key to exit to view the IFC file...."); Console.ReadKey(); LaunchNotepad("HelloWallIfc4.ifc"); return(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)); } } }
public static IEnumerable <IfcBuildingStorey> GetBuildingStoreys(this IfcBuildingStorey buildingStorey, bool sortByElevation = false) { IEnumerable <IfcRelDecomposes> decomp = buildingStorey.IsDecomposedBy; IEnumerable <IfcObjectDefinition> objs = decomp.SelectMany(s => s.RelatedObjects); if (sortByElevation) { List <IfcBuildingStorey> storeys = objs.OfType <IfcBuildingStorey>().ToList(); storeys.Sort(CompareStoreysByElevation); return(storeys); } else { return(objs.OfType <IfcBuildingStorey>()); } }
public BuildingStorey(IfcStore model, string name, LocalPlacement localPlacement, IfcElementCompositionEnum compositionType, double elevation) { this.Model = model; ifcBuildingStorey = model.Instances.New <IfcBuildingStorey>(p => { p.Name = name; p.ObjectPlacement = localPlacement.IfcLocalPlacement; p.CompositionType = compositionType; p.Elevation = elevation; }); this.name = name; this.localPlacement = localPlacement; this.compositionType = compositionType; this.elevation = elevation; }
private string GetFloorDescription(IfcBuildingStorey bs) { if (bs != null) { if (!string.IsNullOrEmpty(bs.LongName)) { return(bs.LongName); } else if (!string.IsNullOrEmpty(bs.Description)) { return(bs.Description); } else if (!string.IsNullOrEmpty(bs.Name)) { return(bs.Name); } } return(DEFAULT_STRING); }
public void CreateProjectInitTest() { //==== DEFAULT PROJECT ==== IfcProject project_default = IfcInit.CreateProject(null, null, null); IfcSite site_default = IfcInit.CreateSite(null, null, null); project_default.Aggregate(site_default, null); IfcBuilding building_default = IfcInit.CreateBuilding(null, null, null, null); site_default.Aggregate(building_default, null); IfcBuildingStorey storey_default = IfcInit.CreateBuildingStorey(null, null, null, null); building_default.Aggregate(storey_default, null); using (FileStream fs = File.Create("./default_project.ifc")) { project_default.SerializeToStep(fs, "IFC2X3", null); } //==== MANUAL CONTENT PROJECT ==== IfcPerson person = IfcInit.CreatePerson("Melange", "Cedric"); IfcOrganization organization = IfcInit.CreateOrganization("test organization", "a dummy organization for testing", "MyOrg"); IfcApplication application = IfcInit.CreateApplication(organization, "1.0", "test app", "TestApp"); IfcOwnerHistory ownerHistory = IfcInit.CreateOwnerHistory(person, organization, application); IfcProject project_manual = IfcInit.CreateProject("manual", "My manual test project", ownerHistory); IfcSite site_manual = IfcInit.CreateSite("test site", "a dummy site for testing", ownerHistory); project_manual.Aggregate(site_manual, ownerHistory); IfcBuilding building_manual = IfcInit.CreateBuilding("test building", "a dummy building for testing", ownerHistory, site_manual.ObjectPlacement); site_manual.Aggregate(building_manual, ownerHistory); IfcBuildingStorey storey_manual = IfcInit.CreateBuildingStorey("first storey", "first storey for testing", ownerHistory, building_manual.ObjectPlacement); building_manual.Aggregate(storey_manual, null); using (FileStream fs = File.Create("./manual_project.ifc")) { project_manual.SerializeToStep(fs, "IFC2X3", "my company"); } }
protected BbFloor(IfcBuildingStorey ifcBuildingStorey) { var a = EarlyBindingInstanceModel.GetReferencedEntities(ifcBuildingStorey.EIN).Values; var b = (from x in a.OfType <IfcRelAggregates>() where x.RelatingObject.GetType() == typeof(IfcBuilding) select x).First() as IfcRelAggregates; IfcRelAggregates = b; if (b != null) { var sPrjGuid = BbInstanceDB.GetSemIdListByEin(b.RelatingObject.EIN).First(); var aa = BbInstanceDB.GetSemById(sPrjGuid) as BbBuilding; BbBuilding = aa; } IfcSpatialStructureElement = ifcBuildingStorey; }
BbFloor( string name, double elevation, BbBuilding building) { ObjectBbLocalPlacement = BbLocalPlacement3D.Create(building.ObjectBbLocalPlacement, BbHeaderSetting.Setting3D.DefaultBbPosition3D); IfcSpatialStructureElement = new IfcBuildingStorey { GlobalId = IfcGloballyUniqueId.NewGuid(), OwnerHistory = BbHeaderSetting.Setting3D.IfcOwnerHistory, Name = name, //Description = "", //ObjectType = "", ObjectPlacement = ObjectBbLocalPlacement.IfcLocalPlacement, //Representation = //LongName = "", CompositionType = IfcElementCompositionEnum.ELEMENT, Elevation = elevation, }; //building.AddFloor(this); BbBuilding = building; if (true) { IfcRelAggregates = new IfcRelAggregates() { GlobalId = IfcGloballyUniqueId.NewGuid(), OwnerHistory = BbHeaderSetting.Setting3D.IfcOwnerHistory, RelatingObject = BbBuilding.IfcSpatialStructureElement, RelatedObjects = new List <IfcObjectDefinition>() { IfcSpatialStructureElement }, }; } }
/// <summary> /// Add space to the building story(Floor) /// </summary> /// <param name="row"></param> /// <param name="ifcSpace"></param> private void AddSpaceToBuildingStory(string floorName, IfcSpace ifcSpace) { if (ValidateString(floorName)) { IfcBuildingStorey spaceBuildingStory = null; if (Floors.ContainsKey(floorName)) { spaceBuildingStory = Floors[floorName]; } else { spaceBuildingStory = Model.Instances.OfType <IfcBuildingStorey>().Where(bs => bs.Name.ToString().ToLower().Trim() == floorName.ToLower().Trim()).FirstOrDefault(); if (spaceBuildingStory != null) { Floors.Add(floorName, spaceBuildingStory); } } if (spaceBuildingStory != null) { spaceBuildingStory.AddToSpatialDecomposition(ifcSpace); } } }
public JsonStoreyIfcElement(IfcBuildingStorey storey, JsonBuildingIfcElement parent, JsonConversionContext context) : base(storey) { userData.siteId = parent.userData?.siteId; userData.projectId = parent.userData?.projectId; userData.buildingId = parent.userData?.buildingId; // userData.objectType = storey.objectType; // comment is from original code userData.type = "IfcBuildingStorey"; userData.name = storey.LongName; // Extract Pset // extractPset(ref storeyElement, buildingStorey); if (!userData.pset.ContainsKey("Elevation")) { userData.pset.Add("Elevation", (storey.Elevation / context.SCALE).ToString()); } // Add Matrix var bsObjectPlacements = storey.ObjectPlacement.Extract <IfcObjectPlacement>(); var bsLocalPlacements = bsObjectPlacements[0].Extract <IfcLocalPlacement>(); var bsPos = bsLocalPlacements[0].RelativePlacement as IfcAxis2Placement3D; if (bsPos.Location != null) { userData.location = bsPos.Location.Coordinates[0] / context.SCALE + "," + bsPos.Location.Coordinates[1] / context.SCALE + "," + bsPos.Location.Coordinates[2] / context.SCALE; } if (bsPos.RefDirection != null) { userData.refDirection = bsPos.RefDirection.DirectionRatios[0] + "," + bsPos.RefDirection.DirectionRatios[1] + "," + bsPos.RefDirection.DirectionRatios[2]; } if (bsPos.Axis != null) { userData.axis = bsPos.Axis.DirectionRatios[0] + "," + bsPos.Axis.DirectionRatios[1] + "," + bsPos.Axis.DirectionRatios[2]; } }
BbFloor( string name, double elevation, BbBuilding building) { ObjectBbLocalPlacement = BbLocalPlacement3D.Create(building.ObjectBbLocalPlacement, BbHeaderSetting.Setting3D.DefaultBbPosition3D); IfcSpatialStructureElement = new IfcBuildingStorey { GlobalId = IfcGloballyUniqueId.NewGuid(), OwnerHistory = BbHeaderSetting.Setting3D.IfcOwnerHistory, Name = name, //Description = "", //ObjectType = "", ObjectPlacement = ObjectBbLocalPlacement.IfcLocalPlacement, //Representation = //LongName = "", CompositionType = IfcElementCompositionEnum.ELEMENT, Elevation = elevation, }; //building.AddFloor(this); BbBuilding = building; if (true) { IfcRelAggregates = new IfcRelAggregates() { GlobalId = IfcGloballyUniqueId.NewGuid(), OwnerHistory = BbHeaderSetting.Setting3D.IfcOwnerHistory, RelatingObject = BbBuilding.IfcSpatialStructureElement, RelatedObjects = new List<IfcObjectDefinition>() { IfcSpatialStructureElement }, }; } }
internal static DatabaseIfc Generate(ModelView mdv, string path) { DatabaseIfc db = new DatabaseIfc(true, mdv); //IfcGeometricRepresentationContext //IfcCartesianPoint //IfcAxis2Placement3D //IfcDirection //IfcAxis2Placement2D //IfcSIUnit //IfcLocalPlacement IfcSite site = new IfcSite(db, "TestSite"); //IfcPerson NOT RV //IfcOrganization NOT RV //IfcPersonAndOrganization NOT RV //IfcOwnerHistory NOT RV //fcApplication NOT RV // IfcProjectLibrary NOT RV Can't have multiple context IfcProject project = new IfcProject(site, "TestProject", IfcUnitAssignment.Length.Millimetre) { }; //IfcUnitAssignment //IfcRelAggregates IfcBuilding building = new IfcBuilding(site, "TestBuilding") { }; IfcBuildingStorey buildingStorey = new IfcBuildingStorey(building, "TestBuildingStorey", 3000); IfcSpace space = new IfcSpace(buildingStorey, null, null) { Name = "TestSpace" }; space.RelatingType = new IfcSpaceType(db, "TestSpaceType", IfcSpaceTypeEnum.INTERNAL); IfcZone zone = new IfcZone(buildingStorey, "TestZone", "TestZoneLongName", new List <IfcSpace>() { space }); IfcLocalPlacement localPlacement = buildingStorey.Placement as IfcLocalPlacement; IfcMaterial material = new IfcMaterial(db, "TestMaterial") { Description = "TestDescription", Category = "TestCategory" }; IfcMaterialProperties materialProperties = new IfcMaterialProperties("TestMaterialProperties", material); materialProperties.AddProperty(new IfcPropertySingleValue(db, "MassDensity", new IfcMassDensityMeasure(1))); IfcSurfaceStyleShading surfaceStyleShading = new IfcSurfaceStyleShading(new IfcColourRgb(db, 1, 0, 0) { Name = "Red" }); IfcSurfaceStyle surfaceStyle = new IfcSurfaceStyle(surfaceStyleShading, null, null, null, null); IfcMaterialDefinitionRepresentation materialDefinitionRepresentation = new IfcMaterialDefinitionRepresentation(new IfcStyledRepresentation(new IfcStyledItem(surfaceStyle) { Name = "TestStyledItem" }), material); IfcIndexedPolyCurve indexedPolyCurve = IPE200Curve(db); IfcArbitraryClosedProfileDef arbitraryClosedProfileDef = new IfcArbitraryClosedProfileDef("IPE200", indexedPolyCurve); IfcMaterialProfile materialProfile = new IfcMaterialProfile("TestMaterialProfile", material, arbitraryClosedProfileDef); IfcMaterialProfileSet materialProfileSet = new IfcMaterialProfileSet("TestMaterialProfileSet", materialProfile); IfcExtrudedAreaSolid extrudedAreaSolid = new IfcExtrudedAreaSolid(arbitraryClosedProfileDef, new IfcAxis2Placement3D(new IfcCartesianPoint(db, 0, 0, 0), new IfcDirection(db, 1, 0, 0), new IfcDirection(db, 0, 1, 0)), new IfcDirection(db, 0, 0, 1), 5000); IfcBeamType beamType = new IfcBeamType(db, "TestBeamType", IfcBeamTypeEnum.BEAM); beamType.MaterialSelect = materialProfileSet; IfcBeam beam = new IfcBeam(buildingStorey, new IfcLocalPlacement(localPlacement, new IfcAxis2Placement3D(new IfcCartesianPoint(db, 1000, 2000, 0)) { RefDirection = new IfcDirection(db, 0, 1, 0) }), new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid))); //IfcGeometricRepresentationSubContext beam.RelatingType = beamType; //IfcRelDefinesByType // if(mdv != ModelView.Ifc4Reference) // IfcActorRole NOT RV //IfcActuator //IfcActuatorType //IfcAdvancedBrep NOT RV //IfcAdvancedFace NOT RV //IfcAirTerminal //IfcAirTerminalBox //IfcAirTerminalBoxType //IfcAirTerminalType //IfcAirToAirHeatRecovery //IfcAirToAirHeatRecoveryType //IfcAlarm //IfcAlarmType //IfcArbitraryOpenProfileDef //IfcArbitraryProfileDefWithVoids //IfcAsymmetricIShapeProfileDef NOT RV //IfcAudioVisualAppliance //IfcAudioVisualApplianceType //IfcAxis1Placement //IfcBeamStandardCase NOT RV //IfcBlock NOT RV //IfcBoiler //IfcBoilerType //IfcBooleanClippingResult NOT RV //IfcBooleanResult NOT RV //IfcBSplineCurveWithKnots NOT RV //IfcBSplineSurface NOT RV //IfcBSplineSurfaceWithKnots NOT RV //IfcBuildingElementPart //IfcBuildingElementPartType //IfcBuildingElementProxy //IfcBuildingElementProxyType //IfcBuildingSystem //IfcBurner //IfcBurnerType //IfcCableCarrierFitting //IfcCableCarrierFittingType //IfcCableCarrierSegment //IfcCableCarrierSegmentType //IfcCableFitting //IfcCableFittingType //IfcCableSegment //IfcCableSegmentType //IfcCartesianPointList2D //IfcCartesianPointList3D //IfcCartesianTransformationOperator2D //IfcCartesianTransformationOperator2DnonUniform //IfcCartesianTransformationOperator3D //IfcCartesianTransformationOperator3DnonUniform //IfcCenterLineProfileDef //IfcChiller //IfcChillerType //IfcChimney //IfcChimneyType //IfcCircle //IfcCircleHollowProfileDef NOT RV //IfcCircleProfileDef NOT RV //IfcCivilElement //IfcCivilElementType //IfcClassification //IfcClassificationReference //IfcClosedShell //IfcCoil //IfcCoilType //IfcColourRgbList //IfcColourSpecification //IfcColumn //IfcColumnStandardCase NOT RV //IfcColumnType //IfcCommunicationsAppliance //IfcCommunicationsApplianceType //IfcComplexProperty //IfcCompositeProfileDef NOT RV //IfcCompressor //IfcCompressorType //IfcCondenser //IfcCondenserType //IfcConnectedFaceSet NOT RV //IfcConnectionCurveGeometry NOT RV //IfcConnectionVolumeGeometry NOT RV //IfcController //IfcControllerType //IfcConversionBasedUnit //IfcConversionBasedUnitWithOffset //IfcCooledBeam //IfcCooledBeamType //IfcCoolingTower //IfcCoolingTowerType //IfcCovering //IfcCoveringType //IfcCsgSolid NOT RV //IfcCShapeProfileDef NOT RV //IfcCurtainWall //IfcCurtainWallType //IfcCurveStyle //IfcCurveStyleFont //IfcCurveStyleFontPattern //IfcDamper //IfcDamperType //IfcDerivedProfileDef NOT RV //IfcDerivedUnit //IfcDerivedUnitElement //IfcDimensionalExponents //IfcDiscreteAccessory //IfcDiscreteAccessoryType //IfcDistributionChamberElement //IfcDistributionChamberElementType //IfcDistributionCircuit //IfcDistributionControlElement //IfcDistributionControlElementType //IfcDistributionElement //IfcDistributionElementType //IfcDistributionFlowElement //IfcDistributionFlowElementType //IfcDistributionPort //IfcDistributionSystem //IfcDocumentReference //IfcDoor //IfcDoorLiningProperties //IfcDoorPanelProperties //IfcDoorStandardCase NOT RV //IfcDoorType //IfcDuctFitting //IfcDuctFittingType //IfcDuctSegment //IfcDuctSegmentType //IfcDuctSilencer //IfcDuctSilencerType //IfcEdge NOT RV //IfcEdgeCurve NOT RV //IfcEdgeLoop NOT RV //IfcElectricAppliance //IfcElectricApplianceType //IfcElectricDistributionBoard //IfcElectricDistributionBoardType //IfcElectricFlowStorageDevice //IfcElectricFlowStorageDeviceType //IfcElectricGenerator //IfcElectricGeneratorType //IfcElectricMotor //IfcElectricMotorType //IfcElectricTimeControl //IfcElectricTimeControlType //IfcElementAssembly //IfcElementAssemblyType //IfcElementComponent //IfcElementComponentType //IfcElementQuantity //IfcEllipseProfileDef NOT RV //IfcEnergyConversionDevice //IfcEnergyConversionDeviceType //IfcEngine //IfcEngineType //IfcEvaporativeCooler //IfcEvaporativeCoolerType //IfcEvaporator //IfcEvaporatorType //IfcExtendedProperties //IfcExternalInformation //IfcExternalReference //IfcExtrudedAreaSolidTapered NOT RV //IfcFace NOT RV //IfcFaceBasedSurfaceModel NOT RV //IfcFaceBound NOT RV //IfcFaceOuterBound NOT RV //IfcFaceSurface NOT RV //IfcFacetedBrep NOT RV //IfcFan //IfcFanType //IfcFastener //IfcFastenerType //IfcFeatureElement //IfcFeatureElementAddition NOT RV //IfcFeatureElementSubtraction //IfcFillAreaStyle //IfcFillAreaStyleHatching //IfcFilter //IfcFilterType //IfcFireSuppressionTerminal //IfcFireSuppressionTerminalType //IfcFixedReferenceSweptAreaSolid NOT RV //IfcFlowController //IfcFlowControllerType //IfcFlowFitting //IfcFlowFittingType //IfcFlowInstrument //IfcFlowInstrumentType //IfcFlowMeter //IfcFlowMeterType //IfcFlowMovingDevice //IfcFlowMovingDeviceType //IfcFlowSegment //IfcFlowSegmentType //IfcFlowStorageDevice //IfcFlowStorageDeviceType //IfcFlowTerminal //IfcFlowTerminalType //IfcFlowTreatmentDevice //IfcFlowTreatmentDeviceType //IfcFooting //IfcFootingType //IfcFurnishingElement //IfcFurnishingElementType //IfcFurniture //IfcFurnitureType //IfcGeographicElement //IfcGeographicElementType //IfcGeometricCurveSet //IfcGeometricSet //IfcGrid //IfcGridAxis //IfcGridPlacement NOT RV //IfcGroup //IfcHalfSpaceSolid NOT RV //IfcHeatExchanger //IfcHeatExchangerType //IfcHumidifier //IfcHumidifierType //IfcIndexedColourMap //IfcIndexedTextureMap //IfcIndexedTriangleTextureMap //IfcInterceptor //IfcInterceptorType //IfcIShapeProfileDef //IfcJunctionBox //IfcJunctionBoxType //IfcLamp //IfcLampType //IfcLibraryInformation NOT RV //IfcLibraryReference NOT RV //IfcLightFixture //IfcLightFixtureType //IfcLine //IfcLoop NOT RV //IfcLShapeProfileDef NOT RV //IfcMapConversion //IfcMappedItem //IfcMaterialConstituent //IfcMaterialConstituentSet //IfcMaterialLayer //IfcMaterialLayerSet //IfcMaterialLayerSetUsage NOT RV //IfcMaterialLayerWithOffsets NOT RV //IfcMaterialProfileSetUsage NOT RV //IfcMaterialProfileSetUsageTapering NOT RV //IfcMaterialProfileWithOffsets NOT RV //IfcMaterialUsageDefinition NOT RV //IfcMeasureWithUnit //IfcMechanicalFastener //IfcMechanicalFastenerType //IfcMedicalDevice //IfcMedicalDeviceType //IfcMember //IfcMemberStandardCase NOT RV //IfcMemberType //IfcMonetaryUnit //IfcMotorConnection //IfcMotorConnectionType //IfcNamedUnit //IfcOpeningElement //IfcOpeningStandardCase NOT RV //IfcOpenShell NOT RV //IfcOrientedEdge NOT RV //IfcOutlet //IfcOutletType //IfcPcurve NOT RV //IfcPhysicalComplexQuantity //IfcPhysicalQuantity //IfcPhysicalSimpleQuantity //IfcPile //IfcPileType //IfcPipeFitting //IfcPipeFittingType //IfcPipeSegment //IfcPipeSegmentType //IfcPlane NOT RV //IfcPlate //IfcPlateStandardCase NOT RV //IfcPlateType //IfcPoint //IfcPolygonalBoundedHalfSpace NOT RV //IfcPolyline NOT RV //IfcPolyLoop NOT RV //IfcPort //IfcPostalAddress //IfcPreDefinedPropertySet //IfcPresentationItem //IfcPresentationLayerAssignment //IfcPresentationStyle //IfcPresentationStyleAssignment //IfcProductDefinitionShape //IfcProductRepresentation //IfcProfileDef //IfcProfileProperties //IfcProjectedCRS //IfcProjectionElement NOT RV //IfcProperty //IfcPropertyAbstraction //IfcPropertyBoundedValue //IfcPropertyDefinition //IfcPropertyEnumeratedValue //IfcPropertyEnumeration //IfcPropertyListValue //IfcPropertySet //IfcPropertySetTemplate NOT RV //IfcPropertyTableValue //IfcPropertyTemplate NOT RV //IfcPropertyTemplateDefinition NOT RV //IfcProtectiveDevice //IfcProtectiveDeviceTrippingUnit //IfcProtectiveDeviceTrippingUnitType //IfcProtectiveDeviceType //IfcPump //IfcPumpType //IfcQuantityArea //IfcQuantityCount //IfcQuantityLength //IfcQuantitySet //IfcQuantityTime //IfcQuantityVolume //IfcQuantityWeight //IfcRailing //IfcRailingType //IfcRamp //IfcRampFlight //IfcRampFlightType //IfcRampType //IfcRectangleHollowProfileDef NOT RV //IfcRectangleProfileDef NOT RV //IfcRectangularPyramid NOT RV //IfcReinforcingBar //IfcReinforcingBarType //IfcReinforcingElement //IfcReinforcingElementType //IfcReinforcingMesh //IfcReinforcingMeshType //IfcRelAssignsToGroup //IfcRelAssociatesClassification //IfcRelAssociatesDocument //IfcRelAssociatesLibrary NOT RV //IfcRelAssociatesMaterial //IfcRelConnectsElements NOT RV //IfcRelConnectsPathElements NOT RV //IfcRelConnectsPorts //IfcRelConnectsWithRealizingElements NOT RV //IfcRelContainedInSpatialStructure //IfcRelCoversBldgElements //IfcRelDeclares //IfcRelDefinesByProperties //IfcRelFillsElement //IfcRelFlowControlElements NOT RV //IfcRelInterferesElements NOT RV //IfcRelNests //IfcRelProjectsElement NOT RV //IfcRelServicesBuildings //IfcRelVoidsElement //IfcRepresentation //IfcRepresentationContext //IfcRepresentationItem //IfcRepresentationMap //IfcRevolvedAreaSolid //IfcRevolvedAreaSolidTapered NOT RV //IfcRightCircularCone NOT RV //IfcRightCircularCylinder NOT RV //IfcRoof //IfcRoofType //IfcRoundedRectangleProfileDef NOT RV //IfcSanitaryTerminal //IfcSanitaryTerminalType //IfcSensor //IfcSensorType //IfcShadingDevice //IfcShadingDeviceType //IfcShapeRepresentation //IfcShellBasedSurfaceModel NOT RV //IfcSimplePropertyTemplate NOT RV //IfcSlab //IfcSlabElementedCase NOT RV //IfcSlabStandardCase NOT RV //IfcSlabType //IfcSolarDevice //IfcSolarDeviceType //IfcSpaceHeater //IfcSpaceHeaterType //IfcSpatialZone //IfcSpatialZoneType //IfcSphere NOT RV //IfcStackTerminal //IfcStackTerminalType //IfcStair //IfcStairFlight //IfcStairFlightType //IfcStairType //IfcStyleModel //IfcSurface NOT RV //IfcSurfaceCurveSweptAreaSolid NOT RV //IfcSurfaceOfLinearExtrusion NOT RV //IfcSurfaceOfRevolution NOT RV //IfcSurfaceStyleRendering //IfcSurfaceStyleWithTextures surfaceStyleWithTextures = new IfcSurfaceStyleWithTextures(new IfcImageTexture(db,true,true,"")); //IfcSweptDiskSolid //IfcSwitchingDevice //IfcSwitchingDeviceType //IfcSystemFurnitureElement //IfcSystemFurnitureElementType //IfcTank //IfcTankType //IfcTelecomAddress NOT RV //IfcTendon //IfcTendonAnchor //IfcTendonAnchorType //IfcTendonType //IfcTessellatedFaceSet //IfcTessellatedItem //IfcTextureCoordinate //IfcTextureVertexList //IfcTransformer //IfcTransformerType //IfcTransportElement //IfcTransportElementType //IfcTriangulatedFaceSet //IfcTrimmedCurve //IfcTShapeProfileDef NOT RV //IfcTubeBundle //IfcTubeBundleType //IfcUnitaryControlElement //IfcUnitaryControlElementType //IfcUnitaryEquipment //IfcUnitaryEquipmentType //IfcUShapeProfileDef NOT RV //IfcValve //IfcValveType //IfcVector //IfcVertex NOT RV //IfcVertexPoint NOT RV //IfcVibrationIsolator //IfcVibrationIsolatorType //IfcVirtualGridIntersection NOT RV //IfcWall //IfcWallElementedCase NOT RV //IfcWallStandardCase NOT RV //IfcWallType //IfcWasteTerminal //IfcWasteTerminalType //IfcWindow //IfcWindowLiningProperties //IfcWindowPanelProperties //IfcWindowStandardCase NOT RV //IfcWindowType //IfcZShapeProfileDef NOT RV db.WriteFile(Path.Combine(path, mdv.ToString() + ".ifc")); return(db); }
protected BbFloor(BbBuilding building, IfcBuildingStorey floor, IfcRelAggregates ifcRelAggregates) { BbBuilding = building; IfcSpatialStructureElement = floor; IfcRelAggregates = ifcRelAggregates; }