Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="authorName"></param>
        /// <param name="authorCompany"></param>
        /// <param name="softwareName"></param>
        /// <param name="softwareVersion"></param>
        /// <param name="softwareCompany"></param>
        public void SetCreator(
            string authorName,
            string authorCompany,
            string softwareName,
            string softwareVersion,
            string softwareCompany)
        {
            var person = new IfcPerson
            {
                GivenName  = authorName,
                FamilyName = authorName
            };
            var organization = new IfcOrganization(authorCompany);

            var personAndOrganization = new IfcPersonAndOrganization(person, organization);

            var appOrganization = new IfcOrganization(softwareCompany);

            var application = new IfcApplication
            {
                ApplicationDeveloper = appOrganization,
                Version               = softwareVersion,
                ApplicationFullName   = softwareName,
                ApplicationIdentifier = softwareCompany + @"." + softwareName,
            };

            IfcOwnerHistory = new IfcOwnerHistory()
            {
                OwningUser        = personAndOrganization,
                OwningApplication = application,
                State             = IfcStateEnum.READONLY,
                ChangeAction      = IfcChangeActionEnum.NOCHANGE,
                CreationDate      = IfcTimeStamp.GetTimeStamp(),
            };
        }
Example #2
0
 public IfcOwnerHistory(IfcPersonAndOrganization owningUser, IfcApplication application)
 {
     if (owningUser == null) throw new ArgumentNullException("owningUser");
     OwningUser = owningUser;
     OwningApplication = application;
     ChangeAction = IfcChangeActionEnum.NOCHANGE;
     CreationDate = IfcTimeStamp.GetTimeStamp();
 }
Example #3
0
        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;
        }
Example #4
0
 public IfcOwnerHistory(IfcPersonAndOrganization owningUser, IfcApplication application)
 {
     if (owningUser == null)
     {
         throw new ArgumentNullException("owningUser");
     }
     OwningUser        = owningUser;
     OwningApplication = application;
     ChangeAction      = IfcChangeActionEnum.NOCHANGE;
     CreationDate      = IfcTimeStamp.GetTimeStamp();
 }
 public Application(IfcStore model, Organization developer, string version, string appName, string appIdentifier)
 {
     ifcApplication = model.Instances.New <IfcApplication>(p =>
     {
         p.ApplicationDeveloper = developer.IfcOrganization;
         p.Version               = version;
         p.ApplicationFullName   = appName;
         p.ApplicationIdentifier = appIdentifier;
     });
     applicationDeveloper  = developer;
     this.version          = version;
     applicationFullName   = appName;
     applicationIdentifier = appIdentifier;
 }
Example #6
0
        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");
            }
        }
Example #7
0
        public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
        {
            switch (propIndex)
            {
            case 0:
                _owningUser = (IfcPersonAndOrganization)(value.EntityVal);
                return;

            case 1:
                _owningApplication = (IfcApplication)(value.EntityVal);
                return;

            case 2:
                _state = (IfcStateEnum)System.Enum.Parse(typeof(IfcStateEnum), value.EnumVal, true);
                return;

            case 3:
                _changeAction = (IfcChangeActionEnum)System.Enum.Parse(typeof(IfcChangeActionEnum), value.EnumVal, true);
                return;

            case 4:
                _lastModifiedDate = value.IntegerVal;
                return;

            case 5:
                _lastModifyingUser = (IfcPersonAndOrganization)(value.EntityVal);
                return;

            case 6:
                _lastModifyingApplication = (IfcApplication)(value.EntityVal);
                return;

            case 7:
                _creationDate = value.IntegerVal;
                return;

            default:
                throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper()));
            }
        }
Example #8
0
        public Model(IDictionary <Guid, BaseIfc> storage, string name, string description, IfcAddress address, IfcPerson user, IfcOrganization owner)
        {
            this.storage = storage;

            this.storage.Add(address.Id, address);
            this.storage.Add(user.Id, user);
            this.storage.Add(owner.Id, owner);

            // Create an organization for app creation.
            var appOrg = new IfcOrganization(APPNAME);

            this.storage.Add(appOrg.Id, appOrg);

            // Create an authoring application.
            var v   = owner.GetType().Assembly.GetName().Version.ToString();
            var app = new IfcApplication(appOrg, v, APPNAME, APPNAME);

            this.storage.Add(app.Id, app);

            // Create an person and history for the owner history.
            var personAndOrg = new IfcPersonAndOrganization(user, owner);

            this.storage.Add(personAndOrg.Id, personAndOrg);

            // Create an owner history for the project.
            var history = new IfcOwnerHistory(personAndOrg, app, UnixNow());

            this.storage.Add(history.Id, history);

            var lu = new IfcSIUnit(null, IfcUnitEnum.LENGTHUNIT, IfcSIUnitName.METRE);

            this.storage.Add(lu.Id, lu);
            var lengthUnit = new IfcUnit(lu);

            var au = new IfcSIUnit(null, IfcUnitEnum.AREAUNIT, IfcSIUnitName.SQUARE_METRE);

            this.storage.Add(au.Id, au);
            var areaUnit = new IfcUnit(au);

            var vu = new IfcSIUnit(null, IfcUnitEnum.VOLUMEUNIT, IfcSIUnitName.CUBIC_METRE);

            this.storage.Add(vu.Id, vu);
            var volumeUnit = new IfcUnit(vu);

            var sau = new IfcSIUnit(null, IfcUnitEnum.SOLIDANGLEUNIT, IfcSIUnitName.STERADIAN);

            this.storage.Add(sau.Id, sau);
            var solidAngleUnit = new IfcUnit(sau);

            var mu = new IfcSIUnit(null, IfcUnitEnum.MASSUNIT, IfcSIUnitName.GRAM);

            this.storage.Add(mu.Id, mu);
            var massUnit = new IfcUnit(mu);

            var tu = new IfcSIUnit(null, IfcUnitEnum.TIMEUNIT, IfcSIUnitName.SECOND);

            this.storage.Add(tu.Id, tu);
            var timeUnit = new IfcUnit(tu);

            var thu = new IfcSIUnit(null, IfcUnitEnum.THERMODYNAMICTEMPERATUREUNIT, IfcSIUnitName.DEGREE_CELSIUS);

            this.storage.Add(thu.Id, thu);
            var thermUnit = new IfcUnit(thu);

            var lmu = new IfcSIUnit(null, IfcUnitEnum.LUMINOUSINTENSITYUNIT, IfcSIUnitName.LUMEN);

            this.storage.Add(lmu.Id, lmu);
            var lumUnit = new IfcUnit(lmu);

            var pau = new IfcSIUnit(null, IfcUnitEnum.PLANEANGLEUNIT, IfcSIUnitName.RADIAN);

            this.storage.Add(pau.Id, pau);
            var planeAngleUnit = new IfcUnit(pau);

            var measure = new IfcMeasureWithUnit(new IfcValue(new IfcMeasureValue(new IfcPlaneAngleMeasure(1.745e-2))), planeAngleUnit);

            this.storage.Add(measure.Id, measure);

            var dimExp = new IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 0);

            this.storage.Add(dimExp.Id, dimExp);

            var du = new IfcConversionBasedUnit(dimExp, IfcUnitEnum.PLANEANGLEUNIT, "DEGREE", measure);

            this.storage.Add(du.Id, du);
            var degree = new IfcUnit(du);

            var units = new List <IfcUnit> {
                lengthUnit, areaUnit, volumeUnit, solidAngleUnit, massUnit, timeUnit, thermUnit, lumUnit, planeAngleUnit, degree
            };
            var unitAss = new IfcUnitAssignment(units);

            this.storage.Add(unitAss.Id, unitAss);

            // Create the project.
            var proj = new IfcProject(IfcGuid.ToIfcGuid(Guid.NewGuid()), history, name, description, null, null, null, null, unitAss);

            this.storage.Add(proj.Id, proj);
        }
Example #9
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="authorName"></param>
        /// <param name="authorCompany"></param>
        /// <param name="softwareName"></param>
        /// <param name="softwareVersion"></param>
        /// <param name="softwareCompany"></param>
        public void SetCreator(
            string authorName,
            string authorCompany,
            string softwareName,
            string softwareVersion,
            string softwareCompany)
        {
            var person = new IfcPerson
            {
                GivenName = authorName,
                FamilyName = authorName
            };
            var organization = new IfcOrganization(authorCompany);

            var personAndOrganization = new IfcPersonAndOrganization(person, organization);

            var appOrganization = new IfcOrganization(softwareCompany);

            var application = new IfcApplication
            {
                ApplicationDeveloper = appOrganization,
                Version = softwareVersion,
                ApplicationFullName = softwareName,
                ApplicationIdentifier = softwareCompany + @"." + softwareName,
            };
            IfcOwnerHistory = new IfcOwnerHistory()
            {
                OwningUser = personAndOrganization,
                OwningApplication = application,
                State = IfcStateEnum.READONLY,
                ChangeAction = IfcChangeActionEnum.NOCHANGE,
                CreationDate = IfcTimeStamp.GetTimeStamp(),
            };
        }