CQ-editor
CQ-editor copied to clipboard
Segmentation fault when rendering a cadquery script that fillets edges
To Reproduce
Here's the cadquery script I am using. Rendering this causes CQ-Editor to segfault.
import cadquery as cq
start_radius = 30
slot_size = 7
slot_inset = 10
length = 100
end_radius = 20
outer = cq.Workplane("XY").circle(start_radius)
lofted = outer.workplane(offset=length).circle(end_radius).loft(combine=True)
channeled = lofted.faces(">Z").rect((2 * end_radius - 3 * slot_inset), (2 * end_radius - 3 * slot_inset), forConstruction=True)\
.vertices().rect(slot_size, slot_size).cutThruAll()\
.faces("|Z").edges().fillet(3) # <---- This line causes the segmentation fault
Environment
OS: Macbook 10.15.7
Was CadQuery installed using Conda?: Yes
Output of conda list from your active Conda environment:
# packages in environment at /Users/blah/anaconda3/envs/cad:
#
# Name Version Build Channel
alabaster 0.7.12 py_0 conda-forge
appdirs 1.4.4 pyh9f0ad1d_0 conda-forge
applaunchservices 0.2.1 py_0 conda-forge
appnope 0.1.2 py38h50d1736_1 conda-forge
argh 0.26.2 pyh9f0ad1d_1002 conda-forge
astroid 2.5.6 py38h50d1736_0 conda-forge
async_generator 1.10 py_0 conda-forge
atomicwrites 1.4.0 pyh9f0ad1d_0 conda-forge
attrs 21.2.0 pyhd8ed1ab_0 conda-forge
autopep8 1.5.6 pyhd8ed1ab_0 conda-forge
babel 2.9.1 pyh44b312d_0 conda-forge
backcall 0.2.0 pyh9f0ad1d_0 conda-forge
backports 1.0 py_2 conda-forge
backports.functools_lru_cache 1.6.4 pyhd8ed1ab_0 conda-forge
black 21.5b1 pyhd8ed1ab_0 conda-forge
bleach 3.3.0 pyh44b312d_0 conda-forge
brotlipy 0.7.0 py38h5406a74_1001 conda-forge
ca-certificates 2021.5.30 h033912b_0 conda-forge
cadquery 2.1 py3.8 cadquery
certifi 2021.5.30 py38h50d1736_0 conda-forge
cffi 1.14.5 py38ha97d567_0 conda-forge
chardet 4.0.0 py38h50d1736_1 conda-forge
click 8.0.1 py38h50d1736_0 conda-forge
cloudpickle 1.6.0 py_0 conda-forge
colorama 0.4.4 pyh9f0ad1d_0 conda-forge
cq-editor 0.2 py3.8 cadquery
cryptography 3.4.7 py38h1fa4640_0 conda-forge
dataclasses 0.8 pyhc8e2a94_1 conda-forge
dbus 1.13.16 h18a8e69_0
decorator 5.0.9 pyhd8ed1ab_0 conda-forge
defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge
diff-match-patch 20200713 pyh9f0ad1d_0 conda-forge
docutils 0.17.1 py38h50d1736_0 conda-forge
entrypoints 0.3 pyhd8ed1ab_1003 conda-forge
expat 2.2.9 h4a8c4bd_2 conda-forge
ezdxf 0.14.2 py_0 conda-forge
flake8 3.8.4 py_0 conda-forge
fontconfig 2.13.1 h10f422b_1005 conda-forge
freetype 2.10.4 h4cff582_1 conda-forge
future 0.18.2 py38h50d1736_3 conda-forge
gettext 0.19.8.1 h7937167_1005 conda-forge
glib 2.68.0 hdf23fa2_0
icu 58.2 h0a44026_1000 conda-forge
idna 2.10 pyh9f0ad1d_0 conda-forge
imagesize 1.2.0 py_0 conda-forge
importlib-metadata 4.3.1 py38h50d1736_0 conda-forge
importlib_metadata 4.3.1 hd8ed1ab_0 conda-forge
intervaltree 3.0.2 py_0 conda-forge
ipykernel 5.5.5 py38h6c79ece_0 conda-forge
ipython 7.24.0 py38h6c79ece_0 conda-forge
ipython_genutils 0.2.0 py_1 conda-forge
isort 5.8.0 pyhd8ed1ab_0 conda-forge
jedi 0.17.2 py38h50d1736_1 conda-forge
jinja2 3.0.1 pyhd8ed1ab_0 conda-forge
jpeg 9d hbcb3906_0 conda-forge
jsonschema 3.2.0 pyhd8ed1ab_3 conda-forge
jupyter_client 6.1.12 pyhd8ed1ab_0 conda-forge
jupyter_core 4.7.1 py38h50d1736_0 conda-forge
jupyterlab_pygments 0.1.2 pyh9f0ad1d_0 conda-forge
keyring 23.0.1 py38h50d1736_0 conda-forge
lazy-object-proxy 1.6.0 py38h96a0964_0 conda-forge
libblas 3.9.0 8_openblas conda-forge
libcblas 3.9.0 8_openblas conda-forge
libcxx 10.0.0 1
libffi 3.3 hb1e8313_2
libgfortran 4.0.0 7_5_0_h1a10cd1_22 conda-forge
libgfortran4 7.5.0 h1a10cd1_22 conda-forge
libiconv 1.16 haf1e3a3_0 conda-forge
liblapack 3.9.0 8_openblas conda-forge
libopenblas 0.3.12 openmp_h63d9170_1 conda-forge
libpng 1.6.37 h7cec526_2 conda-forge
libsodium 1.0.17 h01d97ff_0 conda-forge
libspatialindex 1.9.3 h4a8c4bd_3 conda-forge
libxml2 2.9.10 h7cdb67c_3
llvm-openmp 11.1.0 hda6cdc1_1 conda-forge
logbook 1.5.3 py38h5406a74_4 conda-forge
markupsafe 2.0.1 py38h96a0964_0 conda-forge
matplotlib-inline 0.1.2 pyhd8ed1ab_2 conda-forge
mccabe 0.6.1 py_1 conda-forge
mistune 0.8.4 py38h5406a74_1003 conda-forge
mypy_extensions 0.4.3 py38h50d1736_3 conda-forge
nbclient 0.5.3 pyhd8ed1ab_0 conda-forge
nbconvert 6.0.7 py38h50d1736_3 conda-forge
nbformat 5.1.3 pyhd8ed1ab_0 conda-forge
ncurses 6.2 h0a44026_1
nest-asyncio 1.5.1 pyhd8ed1ab_0 conda-forge
nptyping 1.4.2 pyhd8ed1ab_0 conda-forge
numpy 1.20.3 py38had91d27_1 conda-forge
numpydoc 1.1.0 py_1 conda-forge
occt 7.4.0 hb9b6dc7_3 conda-forge
ocp 7.4 1_py3.8 cadquery
openssl 1.1.1k h0d85af4_0 conda-forge
packaging 20.9 pyh44b312d_0 conda-forge
pandoc 2.13 h0d85af4_0 conda-forge
pandocfilters 1.4.2 py_1 conda-forge
parso 0.7.0 pyh9f0ad1d_0 conda-forge
path 15.1.2 py38h50d1736_0 conda-forge
path.py 12.5.0 0 conda-forge
pathspec 0.8.1 pyhd3deb0d_0 conda-forge
pcre 8.44 h4a8c4bd_0 conda-forge
pexpect 4.8.0 pyh9f0ad1d_2 conda-forge
pickleshare 0.7.5 py_1003 conda-forge
pip 21.1.1 py38hecd8cb5_0
pluggy 0.13.1 py38h50d1736_4 conda-forge
prompt-toolkit 3.0.18 pyha770c72_0 conda-forge
psutil 5.8.0 py38h96a0964_1 conda-forge
ptyprocess 0.7.0 pyhd3deb0d_0 conda-forge
pycodestyle 2.6.0 pyh9f0ad1d_0 conda-forge
pycparser 2.20 pyh9f0ad1d_2 conda-forge
pydocstyle 6.1.1 pyhd8ed1ab_0 conda-forge
pyflakes 2.2.0 pyh9f0ad1d_0 conda-forge
pygments 2.9.0 pyhd8ed1ab_0 conda-forge
pylint 2.7.2 py38h50d1736_0 conda-forge
pyls-black 0.4.6 pyh9f0ad1d_0 conda-forge
pyls-spyder 0.3.2 pyhd8ed1ab_0 conda-forge
pyopenssl 20.0.1 pyhd8ed1ab_0 conda-forge
pyparsing 2.4.7 pyh9f0ad1d_0 conda-forge
pyqt 5.9.2 py38h655552a_2
pyqtgraph 0.11.1 pyhd3deb0d_0 conda-forge
pyrsistent 0.17.3 py38h5406a74_2 conda-forge
pysocks 1.7.1 py38h50d1736_3 conda-forge
python 3.8.10 h88f2d9e_7
python-dateutil 2.8.1 py_0 conda-forge
python-jsonrpc-server 0.4.0 pyh9f0ad1d_0 conda-forge
python-language-server 0.36.2 pyhd8ed1ab_0 conda-forge
python.app 1.3 py38h5406a74_4 conda-forge
python_abi 3.8 1_cp38 conda-forge
pytz 2021.1 pyhd8ed1ab_0 conda-forge
pyyaml 5.4.1 py38h5406a74_0 conda-forge
pyzmq 19.0.1 py38h1fcdcd6_0 conda-forge
qdarkstyle 3.0.2 pyhd8ed1ab_0 conda-forge
qt 5.9.7 h93ee506_2 conda-forge
qtawesome 1.0.2 pyhd8ed1ab_0 conda-forge
qtconsole 5.1.0 pyhd8ed1ab_0 conda-forge
qtpy 1.9.0 py_0 conda-forge
readline 8.1 h9ed2024_0
regex 2021.4.4 py38h96a0964_0 conda-forge
requests 2.25.1 pyhd3deb0d_0 conda-forge
rope 0.19.0 pyhd8ed1ab_0 conda-forge
rtree 0.9.7 py38hc59ffc2_1 conda-forge
scipy 1.4.1 py38h38b60c6_3 conda-forge
setuptools 52.0.0 py38hecd8cb5_0
sip 4.19.8 py38h0a44026_0
six 1.16.0 pyh6c4a22f_0 conda-forge
snowballstemmer 2.1.0 pyhd8ed1ab_0 conda-forge
sortedcontainers 2.4.0 pyhd8ed1ab_0 conda-forge
sphinx 4.0.2 pyh6c4a22f_1 conda-forge
sphinxcontrib-applehelp 1.0.2 py_0 conda-forge
sphinxcontrib-devhelp 1.0.2 py_0 conda-forge
sphinxcontrib-htmlhelp 2.0.0 pyhd8ed1ab_0 conda-forge
sphinxcontrib-jsmath 1.0.1 py_0 conda-forge
sphinxcontrib-qthelp 1.0.3 py_0 conda-forge
sphinxcontrib-serializinghtml 1.1.5 pyhd8ed1ab_0 conda-forge
spyder 4.2.1 py38h50d1736_3 conda-forge
spyder-kernels 1.10.2 py38h50d1736_0 conda-forge
sqlite 3.35.4 hce871da_0
tbb 2020.3 h879752b_0
testpath 0.5.0 pyhd8ed1ab_0 conda-forge
textdistance 4.2.1 pyhd8ed1ab_0 conda-forge
three-merge 0.1.1 pyh9f0ad1d_0 conda-forge
tk 8.6.10 hb0a8c7a_0
toml 0.10.2 pyhd8ed1ab_0 conda-forge
tornado 6.1 py38h5406a74_1 conda-forge
traitlets 5.0.5 py_0 conda-forge
typed-ast 1.4.3 py38h96a0964_0 conda-forge
typing_extensions 3.7.4.3 py_0 conda-forge
typish 1.9.2 pyhd8ed1ab_0 conda-forge
ujson 3.0.0 py38hc84c608_0 conda-forge
urllib3 1.26.5 pyhd8ed1ab_0 conda-forge
watchdog 2.1.2 py38h3c40b66_0 conda-forge
wcwidth 0.2.5 pyh9f0ad1d_2 conda-forge
webencodings 0.5.1 py_1 conda-forge
wheel 0.36.2 pyhd3eb1b0_0
wrapt 1.12.1 py38h5406a74_3 conda-forge
wurlitzer 2.1.0 py38h50d1736_0 conda-forge
xz 5.2.5 h1de35cc_0
yaml 0.2.5 haf1e3a3_0 conda-forge
yapf 0.31.0 pyhd8ed1ab_0 conda-forge
zeromq 4.3.2 h6de7cb9_2 conda-forge
zipp 3.4.1 pyhd8ed1ab_0 conda-forge
zlib 1.2.11 h1de35cc_3
The fillet is too large for the square channels and probably causes some sort of self-intersection. The following code runs and produces a renderable result, but if you change the fillet radius to 1.5 you'll get a general command not done error. Using 3 is causing a segfault within the OCCT CAD kernel.
import cadquery as cq
start_radius = 30
slot_size = 7
slot_inset = 10
length = 100
end_radius = 20
outer = cq.Workplane("XY").circle(start_radius)
lofted = outer.workplane(offset=length).circle(end_radius).loft(combine=True)
channeled = lofted.faces(">Z").rect((2 * end_radius - 3 * slot_inset), (2 * end_radius - 3 * slot_inset), forConstruction=True)\
.vertices().rect(slot_size, slot_size).cutThruAll()\
.faces("|Z").edges().fillet(1.49)
show_object(channeled)
Thanks for the prompt reply! I'll try that out.
For posterity's sake, which repository (github link?) should I log this bug against? Segmentation faults like this, instead of user-friendly parse/compile errors, impact the usability of tools higher up the chain too, such as cadquery and cq-editor.
Logging bugs upstream is more complicated. See https://dev.opencascade.org/doc/overview/html/occt_contribution__contribution_workflow.html#occt_contribution_workflow_issue
You have to reproduce the error in OCCT's Drawexe. I believe you also have to sign an agreement and set up an account.
It would also be worth searching through their bug tracker. I think it's likely there is already a bug for this issue: https://tracker.dev.opencascade.org/view_all_bug_page.php