Nixpkgs: CadQuery, CQ-editor and cqparts

Created on 3 Aug 2019  ยท  14Comments  ยท  Source: NixOS/nixpkgs

Project description

CadQuery is a Python package for generating Cad models. It's similar to OpenSCAD, except it uses Python instead of a limited scripting language and it uses the Opencascade kernel, meaning it offers the modelling features and performance of a professional CAD package.

CQ-editor is a QT based graphical interface for CadQuery.

cqparts is a wrapper for CadQuery objects to create the traditional parts/assembly hierarchy of other CAD software.

The developers strongly recommend installing through Anaconda, which has been successfully used under NixOS. But it would be better if it was packaged with nix.

Metadata

packaging request python qkde

All 14 comments

Progress

CadQuery is currently working. CQ-editor is mostly there but there are some errors related to pyqt5 and qtconsole. I haven't had a go at cqparts yet, but that should be pretty trivial.

I'll keep on working on this.

So pyqtgraph in NixOS/nixpkgs currently depends upon pyqt4: https://github.com/NixOS/nixpkgs/blob/caa9018846045cfacc5682216e0d2c374e1505c1/pkgs/development/python-modules/pyqtgraph/default.nix

From their page, pyqtgraph can use a heap of different bindings and pyside2 works with the most versions of Python.

I feel like I would have less issues if pyqtgraph used pyqt5, like the other dependencies. Should I just override it with a let ... in in the cq-editor expression, or should the nixpkgs' pyqt5 expression be changed in some way to allow different QT bindings?

Or do I not know enough about Python QT bindings, and it's not an issue to have pyqt4 and pyqt5 both being used in the same Python app?

pyqt5 is a bit messy and broken currently. I am looking into that at the moment.
https://github.com/NixOS/nixpkgs/pull/65836

Just tried pulling in master after #65836 was merged and cq-editor now works! Thanks so much @FRidh!
I'll clean up my stuff and open a pull request tomorrow.

I don't think cqparts is ready for packaging just yet. It currently imports FreeCAD, with a comment # FIXME: remove freecad dependency from this module... right now I'm just trying to get it working..
I'll have another go at it when they get around to removing FreeCAD as a dependency.
As a note for either myself or anyone else who picks cqparts up, it's going to need a preconfigure phase something like

cd source/deployment
python3 make-setup.py --lib cqparts

The readme in the deployment directory has more info.

Also, the cqparts GitHub repo is actually 11 Python libraries all in one, the actual cqparts library and other libraries for various part catalogues like cqparts_bearings. Can I combine 11 libraries into one nixpkgs package? Should I? It feels a bit unorganised adding 10 extra, almost identical packages to nixpkgs.

No idea how I got it cq-editor working. Rebased against master, reset my laptop, and it all fell apart. Now qt is back to whining about

[nix-shell:~/tempbuild/nixpkgs]$ QT_QPA_PLATFORM= QT_DEBUG_PLUGINS=1 cq-editor
QFactoryLoader::QFactoryLoader() checking directory path "/nix/store/w7gsq8v86hni4ynaqgwwlnlny115ylng-python3-3.7.4/lib/qt-5.12/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/nix/store/gya8i7afpmgvnz2bkkdipllf2sifm504-cq-editor-0.1RC1/lib/qt-5.12/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/nix/store/hy0z060pmjwrdrbb0qrii7hnwif8cz1y-qtbase-5.12.0-dev/lib/qt-5.12/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/nix/store/3dmdzlqhwgykbh0c1jf1bc59alsm1gik-libxml2-2.9.9-dev/lib/qt-5.12/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/nix/store/is6cqm7lk6gnmqy0bmr0x94cy63cmsnl-libxml2-2.9.9-bin/lib/qt-5.12/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/nix/store/l4fhdrgznbav2zxqgz5801ryairpd093-libxslt-1.1.33-dev/lib/qt-5.12/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/nix/store/p0rlywxvmwjdv21wjqhgmsr4wq9rz7gq-libxslt-1.1.33-bin/lib/qt-5.12/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/nix/store/1z0jyl97lka71av44ki7bnxridw8vdd1-openssl-1.0.2s-bin/lib/qt-5.12/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/nix/store/gqmcgk749sp5a8dl3bjv2i6xxli0sm6z-sqlite-3.28.0-bin/lib/qt-5.12/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/nix/store/vr66xrj0lazm6n4jidvw2wfn3lpzbanr-harfbuzz-icu-2.5.3-dev/lib/qt-5.12/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/nix/store/q0zndgkxqrzj47dg7msifg3wkms9cd34-graphite2-1.3.6/lib/qt-5.12/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/nix/store/11ngz9irxr4mrp936xavckfrrbpb5b04-icu4c-64.2-dev/lib/qt-5.12/plugins/platforms" ...
# snipped many many more paths
QFactoryLoader::QFactoryLoader() checking directory path "/nix/store/xnk229qan97prxmwfsgm65py2qpca109-gnutar-1.32/lib/qt-5.12/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/nix/store/rgb9bhwzwijg87jy1kcd88ixdzg91hjy-gzip-1.10/lib/qt-5.12/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/nix/store/6g1vx8239mrxa1apicld1nbihminadsx-gnumake-4.2.1/lib/qt-5.12/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/nix/store/xfghy8ixrhz3kyy6p724iv3cxji088dx-bash-4.4-p23/lib/qt-5.12/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/nix/store/iyz25vfk5f0w5kfrsx3z9il60dv9nhyn-patch-2.7.6/lib/qt-5.12/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/nix/store/k5vgmfzyzx2ax392m23nx1p92lvik020-swaybg-1.0/lib/qt-5.12/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/home/marcus/lib/qt-5.12/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/run/wrappers/lib/qt-5.12/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/home/marcus/.nix-profile/lib/qt-5.12/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/nix/var/nix/profiles/default/lib/qt-5.12/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/run/current-system/sw/lib/qt-5.12/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/etc/profiles/per-user/marcus/lib/qt-5.12/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/home/marcus/.local/lib/qt-5.12/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/nix/store/w7gsq8v86hni4ynaqgwwlnlny115ylng-python3-3.7.4/bin/platforms" ...
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Aborted

This QT stuff is incredibly frustrating. I'm not sure what QT is looking for. I've lost motivation for the moment, I'll get back to it in a few days.

I think the Qt stuff is due to https://github.com/NixOS/nixpkgs/issues/65399

Thanks @gebner. I had already tried conforming with the libsForQt5.callPackage ... and mkDerivationWith python3Packages.buildPythonApplication style described in the manual and it didn't change the error. (my cq-editor/default.nix)

But rereading #65399 and following the trail of breadcrumbs led me to this comment.

So if I run nix-shell -I nixpkgs=/home/marcus/tempbuild/nixpkgs -p cq-editor it gives the error in my previous comment, if I run nix-shell -I nixpkgs=/home/marcus/tempbuild/nixpkgs -p qt5Full -p cq-editor it works.

I'm finished for the day now, but that's a good starting point for my next run at it.

hmm;;; help me~*

import cadquery
Traceback (most recent call last):
File "", line 1, in
File "/nix/store/j5kki2qzj0svbhs5pw0fj0wydphl115w-python3-3.7.5-env/lib/python3.7/site-packages/cadquery/__init__.py", line 2, in
from .occ_impl.geom import Plane, BoundBox, Vector, Matrix
File "/nix/store/j5kki2qzj0svbhs5pw0fj0wydphl115w-python3-3.7.5-env/lib/python3.7/site-packages/cadquery/occ_impl/geom.py", line 3, in
from OCC.Core.gp import gp_Vec, gp_Ax1, gp_Ax3, gp_Pnt, gp_Dir, gp_Trsf, gp, gp_XYZ
ModuleNotFoundError: No module named 'OCC.Core'

hmm;;; help me~*

Hi @PlumpMath, were you using all the code from this branch? https://github.com/NixOS/nixpkgs/pull/66254

PythonOCC comes from the let statement in pkgs/development/python-modules/cadquery/default.nix

my configuration.nix

      marcus7070 = import (fetchFromGitHub {
        owner = "marcus7070";
        repo = "nixpkgs";
        rev = "07abf0a8723cae353e65a89259462966fe681c98";
        sha256 =

"143bl8n4fcz21dwkc5jq3j8jf7jcf683901ni11nvr34hffsv47i";
}) { config.allowUnfree = true; };

marcus7070.cq-editor

====================================++ cadquery building now.. (opencascade)

I didn't see detail the code because I'm tired at yesterday so late subway.
I'm trying now (building...)
I wish success...
I'm korean 3d BEMS related programmer. so next ifcopenshell g,.g Thanks.

2019๋…„ 11์›” 20์ผ (์ˆ˜) ์˜คํ›„ 12:04, Marcus Boyd notifications@github.com๋‹˜์ด ์ž‘์„ฑ:

hmm;;; help me~*

Hi @PlumpMath https://github.com/PlumpMath, were you using all the code
from this branch? #66254 https://github.com/NixOS/nixpkgs/pull/66254

PythonOCC comes from the let statement in
pkgs/development/python-modules/cadquery/default.nix

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/NixOS/nixpkgs/issues/65830?email_source=notifications&email_token=AAJJOPPALR5GZUHDJTCUWADQUSSLTA5CNFSM4IJCINQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEQRE4I#issuecomment-555815537,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAJJOPIV5O3SNWRBKCM5P5TQUSSLTANCNFSM4IJCINQA
.

66254 has been merged, providing CadQuery and CQ-editor. cqparts is not ready to be packaged yet.

Thanks~! good day everyone.

2019๋…„ 12์›” 1์ผ (์ผ) ์˜คํ›„ 12:49, Marcus Boyd notifications@github.com๋‹˜์ด ์ž‘์„ฑ:

Closed #65830 https://github.com/NixOS/nixpkgs/issues/65830.

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/NixOS/nixpkgs/issues/65830?email_source=notifications&email_token=AAJJOPKHCSOKHB5J5KREIPTQWMX4FA5CNFSM4IJCINQKYY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOVF3LTQA#event-2843130304,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAJJOPLZNXFC7CCFE76YASDQWMX4FANCNFSM4IJCINQA
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

copumpkin picture copumpkin  ยท  3Comments

langston-barrett picture langston-barrett  ยท  3Comments

edolstra picture edolstra  ยท  3Comments

copumpkin picture copumpkin  ยท  3Comments

rzetterberg picture rzetterberg  ยท  3Comments