Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid parametrization of IfcIndexedPolyCurve #500

Open
ChernyshevDS opened this issue Sep 12, 2024 · 0 comments
Open

Invalid parametrization of IfcIndexedPolyCurve #500

ChernyshevDS opened this issue Sep 12, 2024 · 0 comments

Comments

@ChernyshevDS
Copy link

Hello. I have encountered a problem during loading a specific model, containing a lot of reinforcing bars. Bars geometry is defined using IfcSweptDiskSolid over curve IfcIndexedPolyCurve. After generating meshes all of them appeared trimmed.

Assemblies and versions affected:

I'm using my own fork of Xbim.Geometry based on 5.1.431, however I don't see any changes in relevant code base up to current 5.1.762 develop.

Minimal file to reproduce the issue:

bar.stripped.ifc.zip

Expected behavior:

I expect the bar to look like this:

Actual behavior or exception details:

Actually generated mesh:

Additional Details

After some digging I found the reason fot this behaviour. To build the mesh with IfcSweptDiskSolid firstly the wire should be created. Is is created in method XbimSolid::CreateDirectrix(IIfcCurve^ directrix, Nullable<IfcParameterValue> startParam, Nullable<IfcParameterValue> endParam, Microsoft::Extensions::Logging::ILogger^ logger). As you can see, this method accepts two parameters for wire trimming. This method even has a useful link to this thread, which explains, that for composite curves the parameter values are calculated as a sum of parameter lengths of individual segments, where line segment has parameter length 1, and arc segments has parameter length equal to arc angle in degrees.

The problem is that in OpenCascade line segment wires are parameterized not from 0 to 1 as in IFC, but from 0 to segment length. So, if we have a composite wire containing a line segment with the length of 3 and an 90-degree arc, according to IFC this wire should have parametric length of 91 (90 degrees + 1 line), and in OpenCascade it would have length 93 (90 degrees + line length).

The CreateDirectrix method applies a special handling to IIfcCompositeCurves, recalculating parameter values to pass them to underlying OpenCascade objects, but it lacks the same handling for IIfcIndexedPolyCurves. I didn't check it, but it seems that the same problem should arise when using IfcPolyLine, because it has the same problems with parametrization.

I've managed to fix this problem in my fork (both images above are from my application), but I'm a bit hesitant to make a pull request because I'm not enirely happy with the implementation. However, it may be of some help to someone:
xbimsolid.patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant