コード例 #1
0
ファイル: Program.cs プロジェクト: BuildingSMART/IfcDoc
        public static PropertySetDef ExportPsd(DocPropertySet docPset, Dictionary<string, DocPropertyEnumeration> mapEnum)
        {
            string[] apptypes = new string[0];

            if (docPset.ApplicableType != null)
            {
                apptypes = docPset.ApplicableType.Split(',');
            }

            // convert to psd schema
            PropertySetDef psd = new PropertySetDef();
            psd.Versions = new List<IfcVersion>();
            psd.Versions.Add(new IfcVersion());
            psd.Versions[0].version = "IFC4";
            psd.Name = docPset.Name;
            psd.Definition = docPset.Documentation;
            psd.TemplateType = docPset.PropertySetType;
            psd.ApplicableTypeValue = docPset.ApplicableType;
            psd.ApplicableClasses = new List<ClassName>();
            foreach (string app in apptypes)
            {
                ClassName cln = new ClassName();
                cln.Value = app;
                psd.ApplicableClasses.Add(cln);
            }
            psd.IfdGuid = docPset.Uuid.ToString("N");

            psd.PsetDefinitionAliases = new List<PsetDefinitionAlias>();
            foreach (DocLocalization docLocal in docPset.Localization)
            {
                PsetDefinitionAlias alias = new PsetDefinitionAlias();
                psd.PsetDefinitionAliases.Add(alias);
                alias.lang = docLocal.Locale;
                alias.Value = docLocal.Documentation;
            }

            psd.PropertyDefs = new List<PropertyDef>();
            foreach (DocProperty docProp in docPset.Properties)
            {
                PropertyDef prop = new PropertyDef();
                psd.PropertyDefs.Add(prop);
                ExportPsdProperty(docProp, prop, mapEnum);
            }

            return psd;
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: BuildingSMART/IfcDoc
        public static QtoSetDef ExportQto(DocQuantitySet docPset)
        {
            string[] apptypes = new string[0];
            if (docPset.ApplicableType != null)
            {
                apptypes = docPset.ApplicableType.Split(',');
            }

            // convert to psd schema
            QtoSetDef psd = new QtoSetDef();
            psd.Name = docPset.Name;
            psd.Definition = docPset.Documentation;
            psd.Versions = new List<IfcVersion>();
            psd.Versions.Add(new IfcVersion());
            psd.Versions[0].version = "IFC4";
            psd.ApplicableTypeValue = docPset.ApplicableType;
            psd.ApplicableClasses = new List<ClassName>();
            foreach (string app in apptypes)
            {
                ClassName cln = new ClassName();
                cln.Value = app;
                psd.ApplicableClasses.Add(cln);
            }

            psd.QtoDefinitionAliases = new List<QtoDefinitionAlias>();
            foreach (DocLocalization docLocal in docPset.Localization)
            {
                QtoDefinitionAlias alias = new QtoDefinitionAlias();
                psd.QtoDefinitionAliases.Add(alias);
                alias.lang = docLocal.Locale;
                alias.Value = docLocal.Documentation;
            }

            psd.QtoDefs = new List<QtoDef>();
            foreach (DocQuantity docProp in docPset.Quantities)
            {
                QtoDef prop = new QtoDef();
                psd.QtoDefs.Add(prop);
                prop.Name = docProp.Name;
                prop.Definition = docProp.Documentation;

                prop.NameAliases = new List<NameAlias>();
                prop.DefinitionAliases = new List<DefinitionAlias>();
                foreach (DocLocalization docLocal in docProp.Localization)
                {
                    NameAlias na = new NameAlias();
                    prop.NameAliases.Add(na);
                    na.lang = docLocal.Locale;
                    na.Value = docLocal.Name;

                    DefinitionAlias da = new DefinitionAlias();
                    prop.DefinitionAliases.Add(da);
                    da.lang = docLocal.Locale;
                    da.Value = docLocal.Documentation;
                }

                prop.QtoType = docProp.QuantityType.ToString();
            }

            return psd;
        }