Inheritance: IfcTypeProduct
Example #1
0
        internal static void parseFields(IfcGeographicElementType t, List <string> arrFields, ref int ipos)
        {
            IfcElementType.parseFields(t, arrFields, ref ipos);
            string s = arrFields[ipos++];

            if (s.StartsWith("."))
            {
                t.mPredefinedType = (IfcGeographicElementTypeEnum)Enum.Parse(typeof(IfcGeographicElementTypeEnum), s.Replace(".", ""));
            }
        }
        protected void Adopt(BaseClassIfc master)
        {
            IfcRoot thisRoot = this as IfcRoot, masterRoot = master as IfcRoot;

            if (thisRoot != null && masterRoot != null)
            {
                thisRoot.Name        = masterRoot.Name;
                thisRoot.Description = masterRoot.Description;
                IfcObjectDefinition thisObjectDefinition = this as IfcObjectDefinition, masterObjectDefinition = master as IfcObjectDefinition;
                if (thisObjectDefinition != null && masterObjectDefinition != null)
                {
                    foreach (IfcRelAssigns assigns in masterObjectDefinition.HasAssignments)
                    {
                        assigns.RelatedObjects.Add(thisObjectDefinition);
                    }
                    foreach (IfcRelAssociates associates in masterObjectDefinition.HasAssociations)
                    {
                        associates.RelatedObjects.Add(thisObjectDefinition);
                    }
                    if (masterObjectDefinition.HasContext != null)
                    {
                        masterObjectDefinition.HasContext.RelatedDefinitions.Add(thisObjectDefinition);
                    }
                    IfcObject thisObject = this as IfcObject, masterObject = master as IfcObject;
                    if (thisObject != null && masterObject != null)
                    {
                        if (string.IsNullOrEmpty(thisObject.ObjectType))
                        {
                            thisObject.ObjectType = masterObject.ObjectType;
                        }
                    }
                    else
                    {
                        IfcTypeObject thisTypeObject = this as IfcTypeObject, masterTypeObject = master as IfcTypeObject;
                        if (thisTypeObject != null && masterTypeObject != null)
                        {
                            IfcTypeProduct thisTypeProduct = this as IfcTypeProduct, masterTypeProduct = master as IfcTypeProduct;
                            if (thisTypeProduct != null && masterTypeProduct != null)
                            {
                                thisTypeProduct.Tag = masterTypeProduct.Tag;
                                IfcElementType thisElementType = this as IfcElementType, masterElementType = master as IfcElementType;
                                if (thisElementType != null && masterElementType != null)
                                {
                                    thisElementType.ElementType = masterElementType.ElementType;
                                }
                            }
                        }
                    }
                }
            }
        }
        protected void ReplaceDatabase(BaseClassIfc revised)
        {
            IfcRoot thisRoot = this as IfcRoot, revisedRoot = revised as IfcRoot;

            if (thisRoot != null && revisedRoot != null)
            {
                revisedRoot.GlobalId     = thisRoot.GlobalId;
                revisedRoot.OwnerHistory = thisRoot.OwnerHistory;
                revisedRoot.Name         = thisRoot.Name;
                revisedRoot.Description  = thisRoot.Description;
                IfcObjectDefinition thisObjectDefinition = this as IfcObjectDefinition, revisedObjectDefinition = revised as IfcObjectDefinition;
                if (thisObjectDefinition != null && revisedObjectDefinition != null)
                {
                    foreach (IfcRelAggregates rel in thisObjectDefinition.IsDecomposedBy.ToList())
                    {
                        rel.RelatingObject = revisedObjectDefinition;
                    }
                    foreach (IfcRelNests rel in thisObjectDefinition.IsNestedBy.ToList())
                    {
                        rel.RelatingObject = revisedObjectDefinition;
                    }

                    IfcRelAggregates relAggregates = thisObjectDefinition.Decomposes;
                    if (relAggregates != null)
                    {
                        relAggregates.RelatedObjects.Remove(thisObjectDefinition);
                        relAggregates.RelatedObjects.Add(revisedObjectDefinition);
                    }
                    IfcRelNests relNests = thisObjectDefinition.Nests;
                    if (relNests != null)
                    {
                        relNests.RelatedObjects.Remove(thisObjectDefinition);
                        relNests.RelatedObjects.Add(thisObjectDefinition);
                    }

                    foreach (IfcRelDefinesByProperties relDefinesByProperties in thisObjectDefinition.mIsDefinedBy.ToList())
                    {
                        relDefinesByProperties.RelatedObjects.Remove(thisObjectDefinition);
                        relDefinesByProperties.RelatedObjects.Add(revisedObjectDefinition);
                    }

                    foreach (IfcRelAssigns assigns in thisObjectDefinition.HasAssignments.ToList())
                    {
                        assigns.RelatedObjects.Remove(thisObjectDefinition);
                        assigns.RelatedObjects.Add(revisedObjectDefinition);
                    }
                    IfcRelDeclares relDeclares = thisObjectDefinition.HasContext;
                    if (relDeclares != null)
                    {
                        relDeclares.RelatedDefinitions.Remove(thisObjectDefinition);
                        relDeclares.RelatedDefinitions.Add(revisedObjectDefinition);
                    }
                    foreach (IfcRelAssociates associates in thisObjectDefinition.HasAssociations.ToList())
                    {
                        associates.RelatedObjects.Remove(thisObjectDefinition);
                        associates.RelatedObjects.Add(revisedObjectDefinition);
                    }
                    IfcObject thisObject = this as IfcObject, revisedObject = revised as IfcObject;
                    if (thisObject != null && revisedObject != null)
                    {
                        if (!string.IsNullOrEmpty(thisObject.ObjectType))
                        {
                            revisedObject.ObjectType = thisObject.ObjectType;
                        }

                        if (thisObject.mIsTypedBy != null)
                        {
                            thisObject.mIsTypedBy.mRelatedObjects.Remove(thisObject);
                        }
                        IfcProduct thisProduct = this as IfcProduct, revisedProduct = revised as IfcProduct;
                        if (thisProduct != null && revisedProduct != null)
                        {
                            IfcRelContainedInSpatialStructure containedInSpatialStructure = thisProduct.mContainedInStructure;
                            if (containedInSpatialStructure != null)
                            {
                                containedInSpatialStructure.RelatedElements.Remove(thisProduct);
                                containedInSpatialStructure.RelatedElements.Add(revisedProduct);
                            }
                            IfcElement thisElement = this as IfcElement, revisedElement = revised as IfcElement;
                            if (thisElement != null && revisedElement != null)
                            {
                                revisedElement.Tag = thisElement.Tag;
                                List <IfcRelVoidsElement> voids = thisElement.HasOpenings.ToList();
                                foreach (var relVoids in voids)
                                {
                                    relVoids.RelatingBuildingElement = revisedElement;
                                }
                            }
                            IfcSpatialElement thisSpatial = this as IfcSpatialElement, revisedSpatial = revised as IfcSpatialElement;
                            if (thisSpatial != null && revisedSpatial != null)
                            {
                                foreach (IfcRelContainedInSpatialStructure contained in thisSpatial.ContainsElements.ToList())
                                {
                                    contained.RelatingStructure = revisedSpatial;
                                }
                            }
                            else if (revisedSpatial != null && thisElement != null)
                            {
                                if (containedInSpatialStructure != null)
                                {
                                    containedInSpatialStructure.RelatedElements.Remove(revisedProduct);
                                    containedInSpatialStructure.RelatingStructure.AddAggregated(revisedProduct);
                                }
                                List <IfcProduct> subProducts = thisObjectDefinition.IsDecomposedBy.SelectMany(x => x.RelatedObjects).OfType <IfcProduct>().ToList();
                                if (subProducts.Count > 0)
                                {
                                    new IfcRelContainedInSpatialStructure(subProducts, revisedSpatial);
                                }
                                foreach (IfcRelAssociatesMaterial associates in revisedSpatial.HasAssociations.OfType <IfcRelAssociatesMaterial>().ToList())
                                {
                                    associates.RelatedObjects.Remove(revisedSpatial);
                                }

                                IfcFacilityPart facilityPart = revisedSpatial as IfcFacilityPart;
                                if (facilityPart != null)
                                {
                                    IfcFacility facility = revisedSpatial.FindHost <IfcFacility>();
                                    if (facility != null)
                                    {
                                        facility.AddAggregated(revisedSpatial);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        IfcTypeObject thisTypeObject = this as IfcTypeObject, revisedTypeObject = revised as IfcTypeObject;
                        if (thisTypeObject != null && revisedTypeObject != null)
                        {
                            IfcTypeProduct thisTypeProduct = this as IfcTypeProduct, revisedTypeProduct = revised as IfcTypeProduct;
                            if (thisTypeProduct != null && revisedTypeProduct != null)
                            {
                                revisedTypeProduct.Tag = thisTypeProduct.Tag;
                                IfcElementType thisElementType = this as IfcElementType, revisedElementType = revised as IfcElementType;
                                if (thisElementType != null && revisedElementType != null)
                                {
                                    revisedElementType.ElementType = thisElementType.ElementType;
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                IfcRepresentationItem representationItem = this as IfcRepresentationItem, revisedItem = revised as IfcRepresentationItem;
                if (representationItem != null && revisedItem != null)
                {
                    IfcStyledItem styledItem = representationItem.StyledByItem;
                    if (styledItem != null)
                    {
                        styledItem.Item = revisedItem;
                    }

                    foreach (IfcShapeModel shapeModel in representationItem.Represents.ToList())
                    {
                        shapeModel.Items.Remove(representationItem);
                        shapeModel.Items.Add(revisedItem);
                    }
                    IfcPresentationLayerAssignment layerAssignment = representationItem.mLayerAssignment;
                    if (layerAssignment != null)
                    {
                        layerAssignment.AssignedItems.Remove(representationItem);
                        layerAssignment.AssignedItems.Add(revisedItem);
                    }
                }
            }
            mDatabase[revised.mStepId] = null;
            revised.mStepId            = StepId;
            mDatabase[StepId]          = revised;
        }
Example #4
0
		protected static void parseFields(IfcElementType t, List<string> arrFields, ref int ipos) { IfcTypeProduct.parseFields(t, arrFields, ref ipos); t.mElementType = arrFields[ipos++].Replace("'", ""); }
Example #5
0
		protected IfcElementType(IfcElementType t) : base(t) { mElementType = t.mElementType; }
Example #6
0
		internal void associateElement(IfcElementType eltype) { Associates.mRelatedObjects.Add(eltype.mIndex); }
Example #7
0
 public Pset_ManufacturerTypeInformation(IfcElementType type)
     : base(type.mDatabase, "Pset_ManufacturerTypeInformation")
 {
     Description = type.Name; type.AddPropertySet(this);
 }
        protected void ReplaceDatabase(BaseClassIfc revised)
        {
            IfcRoot thisRoot = this as IfcRoot, revisedRoot = revised as IfcRoot;

            if (thisRoot != null && revisedRoot != null)
            {
                revisedRoot.GlobalId     = thisRoot.GlobalId;
                revisedRoot.OwnerHistory = thisRoot.OwnerHistory;
                revisedRoot.Name         = thisRoot.Name;
                revisedRoot.Description  = thisRoot.Description;
                IfcObjectDefinition thisObjectDefinition = this as IfcObjectDefinition, revisedObjectDefinition = revised as IfcObjectDefinition;
                if (thisObjectDefinition != null && revisedObjectDefinition != null)
                {
                    foreach (IfcRelAggregates rel in thisObjectDefinition.IsDecomposedBy.ToList())
                    {
                        rel.RelatingObject = revisedObjectDefinition;
                    }
                    foreach (IfcRelNests rel in thisObjectDefinition.IsNestedBy.ToList())
                    {
                        rel.RelatingObject = revisedObjectDefinition;
                    }

                    foreach (IfcRelAssigns assigns in thisObjectDefinition.HasAssignments.ToList())
                    {
                        assigns.RelatedObjects.Remove(thisObjectDefinition);
                        assigns.RelatedObjects.Add(revisedObjectDefinition);
                    }
                    IfcRelDeclares relDeclares = thisObjectDefinition.HasContext;
                    if (relDeclares != null)
                    {
                        relDeclares.RelatedDefinitions.Remove(thisObjectDefinition);
                        relDeclares.RelatedDefinitions.Add(revisedObjectDefinition);
                    }
                    foreach (IfcRelAssociates associates in thisObjectDefinition.HasAssociations.ToList())
                    {
                        associates.RelatedObjects.Remove(thisObjectDefinition);
                        associates.RelatedObjects.Add(revisedObjectDefinition);
                    }
                    IfcObject thisObject = this as IfcObject, revisedObject = revised as IfcObject;
                    if (thisObject != null && revisedObject != null)
                    {
                        revisedObject.ObjectType = thisObject.ObjectType;

                        if (thisObject.mIsTypedBy != null)
                        {
                            thisObject.mIsTypedBy.mRelatedObjects.Remove(thisObject);
                        }
                        IfcProduct thisProduct = this as IfcProduct, revisedProduct = revised as IfcProduct;
                        if (thisProduct != null && revisedProduct != null)
                        {
                            thisProduct.detachFromHost();
                            IfcElement thisElement = this as IfcElement, revisedElement = revised as IfcElement;
                            if (thisElement != null && revisedElement != null)
                            {
                                revisedElement.Tag = thisElement.Tag;
                            }
                        }
                    }
                    else
                    {
                        IfcTypeObject thisTypeObject = this as IfcTypeObject, revisedTypeObject = revised as IfcTypeObject;
                        if (thisTypeObject != null && revisedTypeObject != null)
                        {
                            IfcTypeProduct thisTypeProduct = this as IfcTypeProduct, revisedTypeProduct = revised as IfcTypeProduct;
                            if (thisTypeProduct != null && revisedTypeProduct != null)
                            {
                                revisedTypeProduct.Tag = thisTypeProduct.Tag;
                                IfcElementType thisElementType = this as IfcElementType, revisedElementType = revised as IfcElementType;
                                if (thisElementType != null && revisedElementType != null)
                                {
                                    revisedElementType.ElementType = thisElementType.ElementType;
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                IfcRepresentationItem representationItem = this as IfcRepresentationItem, revisedItem = revised as IfcRepresentationItem;
                if (representationItem != null && revisedItem != null)
                {
                    IfcStyledItem styledItem = representationItem.StyledByItem;
                    if (styledItem != null)
                    {
                        styledItem.Item = revisedItem;
                    }

                    foreach (IfcShapeModel shapeModel in representationItem.mRepresents.ToList())
                    {
                        shapeModel.Items.Remove(representationItem);
                        shapeModel.Items.Add(revisedItem);
                    }
                    IfcPresentationLayerAssignment layerAssignment = representationItem.mLayerAssignment;
                    if (layerAssignment != null)
                    {
                        layerAssignment.AssignedItems.Remove(representationItem);
                        layerAssignment.AssignedItems.Add(revisedItem);
                    }
                }
            }
            mDatabase[revised.mIndex] = null;
            revised.mIndex            = mIndex;
            mDatabase[mIndex]         = revised;
        }
Example #9
0
 public Pset_ManufacturerOccurrence(IfcElementType type)
     : base(type.mDatabase, "Pset_ManufacturerOccurrence")
 {
     Description = type.Name; type.AddPropertySet(this);
 }
Example #10
0
		public IfcDistributionPort(IfcElementType host) : base(host) { }
Example #11
0
		protected IfcPort(IfcElementType t)
			: base(t.mDatabase)
		{
			if (t.mIsNestedBy.Count == 0)
				t.mIsNestedBy.Add(new IfcRelNests(t, this));
			else
				t.mIsNestedBy[0].addObject(this);
		}
Example #12
0
		protected IfcElementType(DatabaseIfc db, IfcElementType t) : base(db,t) { mElementType = t.mElementType; }
Example #13
0
		protected IfcElementType(IfcElementType basis) : base(basis) { mElementType = basis.mElementType; }