/// <summary> /// Returns the Material Select or creates /// </summary> /// <param name = "elemType"></param> /// <returns></returns> public static void SetMaterial(this IfcElementType elemType, IfcMaterialSelect matSel) { if (matSel is IfcMaterialLayerSetUsage) { throw new Exception("IfcElementType cannot have an IfcMaterialLayerSetUsage as its associated material"); } IfcRelAssociatesMaterial relMat = elemType.HasAssociations.OfType <IfcRelAssociatesMaterial>().FirstOrDefault(); if (relMat == null) { IModel model = elemType.ModelOf; if (model == null) { throw new Exception("IfcElementType is not contained in a valid model"); } else { relMat = model.Instances.New <IfcRelAssociatesMaterial>(); relMat.RelatedObjects.Add(elemType); } } relMat.RelatingMaterial = matSel; }
/// <summary> /// Convert an IfcMaterialSelect to a material or a layered material. /// </summary> /// <param name="materialSelect">An IfcMaterialSelect.</param> private static dynamic ToMaterialOrMaterialLayers(this IfcMaterialSelect materialSelect) { if (materialSelect.Choice is IfcMaterial) { var m = (IfcMaterial)materialSelect.Choice; return(m.ToMaterial()); } else if (materialSelect.Choice is IfcMaterialList) { throw new NotImplementedException("IfcMaterialList is not yet supported."); } else if (materialSelect.Choice is IfcMaterialLayerSetUsage) { // Return a material layer set. var m = (IfcMaterialLayerSetUsage)materialSelect.Choice; return(m.ToMaterialLayers()); } else if (materialSelect.Choice is IfcMaterialLayerSet) { // Return a material layer set. var m = (IfcMaterialLayerSet)materialSelect.Choice; return(m.ToMaterialLayers()); } else if (materialSelect.Choice is IfcMaterialLayer) { // Return a material layer. var m = ((IfcMaterialLayer)materialSelect.Choice).ToMaterialLayer(); } return(null); }
public static int CreateHashCode(this IfcMaterialSelect materialSelect) { var material = materialSelect as IfcMaterial; if (material != null) { return("IfcMaterial".GetHashCode() + material.Name.GetHashCode()); } var materialList = materialSelect as IfcMaterialList; if (materialList != null) { int result = "IfcMaterialList".GetHashCode(); foreach (var item in materialList.Materials) { result += item.CreateHashCode(); } return(result); } var usage = materialSelect as IfcMaterialLayerSetUsage; if (usage != null) { int result = "IfcMaterialLayerSetUsage".GetHashCode(); var lSet = usage.ForLayerSet; return(result += lSet.CreateHashCode()); } var layerSet = materialSelect as IfcMaterialLayerSet; if (layerSet != null) { int result = "IfcMaterialLayerSet".GetHashCode(); foreach (var l in layerSet.MaterialLayers) { result += l.CreateHashCode(); } return(result); } var layer = materialSelect as IfcMaterialLayer; if (layer != null) { int result = "IfcMaterialLayer".GetHashCode(); result += layer.Material.CreateHashCode(); result += layer.LayerThickness.ToString().GetHashCode(); return(result); } throw new NotImplementedException(); }
private void AddMaterialData(IfcMaterialSelect matSel, string setName) { if (matSel is IfcMaterial) //simplest just add it { _materials.Add(new PropertyItem { Name = string.Format("{0} [#{1}]", ((IfcMaterial)matSel).Name, matSel.EntityLabel), PropertySetName = setName, Value = "" }); } else if (matSel is IfcMaterialLayer) { _materials.Add(new PropertyItem { Name = string.Format("{0} [#{1}]", ((IfcMaterialLayer)matSel).Material.Name, matSel.EntityLabel), Value = ((IfcMaterialLayer)matSel).LayerThickness.Value.ToString(), PropertySetName = setName }); } else if (matSel is IfcMaterialList) { foreach (var mat in ((IfcMaterialList)matSel).Materials) { _materials.Add(new PropertyItem { Name = string.Format("{0} [#{1}]", mat.Name, mat.EntityLabel), PropertySetName = setName, Value = "" }); } } else if (matSel is IfcMaterialLayerSet) { foreach (var item in ((IfcMaterialLayerSet)matSel).MaterialLayers) //recursive call to add materials { AddMaterialData(item, ((IfcMaterialLayerSet)matSel).LayerSetName); } } else if (matSel is IfcMaterialLayerSetUsage) { foreach (var item in ((IfcMaterialLayerSetUsage)matSel).ForLayerSet.MaterialLayers) //recursive call to add materials { AddMaterialData(item, ((IfcMaterialLayerSetUsage)matSel).ForLayerSet.LayerSetName); } } }
//public static IfcClassificationNotationFacet GetOrCreateClassicifationNotationFacet(this IfcRoot root, IModel Model, string ClassificationFacet) /// <summary> /// Returns the Material Select or creates /// </summary> /// <param name="obj"></param> /// <returns></returns> public static void SetMaterial(this IfcRoot obj, IfcMaterialSelect matSel) { if (obj is IfcTypeProduct && matSel is IfcMaterialLayerSetUsage) throw new Exception("IfcElementType cannot have an IfcMaterialLayerSetUsage as it's associated material"); IModel model = obj.ModelOf; IfcRelAssociatesMaterial relMat = model.Instances.Where<IfcRelAssociatesMaterial>(r => r.RelatedObjects.Contains(obj)).FirstOrDefault(); if (relMat == null) { relMat = model.Instances.New<IfcRelAssociatesMaterial>(); relMat.RelatedObjects.Add(obj); } relMat.RelatingMaterial = matSel; }
//public static IfcClassificationNotationFacet GetOrCreateClassicifationNotationFacet(this IfcRoot root, IModel Model, string ClassificationFacet) /// <summary> /// Returns the Material Select or creates /// </summary> /// <param name="obj"></param> /// <returns></returns> public static void SetMaterial(this IfcRoot obj, IfcMaterialSelect matSel) { if (obj is IfcTypeProduct && matSel is IfcMaterialLayerSetUsage) { throw new Exception("IfcElementType cannot have an IfcMaterialLayerSetUsage as it's associated material"); } IModel model = obj.ModelOf; IfcRelAssociatesMaterial relMat = model.Instances.Where <IfcRelAssociatesMaterial>(r => r.RelatedObjects.Contains(obj)).FirstOrDefault(); if (relMat == null) { relMat = model.Instances.New <IfcRelAssociatesMaterial>(); relMat.RelatedObjects.Add(obj); } relMat.RelatingMaterial = matSel; }
public override void IfcParse(int propIndex, IPropertyValue value) { switch (propIndex) { case 0: case 1: case 2: case 3: case 4: base.IfcParse(propIndex, value); break; case 5: _relatingMaterial = (IfcMaterialSelect) value.EntityVal; break; default: this.HandleUnexpectedAttribute(propIndex, value); break; } }
/// <summary> /// Returns the Material Select or creates /// </summary> /// <param name = "elemType"></param> /// <returns></returns> public static void SetMaterial(this IfcElementType elemType, IfcMaterialSelect matSel) { if (matSel is IfcMaterialLayerSetUsage) throw new Exception("IfcElementType cannot have an IfcMaterialLayerSetUsage as its associated material"); IfcRelAssociatesMaterial relMat = elemType.HasAssociations.OfType<IfcRelAssociatesMaterial>().FirstOrDefault(); if (relMat == null) { IModel model = elemType.ModelOf; if (model == null) throw new Exception("IfcElementType is not contained in a valid model"); else { relMat = model.Instances.New<IfcRelAssociatesMaterial>(); relMat.RelatedObjects.Add_Reversible(elemType); } } relMat.RelatingMaterial = matSel; }
public override void IfcParse(int propIndex, IPropertyValue value) { switch (propIndex) { case 0: case 1: case 2: case 3: case 4: base.IfcParse(propIndex, value); break; case 5: _relatingMaterial = (IfcMaterialSelect)value.EntityVal; break; default: this.HandleUnexpectedAttribute(propIndex, value); break; } }
public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex) { switch (propIndex) { case 0: case 1: case 2: case 3: case 4: base.Parse(propIndex, value, nestedIndex); return; case 5: _relatingMaterial = (IfcMaterialSelect)(value.EntityVal); return; default: throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper())); } }
internal IfcMaterialLayerSet detectMaterialLayerSet() { IfcRelAssociatesMaterial associates = RelatedMaterialAssociation; if (associates == null) { return(null); } IfcMaterialSelect material = associates.RelatingMaterial; IfcMaterialLayerSet materialLayerSet = material as IfcMaterialLayerSet; if (materialLayerSet != null) { return(materialLayerSet); } IfcMaterialLayerSetUsage materialLayerSetUsage = material as IfcMaterialLayerSetUsage; if (materialLayerSetUsage != null) { return(materialLayerSetUsage.ForLayerSet); } return(null); }
internal void setMaterial(IfcMaterialSelect material) { IfcMaterialSelect m = material; if (mDatabase.mRelease == ReleaseVersion.IFC2x3) { IfcMaterialProfile profile = material as IfcMaterialProfile; if (profile != null) { m = profile.Material; mMaterialSelectIFC4 = profile; IfcProfileDef pd = profile.Profile; if (pd != null) { if (pd.mHasProperties.Count == 0) { IfcProfileProperties pp = new IfcProfileProperties(pd.Name, pd); pp.mAssociates.addRelated(this); } else { pd.mHasProperties[0].mAssociates.addRelated(this); } } } else { IfcMaterialProfileSet profileSet = material as IfcMaterialProfileSet; if (profileSet == null) { IfcMaterialProfileSetUsage profileSetUsage = material as IfcMaterialProfileSetUsage; if (profileSetUsage != null) { profileSet = profileSetUsage.ForProfileSet; } } if (profileSet != null) { m = profileSet.PrimaryMaterial; mMaterialSelectIFC4 = profileSet; foreach (IfcMaterialProfile matp in profileSet.MaterialProfiles) { IfcProfileDef pd = matp.Profile; if (pd != null) { if (pd.mHasProperties.Count == 0) { IfcProfileProperties pp = new IfcProfileProperties(pd.Name, null, pd); } pd.mHasProperties[0].mAssociates.addRelated(this); } } } else { //constituentset.... } } } for (int icounter = 0; icounter < mHasAssociations.Count; icounter++) { IfcRelAssociatesMaterial rm = mHasAssociations[icounter] as IfcRelAssociatesMaterial; if (rm != null) { rm.unassign(this); } } if (m != null) { m.Associates.addRelated(this); } }
private void AddMaterialData(IfcMaterialSelect matSel, string setName) { if (matSel is IfcMaterial) //simplest just add it _materials.Add(new PropertyItem() { Name = string.Format("{0} [#{1}]", ((IfcMaterial)matSel).Name, Math.Abs(matSel.EntityLabel)), PropertySetName = setName, Value = "" }); else if (matSel is IfcMaterialLayer) _materials.Add(new PropertyItem() { Name = string.Format("{0} [#{1}]", ((IfcMaterialLayer)matSel).Material.Name, Math.Abs(matSel.EntityLabel)), Value = ((IfcMaterialLayer)matSel).LayerThickness.Value.ToString(), PropertySetName = setName }); else if (matSel is IfcMaterialList) { foreach (var mat in ((IfcMaterialList)matSel).Materials) { _materials.Add(new PropertyItem() { Name = string.Format("{0} [#{1}]", mat.Name, Math.Abs(mat.EntityLabel)), PropertySetName = setName, Value = "" }); } } else if (matSel is IfcMaterialLayerSet) { foreach (var item in ((IfcMaterialLayerSet)matSel).MaterialLayers) //recursive call to add materials { AddMaterialData(item, ((IfcMaterialLayerSet)matSel).LayerSetName); } } else if (matSel is IfcMaterialLayerSetUsage) { foreach (var item in ((IfcMaterialLayerSetUsage)matSel).ForLayerSet.MaterialLayers) //recursive call to add materials { AddMaterialData(item, ((IfcMaterialLayerSetUsage)matSel).ForLayerSet.LayerSetName); } } }
/// <summary> /// Returns the list of Object in a IfcRelAssociatesMaterial with the specified material select. /// </summary> /// <param name="matSel">The material select to search.</param> /// <param name="DeepSearch"> /// True if the function needs to execute a deeper semantical analysis of the relations (it can expand the query result). /// False if a direct analysis of explicit associations with the specific MaterialSet. /// </param> public static IEnumerable <IfcRoot> GetInstancesOfMaterial(this IXbimInstanceCollection InstanceCollection, IfcMaterialSelect matSel, bool DeepSearch) { // Debug.WriteLine(string.Format("GetInstance {0}, {1}", matSel.EntityLabel.ToString(), DeepSearch)); if (matSel is IfcMaterial) { // straight return of objects of all associations var Assocs = InstanceCollection.OfType <IfcRelAssociatesMaterial>().Where( x => x.RelatingMaterial.EntityLabel == matSel.EntityLabel ); foreach (var assoc in Assocs) { // ... and returns one object at a time in the enumerable foreach (var item in assoc.RelatedObjects) { yield return(item); } } } else if (matSel is IfcMaterialLayer) { if (!DeepSearch) { // straight return of objects of all associations var Assocs = InstanceCollection.OfType <IfcRelAssociatesMaterial>().Where( x => x.RelatingMaterial.EntityLabel == matSel.EntityLabel ); foreach (var assoc in Assocs) { // ... and returns one object at a time in the enumerable foreach (var item in assoc.RelatedObjects) { yield return(item); } } } else // this is deep search { foreach (var StraightMatch in GetInstancesOfMaterial(InstanceCollection, ((IfcMaterialLayer)matSel).ToMaterialLayerSet, false)) { yield return(StraightMatch); } } } else if (matSel is IfcMaterialList) { if (!DeepSearch) { // straight return of objects of all associations var Assocs = InstanceCollection.OfType <IfcRelAssociatesMaterial>().Where( x => x.RelatingMaterial.EntityLabel == matSel.EntityLabel ); foreach (var assoc in Assocs) { // ... and returns one object at a time in the enumerable foreach (var item in assoc.RelatedObjects) { yield return(item); } } } else // this is deep search { // a problem with this is that some exporters produce multiple IfcMaterialList that // they share the same underlying set of Materials, so we are looking for a signature of the underlying materials. // var BaseMatArray = ((IfcMaterialList)matSel).Materials.Select(x => x.EntityLabel).ToArray(); // this is the signature. var cmp = EqualityComparer <int> .Default; foreach (var testingMaterialList in InstanceCollection.OfType <IfcMaterialList>()) { bool bDoesMatch = false; if (testingMaterialList.EntityLabel == matSel.EntityLabel) { // no need to compare bDoesMatch = true; } else { var CompMatArray = ((IfcMaterialList)testingMaterialList).Materials.Select(x => x.EntityLabel).ToArray(); // this is the other signature. bDoesMatch = ArraysEqual <int>(BaseMatArray, CompMatArray, cmp); } if (bDoesMatch) { foreach (var StraightMatch in GetInstancesOfMaterial(InstanceCollection, testingMaterialList, false)) { yield return(StraightMatch); } } } } } else if (matSel is IfcMaterialLayerSet) { // no difference in deep mode available for this type // given a material layerset ... // ... search for all its usages modes ... var lsUsages = InstanceCollection.OfType <IfcMaterialLayerSetUsage>().Where( x => x.ForLayerSet.EntityLabel == ((IfcMaterialLayerSet)matSel).EntityLabel ); foreach (var lsUsage in lsUsages) { // ... then for each usage mode, searches the relations with objects ... foreach (var item in GetInstancesOfMaterial(InstanceCollection, lsUsage, false)) { yield return(item); } } } else if (matSel is IfcMaterialLayerSetUsage) { if (DeepSearch) { // identify the underlying material layer set and return all its usages. foreach (var item in InstanceCollection.GetInstancesOfMaterial(((IfcMaterialLayerSetUsage)matSel).ForLayerSet, false)) { yield return(item); } } else { // straight return of objects of all associations var Assocs = InstanceCollection.OfType <IfcRelAssociatesMaterial>().Where( x => x.RelatingMaterial.EntityLabel == matSel.EntityLabel ); foreach (var assoc in Assocs) { // ... and returns one object at a time in the enumerable foreach (var item in assoc.RelatedObjects) { yield return(item); } } } } else { Debugger.Break(); Debug.WriteLine("Unexpected case"); } }
internal void setMaterial(IfcMaterialSelect material) { IfcMaterialSelect m = material; if (mDatabase.mSchema == Schema.IFC2x3) { IfcMaterialProfile profile = material as IfcMaterialProfile; if (profile != null) { m = profile.Material; mMaterialSelectIFC4 = profile; IfcProfileDef pd = profile.Profile; if (pd != null) { if (pd.mHasProperties.Count == 0) { IfcProfileProperties pp = new IfcProfileProperties(pd.Name, null, pd); } pd.mHasProperties[0].mAssociates.addAssociation(this); } } else { IfcMaterialProfileSet profileSet = material as IfcMaterialProfileSet; if (profileSet == null) { IfcMaterialProfileSetUsage profileSetUsage = material as IfcMaterialProfileSetUsage; if (profileSetUsage != null) profileSet = profileSetUsage.ForProfileSet; } if (profileSet != null) { m = profileSet.PrimaryMaterial; mMaterialSelectIFC4 = profileSet; foreach (IfcMaterialProfile matp in profileSet.MaterialProfiles) { IfcProfileDef pd = matp.Profile; if (pd != null) { if (pd.mHasProperties.Count == 0) { IfcProfileProperties pp = new IfcProfileProperties(pd.Name, null, pd); } pd.mHasProperties[0].mAssociates.addAssociation(this); } } } else { //constituentset.... } } } for (int icounter = 0; icounter < mHasAssociations.Count; icounter++) { IfcRelAssociatesMaterial rm = mHasAssociations[icounter] as IfcRelAssociatesMaterial; if (rm != null) rm.unassign(this); } if (m != null) m.Associates.addAssociation(this); }
static IfcMaterial extractMaterial(IfcMaterialSelect materialSelect) //To be enabled in opensource Library { IfcMaterial material = materialSelect as IfcMaterial; if (material != null) { return(material); } IfcMaterialProfile profile = materialSelect as IfcMaterialProfile; if (profile != null) { return(profile.Material); } IfcMaterialProfileSet profileSet = materialSelect as IfcMaterialProfileSet; if (profileSet == null) { IfcMaterialProfileSetUsage profileUsage = materialSelect as IfcMaterialProfileSetUsage; if (profileUsage != null) { profileSet = profileUsage.ForProfileSet; } } if (profileSet != null) { return(profileSet.PrimaryMaterial); } IfcMaterialLayer layer = materialSelect as IfcMaterialLayer; if (layer != null) { return(layer.Material); } IfcMaterialLayerSet layerSet = materialSelect as IfcMaterialLayerSet; if (layerSet != null) { return(layerSet.PrimaryMaterial); } IfcMaterialLayerSetUsage layerSetUsage = materialSelect as IfcMaterialLayerSetUsage; if (layerSetUsage != null) { return(layerSetUsage.PrimaryMaterial); } IfcMaterialList list = materialSelect as IfcMaterialList; if (list != null) { return(list.PrimaryMaterial); } IfcMaterialConstituent constituent = materialSelect as IfcMaterialConstituent; if (constituent != null) { return(constituent.PrimaryMaterial); } IfcMaterialConstituentSet constituentSet = materialSelect as IfcMaterialConstituentSet; if (constituentSet != null) { return(constituentSet.PrimaryMaterial); } return(null); }
internal IfcRelAssociatesMaterial(IfcMaterialSelect material) : base(material.Database) { Name = "MatAssoc"; Description = "Material Associates"; mRelatingMaterial = material.Index; material.Associates = this; }
private static void SetMaterial(IPersistIfcEntity entity, IfcMaterialSelect material, AbstractScanner<ValueType, LexLocation> scanner) { if (entity == null || material == null) return; var materialSelect = material as IfcMaterialSelect; if (materialSelect == null) { scanner.yyerror(material.GetType() + " can't be used as a material"); return; } var root = entity as IfcRoot; if (root == null) { scanner.yyerror(root.GetType() + " can't have a material assigned."); return; } IModel model = material.ModelOf; var matSet = material as IfcMaterialLayerSet; if (matSet != null) { var element = root as IfcElement; if (element != null) { var usage = model.Instances.New<IfcMaterialLayerSetUsage>(mlsu => { mlsu.DirectionSense = IfcDirectionSenseEnum.POSITIVE; mlsu.ForLayerSet = matSet; mlsu.LayerSetDirection = IfcLayerSetDirectionEnum.AXIS1; mlsu.OffsetFromReferenceLine = 0; }); var rel = model.Instances.New<IfcRelAssociatesMaterial>(r => { r.RelatedObjects.Add_Reversible(root); r.RelatingMaterial = usage; }); return; } } var matUsage = material as IfcMaterialLayerSetUsage; if (matUsage != null) { var typeElement = root as IfcElementType; if (typeElement != null) { //change scope to the layer set for the element type. It will be processed in a standard way than materialSelect = matUsage.ForLayerSet; } } //find existing relation var matRel = model.Instances.Where<IfcRelAssociatesMaterial>(r => r.RelatingMaterial == materialSelect).FirstOrDefault(); if (matRel == null) //create new if none exists matRel = model.Instances.New<IfcRelAssociatesMaterial>(r => r.RelatingMaterial = materialSelect); //insert only if it is not already there if (!matRel.RelatedObjects.Contains(root)) matRel.RelatedObjects.Add_Reversible(root); }
/// <summary> /// Get names of all materials involved /// </summary> /// <param name="materialSelect">Possible types of material</param> /// <returns>List of names</returns> private static List<string> GetMaterialNames(IfcMaterialSelect materialSelect) { List<string> names = new List<string>(); IfcMaterial material = materialSelect as IfcMaterial; if (material != null) names.Add( material.Name); IfcMaterialList materialList = materialSelect as IfcMaterialList; if (materialList != null) foreach (var m in materialList.Materials) { names.Add(m.Name); } IfcMaterialLayerSetUsage materialUsage = materialSelect as IfcMaterialLayerSetUsage; if (materialUsage != null) names.AddRange(GetMaterialNames(materialUsage.ForLayerSet)); IfcMaterialLayerSet materialLayerSet = materialSelect as IfcMaterialLayerSet; if (materialLayerSet != null) foreach (var m in materialLayerSet.MaterialLayers) { names.AddRange(GetMaterialNames(m)); } IfcMaterialLayer materialLayer = materialSelect as IfcMaterialLayer; if (materialLayer != null) if (materialLayer.Material != null) names.Add(materialLayer.Material.Name); return names; }
public MaterialHash(IfcRoot root, IfcMaterialSelect material) { _root = root; _material = material; _hash = _material.CreateHashCode(); }
public IfcRelAssociatesMaterial(IfcGloballyUniqueId __GlobalId, IfcOwnerHistory __OwnerHistory, IfcLabel?__Name, IfcText?__Description, IfcRoot[] __RelatedObjects, IfcMaterialSelect __RelatingMaterial) : base(__GlobalId, __OwnerHistory, __Name, __Description, __RelatedObjects) { this._RelatingMaterial = __RelatingMaterial; }
public IfcElementSignature(IfcElement elem, Xbim3DModelContext geometryContext) { XbimMatrix3D m3D = XbimMatrix3D.Identity; if (elem.ObjectPlacement != null) { m3D = elem.ObjectPlacement.ToMatrix3D(); } var geomManager = elem.ModelOf.GeometryManager; ShapeId = 0; //get the 3D shape var shapes = geometryContext.ShapeInstancesOf(elem); if (shapes.Any()) { XbimRect3D r3D = XbimRect3D.Empty; foreach (var shape in shapes) { if (r3D.IsEmpty) { r3D = shape.BoundingBox; } else { r3D.Union(shape.BoundingBox); } } XbimPoint3D p3D = r3D.Centroid(); p3D = m3D.Transform(p3D); BoundingSphereRadius = r3D.Length() / 2; CentroidX = p3D.X; CentroidY = p3D.Y; CentroidZ = p3D.Z; } //get the defining type IfcTypeObject ot = elem.GetDefiningType(); IfcMaterialSelect material = elem.GetMaterial(); //sort out property definitions List <IfcPropertySet> psets = elem.GetAllPropertySets(); PropertyCount = psets.SelectMany(p => p.HasProperties).Count(); psets.Sort(new PropertySetNameComparer()); foreach (var pset in psets) { PropertySetNamesKey ^= pset.Name.GetHashCode(); } List <IfcPropertySingleValue> props = psets.SelectMany(p => p.HasProperties).OfType <IfcPropertySingleValue>().ToList(); props.Sort(new PropertySingleValueNameComparer()); foreach (var prop in props) { PropertyNamesKey ^= prop.Name.GetHashCode(); } props.Sort(new PropertySingleValueValueComparer()); foreach (var prop in props) { PropertyValuesKey ^= prop.NominalValue.GetHashCode(); } ModelID = elem.EntityLabel; SchemaType = elem.GetType().Name; DefinedTypeId = (ot == null ? "" : ot.GlobalId.ToPart21); GlobalId = elem.GlobalId; OwningUser = elem.OwnerHistory.LastModifyingUser != null?elem.OwnerHistory.LastModifyingUser.ToString() : elem.OwnerHistory.OwningUser.ToString(); Name = elem.Name ?? ""; Description = elem.Description ?? ""; HasAssignmentsKey = elem.HasAssignments.Count(); IsDecomposedByKey = elem.IsDecomposedBy.Count(); DecomposesKey = elem.Decomposes.Count(); HasAssociationsKey = elem.HasAssociations.Count(); ObjectType = elem.ObjectType ?? ""; MaterialName = material == null ? "" : material.Name; ReferencedByKey = elem.ReferencedBy.Count(); Tag = elem.Tag ?? ""; HasStructuralMemberKey = elem.HasStructuralMember.Count(); FillsVoidsKey = elem.FillsVoids.Count(); ConnectedToKey = elem.ConnectedTo.Count(); HasCoveringsKey = elem.HasCoverings.Count(); HasProjectionsKey = elem.HasProjections.Count(); ReferencedInStructuresKey = elem.ReferencedInStructures.Count(); HasPortsKey = elem.HasPorts.Count(); HasOpeningsKey = elem.HasOpenings.Count(); IsConnectionRealizationKey = elem.IsConnectionRealization.Count(); ProvidesBoundariesKey = elem.ProvidesBoundaries.Count(); ConnectedFromKey = elem.ConnectedFrom.Count(); ContainedInStructureKey = elem.ContainedInStructure.Count(); }