예제 #1
0
        /// <summary>
        /// Add the child objects to the IfcRelDecomposes
        /// </summary>
        /// <param name="ifcRelDecomposes">Either a IfcRelAggregates or IfcRelNests object</param>
        /// <param name="sheetName">SheetName the children come from</param>
        /// <param name="childNames">list of child object names separated by " : ", NOT case sensitive</param>
        private bool AddChildObjects(IfcRelDecomposes ifcRelDecomposes, string sheetName, string childNames)
        {
            bool returnValue = false;
            IEnumerable<IfcObjectDefinition> childObjs  = GetSheetObjectList(sheetName);
            //check that the name is not a single element, also gets over single entries with : in them
            string test = childNames.ToLower().Trim();
            IfcObjectDefinition RelatedObject = childObjs.Where(obj => obj.Name.ToString().ToLower().Trim() == test).FirstOrDefault();
            if (RelatedObject != null)
            {
                //check we have not already added as this can be a merge
                if (!ifcRelDecomposes.RelatedObjects.Contains(RelatedObject))
                {
                    ifcRelDecomposes.RelatedObjects.Add_Reversible(RelatedObject);
                }
                returnValue = true;
            }
            else //ok nothing found for the full string so assume delimited string
            {
                char splitChar = GetSplitChar(childNames);
                List<string> splitChildNames = SplitString(childNames, splitChar);

                foreach (string item in splitChildNames)
                {
                    string name = item.ToLower().Trim();
                    RelatedObject = childObjs.Where(obj => obj.Name.ToString().ToLower().Trim() == name).FirstOrDefault();
                    if (RelatedObject != null)
                    {
                        //check we have not already added as this can be a merge
                        if (!ifcRelDecomposes.RelatedObjects.Contains(RelatedObject))
                        {
                            ifcRelDecomposes.RelatedObjects.Add_Reversible(RelatedObject);
                        }
                        returnValue = true;
                    }
                }
            }
            return returnValue;
        }
예제 #2
0
        protected void AddRelatedObjects(IfcRelDecomposes rel, CompositionNode treeItem)
        {
            foreach (IfcObjectDefinition child in rel.RelatedObjects)
            {
                if (child.EntityLabel == treeItem.EntityId) { continue; }//prevent any infinite looping
                CompositionNode childItem;
                if (!NodeMap.TryGetValue(child, out childItem)) //already written
                {
                    childItem = new CompositionNode(child);
                    NodeMap.Add(child, childItem);

                }
                treeItem.Children.Add(childItem);

            }
        }
예제 #3
0
        /// <summary>
        /// Add the parent objects to the IfcRelDecomposes
        /// </summary>
        /// <param name="ifcRelDecomposes">Either a IfcRelAggregates or IfcRelNests object</param>
        /// <param name="parentName">IfcObjectDefinition.Name value to search for, NOT case sensitive</param>
        /// <returns></returns>
        private bool AddParentObject(IfcRelDecomposes ifcRelDecomposes, string parentName)
        {
            IfcObjectDefinition relatingObject = GetParentObject(parentName);

            if (relatingObject != null)
            {
                ifcRelDecomposes.RelatingObject = relatingObject;
                return true;
            }
            return false;
        }