Skip to content

Commit

Permalink
Implements IfcSegmentReferenceCurve and cant
Browse files Browse the repository at this point in the history
  • Loading branch information
RickBrice committed Mar 28, 2024
1 parent 960a59d commit 83a127b
Show file tree
Hide file tree
Showing 2 changed files with 444 additions and 324 deletions.

9 comments on commit 83a127b

@RickBrice
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aothms By some miracle I managed to get IfcSegmentedReferenceCurve and cant working with this commit.

I am able to match the published results from the bSI Railway Room Unit Tests. This gives me a good amount of confidence in the implementation, but I know there are still problems because of my lack of true understanding of parent curve placement and curve segment placement within the composite curve.

In some cases I had to ignore the curve segment placement to match the unit test results. In other cases I had to the XYZ position. Someday this is going to cause problems.

If you don't mind, please review this commit paying particular attention to cases where segment_type_ == ST_CANT. In general, all of the IfcSpiral-subtypes are treated uniformly. The IfcNNNOrderPolynomialSpiral, IfcCosineSpiral, and IfcSineSpiral all basically work the same. IfcClothoid should work the same as the other spirals, but it doesn't. I had to hack in a correction to match the unit tests (Compare curve_segment_evaluator::set_cant_spiral_function and curve_segment_evaluator::set_clothoid_cant_spiral_function). I also had to hack in a correction for IfcLine when used for constant cant.

@RickBrice
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aothms In hopes of visually verifying the cant implementation, I tweaked the sectioned-solid-horizontal model by copy/paste a Bloss curve cant alignment from one of the Railway Room unit test files. I set the cant so it is very extreme (45 degree rotation over 100m). The attached file makes it through the validation service without errors.

When I run it through IfcConvert I get the following and no DAE file.

PS F:\IfcOpenShell_installed-vs2022-x64\bin> .\IfcConvert.exe .\sectioned-solid-horizontal_bloss_cant.ifc -yvv .\sectioned-solid-horizontal_bloss_cant.dae --use-element-guids
IfcOpenShell IfcConvert 0.8.0 (OCC 7.7.1)
[Notice] [2024-03-28 15:22:06] exclude entities IfcOpeningElement IfcSpace
Scanning file...
Done scanning file
Parsing input file took 0 seconds
[Error] [2024-03-28 15:22:06] Instance of type IfcAxis2Placement3D cannot be cast to IfcPlacement
Failed to convert:
#40113=IfcCurveSegment(.CONTINUOUS.,#40123,IfcLengthMeasure(0.),IfcLengthMeasure(100.),#40127)
[Error] [2024-03-28 15:22:06] No operation defined for:
#40113=IfcCurveSegment(.CONTINUOUS.,#40123,IfcLengthMeasure(0.),IfcLengthMeasure(100.),#40127)

Same results if the --plan option is used.

IfcAxis2Placement3D is a subclass of IfcPlacement.

RDG and ODA show the alignment curve but no solid.

sectioned-solid-horizontal_bloss_cant.ifc.txt

@aothms
Copy link
Member

@aothms aothms commented on 83a127b Mar 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, really great to hear. At least these inconsistencies in how certain transitions are handled are now fully explicit and can be discussed with the other vendors. That's great news.

So what happened when I ran you example was that the section solid first cross section was positioned at distalong 300, but the curve length was only 100. This didn't work very well, caused integer overflow and completely crashed trying to allocate a near infinite number of loft faces. So that is fixed now, now that particular file yields:

[Warning] [2024-03-29 15:41:50] Empty sweep domain with start at 300.000000 end at 600.000000 and curve domain length 100.000000

Maybe there is still something wrong there in the code, but at least it makes sense to some bounds checking.

Then I changed your model to have the first profile at distlong = 0, by changing the first point by dist expr

#118 = IFCPOINTBYDISTANCEEXPRESSION(IFCLENGTHMEASURE(0.), $, $, $, /*#79*/#40112); /*Replace composite curve with segmented reference curve*/

With that I indeed see something in the viewport that resembles cant! This is amazing!

afbeelding

I'm not sure if it's visible from the screenshot. I don't think it's 45 degrees though.

I would be tempted to say that ODA doesn't show the cant.

afbeelding

In rdf viewer something goes wrong

afbeelding

But yeah maybe there's still something unconventional going on in the file.

@aothms
Copy link
Member

@aothms aothms commented on 83a127b Mar 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, ACCA does the same thing as RDF, but allows to zoom in a bit more controlled, so it's possible to see what's going on.

afbeelding

Somehow the entire sweep is orthogonal with the alignment curve.

There does seem to be cant in the sweep, but a bit hard to see.

@RickBrice
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argg - I didn't think to check where the solid was positioned on the curve. Thanks.
I changed the optional end point of the IfcSegmentedReferenceCurve for a 45degree tilt but didn't change the IfcThirdOrderPolynomialSprial parameters. The parameters are for a cant of 0.16 with a railhead distance of 1.5 so that is about a 6 degree cross slope. This is consistent with the image.

@RickBrice
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea what is going on with my IfcConvert. I pulled your fix and did a clean build and install of everything. Still can't generate a DAE file.

F:\IfcOpenShell_installed-vs2022-x64\bin> .\IfcConvert.exe .\sectioned-solid-horizontal_bloss_cant.ifc -yvv .\sectioned-solid-horizontal_bloss_cant.dae --use-element-guids
IfcOpenShell IfcConvert 0.8.0 (OCC 7.7.1)
[Notice] [2024-03-29 09:06:44] exclude entities IfcOpeningElement IfcSpace
Scanning file...
Done scanning file
Parsing input file took 0 seconds
[Error] [2024-03-29 09:06:44] Instance of type IfcAxis2Placement3D cannot be cast to IfcPlacement
Failed to convert:
#40113=IfcCurveSegment(.CONTINUOUS.,#40123,IfcLengthMeasure(0.),IfcLengthMeasure(100.),#40127)
[Error] [2024-03-29 09:06:44] No operation defined for:
#40113=IfcCurveSegment(.CONTINUOUS.,#40123,IfcLengthMeasure(0.),IfcLengthMeasure(100.),#40127)

@RickBrice
Copy link
Contributor Author

@RickBrice RickBrice commented on 83a127b Mar 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you make other changes to the IFC file I shared?
I deleted icfos from my computer and did a complete rebuild, including the dependencies, of the v0.8.0 branch overnight.
I still get the same errors from IfcConvert

Edit: the problem is definitely with the file. I get good results with the original sectioned solid horizontal file. I’ll keep at it

@aothms
Copy link
Member

@aothms aothms commented on 83a127b Mar 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RickBrice

No other changes

$ diff sectioned-solid-horizontal_bloss_cant.ifc.txt sectioned-solid-horizontal_bloss_cant.2.ifc
120c120
< #118 = IFCPOINTBYDISTANCEEXPRESSION(IFCLENGTHMEASURE(300.), $, $, $, /*#79*/#40112); /*Replace composite curve with segmented reference curve*/
---
> #118 = IFCPOINTBYDISTANCEEXPRESSION(IFCLENGTHMEASURE(0.), $, $, $, /*#79*/#40112); /*Replace composite curve with segmented reference curve*/

Also not in code.

$ git status
On branch v0.8.0
Your branch is up to date with 'origin/v0.8.0'.

nothing to commit, working tree clean

Do you have any pending changes perhaps in git?

Otherwise, shall we get on a call to debug this together?

@RickBrice
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS F:\IfcOpenShell> git status
On branch v0.8.0
Your branch is up to date with 'origin/v0.8.0'.

nothing to commit, working tree clean

A call would be great. There are a few other things I'd like to chat with you as well. I'm having trouble with HDF5 and the debug version of the lib files. I also have some questions about the best place to put some alignment building utility functions I have create (maybe in the hierarchy helper class).

You have my direct email. Let's find a time that works.

Please sign in to comment.