Пример #1
0
        public static ObjVer CreateMaterial(this MaterialElement mat, VaultAliases vaultAlias, int modelId, AccessControlList acl)
        {
            var objTypeId = vaultAlias.ObDict[OB.Material];
            var classId   = vaultAlias.CsDict[CS.Material];
            var pvs       = new PropertyValues();

            AddProperties(mat, pvs, vaultAlias, modelId);
            return(BaseElementExtensions.CreateBasicObject(objTypeId, classId, pvs, vaultAlias.Vault, acl));
        }
Пример #2
0
        public static ObjVer CreatePart(this Element elem, VaultAliases vaultAlias
                                        , int cateId, int typeId, int matId, int levelId, int famId, int modelId, AccessControlList acl, string modelUrl, int?unitId, int?floorId, int?discId)
        {
            var objTypeId = vaultAlias.ObDict[OB.Part];
            var classId   = vaultAlias.CsDict[CS.Part];
            var pvs       = new PropertyValues();

            AddProperties(elem, pvs, vaultAlias, cateId, typeId, matId, levelId, famId, modelId, modelUrl, unitId, floorId, discId);
            return(BaseElementExtensions.CreateBasicObject(objTypeId, classId, pvs, vaultAlias.Vault, acl));
        }
Пример #3
0
        public static ObjVer CreateFamily(this ElementFamily fam, VaultAliases vaultAlias, int cateId, int modelId, AccessControlList acl)
        {
            var objTypeId = vaultAlias.ObDict[OB.Family];
            var classId   = vaultAlias.CsDict[CS.Family];

            var pvs = new PropertyValues();

            AddProperties(fam, pvs, vaultAlias, cateId, modelId);
            return(BaseElementExtensions.CreateBasicObject(objTypeId, classId, pvs, vaultAlias.Vault, acl));
        }
Пример #4
0
        public static void AddProperties(this MaterialElement mat, PropertyValues pvs, VaultAliases vaultAlias, int modelId)
        {
            mat.AddBasicProperties(pvs, vaultAlias, modelId);

            if (mat.Parameters.Count > 0)
            {
                var pPV = BaseElementExtensions.CreateParameterProp(mat.Parameters, vaultAlias);
                pvs.Add(-1, pPV);
            }
        }
Пример #5
0
        public static void AddProperties(this ElementType elemType, PropertyValues pvs, VaultAliases vaultAlias, int modelId)
        {
            elemType.AddBasicProperties(pvs, vaultAlias, modelId);

            if (elemType.Parameters.Count > 0)
            {
                var pPV = BaseElementExtensions.CreateParameterProp(elemType.Parameters, vaultAlias);
                pvs.Add(-1, pPV);
            }
        }
Пример #6
0
        public static ObjVer CreateView(this ViewElement view, VaultAliases vaultAlias, int levelId, int modelId, AccessControlList acl)
        {
            var objTypeId = vaultAlias.ObDict[OB.View];
            var classId   = vaultAlias.CsDict[CS.View];

            var pvs = new PropertyValues();

            AddProperties(view, pvs, vaultAlias, levelId, modelId);

            return(BaseElementExtensions.CreateBasicObject(objTypeId, classId, pvs, vaultAlias.Vault, acl));
        }
Пример #7
0
        public static ObjVer CreateCategory(this ElementCategory cate, VaultAliases vaultAlias, int modelId, AccessControlList acl)
        {
            if (cate == null)
            {
                return(null);
            }
            var objTypeId = vaultAlias.ObDict[OB.Category];
            var classId   = vaultAlias.CsDict[CS.Category];
            var pvs       = new PropertyValues();

            AddProperties(cate, pvs, vaultAlias, modelId);

            return(BaseElementExtensions.CreateBasicObject(objTypeId, classId, pvs, vaultAlias.Vault, acl));
        }
Пример #8
0
        public static void AddProperties(this ElementFamily fam, PropertyValues pvs, VaultAliases vaultAlias, int cateId, int modelId)
        {
            fam.AddBasicProperties(pvs, vaultAlias, modelId);
            var catePV = new PropertyValue {
                PropertyDef = vaultAlias.PdDict[PD.PartCategory]
            };

            catePV.Value.SetValue(MFDataType.MFDatatypeLookup, cateId);
            pvs.Add(-1, catePV);
            if (fam.Parameters.Count > 0)
            {
                var pPV = BaseElementExtensions.CreateParameterProp(fam.Parameters, vaultAlias);
                pvs.Add(-1, pPV);
            }
        }
Пример #9
0
        public static void AddProperties(this Element elem, PropertyValues pvs, VaultAliases vaultAlias
                                         , int cateId, int typeId, int matId, int levelId, int famId, int modelId, string modelUrl, int?unitId, int?floorId, int?discId)
        {
            elem.AddBasicProperties(pvs, vaultAlias, modelId);

            if (elem.IfcId != null)
            {
                var ifcPV = new PropertyValue {
                    PropertyDef = vaultAlias.PdDict[PD.IfcId]
                };
                ifcPV.Value.SetValue(MFDataType.MFDatatypeText, elem.IfcId);
                pvs.Add(-1, ifcPV);
                if (!String.IsNullOrEmpty(modelUrl))
                {
                    var urlPV = new PropertyValue {
                        PropertyDef = vaultAlias.PdDict[PD.ModelUrl]
                    };
                    urlPV.Value.SetValue(MFDataType.MFDatatypeMultiLineText, modelUrl + "&ifcguid=" + elem.IfcId);
                    pvs.Add(-1, urlPV);
                }
            }

            var catePV = new PropertyValue {
                PropertyDef = vaultAlias.PdDict[PD.PartCategory]
            };

            catePV.Value.SetValue(MFDataType.MFDatatypeLookup, cateId);
            pvs.Add(-1, catePV);
            var typePV = new PropertyValue {
                PropertyDef = vaultAlias.PdDict[PD.PartType]
            };

            typePV.Value.SetValue(MFDataType.MFDatatypeLookup, typeId);
            pvs.Add(-1, typePV);
            if (matId > 0)
            {
                var matPV = new PropertyValue {
                    PropertyDef = vaultAlias.PdDict[PD.Material]
                };
                matPV.Value.SetValue(MFDataType.MFDatatypeLookup, matId);
                pvs.Add(-1, matPV);
            }
            if (levelId > 0)
            {
                var levelPV = new PropertyValue {
                    PropertyDef = vaultAlias.PdDict[PD.Level]
                };
                levelPV.Value.SetValue(MFDataType.MFDatatypeLookup, levelId);
                pvs.Add(-1, levelPV);
            }
            if (elem.Parameters.Count > 0)
            {
                var pPV = BaseElementExtensions.CreateParameterProp(elem.Parameters, vaultAlias);
                pvs.Add(-1, pPV);
            }
            if (elem.Family != null)
            {
                var pPV = new PropertyValue {
                    PropertyDef = vaultAlias.PdDict[PD.OwnedFamily]
                };
                pPV.Value.SetValue(MFDataType.MFDatatypeLookup, famId);
                pvs.Add(-1, pPV);
            }

            if (unitId != null)
            {
                var pPV = new PropertyValue {
                    PropertyDef = vaultAlias.PdDict[PD.ModelUnitAt]
                };
                pPV.Value.SetValue(MFDataType.MFDatatypeLookup, unitId.Value);
                pvs.Add(-1, pPV);
            }
            if (floorId != null)
            {
                var pPV = new PropertyValue {
                    PropertyDef = vaultAlias.PdDict[PD.FloorAt]
                };
                pPV.Value.SetValue(MFDataType.MFDatatypeLookup, floorId.Value);
                pvs.Add(-1, pPV);
            }
            if (discId != null)
            {
                var pPV = new PropertyValue {
                    PropertyDef = vaultAlias.PdDict[PD.DiscAt]
                };
                pPV.Value.SetValue(MFDataType.MFDatatypeLookup, discId.Value);
                pvs.Add(-1, pPV);
            }
        }