GEOUNED-org / GEOUNED

A tool to convert CAD to CSG & CSG to CAD for Monte Carlo transport codes
European Union Public License 1.2
45 stars 27 forks source link

Adding check for splines #210

Open shimwell opened 3 weeks ago

shimwell commented 3 weeks ago

Description

This PR adds a check on all the imported solids to see if there are splines present. If spines are present then a VaueError is raised and a message explaining the options is provided to the users.

Here is a screen shot of a cad geometry with spines being loaded and the error message

then the cad file gets loaded again with skip_solids=[0] and the load is successful

Screenshot 2024-06-05 130227

Fixes issue

fixes #201

Checklist

shimwell commented 3 weeks ago

I see the CI is failing with STEP files that are in the repo already. It looks like now I've added a check for splines some of the step files in testing/inputSTEP are found to contain contain splines.

I shall improve the error message so we can see which files have splines

shimwell commented 3 weeks ago

Locally I'm seeing that these files contain splines

FAILED tests/test_convert.py::test_conversion[input_step_file5] - ValueError: The solids [0] contain splines in the CAD geometry /home/j/GEOUNED/testing/inputSTEP/placa2.stp
FAILED tests/test_convert.py::test_conversion[input_step_file7] - ValueError: The solids [0] contain splines in the CAD geometry /home/j/GEOUNED/testing/inputSTEP/cylBox.stp
FAILED tests/test_convert.py::test_conversion[input_step_file10] - ValueError: The solids [0] contain splines in the CAD geometry /home/j/GEOUNED/testing/inputSTEP/Misc/origSolid_0.stp
FAILED tests/test_convert.py::test_conversion[input_step_file11] - ValueError: The solids [0] contain splines in the CAD geometry /home/j/GEOUNED/testing/inputSTEP/Misc/PiezaDavid.stp
FAILED tests/test_convert.py::test_conversion[input_step_file13] - ValueError: The solids [0] contain splines in the CAD geometry /home/j/GEOUNED/testing/inputSTEP/Misc/origSolid_6.stp
FAILED tests/test_convert.py::test_conversion[input_step_file14] - ValueError: The solids [0] contain splines in the CAD geometry /home/j/GEOUNED/testing/inputSTEP/Misc/RJ24.stp
FAILED tests/test_convert.py::test_conversion[input_step_file15] - ValueError: The solids [0] contain splines in the CAD geometry /home/j/GEOUNED/testing/inputSTEP/Misc/sphereBarCyl1.stp
FAILED tests/test_convert.py::test_conversion[input_step_file17] - ValueError: The solids [0] contain splines in the CAD geometry /home/j/GEOUNED/testing/inputSTEP/Misc/P52.stp
FAILED tests/test_convert.py::test_conversion[input_step_file18] - ValueError: The solids [0] contain splines in the CAD geometry /home/j/GEOUNED/testing/inputSTEP/Misc/sphereBarCyl2.stp
FAILED tests/test_convert.py::test_conversion[input_step_file21] - ValueError: The solids [0] contain splines in the CAD geometry /home/j/GEOUNED/testing/inputSTEP/Misc/origSolid_1.stp
FAILED tests/test_convert.py::test_conversion[input_step_file24] - ValueError: The solids [7, 70, 71, 72, 73, 76, 77, 78, 79, 109, 110, 111, 112, 113, 114, 115, 116, 133, 136, 149, 150] contain splines in th...
FAILED tests/test_convert.py::test_conversion[input_step_file25] - ValueError: The solids [8, 9, 14, 34, 51, 52, 63, 67, 77, 78, 113, 170, 172, 175, 176, 177, 178] contain splines in the CAD geometry /home/j...
FAILED tests/test_convert.py::test_conversion[input_step_file27] - ValueError: The solids [0] contain splines in the CAD geometry /home/j/GEOUNED/testing/inputSTEP/Torus/solid1.stp
FAILED tests/test_convert.py::test_conversion[input_step_file30] - ValueError: The solids [0] contain splines in the CAD geometry /home/j/GEOUNED/testing/inputSTEP/Torus/solid3.stp
FAILED tests/test_convert.py::test_conversion[input_step_file33] - ValueError: The solids [0] contain splines in the CAD geometry /home/j/GEOUNED/testing/inputSTEP/Torus/solid2.stp
FAILED tests/test_convert.py::test_conversion[input_step_file35] - ValueError: The solids [0, 1, 2, 3] contain splines in the CAD geometry /home/j/GEOUNED/testing/inputSTEP/Torus/Design1.stp
FAILED tests/test_convert.py::test_conversion[input_step_file36] - ValueError: The solids [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] contain splines in the CAD geometry /home/j/GEOUNED/testing/inputSTEP/Torus/ex...
FAILED tests/test_convert.py::test_conversion[input_step_file38] - ValueError: The solids [0] contain splines in the CAD geometry /home/j/GEOUNED/testing/inputSTEP/Torus/placa2.stp
FAILED tests/test_convert.py::test_conversion[input_step_file44] - ValueError: The solids [0] contain splines in the CAD geometry /home/j/GEOUNED/testing/inputSTEP/Torus/placa3.stp
FAILED tests/test_convert.py::test_conversion[input_step_file51] - ValueError: The solids [0] contain splines in the CAD geometry /home/j/GEOUNED/testing/inputSTEP/DoubleCylinder/placa3.step
FAILED tests/test_convert.py::test_conversion[input_step_file52] - ValueError: The solids [0] contain splines in the CAD geometry /home/j/GEOUNED/testing/inputSTEP/DoubleCylinder/placa2.step
shimwell commented 3 weeks ago

I've replaced the code that terminated the program when finding splines with a more gentle writing to log file as it appears that spines can be contained in step files but not used and that GEOUNED is fine with this.

shimwell commented 3 weeks ago

this one is ready for review

akolsek commented 3 weeks ago

Hey @psauvan and @jpcatalanUNED! Any idea why some of the stp files, when opened in text editor, show _B_SPLINE_CURVE_WITHKNOTS, but splines are not identified in SpaceClaim and the models translate well?

shimwell commented 3 weeks ago

Hey @psauvan and @jpcatalanUNED! Any idea why some of the stp files, when opened in text editor, show _B_SPLINE_CURVE_WITHKNOTS, but splines are not identified in SpaceClaim and the models translate well?

I think the STP file keeps a history of the previous edges even after they have been simplified or converted to other edge types

alexvalentine94 commented 2 weeks ago

Check for spline by using face.surface rather than edges