static void Main(string[] args) { DatabaseIfc db = new DatabaseIfc(ModelView.Ifc4DesignTransfer); IfcBuilding building = new IfcBuilding(db, "IfcBuilding") { }; IfcProject project = new IfcProject(building, "IfcProject", IfcUnitAssignment.Length.Millimetre) { }; //IfcBuildingStorey storey = new IfcBuildingStorey(building, "Ground Floor", 0); IfcMaterial masonryFinish = new IfcMaterial(db, "Masonry - Brick - Brown"); IfcMaterial masonry = new IfcMaterial(db, "Masonry"); IfcMaterialLayer layerFinish = new IfcMaterialLayer(masonryFinish, 110, "Finish"); IfcMaterialLayer airInfiltrationBarrier = new IfcMaterialLayer(db, 50, "Air Infiltration Barrier") { IsVentilated = IfcLogicalEnum.TRUE }; IfcMaterialLayer structure = new IfcMaterialLayer(masonry, 110, "Core"); string name = "Double Brick - 270"; IfcMaterialLayerSet materialLayerSet = new IfcMaterialLayerSet(new List <IfcMaterialLayer>() { layerFinish, airInfiltrationBarrier, structure }, name); IfcMaterialLayerSetUsage materialLayerSetUsage = new IfcMaterialLayerSetUsage(materialLayerSet, IfcLayerSetDirectionEnum.AXIS2, IfcDirectionSenseEnum.POSITIVE, 0); db.NextObjectRecord = 300; IfcWallType wallType = new IfcWallType(name, materialLayerSet, IfcWallTypeEnum.NOTDEFINED) { }; IfcWallStandardCase wallStandardCase = new IfcWallStandardCase(building, materialLayerSetUsage, new IfcAxis2Placement3D(new IfcCartesianPoint(db, 0, 0, 0)), 5000, 2000) { }; }
public static CcManufacturerProduct LoadProductDataTemplate(string key, string classificationCode) { IfcProject ifcProject = Workspace.Current.Documents[key].Project; CcManufacturerProduct ccProductDataTemplate = new CcManufacturerProduct(classificationCode); return(ccProductDataTemplate); }
public List <XTreeNode> CreateProjectTree(string projectId) { List <XTreeNode> projectStructure = new List <XTreeNode>(); try { string modelPath = GetFolderPath(projectId) + projectId + ".ifc"; model = IfcStore.Open(modelPath); IfcBuilding ifcBuilding = model.Instances.OfType <IfcBuilding>().FirstOrDefault(); if (ifcBuilding != null) { building = new XPreviewBuilding(ifcBuilding); IfcProject project = model.Instances.OfType <IfcProject>().FirstOrDefault(); if (project != null) { IfcUtils utils = new IfcUtils(); XTreeNode projectNode = utils.CreateProjectHierarchy(project); if (projectNode != null) { projectStructure.Add(projectNode); } } model.Close(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } return(projectStructure); }
/// <summary> /// Initialisiert ein leeres Projekt /// </summary> private static IfcStore createandInitModel(string projectName, string editorsFamilyName, string editorsGivenName, string editorsOrganisationName, out IfcProject project) { //first we need to set up some credentials for ownership of data in the new model var credentials = new XbimEditorCredentials { ApplicationDevelopersName = "HTW Dresden for DDBIM", ApplicationFullName = System.Reflection.Assembly.GetExecutingAssembly().FullName, ApplicationIdentifier = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, ApplicationVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(), EditorsFamilyName = editorsFamilyName, EditorsGivenName = editorsGivenName, EditorsOrganisationName = editorsOrganisationName }; var model = IfcStore.Create(credentials, XbimSchemaVersion.Ifc2X3, XbimStoreType.EsentDatabase); //Begin a transaction as all changes to a model are ACID using (var txn = model.BeginTransaction("Initialise Model")) { //create a project project = model.Instances.New <IfcProject>(); //set the units to SI (metres) project.Initialize(ProjectUnits.SIUnitsUK); project.Name = projectName; project.UnitsInContext.SetOrChangeSiUnit(IfcUnitEnum.LENGTHUNIT, IfcSIUnitName.METRE, null); //now commit the changes, else they will be rolled back at the end of the scope of the using statement txn.Commit(); } return(model); }
//Demonstration of approach to filter out fire rated walls into seperate IFC file static void Main(string[] args) { DatabaseIfc db = new DatabaseIfc(args[0]); DuplicateOptions duplicateOptions = new DuplicateOptions(db.Tolerance); duplicateOptions.DuplicateDownstream = false; DatabaseIfc filteredDb = new DatabaseIfc(db); IfcProject project = filteredDb.Factory.Duplicate(db.Project, duplicateOptions) as IfcProject; duplicateOptions.DuplicateDownstream = true; List <IfcWall> walls = db.Project.Extract <IfcWall>(); foreach (IfcWall wall in walls) { IfcPropertySingleValue property = wall.FindProperty("FireRating", true) as IfcPropertySingleValue; if (property != null && property.NominalValue != null) { string value = property.NominalValue.ValueString.Trim(); if (value != "0") { filteredDb.Factory.Duplicate(wall, duplicateOptions); } } } filteredDb.WriteFile(args[1]); }
public XbimModelViewModel(IfcProject project, IXbimViewModel parent) { xbimModel = project.ModelOf as XbimModel; _project = project; this.CreatingParent = parent; IEnumerable subs = this.Children; //call this once to preload first level of hierarchy }
private static IfcStore CreateAndInitModel(string projectName) { var credentials = new XbimEditorCredentials { ApplicationDevelopersName = "xbim developer", ApplicationFullName = "T-Rex", ApplicationIdentifier = "T-Rex", ApplicationVersion = "0.2", EditorsFamilyName = "Team", EditorsGivenName = "xbim", EditorsOrganisationName = "xbim developer" }; var model = IfcStore.Create(credentials, XbimSchemaVersion.Ifc4x1, XbimStoreType.InMemoryModel); using (ITransaction transaction = model.BeginTransaction("Initialise Model")) { IfcProject project = model.Instances.New <IfcProject>(); project.Initialize(ProjectUnits.SIUnitsUK); project.Name = projectName; transaction.Commit(); } return(model); }
static void Main(string[] args) { DatabaseIfc db = new DatabaseIfc(Console.In); IfcProject project = db.Project; Console.Out.Write("Number of Stories in file :" + project.Extract <IfcBuildingStorey>().Count); }
/// <summary> /// Sets up the basic parameters any model must provide, units, ownership etc /// </summary> /// <param name="projectName">Name of the project</param> /// <returns></returns> private XbimModel CreateandInitModel(string projectName) { XbimModel model = XbimModel.CreateModel(projectName + ".xBIM");; //create an empty model //Begin a transaction as all changes to a model are transacted using (XbimReadWriteTransaction txn = model.BeginTransaction("Initialise Model")) { //do once only initialisation of model application and editor values model.DefaultOwningUser.ThePerson.GivenName = "John"; model.DefaultOwningUser.ThePerson.FamilyName = "Bloggs"; model.DefaultOwningUser.TheOrganization.Name = "Department of Building"; model.DefaultOwningApplication.ApplicationIdentifier = "Construction Software inc."; model.DefaultOwningApplication.ApplicationDeveloper.Name = "Construction Programmers Ltd."; model.DefaultOwningApplication.ApplicationFullName = "Ifc sample programme"; model.DefaultOwningApplication.Version = "2.0.1"; //set up a project and initialise the defaults IfcProject project = model.Instances.New <IfcProject>(); project.Initialize(ProjectUnits.SIUnitsUK); project.Name = "testProject"; project.OwnerHistory.OwningUser = model.DefaultOwningUser; project.OwnerHistory.OwningApplication = model.DefaultOwningApplication; //validate and commit changes if (model.Validate(txn.Modified(), Console.Out) == 0) { txn.Commit(); return(model); } } return(null); //failed so return nothing }
static void Main(string[] args) { DatabaseIfc db = new DatabaseIfc(ModelView.Ifc4DesignTransfer); IfcBuilding building = new IfcBuilding(db, "IfcBuilding") { }; IfcProject project = new IfcProject(building, "IfcProject", IfcUnitAssignment.Length.Millimetre) { }; //IfcBuildingStorey storey = new IfcBuildingStorey(building, "Ground Floor", 0); IfcMaterial masonryFinish = new IfcMaterial(db, "Masonry - Brick - Brown"); IfcMaterial masonry = new IfcMaterial(db, "Masonry"); IfcMaterialLayer layerFinish = new IfcMaterialLayer(masonryFinish, 110, "Finish"); IfcMaterialLayer airInfiltrationBarrier = new IfcMaterialLayer(db, 50, "Air Infiltration Barrier") { IsVentilated = IfcLogicalEnum.TRUE }; IfcMaterialLayer structure = new IfcMaterialLayer(masonry, 110, "Core"); string name = "Double Brick - 270"; IfcMaterialLayerSet materialLayerSet = new IfcMaterialLayerSet(new List <IfcMaterialLayer>() { layerFinish, airInfiltrationBarrier, structure }, name); db.NextObjectRecord = 300; IfcWallType wallType = new IfcWallType(name, materialLayerSet, IfcWallTypeEnum.NOTDEFINED) { }; // todo implement rhinocommon overload IfcWallStandardCase wallStandardCase = new IfcWallStandardCase(building, wallType, new Line(0, 0, 0, 5000, 0, 0), 2000, 0, true, null) { }; }
static void Main(string[] args) { DatabaseIfc db = new DatabaseIfc(Console.In); IfcProject project = db.Project; IfcSpatialElement rootElement = project.RootElement; List <IfcBuildingElement> elements = project.Extract <IfcBuildingElement>(); List <IfcFacetedBrep> breps = new List <IfcFacetedBrep>(); foreach (IfcBuildingElement element in elements) { List <IfcRepresentation> reps = element.Representation.Representations; foreach (IfcRepresentation rep in reps) { IfcShapeRepresentation sr = rep as IfcShapeRepresentation; if (sr != null) { List <IfcRepresentationItem> items = sr.Items; foreach (IfcRepresentationItem item in items) { IfcFacetedBrep fb = item as IfcFacetedBrep; if (fb != null) { breps.Add(fb); } } } } } }
/// <summary> /// Set up the Model Object /// </summary> private void ModelSetUp() { using (XbimReadWriteTransaction trans = Model.BeginTransaction("Model initialization")) { Assembly assembly = Assembly.GetExecutingAssembly(); FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location); string version = fvi.ProductVersion; Model.DefaultOwningApplication.ApplicationIdentifier = fvi.Comments; Model.DefaultOwningApplication.ApplicationDeveloper.Name = fvi.CompanyName; Model.DefaultOwningApplication.ApplicationFullName = fvi.ProductName; Model.DefaultOwningApplication.Version = fvi.ProductVersion; //TODO add correct IfcPersonAndOrganization to DefaultOwningUser Model.DefaultOwningUser.ThePerson.FamilyName = "Unknown"; Model.DefaultOwningUser.TheOrganization.Name = "Unknown"; if (Model.Header == null) { Model.Header = new IfcFileHeader(IfcFileHeader.HeaderCreationMode.InitWithXbimDefaults); } Model.Header.FileDescription.Description.Clear(); Model.Header.FileDescription.Description.Add("ViewDefinition[CoordinationView]"); Model.Header.FileName.Name = Path.GetFileName(FileName); Model.Header.FileName.AuthorName.Add("4Projects"); Model.Header.FileName.AuthorizationName = "4Projects"; IfcProject project = Model.Instances.New <IfcProject>(); //set world coordinate system XBimContext.WCS = Model.Instances.New <IfcAxis2Placement3D>(); XBimContext.WCS.SetNewDirectionOf_XZ(1, 0, 0, 0, 0, 1); XBimContext.WCS.SetNewLocation(0, 0, 0); trans.Commit(); } }
public void CanConstructAProject() { var id = new IfcGloballyUniqueId(TestId()); var p = new IfcProject(id); Assert.NotNull(p); }
private static IfcBuilding CreateBuilding(IfcStore model, IfcProject project, string name) { var building = model.Instances.New <IfcBuilding>(b => b.Name = name); project.AddBuilding(building); return(building); }
static void Main(string[] args) { DatabaseIfc db = new DatabaseIfc(Console.In); IfcProject project = db.Project; IfcSpatialElement rootElement = project.RootElement(); List <IfcBuiltElement> elements = project.Extract <IfcBuiltElement>(); //IfcBuiltElement renamed from IfcBuildingElement List <IfcFacetedBrep> breps = new List <IfcFacetedBrep>(); foreach (IfcBuiltElement element in elements) { IfcProductDefinitionShape representation = element.Representation; if (representation != null) { foreach (IfcShapeModel rep in representation.Representations) { IfcShapeRepresentation sr = rep as IfcShapeRepresentation; if (sr != null) { foreach (IfcRepresentationItem item in sr.Items) { IfcFacetedBrep fb = item as IfcFacetedBrep; if (fb != null) { breps.Add(fb); } } } } } } }
//sample to show how to create a model from scratch static void Main(string[] args) { Logger.Debug("Creating Model..."); XbimModel model = CreateModel("NewModel"); if (model != null) { using (XbimReadWriteTransaction txn = model.BeginTransaction()) //start a readwrite transaction { try { IfcProject project = model.Instances.New <IfcProject>(); //Project Created txn.Commit(); //commit the changes if nothing went wrong } catch (Exception e) { Logger.DebugFormat("Error {0}\nRolling back changes.....", e.Message); } } model.SaveAs("NewModel.ifc", XbimStorageType.IFC); //export as an Ifc File model.Close(); //close the model and release all resources and handles } Logger.Debug("Model Created Ended..."); Console.ReadLine(); // CreateProject }
private void openFileButton_Click(object sender, RoutedEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "ifc|*.ifc"; ofd.ShowDialog(); DatabaseIfc db = new DatabaseIfc(ofd.FileName); IfcProject project = db.Project; IfcSpatialElement rootElement = project.RootElement; List <IfcBuildingElement> elements = project.Extract <IfcBuildingElement>(); List <IfcFacetedBrep> breps = new List <IfcFacetedBrep>(); foreach (IfcBuildingElement element in elements) { //outputLabel.Content += element.Name+ "\n"; IfcProductRepresentation representation = element.Representation; if (representation != null) { foreach (IfcRepresentation rep in representation.Representations) { IfcShapeRepresentation sr = rep as IfcShapeRepresentation; if (sr != null) { foreach (IfcRepresentationItem item in sr.Items) { Debug.WriteLine(item.GetType()); IfcFacetedBrep fb = item as IfcFacetedBrep; if (fb != null) { breps.Add(fb); outputLabel.Content += fb + "\n"; /// Each IfcFacetedBrep has one IfcClosedShell called "Outer". /// IfcClosedShell has several IfcFaces called CfsFaces //foreach (var face in fb.Outer.CfsFaces) //{ // /// IfcFace has several IfcFaceOuterBounds called bounds // foreach(var bound in face.Bounds) // { // /// Each IfcFaceOuterBound inherited from IfcFacetedBrep has IfcPolyLoop // var loop = bound.Bound as IfcPolyloop; // if(loop != null) // { // foreach(var point in loop.Polygon) // { // //point.Coordinates; // outputLabel.Content += point.Coordinates + "\n"; // } // } // } //} //outputLabel.Content += fb.ToString() + "\n"; } } } } } } }
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 IfcProject AddProject(string name, string description) { var p = new IfcProject(IfcGuid.IfcGuid.ToIfcGuid(Guid.NewGuid())); p.Name = name; p.Description = description; storage.AddInstance(p); return(p); }
public ProjectType(IfcProject ifcProject, CoBieLiteHelper helper) : this() { // _ifcProject = ifcProject; externalEntityName = helper.ExternalEntityName(ifcProject); externalID = helper.ExternalEntityIdentity(ifcProject); externalSystemName = helper.ExternalSystemName(ifcProject); ProjectName = ifcProject.Name; ProjectDescription = ifcProject.Description; }
public IfcSite AddSite(IfcProject project, string name = "", string description = "") { var s = new IfcSite(IfcGuid.IfcGuid.ToIfcGuid(Guid.NewGuid())); s.Name = name; s.Description = description; storage.AddInstance(s); CreateAggregationRelationship(project, s); return(s); }
protected override Project Mapping(IfcProject source, Project target) { var helper = ((IfcToCOBieLiteUkExchanger)Exchanger).Helper; target.ExternalEntity = helper.ExternalEntityName(source); target.ExternalId = helper.ExternalEntityIdentity(source); target.Name = source.Name; target.Description = source.Description; return(target); }
private static void HandleBuildings(IfcProject ifcProject, IEnumerable <IIfcBuilding> buildings) { foreach (var building in buildings) { Console.WriteLine("description: " + building.BuildingAddress.Description); var storeys = building.BuildingStoreys; var site = ifcProject.Sites.FirstOrDefault(); HandleStoreys(storeys, site.RefLongitude.Value.AsDouble, site.RefLatitude.Value.AsDouble); } }
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> /// Set the global units in the UnitsInContext property /// </summary> private IfcUnitAssignment GetProjectUnitAssignment() { IfcProject ifcProject = Model.IfcProject; if (ifcProject.UnitsInContext == null) { ifcProject.UnitsInContext = Model.Instances.New <IfcUnitAssignment>(); } return(ifcProject.UnitsInContext); }
private void ViewModel() { IfcProject project = Model.IfcProject; if (project != null) { ChildrenPath = "Children"; ObservableCollection <XbimModelViewModel> svList = new ObservableCollection <XbimModelViewModel>(); svList.Add(new XbimModelViewModel(project, null)); HierarchySource = svList; } }
private void ViewModel() { IfcProject project = Model.IfcProject as IfcProject; if (project != null) { this.ChildrenBinding = new Binding("Children"); ObservableCollection <XbimModelViewModel> svList = new ObservableCollection <XbimModelViewModel>(); svList.Add(new XbimModelViewModel(project, null)); this.HierarchySource = svList; } }
public XTreeNode CreateProjectHierarchy(IfcProject project) { XTreeNode projectNode = null; if (project != null) { projectNode = CreateObject(project); PrintHierarchy(project, projectNode); } return(projectNode); }
static void Main(string[] args) { var dbInitial = new DatabaseIfc(ModelView.Ifc4NotAssigned); dbInitial.Factory.Options.GenerateOwnerHistory = false; var site = new IfcSite(dbInitial, "site") { Guid = new Guid("aa4019f8-2584-44a1-a132-c17dfff69c41") }; var project = new IfcProject(dbInitial, "GeomRep") { Guid = new Guid("94d4ddac-9120-4fb9-bea0-7a414ee725d4") }; new IfcRelAggregates(project, new List <IfcObjectDefinition>() { site }) { Guid = new Guid("5e1fd0e5-b005-fe11-501e-5caff01dc1ad") }; IfcAxis2Placement3D placement1 = new IfcAxis2Placement3D(new IfcCartesianPoint(dbInitial, 2, 5, 1)); IfcLocalPlacement objectPlacement1 = new IfcLocalPlacement(site.ObjectPlacement, placement1); IfcAxis2Placement3D placement2 = new IfcAxis2Placement3D(new IfcCartesianPoint(dbInitial, 14, 5, 1)); IfcLocalPlacement objectPlacement2 = new IfcLocalPlacement(site.ObjectPlacement, placement2); var profile1 = new IfcRectangleProfileDef(dbInitial, "rectangleProfileDef", 4, 6); IfcExtrudedAreaSolid extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35); IfcProductDefinitionShape shape1 = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1)); var profile2 = new IfcRectangleProfileDef(dbInitial, "rectangleProfileDef", 5, 8); IfcExtrudedAreaSolid extrudedAreaSolid2 = new IfcExtrudedAreaSolid(profile2, 4.1); IfcProductDefinitionShape shape2 = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid2)); var proxy1 = new IfcBuildingElementProxy(site, objectPlacement1, shape1) { Name = "Cuboid1", Guid = new Guid("fbc7f4b2-177d-4875-88bb-d3b44115bbaa") }; var proxy2 = new IfcBuildingElementProxy(site, objectPlacement2, shape2) { Name = "Cuboid2", Guid = new Guid("f8e196cb-c7d9-4d53-9885-0f687706727a") }; dbInitial.WriteFile("cube_double.ifc"); }
public static void InitializeManufacturerFile(string key, string manufacurerName, string manufacturerDescription) { IfcProject ifcProject = Workspace.Current.Documents[key].Project; ifcProject.Name = manufacurerName; ifcProject.LongName = manufacturerDescription; IfcSite site = ifcProject.Sites.AddNewSite(); site.Name = manufacurerName; site.LongName = manufacturerDescription; }
internal void GenerateExample(string path,ModelView modelView) { STPModelData md = new STPModelData(false,modelView); md.NextObjectRecord = 50; IfcBuilding building = new IfcBuilding(md, "IfcBuilding") { GlobalId = "39t4Pu3nTC4ekXYRIHJB9W"}; building.ContainsElements[0].GlobalId = "3Sa3dTJGn0H8TQIGiuGQd5"; building.Comments.Add("defines the default building (as required as the minimum spatial element) "); md.NextObjectRecord = 100; IfcProject project = new IfcProject(building, "IfcProject", GGYM.Units.Length.mm) { GlobalId = "0$WU4A9R19$vKWO$AdOnKA"}; project.IsDecomposedBy[0].GlobalId = "091a6ewbvCMQ2Vyiqspa7a"; project.RepresentationContexts[0].Comments.Add("general entities required for all IFC data sets, defining the context for the exchange"); md.NextObjectRecord = 200; GenerateData(md,building); string filePath = Path.Combine(path,this.GetType().Name + ".ifc"); if (File.Exists(filePath)) { string[] newLines = md.ToString().Split(new char[] { '\r' , '\n' },StringSplitOptions.RemoveEmptyEntries); List<string> existingLines = new List<string>( File.ReadAllLines(filePath)); existingLines.RemoveAll(x => string.IsNullOrEmpty(x)); if (newLines.Length == existingLines.Count) { bool identical = true; for (int icounter = 0; icounter < newLines.Length; icounter++) { string s1 = newLines[icounter], s2 = existingLines[icounter]; if (s1.StartsWith("/* time_stamp */ ") && s2.StartsWith("/* time_stamp */ ")) continue; if (string.Compare(s1, s2, true) != 0) { identical = false; break; } } if (identical) return; } } md.WriteFile(filePath); }
//: this() protected BbProject(Guid guid, string name, string description, string objectType, string longname, string phase) { _ifcProject = new IfcProject { GlobalId = IfcGloballyUniqueId.ConvertToIfcGuid(guid), OwnerHistory = BbHeaderSetting.Setting3D.IfcOwnerHistory, Name = name, Description = description, ObjectType = objectType, LongName = longname, Phase = phase, RepresentationContexts = new List<IfcRepresentationContext>(), UnitsInContext = BbHeaderSetting.Setting3D.IfcUnitAssignment, }; _ifcProject.RepresentationContexts.Add(BbHeaderSetting.Setting3D.GeometricRepresentationContext); }
//protected BbProject() //{ //} //protected BbProject(string name) // : this(Guid.NewGuid(), name, null, null, null, null) //{ //} protected BbProject(IfcProject ifcProject) { _ifcProject = ifcProject; }