XbimGeometry icon indicating copy to clipboard operation
XbimGeometry copied to clipboard

Some objects (walls, slabs) are not being displayed and a possible solution

Open santiagoIT opened this issue 1 year ago • 1 comments

If you open the IFC file with XBimExplorer (compiling the master branch) you will notice that the walls are not being displayed:

image

I doubt this is the proper solution, but it might give a hint as to what might be wrong. But if the code changes listed are applied, then the walls do display: image

Btw, XbimXplorer version 4 does display the walls. So this is some sort of regression.

Let me know how to proceed. If this should be the proper solution, I can make a pull request, otherwise please give me some hints as to where the problem might be. I spent a lot of time, trying to figure this out, so any help/advice is appreciated.

This is in XbimGeometryCreator.cpp. Just added code to support XBimSolidSets.

void XbimGeometryCreator::WriteTriangulation(BinaryWriter^ bw, IXbimGeometryObject^ shape, double tolerance, double deflection, double angle)
{

	XbimOccShape^ xShape = dynamic_cast<XbimOccShape^>(shape);
	if (xShape != nullptr)
	{
		xShape->WriteTriangulation(bw, tolerance, deflection, angle);
		return;
	}

	/// START
	/// NEW CODE -> workaround for the problem of the walls not being displayed
	XbimSolidSet^ xSolidSet = dynamic_cast<XbimSolidSet^>(shape);
	if (xSolidSet != nullptr)
	{
		// create an XBimCompound out of the XBimSolidSet
		TopoDS_Compound compound;
		BRep_Builder b;
		b.MakeCompound(compound);

		for each (IXbimSolid^ solid in xSolidSet)
		{
			if (!solid->IsValid)
			{
				continue;
			}

			XbimSolid^ solid2 = dynamic_cast<XbimSolid^>(solid);
			if (solid2 != nullptr) {
				b.Add(compound, solid2);
				//GC::KeepAlive(solid);
				XbimCompound^ compound2 = gcnew XbimCompound(compound, true, tolerance);
				compound2->WriteTriangulation(bw, tolerance, deflection, angle);
			}
		}
	}
	/// END
	/// NEW CODE
}

Thank you! xBim-Issue.zip

santiagoIT avatar Aug 15 '24 21:08 santiagoIT

This has been fixed here in v6 branch: https://github.com/xBimTeam/XbimGeometry/commit/44610f146c3c597b5024a65a25a2684ac57fb206

andyward avatar Dec 14 '24 15:12 andyward