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

[BUG] - Issues when using simplify - "full" #203

Closed
KBGrammer opened this issue May 31, 2024 · 2 comments
Closed

[BUG] - Issues when using simplify - "full" #203

KBGrammer opened this issue May 31, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@KBGrammer
Copy link
Contributor

Describe the bug

Simplification fails when using the option "full" with the error below. It appers to be a missing second option for calls to get_box() and build_c_table_from_solids().

To Reproduce

  1. use option "simplify": "full"
  2. See errors

Expected behavior

Should process the simplification of the geometry, but it crashes with a number of errors.

Error message

This is the error for get_box:

Traceback (most recent call last):
  File "~/test_convert.py", line 233, in <module>
    test_cad_to_csg_from_json_with_defaults("config_complete_defaults.json")
  File "~/test_convert.py", line 134, in test_cad_to_csg_from_json_with_defaults
    my_cad_to_csg = geouned.CadToCsg.from_json(input_json_file)
  File "~/GEOUNED-1.1.0/src/geouned/GEOUNED/core.py", line 252, in from_json
    cad_to_csg.start()
  File "~/GEOUNED-1.1.0/src/geouned/GEOUNED/core.py", line 642, in start
    Box = UF.get_box(c)
TypeError: get_box() missing 1 required positional argument: 'options'

This is the error for build_c_table_from_solids:

Traceback (most recent call last):
  File "~/test_convert.py", line 233, in <module>
    test_cad_to_csg_from_json_with_defaults("config_complete_defaults.json")
  File "~/test_convert.py", line 134, in test_cad_to_csg_from_json_with_defaults
    my_cad_to_csg = geouned.CadToCsg.from_json(input_json_file)
  File "~/GEOUNED-1.1.0/src/geouned/GEOUNED/core.py", line 252, in from_json
    cad_to_csg.start()
  File "~/GEOUNED-1.1.0/src/geouned/GEOUNED/core.py", line 643, in start
    CT = build_c_table_from_solids(Box, (c.Surfaces, Surfs), option="full")
TypeError: build_c_table_from_solids() missing 1 required positional argument: 'options'

This is the error from the point_inside function:

Traceback (most recent call last):
  File "~/test_convert.py", line 233, in <module>
    test_cad_to_csg_from_json_with_defaults("config_complete_defaults.json")
  File "~/test_convert.py", line 134, in test_cad_to_csg_from_json_with_defaults
    my_cad_to_csg = geouned.CadToCsg.from_json(input_json_file)
  File "~/GEOUNED-1.1.0/src/geouned/GEOUNED/core.py", line 252, in from_json
    cad_to_csg.start()
  File "~/GEOUNED-1.1.0/src/geouned/GEOUNED/core.py", line 643, in start
    CT = build_c_table_from_solids(Box, (c.Surfaces, Surfs), option="full",options=self.options)
  File "~/GEOUNED-1.1.0/src/geouned/GEOUNED/utils/boolean_solids.py", line 269, in build_c_table_from_solids
    res, splitRegions = split_solid_fast(Box, surfaces[s1], True, options)
  File "~/GEOUNED-1.1.0/src/geouned/GEOUNED/utils/boolean_solids.py", line 404, in split_solid_fast
    sgn = check_sign(s, surf)
  File "~/GEOUNED-1.1.0/src/geouned/GEOUNED/utils/boolean_solids.py", line 552, in check_sign
    point = point_inside(solid)
  File "~/GEOUNED-1.1.0/src/geouned/GEOUNED/utils/boolean_solids.py", line 463, in point_inside
    boxes, centers = cut_box(box)
TypeError: 'int' object is not callable

Please complete the following information):

  • OS: Linux
  • GEOUNED 1.1.0
  • Python 3.9.2

Additional context

If I had only posted the first error, I wouldn't have found the second. I'm working through these and resolving them as I go.

Errors 1 and 2 seem to be resolved by changing the following lines in core.py:

Box = UF.get_box(c)
CT = build_c_table_from_solids(Box, (c.Surfaces, Surfs), option="full")

to this:

Box = UF.get_box(c,self.options)
CT = build_c_table_from_solids(Box, (c.Surfaces, Surfs), option="full",options=self.options)

Error 3 is because an integer "cut_box" is defined in the function point_inside() as well as being defined as a callable function. Changing the integer to something else resolves it. Affects two lines in utils/boolean_solids.py, with cut_box replaced as "cbox".

    cbox = 2
        if n == cbox:
@KBGrammer KBGrammer added the bug Something isn't working label May 31, 2024
KBGrammer pushed a commit to KBGrammer/GEOUNED that referenced this issue Jun 3, 2024
KBGrammer pushed a commit to KBGrammer/GEOUNED that referenced this issue Jun 3, 2024
KBGrammer pushed a commit to KBGrammer/GEOUNED that referenced this issue Jun 3, 2024
psauvan pushed a commit that referenced this issue Jun 4, 2024
* Patch for #203

* Responding to comments on #206

* Update core.py

Add missing space to call to UF.get_box()

---------

Co-authored-by: AlvaroCubi <55387701+AlvaroCubi@users.noreply.github.com>
Co-authored-by: Grammer, Kyle <grammerkb@ornl.gov>
@KBGrammer
Copy link
Contributor Author

This bug has been resolved.

KBGrammer pushed a commit to KBGrammer/GEOUNED that referenced this issue Jun 5, 2024
@KBGrammer
Copy link
Contributor Author

The parameter passed down to get_box should be "self.options" because it is treated as options in get_box. Additionally, there's a call to get_box that was also missing the required second parameter in conversion/cell_definition.py

def get_box(comp, options):
    bb = FreeCAD.BoundBox(comp.BoundBox)
    bb.enlarge(options.enlargeBox)

@KBGrammer KBGrammer mentioned this issue Jun 5, 2024
4 tasks
psauvan pushed a commit that referenced this issue Jun 7, 2024
* Patch for #203

* Responding to comments on #206

* Update core.py

Add missing space to call to UF.get_box()

* Replace all get_box calls to have options.enlargeBox, change get_box to refer only to enlargeBox instead of options.enlargeBox

---------

Co-authored-by: AlvaroCubi <55387701+AlvaroCubi@users.noreply.github.com>
Co-authored-by: Grammer, Kyle <grammerkb@ornl.gov>
psauvan pushed a commit that referenced this issue Jun 17, 2024
* Patch for #203

* Responding to comments on #206

* Update core.py

Add missing space to call to UF.get_box()

---------

Co-authored-by: AlvaroCubi <55387701+AlvaroCubi@users.noreply.github.com>
Co-authored-by: Grammer, Kyle <grammerkb@ornl.gov>
psauvan pushed a commit that referenced this issue Jun 17, 2024
* Patch for #203

* Responding to comments on #206

* Update core.py

Add missing space to call to UF.get_box()

* Replace all get_box calls to have options.enlargeBox, change get_box to refer only to enlargeBox instead of options.enlargeBox

---------

Co-authored-by: AlvaroCubi <55387701+AlvaroCubi@users.noreply.github.com>
Co-authored-by: Grammer, Kyle <grammerkb@ornl.gov>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant