michaelgale / cq-gridfinity

A python library to build parameterized gridfinity compatible objects such a baseplates and boxes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gridfinitybox with -s -l and either -ld or -wd > 1 fails

iceleftd opened this issue · comments

The following command fails: gridfinitybox 3 1 2 -ld 2 -l -s -f STL.

After some experimentation it appears that changing removing -l OR removing -s OR setting -ld < 2 does not fail, so this appears to be a corner condition of some sort.

Versions:

$ python
Python 3.11.7 (tags/v3.11.7:fa7a6f2, Dec  4 2023, 19:24:49) [MSC v.1937 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cqgridfinity
>>> cqgridfinity.__version__
'0.4.2'
>>>

Error text:

$ gridfinitybox 3 1 2 -ld 2 -l -s -f STL
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\xxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts\gridfinitybox.exe\__main__.py", line 7, in <module>
  File "C:\Users\xxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\cqgridfinity\scripts\gridfinitybox.py", line 222, in main
    box.save_stl_file(filename=argsd["output"])
  File "C:\Users\xxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\cqgridfinity\gf_obj.py", line 282, in save_stl_file
    obj = self.cq_obj.val().wrapped
          ^^^^^^^^^^^
  File "C:\Users\xxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\cqgridfinity\gf_obj.py", line 57, in cq_obj
    return self.render()
           ^^^^^^^^^^^^^
  File "C:\Users\xxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\cqgridfinity\gf_box.py", line 136, in render
    r = self.safe_fillet(r, bs, self.safe_fillet_rad)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\xxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\cqgridfinity\gf_obj.py", line 173, in safe_fillet
    return obj.edges(selector).fillet(rad)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\xxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\cadquery\cq.py", line 1304, in fillet
    s = solid.fillet(radius, edgeList)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\xxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\cadquery\occ_impl\shapes.py", line 2780, in fillet
    return self.__class__(fillet_builder.Shape())
                          ^^^^^^^^^^^^^^^^^^^^^^
OCP.StdFail.StdFail_NotDone: BRep_API: command not done

  _____      _     _  __ _       _ _           ____
 / ____|    (_)   | |/ _(_)     (_) |         |  _ \
| |  __ _ __ _  __| | |_ _ _ __  _| |_ _   _  | |_) | _____  __
| | |_ | '__| |/ _` |  _| | '_ \| | __| | | | |  _ < / _ \ \/ /
| |__| | |  | | (_| | | | | | | | | |_| |_| | | |_) | (_) >  <
 \_____|_|  |_|\__,_|_| |_|_| |_|_|\__|\__, | |____/ \___/_/\_\
                                        __/ |
                                       |___/

Version: 0.4.2
Gridfinity box: 3U x 1U x 2U (126.0 mm x 42.0 mm x 17.8 mm), 1.00 mm walls
  with options: scoops, label strips, 2 length-wise walls

Can you please check which version of cq-gridfinity you are using? My latest version seems to work with your broken test case.

$ python
>>> import cqgridfinity
>>> cqgridfinity.__version__

Update the issue with versioning info.

Ok thanks. It looks like you are using v.0.4.0. Can you try pip installing v.0.4.2 and see if that works?

Updated the version and it still fails. Updated the issue description accordingly.

Thanks. Since it is a problem down in the OCP kernel (called from CadQuery), can you please check the versions of those packages too?

$ python
>>> import cadquery
>>> cadquery.__version__
>>> import OCP
>>> OCP.__version__

FYI, on my working platform CadQuery is v.2.2.0 and OCP is v.7.7.1.0.

Another thing to try is changing the box size to 3x1x3, i.e. gridfinitybox 3 1 3 -ld 2 -l -s -f STL Does this variant fail too?

Yes, height 1, 2, or 3 doesn't change anything. I should mention that this is an all-new installation. I had all kinds of problems at first that went away when I moved backwards from Python 3.12 to Python 3.11 and reinstalled.

I'm not surprised about the python version 3.12 to 3.11 issue. I think I remember folks in the CadQuery team discussing issues with supporting python 3.12. Sadly as both platforms and libraries are always changing, the probability of breaking changes among dependencies is not zero!

This might help explain your issue with python 3.12: CadQuery/cadquery#1475

Yeah, I more or less figured that one out. :)

@iceleftd Did you identify which versions of CadQuery and OCP your installation are using?

Closing this issue out. Likely a platform difference and potentially resolved since v.0.5.5.