public XbimReferencedModel(IfcDocumentInformation documentInformation)
 {
     DocumentInformation = documentInformation;
     if (!File.Exists(documentInformation.Name))
     {
         throw new XbimException("Reference model not found:" + documentInformation.Name);
     }
     Model = new XbimModel();
     if (!Model.Open(documentInformation.Name, XbimDBAccess.Read))
     {
         throw new XbimException("Unable to open reference model: " + documentInformation.Name);
     }
 }
示例#2
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
            IfcDocumentInformation root = (IfcDocumentInformation)obj;

            return(this == root);
        }
示例#3
0
        public void IfcParse(int propIndex, IPropertyValue value)
        {
            switch (propIndex)
            {
            case 0:
                _relatingDocument = (IfcDocumentInformation)value.EntityVal;
                break;

            case 1:
                ((IXbimNoNotifyCollection)_relatedDocuments).Add((IfcDocumentInformation)value.EntityVal);
                break;

            case 2:
                _relationshipType = value.StringVal;
                break;

            default:
                this.HandleUnexpectedAttribute(propIndex, value); break;
            }
        }
        public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
        {
            switch (propIndex)
            {
            case 0:
                _relatingDocument = (IfcDocumentInformation)(value.EntityVal);
                return;

            case 1:
                _relatedDocuments.InternalAdd((IfcDocumentInformation)value.EntityVal);
                return;

            case 2:
                _relationshipType = value.StringVal;
                return;

            default:
                throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper()));
            }
        }
示例#5
0
        /// <summary>
        /// Add the document references to the IfcDocumentInformation object
        /// </summary>
        /// <param name="row">COBieDocumentRow holding row data</param>
        /// <param name="ifcDocumentInformation">IfcDocumentInformation object to add references too</param>
        private void AddDocumentReference(COBieDocumentRow row, IfcDocumentInformation ifcDocumentInformation)
        {
            if (ValidateString(row.File))
            {
                //get locations, assume we have the same number of locations and document names
                List<string> strLocationValues = null;
                if (ValidateString(row.Directory)) strLocationValues = SplitString(row.Directory, ':');
                List<string> strNameValues = SplitString(row.File, ':');
                //see if we have a location match to every document name
                if ((strLocationValues != null) && (strNameValues.Count != strLocationValues.Count))
                {
                    strLocationValues = null; //cannot match locations to document so just supply document names
                }
                //create the Document References
                if (strNameValues.Count > 0)
                {
                    IfcDocumentReference[] ifcDocumentReferences = new IfcDocumentReference[strNameValues.Count];
                    int i = 0;
                    foreach (string name in strNameValues)
                    {
                        ifcDocumentReferences[i] = Model.Instances.New<IfcDocumentReference>(dr => { dr.Name = name; });
                        if (strLocationValues != null)
                            ifcDocumentReferences[i].Location = strLocationValues[i];
                        i++;
                    }
                    ifcDocumentInformation.SetDocumentReferences(true, ifcDocumentReferences);
                }

            }
        }
 public void IfcParse(int propIndex, IPropertyValue value)
 {
     switch (propIndex)
     {
         case 0:
             _relatingDocument = (IfcDocumentInformation) value.EntityVal;
             break;
         case 1:
             ((IXbimNoNotifyCollection)_relatedDocuments).Add((IfcDocumentInformation) value.EntityVal);
             break;
         case 2:
             _relationshipType = value.StringVal;
             break;
         default:
             this.HandleUnexpectedAttribute(propIndex, value); break;
     }
 }