Open hsbBill opened 5 years ago
Can you give us more detail about the failure? I just tried and the file opens fine for me. No errors, no exceptions:
Hi, Yes, the mesh is loading fine in the viewer. But, when I am creating an IXbimGeometryObject object from the geometry engine the returned solid is invalid. Typically I am using similar code to the following. As I mentioned, my earlier implementation with v3 xBim libs returns a valid solid from the same file.
var bodyrep = ifcelement.Representation as IIfcProductRepresentation;
IXbimGeometryObject geom = null;
if (bodyrep != null)
{
var ifcRep = bodyrep.Representations.GetAt(0) as IIfcRepresentation;
if (ifcRep != null)
{
var ifcItem = ifcRep.Items.First();
var ifcBrepItem = ifcItem as IIfcGeometricRepresentationItem;
geom = engine.Create(ifcBrepItem, null);
}
}
Many thanks
Confirmed. This was not an issue until recently. After upgrading my test solution to the latest Xbim.Geometry 5.1.254
this produces an invalid geometry (geom.IsValid == false
).
For the sake of completeness:
private static void Test()
{
var engine = new XbimGeometryEngine();
var log = XbimLogging.CreateLogger("Test");
using (var model = IfcStore.Open(@"c:\Users\Martin\Downloads\TestSolid.ifc"))
{
var wall = model.Instances[229] as IIfcProduct;
if (wall.Representation is IIfcProductRepresentation bodyrep)
{
if (bodyrep.Representations.GetAt(0) is IIfcRepresentation ifcRep)
{
var ifcItem = ifcRep.Items.First() as IIfcGeometricRepresentationItem;
var geom = engine.Create(ifcItem, null);
if (!geom.IsValid)
throw new Exception("Invalid geometry");
else
return;
}
}
}
throw new Exception("Test didn't go as expected.");
}
Hi, I have been moving up to the latest xBim v5. libs from the earlier v3. ones to support both Ifc3x2 and Ifc4. All going well except the XbimGeometryEngine.Create method is now failing to create geometry on some facetedbreps that were successful running on earlier v3. libs.
Any help greatly appreciated.
Regards Bill Malcolm
Attached is an IFC containing one brep that fails on v5. but succeeds on v3. TestSolid.zip