Inheritance: IfcBuildingElement
Example #1
0
 internal IfcBuildingElementProxy(DatabaseIfc db, IfcBuildingElementProxy p, DuplicateOptions options) : base(db, p, options)
 {
     mPredefinedType = p.mPredefinedType;
 }
Example #2
0
		internal static IfcElement constructElement(string className, IfcProduct container, IfcObjectPlacement pl, IfcProductRepresentation r, IfcDistributionSystem system)
		{
			string str = className, definedType = "";
			if (!string.IsNullOrEmpty(str))
			{
				string[] fields = str.Split(".".ToCharArray());
				if (fields.Length > 1)
				{
					str = fields[0];
					definedType = fields[1];
				}
			}
			IfcElement element = null;
			Type type = Type.GetType("GeometryGym.Ifc." + str);
			if (type != null)
			{
				ConstructorInfo ctor = type.GetConstructor(new[] { typeof(IfcProduct), typeof(IfcObjectPlacement), typeof(IfcProductRepresentation) });
				if (ctor == null)
				{
					ctor = type.GetConstructor(new[] { typeof(IfcProduct), typeof(IfcObjectPlacement), typeof(IfcProductRepresentation), typeof(IfcDistributionSystem) });
					if (ctor == null)
						throw new Exception("XXX Unrecognized Ifc Constructor for " + className);
					else
						element = ctor.Invoke(new object[] { container, pl, r, system }) as IfcElement;
				}
				else
					element = ctor.Invoke(new object[] { container, pl, r }) as IfcElement;
			}
			if (element == null)
				element = new IfcBuildingElementProxy(container, pl, r);

			if (!string.IsNullOrEmpty(definedType))
			{
				if (container.mDatabase.mSchema == Schema.IFC2x3)
					element.ObjectType = definedType;
				else
				{
					type = element.GetType();
					PropertyInfo pi = type.GetProperty("PredefinedType");
					if (pi != null)
					{
						Type enumType = Type.GetType("GeometryGym.Ifc." + type.Name + "TypeEnum");
						if (enumType != null)
						{
							FieldInfo fi = enumType.GetField(definedType);
							if (fi == null)
							{
								element.ObjectType = definedType;
								fi = enumType.GetField("NOTDEFINED");
							}
							if (fi != null)
							{
								int i = (int)fi.GetValue(enumType);
								object newEnumValue = Enum.ToObject(enumType, i);
								pi.SetValue(element, newEnumValue, null);
							}
							else
								element.ObjectType = definedType;
						}
						else
							element.ObjectType = definedType;
					}
					else
						element.ObjectType = definedType;
				}
			}
			return element;
		}
Example #3
0
 internal IfcBuildingElementProxy(DatabaseIfc db, IfcBuildingElementProxy p, IfcOwnerHistory ownerHistory, bool downStream) : base(db, p, ownerHistory, downStream)
 {
     mPredefinedType = p.mPredefinedType;
 }
Example #4
0
 public Pset_ConcreteElementGeneral(IfcBuildingElementProxy instance)
     : base(instance.mDatabase, "Pset_ConcreteElementGeneral")
 {
     Description = instance.Name; DefinesOccurrence.Assign(instance);
 }
Example #5
0
		internal static IfcBuildingElementProxy Parse(string strDef) { IfcBuildingElementProxy p = new IfcBuildingElementProxy(); int ipos = 0; parseFields(p, ParserSTEP.SplitLineFields(strDef), ref ipos); return p; }
Example #6
0
		internal static void parseFields(IfcBuildingElementProxy p, List<string> arrFields, ref int ipos)
		{
			IfcBuildingElement.parseFields(p, arrFields, ref ipos);
			string str = arrFields[ipos++];
			if (str.StartsWith("."))
			{
				try
				{
					p.mPredefinedType = (IfcBuildingElementProxyTypeEnum)Enum.Parse(typeof(IfcBuildingElementProxyTypeEnum), str.Replace(".", ""));
				}
				catch (Exception) { }
			}
		}
Example #7
0
		internal IfcBuildingElementProxy(IfcBuildingElementProxy p) : base(p) { mPredefinedType = p.mPredefinedType; }
Example #8
0
 internal static IfcBuildingElementProxy Parse(string str)
 {
     IfcBuildingElementProxy p = new IfcBuildingElementProxy(); int pos = 0; p.Parse(str, ref pos, str.Length); return p;
 }
Example #9
0
 internal IfcBuildingElementProxy(DatabaseIfc db, IfcBuildingElementProxy p)
     : base(db, p)
 {
     mPredefinedType = p.mPredefinedType;
 }