public static void RemoveObjectFromClassificationNotation(this IfcClassificationNotationSelect cls, IfcRoot root)
 {
     var model = cls.ModelOf;
     var rel = model.Instances.Where<IfcRelAssociatesClassification>(r => r.RelatingClassification == cls).FirstOrDefault();
     if (rel == null)
         return;
     else if (rel.RelatedObjects.Contains(root))
         rel.RelatedObjects.Remove_Reversible(root);
 }
 public static void AddObjectToClassificationNotation(this IfcClassificationNotationSelect cls, IfcRoot root)
 {
     var model = cls.ModelOf;
     var rel = model.Instances.Where<IfcRelAssociatesClassification>(r => r.RelatingClassification == cls).FirstOrDefault();
     if (rel == null)
         model.Instances.New<IfcRelAssociatesClassification>(r =>
         {
             r.RelatingClassification = cls;
             r.RelatedObjects.Add_Reversible(root);
         });
     else if (!rel.RelatedObjects.Contains(root))
         rel.RelatedObjects.Add_Reversible(root);
 }
Exemple #3
0
        public TreeNode(IfcRoot entity, bool isRoot, bool isLeaf)
        {
            IsRoot = isRoot;
            IsLeaf = isLeaf;
            if (!IsLeaf)
            {
                Children = new TreeNodes();
            }

            if (entity != null)
            {
                SetDefaults(entity);
            }
        }
Exemple #4
0
        private void SetDefaults(IfcRoot entity)
        {
            Name = entity.CreateFriendlyName();
            EntityId = entity.EntityLabel;

            if (entity is IfcObjectDefinition)
            {
                IfcType = entity.GetType().Name;
            }
            else if (entity is IfcRelDecomposes)
            {
                IfcRelDecomposes rel = entity as IfcRelDecomposes;
                IfcType = rel.RelatingObject.GetType().Name;
            }

        }
Exemple #5
0
        public override bool Equals(object obj)
        {
            // Check for null
            if (obj == null)
            {
                return(false);
            }

            // Check for type
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }

            // Cast as IfcRoot
            IfcRoot root = (IfcRoot)obj;

            return(this == root);
        }
Exemple #6
0
        public CompositionNode(IfcRoot entity)
            : base(entity, false, false)
        {

        }
Exemple #7
0
 public ElementNode(IfcRoot entity)
     : base(entity, false, true)
 { }
        private static String BuildName(IfcRoot ifcObject)
        {
            String name;
            if (ifcObject is IfcRelDecomposes)
            {
                IfcRelDecomposes rel = ifcObject as IfcRelDecomposes;
                name = BuildName(rel.RelatingObject);
            }
            else
            {
                name = ifcObject.Name;
            }

            if (String.IsNullOrEmpty(name))
            {
                name = ifcObject.ToString();
            }

            return name;
        }
 /// <summary>
 /// Set Category to the property set
 /// </summary>
 /// <param name="ifcRoot">IfcRoot Object (IfcPropertySet)</param>
 /// <param name="category">string, category Name</param>
 private void SetCategory(IfcRoot ifcRoot, string category)
 {
     IfcRelAssociatesClassification ifcRelAssociatesClassification = Model.Instances.Where<IfcRelAssociatesClassification>(r => (r.RelatingClassification is IfcClassificationReference) && ((IfcClassificationReference)r.RelatingClassification).Name.ToString().ToLower() == category.ToLower()).FirstOrDefault();
     //create if none found
     if (ifcRelAssociatesClassification == null)
     {
         ifcRelAssociatesClassification = Model.Instances.New<IfcRelAssociatesClassification>();
         IfcClassificationReference ifcClassificationReference = Model.Instances.New<IfcClassificationReference>();
         ifcClassificationReference.Name = category;
         ifcRelAssociatesClassification.RelatingClassification = ifcClassificationReference;
     }
     //add this IfcRoot object if not already associated
     if (!ifcRelAssociatesClassification.RelatedObjects.Contains(ifcRoot))
     {
         ifcRelAssociatesClassification.RelatedObjects.Add_Reversible(ifcRoot);
     }
     
 }