You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now the examples in documentation say nothing about IFC 4x3. For example, when writing data to an existing IFC file, do I now need to handle all IFC 2x3, IFC4 and IFC 4x3 separately?
Let's take modifying IfcSite as a case study. Below is how I replace the values in an existing IFCSITE entity that. It handles those three versions separately, but I am not sure yet if it is actually necessary for Ifc 4x3 :
(If you are wondering why the code for Ifc4x3 is more complex, it's because Xbim.Ifc4x3.MeasureResource.IfcCompoundPlaneAngleMeasure doesn' have FromDouble method)
The text was updated successfully, but these errors were encountered:
Yes we need to update the docs with some 4x3 examples. On the list. But actually cross-schema support works the same way it does with Ifc4-Ifc2x3. The important thing is that the Ifc4 interfaces are 'special' and work across schemas (Note: in future we'll make this more explicit with a 'Xbim.CrossSchema' that targets the latest schema)
But for now if you use the Ifc4 interfaces all the other schemas implement this contract and handle the cross schema mapping. So setting ifcSite.RefLatitude to an Ifc4.MeasureResource.IfcCompoundPlaneAngleMeasure in the IFC4x3 example below actually assigns an Ifc4x3.MeasureResource.IfcCompoundPlaneAngleMeasure .
Note I've also shown how to use the EntityCreator to create entities agnostic of the schema
// using Xbim.Ifc;// using Xbim.Ifc4.Interfaces;double?northings=50.123d;double?eastings=-1d;double?elevation=123.4d;usingvarmodel=IfcStore.Open("ViadottoAcerno4x3.ifc");usingvartransaction=model.BeginTransaction("Edit");varifcSite=model.Instances.OfType<IIfcSite>().FirstOrDefault()!;varifcProject=model.Instances.OfType<IIfcProject>().FirstOrDefault()!;if(eastings!=null&&northings!=null){ifcSite.RefLatitude=Xbim.Ifc4.MeasureResource.IfcCompoundPlaneAngleMeasure.FromDouble(northings.Value);ifcSite.RefLongitude=Xbim.Ifc4.MeasureResource.IfcCompoundPlaneAngleMeasure.FromDouble(eastings.Value);}if(elevation!=null){varprojectLengthUnit=ifcProject.UnitsInContext.Units.OfType<IIfcSIUnit>().FirstOrDefault(u =>u.UnitType==IfcUnitEnum.LENGTHUNIT);ifcSite.RefElevation=newXbim.Ifc4.MeasureResource.IfcLengthMeasure(elevation.Value/(projectLengthUnit?.Power??1d));}// Create a Beam in the current schemavarfactory=newEntityCreator(model);varbeam=factory.Beam(c =>c.PredefinedType=IfcBeamTypeEnum.JOIST);transaction.Commit();
There are a few items I'll add to the list to follow up on:
We need to complete the IFC4x3 partials = e.g. IfcCompoundPlaneAngleMeasurePartial's AsDouble()
We should consider making some of these partials extension methods on the Cross-schema interfaces. E.g. IfcUnitAssignmentPartial
We need to extend EntityCreator with the new Ifc4x3 entities.
Right now the examples in documentation say nothing about IFC 4x3. For example, when writing data to an existing IFC file, do I now need to handle all IFC 2x3, IFC4 and IFC 4x3 separately?
Let's take modifying IfcSite as a case study. Below is how I replace the values in an existing
IFCSITE
entity that. It handles those three versions separately, but I am not sure yet if it is actually necessary for Ifc 4x3 :(If you are wondering why the code for Ifc4x3 is more complex, it's because
Xbim.Ifc4x3.MeasureResource.IfcCompoundPlaneAngleMeasure
doesn' haveFromDouble
method)The text was updated successfully, but these errors were encountered: