Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            DatabaseIfc db = new DatabaseIfc(ModelView.Ifc4X3NotAssigned);

            db.Factory.Options.GenerateOwnerHistory = false;

            IfcProject        project        = new IfcProject(db, "DemoProject");
            IfcProjectLibrary projectLibrary = new IfcProjectLibrary(db, "ClassificationLibrary");

            project.AddDeclared(projectLibrary);

            IfcClassification classification = new IfcClassification(db, "MyClassification");

            new IfcRelAssociatesClassification(classification, projectLibrary);

            IfcClassificationReference buildingElements = new IfcClassificationReference(classification)
            {
                Identification = "100", Name = "BuildingElements"
            };
            IfcClassificationReference walls = new IfcClassificationReference(buildingElements)
            {
                Identification = "100.100", Name = "Walls"
            };
            IfcClassificationReference partionWalls = new IfcClassificationReference(walls)
            {
                Identification = "100.100.002", Name = "PartiionWalls"
            };

            IfcSimplePropertyTemplate simplePropertyTemplate = new IfcSimplePropertyTemplate(db, "IsExternal")
            {
                GlobalId = "3Yss80qXKHuO00025QrE$V", PrimaryMeasureType = "IfcBoolean"
            };
            IfcPropertySetTemplate psetTemplate = new IfcPropertySetTemplate("Pset_WallCommon", simplePropertyTemplate)
            {
                GlobalId = "2VWFE0qXKHuO00025QrE$V"
            };

            IfcPropertySingleValue psv  = new IfcPropertySingleValue(db, "IsExternal", new IfcBoolean(false));
            IfcPropertySet         pset = new IfcPropertySet("Pset_WallCommon", psv);

            new IfcRelDefinesByTemplate(pset, psetTemplate);

            new IfcRelAssociatesClassification(partionWalls, pset);

            DirectoryInfo di = Directory.GetParent(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location));

            di = Directory.GetParent(di.FullName);
            db.WriteFile(Path.Combine(di.FullName, "TestClassification.ifc"));
        }
Ejemplo n.º 2
0
 internal IfcWorkCalendar(DatabaseIfc m, List <IfcWorkTime> working, List <IfcWorkTime> exception, IfcWorkCalendarTypeEnum type, IfcProject prj)
     : base(m)
 {
     if (working != null)
     {
         mWorkingTimes = working.ConvertAll(x => x.mIndex);
     }
     if (exception != null)
     {
         mExceptionTimes = exception.ConvertAll(x => x.mIndex);
     }
     mPredefinedType = type;
     if (prj != null)
     {
         prj.AddDeclared(this);
     }
 }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            DatabaseIfc db = new DatabaseIfc(ReleaseVersion.IFC4X3);

            IfcRailway sydneyLightRail = new IfcRailway(db);

            sydneyLightRail.Name       = "Sydney Light Rail";
            sydneyLightRail.ObjectType = "Light Rail Complexes";

            IfcProject project = new IfcProject(sydneyLightRail, "", IfcUnitAssignment.Length.Metre);

            IfcClassification          uniclass2015       = new IfcClassification(db, "Uniclass2015");
            IfcClassificationReference lightRailComplexes = new IfcClassificationReference(uniclass2015);

            lightRailComplexes.Identification = "Co_80_50_45";
            lightRailComplexes.Name           = "Light Rail Complexes";

            lightRailComplexes.Associate(sydneyLightRail);

            IfcFacilityPartTypeSelect facilityPartTypeSelect = new IfcFacilityPartTypeSelect(IfcRailwayPartTypeEnum.USERDEFINED);
            IfcFacilityPart           cbdCorridor            = new IfcFacilityPart(sydneyLightRail, "CBD and SE Light Rail", facilityPartTypeSelect, IfcFacilityUsageEnum.LONGITUDINAL);

            new IfcClassificationReference(uniclass2015)
            {
                Identification = "En_80_50_71", Name = "Railway Corridors"
            }.Associate(cbdCorridor);

            IfcSpace deStop = new IfcSpace(cbdCorridor, "DE Stop");

            deStop.PredefinedType = IfcSpaceTypeEnum.USERDEFINED;
            deStop.ObjectType     = "Light Rail Stops";

            new IfcClassificationReference(uniclass2015)
            {
                Identification = "SL_80_50_47", Name = "Light Rail Stops"
            }.Associate(deStop);

            IfcSpace platform1_2 = new IfcSpace(deStop, "Platform 1/2");

            IfcClassificationReference classificationTicketSystem = new IfcClassificationReference(uniclass2015)
            {
                Identification = "Ss_75_90_80", Name = "Ticketing Systems"
            };
            IfcSystem opal = new IfcSystem(sydneyLightRail, "Opal system");

            classificationTicketSystem.Associate(opal);

            IfcDistributionSystem platform1_2TicketSystem = new IfcDistributionSystem(platform1_2, "DE Stop Platform 1/2 Ticket System", IfcDistributionSystemEnum.USERDEFINED);

            opal.AddAggregated(platform1_2TicketSystem);
            classificationTicketSystem.Associate(platform1_2TicketSystem);

            IfcCommunicationsApplianceType opalTicketMachineType = new IfcCommunicationsApplianceType(db, "Opal Ticket Machine", IfcCommunicationsApplianceTypeEnum.USERDEFINED);

            new IfcClassificationReference(uniclass2015)
            {
                Identification = "Pr_75_75_27_80", Name = "Smart card readers and writers"
            }.Associate(opalTicketMachineType);
            project.AddDeclared(opalTicketMachineType);

            IfcLocalPlacement          ticketMachineLocalPlacement = null;
            IfcProductDefinitionShape  ticketMachineShape          = null;
            IfcCommunicationsAppliance ticketMachine = new IfcCommunicationsAppliance(platform1_2, ticketMachineLocalPlacement, ticketMachineShape, platform1_2TicketSystem);

            IfcPropertySingleValue dateCommissioned = new IfcPropertySingleValue(db, "Date Commissioned", new IfcDate(DateTime.Now));

            new IfcPropertySet("TfNSW_Asset", dateCommissioned);

            System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog();
            saveFileDialog.Filter = "IFC BIM Data (*.ifc,*.ifcxml,*.ifcjson,*.ifczip)|*.ifc;*.ifcxml;*.ifcjson;*.ifczip";;
            if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                db.WriteFile(saveFileDialog.FileName);
            }
        }