Closed santiagoIT closed 3 months ago
Sounds like there's a few IFC4.3 areas unimplememented on the cross schema interfaces.
So while we code-gen these files, any code within blocks starting and ending //##
is preserved when re-generating.
In this case you'd just need to add the implementation as per IFC2x3 in place of the NotImplementedException. E.g. see
(I'm not sure why, but the IFC2x3 code should have the same //##
markers around it in case we regen IFC2x3. But that's a separate issue)
In Ifc4 and lower the segments list is defined as:
private readonly ItemSet<IfcCompositeCurveSegment> _segments;
But starting with IFC4x3, the segments list is defined as:
private readonly ItemSet<IfcSegment> _segments;
it changed from IfcCompositeCurveSegment to IfcSegment
That is why I just cannot take over the code from earlier implementations.
This is how I implemented it:
[CrossSchemaAttribute(typeof(IIfcCompositeCurve), 1)]
IItemSet<IIfcCompositeCurveSegment> IIfcCompositeCurve.Segments
{
get
{
//##
var list= new ItemSet<IIfcCompositeCurveSegment>(this, 0, 1);
list.AddRange(@Segments.Where(x => x is IIfcCompositeCurveSegment).Cast<IIfcCompositeCurveSegment>());
return new Common.Collections.ProxyItemSet<IIfcCompositeCurveSegment, IIfcCompositeCurveSegment>(list);
//##
}
}
Let me know if this looks ok, if so, I can create a pull request.
What I posted above does not work. I get an Operation Out Of Transaction exception.
Trying to find a solution...
This works, The 4.3 ifc file still does not open, but processing continues much further now. There must be some other problem which I will investigate.
`
[CrossSchemaAttribute(typeof(IIfcCompositeCurve), 1)]
IItemSet
var list = new ItemSet<IIfcCompositeCurveSegment>(this, 0, 1);
foreach (var seg in compCurveSegs)
{
list.InternalAdd(seg); // no transaction available
}
return new Common.Collections.ProxyItemSet<IIfcCompositeCurveSegment, IIfcCompositeCurveSegment>(list);
//##
}
}`
@andyward Could you please review this pull request as well. It solves the other issue I ran into when trying to load a particular IFC4x3 model.
https://github.com/xBimTeam/XbimEssentials/pull/570
Thank you!
Should be done. Again I tweaked it. We don't have test coverage on this IIfcCompositeCurve.Segments code so please do retest my implementation.
Tested your implementation, worked 👍
Hello,
the following AutoGenerated code:
throws an exception when called.
I ran into this problem when opening an IFC file. This happens when an XbimWire is initialized from an IIfcCompositeCurve:
When line 861 is executed, the exception is thrown.
Since the IfcCompositeCurve file is generated by the Xbim.CodeGeneration tool, I have no idea on how to approach this problem. If you provide some guidance I can attempt to solve it.
test.zip