Exemplo n.º 1
0
 SemConnectedElements(SemElement main, SemElement sub)
 {
     IfcRelConnectsElements = new IfcRelConnectsElements
                                  {
                                      GlobalId = IfcGloballyUniqueId.NewGuid(),
                                      OwnerHistory = SemHeaderSetting.Setting3D.IfcOwnerHistory,
                                      RelatingElement = main.IfcObject as IfcElement,
                                      RelatedElement = sub.IfcObject as IfcElement
                                  };
 }
Exemplo n.º 2
0
 SemConnectedElements(SemElement main, SemElement sub)
 {
     IfcRelConnectsElements = new IfcRelConnectsElements
     {
         GlobalId        = IfcGloballyUniqueId.NewGuid(),
         OwnerHistory    = SemHeaderSetting.Setting3D.IfcOwnerHistory,
         RelatingElement = main.IfcObject as IfcElement,
         RelatedElement  = sub.IfcObject as IfcElement
     };
 }
Exemplo n.º 3
0
 /// <summary>
 /// Get Description for passed in IfcElement
 /// </summary>
 /// <param name="ifcRelConnectsElement">Element holding description</param>
 /// <returns>string</returns>
 internal string GetComponentDescription(IfcRelConnectsElements ifcRelConnectsElement)
 {
     if (ifcRelConnectsElement != null)
     {
         if (!string.IsNullOrEmpty(ifcRelConnectsElement.Description))
         {
             return(ifcRelConnectsElement.Description);
         }
         else if (!string.IsNullOrEmpty(ifcRelConnectsElement.Name))
         {
             return(ifcRelConnectsElement.Name);
         }
     }
     return(DEFAULT_STRING);
 }
Exemplo n.º 4
0
        /// <summary>
        /// Add the data to the IfcRelConnectsElements object
        /// </summary>
        /// <param name="row">COBieConnectionRow holding the data</param>
        private void AddConnection(COBieConnectionRow row)
        {
            IfcElement             relatingElement        = null;
            IfcElement             relatedElement         = null;
            IfcRelConnectsElements ifcRelConnectsElements = null;

            if (ValidateString(row.RowName1))
            {
                relatingElement = GetElement(row.RowName1);
            }

            if (ValidateString(row.RowName2))
            {
                relatedElement = GetElement(row.RowName2);
            }

            //check on merge that we have not already created the IfcRelConnectsElements object
            ifcRelConnectsElements = CheckIfObjExistOnMerge <IfcRelConnectsElements>(row.Name).Where(rce => (rce.RelatingElement == relatingElement) && (rce.RelatedElement == relatedElement)).FirstOrDefault();
            if (ifcRelConnectsElements != null)
            {
                return; //we have this object so return, make assumption that ports will also have exist!
            }

            if (ifcRelConnectsElements == null)
            {
                ifcRelConnectsElements = Model.Instances.New <IfcRelConnectsElements>();
            }

            //Add Created By, Created On and ExtSystem to Owner History.
            SetUserHistory(ifcRelConnectsElements, row.ExtSystem, row.CreatedBy, row.CreatedOn);

            //using statement will set the Model.OwnerHistoryAddObject to ifcRelConnectsElements.OwnerHistory as OwnerHistoryAddObject is used upon any property changes,
            //then swaps the original OwnerHistoryAddObject back in the dispose, so set any properties within the using statement
            using (COBieXBimEditScope context = new COBieXBimEditScope(Model, ifcRelConnectsElements.OwnerHistory))
            {
                if (ValidateString(row.Name))
                {
                    ifcRelConnectsElements.Name = row.Name;
                }
                if (ValidateString(row.ConnectionType))
                {
                    ifcRelConnectsElements.Description = row.ConnectionType;
                }

                if (relatingElement != null)
                {
                    ifcRelConnectsElements.RelatingElement = relatingElement;
                }

                if (relatedElement != null)
                {
                    ifcRelConnectsElements.RelatedElement = relatedElement;
                }


                //Add Ports
                AddRelConnectsPorts(row.RealizingElement, row.PortName1, row.PortName2, relatingElement, relatedElement);

                //Add GlobalId
                AddGlobalId(row.ExtIdentifier, ifcRelConnectsElements);

                if (!ValidateString(ifcRelConnectsElements.Description))
                {
                    ifcRelConnectsElements.Description = row.Description;
                }
            }
        }