New CadQuery GUI available

1,508 views
Skip to first unread message

Adam Urbanczyk

unread,
Jun 8, 2018, 9:18:06 AM6/8/18
to CadQuery

I made my CadQuery GUI public today. You can check it out here:


https://github.com/CadQuery/CQ-editor


It has some interesting CQ debugging and introspection capabilities. Let me know what you think!

Dave Cowden

unread,
Jun 8, 2018, 9:30:37 AM6/8/18
to Adam Urbanczyk, CadQuery
Hi,Adam!
That's awesome! I can't wait, i'll try it out this weekend.

--
cadquery home: https://github.com/dcowden/cadquery
post issues at https://github.com/dcowden/cadquery/issues
run it at home at : https://github.com/jmwright/cadquery-freecad-module
see it in action at http://www.parametricparts.com
---
You received this message because you are subscribed to the Google Groups "CadQuery" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cadquery+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cadquery/61934060-14b3-4267-85f3-a12ca882bd4b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Simon Kirkby

unread,
Jun 8, 2018, 10:01:35 AM6/8/18
to CadQuery
Will test , great work.

Jeremy Wright

unread,
Jun 8, 2018, 10:35:52 AM6/8/18
to CadQuery
Thanks Adam!

Dave Cowden

unread,
Jun 8, 2018, 9:23:01 PM6/8/18
to Adam Urbanczyk, CadQuery
Adam, i tried it out, and it worked great for me!

I need to work out how cqgi will fit in with your GUI.  The standard cadquery examples did not work because show_object() isn't defined.

The plan is to require scripts to import that function from cqgi-- in which case it won't be a compile error, and the script should run.

But then the question is-- how should show_object behave, since in your case you can show any object already? should it just have no affect?

On Fri, Jun 8, 2018 at 9:18 AM Adam Urbanczyk <adam.jan....@gmail.com> wrote:
--

Adam Urbanczyk

unread,
Jun 9, 2018, 3:40:28 AM6/9/18
to CadQuery
Good to hear!

for now it works like that: code form the editor is compiled into a code object. Then it is executed into a temporary module. All instances of cq.Workplane that are present in the __dict__ of this module are then displayed. Show_object function is not defined at the moment indeed (and not needed IMO in such a setup).

Why would you want to use show_object in this context? Is it for consistence? If people really want to use this function it could e.g. hide all other objects in the view

Best,
Adam

Dave Cowden

unread,
Jun 9, 2018, 9:28:20 AM6/9/18
to Adam Urbanczyk, CadQuery
Why would you want to use show_object in this context? Is it for consistence? If people really want to use this function it could e.g. hide all other objects in the view

The goal is to have cq scripts work without modifications in a variety of execution contexts.  I had to modify the examples by removing the show_object command for them to work in cq-gui.  The same scripts work differently in cadquery-freecad-module, and they work yet differently again at the command line, and yet differently again in the auto-generated documentation, and yet differently again in cqparts.

The goal of cqgi is to allow scripts to be portable by splitting the problem of displaying an object into two parts-- one part is the script indicating to the executing environment that it desires to show  a particular object.  The other is the environment showing it.

Cq-gui shows objects automatically, but it lacks the ability for the user to add properties associated with the display ( colors/styles).

On the other hand, scripts that would work without modification in cq-gui cannot generate the documentation here because there has to be way to tell the sphinx script which object to show.

Another use case for cqgi is allowing the script author to identify important variables, and allow the user to change them without digging into the script.  cqparts contemplates this by exposing arguments to parts.  You've contemplated this by showing variables on the right widget, but they are read only.  it would be ideal if there's a standard way for ui's to render a widget that allows users to change important variables without editing the script source-- including constraints on the variables ( this is a floating point number between 0 and 1, etc).  

given a script like this one, cqgi will detect that the first few vars are user inputs, and allow changing them without editing the scirpt.

code form the editor is compiled into a code object. Then it is executed into a temporary module. 

Could we leverage an approach like this and accomplish the goals I"m trying to achieve with cqgi? The main thing missing is the other arguments on show_object-- ​ability to give properties ( colors, tesselation tolerances, etc), and the difference between debug and showing an object.  I also think its actually important for a script to explicitly identify which object is the'output' of the script-- after all, though a script creates 30 workplanes, they are not all the result-- usually the last one is. But what about this case-- there are two outputs, the bottom and the lid--what are they if the code doesn't explicitly export them?



To unsubscribe from this group and stop receiving emails from it, send an email to cadquery+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cadquery/a61e863d-1f0a-46cd-b27e-6f2776f28b22%40googlegroups.com.

Adam Urbanczyk

unread,
Jun 9, 2018, 6:14:34 PM6/9/18
to CadQuery
Thanks for the extensive feedback. In the short term I can inject a show_object function into the module used for code execution so that scripts run without modification. In general I am for keeping things simple and using standard python (i.e. functions for abstracting away the object creation details; function arguments for marking which parameters should be user changeable). I think a well behaved CQ script should leave only one object behind (NB: it could be a compound object). IMO debugging should be a function of the GUI not a function of th CQ/CQGI module. I do plan to implement some sort of control over object appearance (color, material, transparency,...). Of course all PRs are welcome.

For now my priority is implementing CI/CD and making things work on Windows.

Adam Urbanczyk

unread,
Jun 16, 2018, 1:13:11 PM6/16/18
to CadQuery
Alright, I added cqgi like functions to the execution context of the code in the CQ-editor. Running standard examples from the docs should work now without any modification.

Are there any other thoughts from the community on the usability of the CQ-editor?



Dave Cowden

unread,
Jun 16, 2018, 2:57:27 PM6/16/18
to Adam Urbanczyk, CadQuery
would it be possible to make it easy in code to highlight a plane or  object?
the inspector is nice, but when i'm debugging i'd like to be able to do show_object(workplane, { 'color': red } ) or something like that, so i can see it in the project quickly.

On Sat, Jun 16, 2018 at 1:13 PM, Adam Urbanczyk <adam.jan....@gmail.com> wrote:
Alright, I added cqgi like functions to the execution context of the code in the CQ-editor. Running standard examples from the docs should work now without any modification.

Are there any other thoughts from the community on the usability of the CQ-editor?



--
cadquery home: https://github.com/dcowden/cadquery
post issues at https://github.com/dcowden/cadquery/issues
run it at home at : https://github.com/jmwright/cadquery-freecad-module
see it in action at http://www.parametricparts.com
---
You received this message because you are subscribed to the Google Groups "CadQuery" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cadquery+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cadquery/638e6a7b-b504-4a01-84a1-4ee9f4043ff2%40googlegroups.com.

Jeremy Wright

unread,
Jun 16, 2018, 8:56:13 PM6/16/18
to CadQuery
@Adam - I really appreciate the work you've put into this. It looks great.

A few things I've noticed so far.
1. There's no File->Close menu item, which may be tied to #2
2. If I open several scripts and execute them, the objects stack up under "CQ models" in the Object viewer. I can't find a way to close out and get rid of a previous script and its objects.
3. I make heavy use of the tabbed document interface (MDI area) with the FreeCAD module, including tiling the windows. When you're working on a cqparts assembly, it's hugely helpful. Just a thought for a potential future feature.
4. When I try to run a cqparts script I get 'ModuleNotFoundError: No module named 'FreeCAD'. I'm not sure why this error would be thrown on cqparts scripts and not on cadquery scripts though.
5. Feel free to use (or not use) the view icons I created for cadquery-gui. I can export them as a specific size png/jpg files if you want too. https://github.com/jmwright/cadquery-gui/tree/master/assets/images/icons

I'm sure I'll have more comments as I use it more, but for now that's it. I'm doing a lot of cqparts work right now, and not being able to run those scripts in CQ-editor is limiting my hands-on time with it.

Thanks!

On Saturday, June 16, 2018 at 2:57:27 PM UTC-4, thebluedirt wrote:
would it be possible to make it easy in code to highlight a plane or  object?
the inspector is nice, but when i'm debugging i'd like to be able to do show_object(workplane, { 'color': red } ) or something like that, so i can see it in the project quickly.

Jeremy Wright

unread,
Jun 16, 2018, 11:12:59 PM6/16/18
to CadQuery
It just occurred to me that #4 is not a CQ-editor issue since is based on PythonOCC. cqparts will have to be made to work with CQ 2.0 first, which I think there's an issue for in the cqparts tracker.

Adam Urbanczyk

unread,
Jun 19, 2018, 1:50:09 PM6/19/18
to CadQuery
I plan to implement color/material/transparency editing on per object basis in the UI. Once it is there, I can add it to the show_object interface. Did you try the debugger? BTW you can set a breakpoint in the current file by double clicking and just run the code until it is hit. The view will be updated according to the content of locals. You can even inspect while debugging.


W dniu sobota, 16 czerwca 2018 20:57:27 UTC+2 użytkownik thebluedirt napisał:
would it be possible to make it easy in code to highlight a plane or  object?
the inspector is nice, but when i'm debugging i'd like to be able to do show_object(workplane, { 'color': red } ) or something like that, so i can see it in the project quickly.
On Sat, Jun 16, 2018 at 1:13 PM, Adam Urbanczyk <adam.jan....@gmail.com> wrote:
Alright, I added cqgi like functions to the execution context of the code in the CQ-editor. Running standard examples from the docs should work now without any modification.

Are there any other thoughts from the community on the usability of the CQ-editor?



--
cadquery home: https://github.com/dcowden/cadquery
post issues at https://github.com/dcowden/cadquery/issues
run it at home at : https://github.com/jmwright/cadquery-freecad-module
see it in action at http://www.parametricparts.com
---
You received this message because you are subscribed to the Google Groups "CadQuery" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cadquery+u...@googlegroups.com.

Adam Urbanczyk

unread,
Jun 19, 2018, 1:54:56 PM6/19/18
to CadQuery
Thanks for your feedback!

1+2. yes there is some room for improvement. For now you can use clear all. Not decided yet if I'd like to have clear all before every execution.

3. I do plan to integrate the full editor widget from Spyder (with tabs,splits and what not).

4. Yes is is partially on the cqparts side. I did implement the multiply method in cq-occ. In principle it should be possible now to run cqparts (after some modifications).

5. Thanks for the PR!

Jérôme moa

unread,
Jul 10, 2018, 6:37:21 AM7/10/18
to CadQuery
Wow, this is awesome !
A more comfortable IDE than freeCAD is something I really miss as of now, I will definitely test that as soon as possible (it will take some time, as my main machine is not running linux though).

Thanks for the work anyway !

Adam Urbanczyk

unread,
Jul 10, 2018, 3:06:41 PM7/10/18
to CadQuery
Looking forward to you feedback! Windows version will come too at certain point (what is actually needed is windows version of cq-occ).

Jérôme D

unread,
Jul 11, 2018, 6:24:56 AM7/11/18
to CadQuery
I am currently using MacOS.
I tried to follow in installation instruction, just in case, but it seems the situation is the same as for windows : cq-occ is not available.

My knowledge of Python not incredibly high (I use it mostly for scripting, or for data manipulation using Pandas and Petl), but if I can help a bit in any way, I would be very glad to.

Meanwhile, I'll setup a virtual machine asap to test it on linux.

Adam Urbanczyk

unread,
Jul 15, 2018, 7:19:40 AM7/15/18
to CadQuery
Jerome, I just made a cq-occ conda package for MacOS. I cannot really test, but CI-wise things look fine. Please Let me know if it works for you.

Best,
Adam

Jérôme D

unread,
Jul 16, 2018, 3:06:25 AM7/16/18
to CadQuery
Adam, you are awesome :-).

I installed that yesteraday, here is a first quick report :
- It does install, and it does start. This is already enormous :-).
- It seems to execute the cadQuery script as expected, as the list of objects get filled when rendering.
- The viewer, though, is not functional : it contains random pieces of images from the rest of the screen. This might indicate a GPU memory initialisation problem (blind guess, I did not investigate more than that).
- I have a few logs that indicates problems, that may be releated :

TKOpenGl | Type: Performance | ID: 0 | Severity: Low | Message:

 VBO creation for Primitive Array has failed for 2 vertices. Out of memory?

TKOpenGl | Type: Performance | ID: 0 | Severity: Low | Message:

 VBO creation for Primitive Array has failed for 2 vertices. Out of memory?

TKOpenGl | Type: Performance | ID: 0 | Severity: Low | Message:

 VBO creation for Primitive Array has failed for 2 vertices. Out of memory?

TKOpenGl | Type: Performance | ID: 0 | Severity: Low | Message:

 VBO creation for Primitive Array has failed for 4 vertices. Out of memory?

TKOpenGl | Type: Performance | ID: 0 | Severity: Low | Message:

 VBO creation for Primitive Array has failed for 4 vertices. Out of memory?

QWidgetWindow(0x7f82e9398d70, name="Main toolbarWindow") ( QScreen(0x7f82e5d6a010, name="Color LCD") ): Attempt to set a screen on a child window.

QWidgetWindow(0x7f82e9398d70, name="Main toolbarWindow") ( QScreen(0x7f82e5d6a010, name="Color LCD") ): Attempt to set a screen on a child window.

QWidgetWindow(0x7f82e9398d70, name="Main toolbarWindow") ( QScreen(0x7f82e5d6a010, name="Color LCD") ): Attempt to set a screen on a child window.

TKOpenGl | Type: Performance | ID: 0 | Severity: Low | Message:

 VBO creation for Primitive Array has failed for 176 vertices. Out of memory?

TKOpenGl | Type: Performance | ID: 0 | Severity: Low | Message:

 VBO creation for Primitive Array has failed for 112 vertices. Out of memory?

QWidgetWindow(0x7f82e9398d70, name="Main toolbarWindow") ( QScreen(0x7f82e5d6a010, name="Color LCD") ): Attempt to set a screen on a child window.


At the very beginning of the log, I also have that :

TKOpenGl | Type: Error | ID: 0 | Severity: High | Message:

 New texture intialization of size 8192x128 for textured font has failed.

TKOpenGl | Type: Error | ID: 0 | Severity: High | Message:

 Font 'Courier' - initialization of GL resources has failed!

I do have a 'Courier' font installed on my machine though.

Here is a screenshot of the visible window at launch time:

Thanks for the work, it looks very promising !

Adam Urbanczyk

unread,
Jul 17, 2018, 6:03:19 AM7/17/18
to CadQuery
Hi Jerome,

that is unfortunate. I don't have access to a Mac so I'm afraid debugging this will be a challenge. I have two requests:

Could you paste what is printed on the console just after staring of the application. I get this:

INFO:OCC.Display.backend:backend loaded: qt-pyqt5
 ###### 3D rendering pipe initialisation #####
Display3d class initialization starting ...
Aspect_DisplayConnection created.
Graphic_Driver created.
V3d_Viewer created.
AIS_InteractiveContext created.
V3d_View created
Xw_Window created.
Display3d class successfully initialized.
 ########################################

2. Could you run python -m src.widgets.viewer and tell me what you see then? NB: please git pull first.

Best,
Adam

Jérôme D

unread,
Jul 17, 2018, 3:43:36 PM7/17/18
to CadQuery
Here are the first logs after startup :

INFO:OCC.Display.backend:backend loaded: qt-pyqt5

###### 3D rendering pipe initialisation #####

Display3d class initialization starting ...

Aspect_DisplayConnection created.

Graphic_Driver created.

V3d_Viewer created.

AIS_InteractiveContext created.

V3d_View created

Cocoa window created.

Display3d class successfully initialized.

########################################



2. Here are the logs and display output of the command line :

INFO:OCC.Display.backend:backend loaded: qt-pyqt5

###### 3D rendering pipe initialisation #####

Display3d class initialization starting ...

Aspect_DisplayConnection created.

Graphic_Driver created.

V3d_Viewer created.

AIS_InteractiveContext created.

V3d_View created

Cocoa window created.

Display3d class successfully initialized.

########################################

Layer manager created

Layer dimensions: 100, 30

TKOpenGl | Type: Performance | ID: 0 | Severity: Low | Message:

 VBO creation for Primitive Array has failed for 4 vertices. Out of memory?

TKOpenGl | Type: Performance | ID: 0 | Severity: Low | Message:

 VBO creation for Primitive Array has failed for 169 vertices. Out of memory?

TKOpenGl | Type: Performance | ID: 0 | Severity: Low | Message:

 VBO creation for Primitive Array has failed for 26 vertices. Out of memory?

TKOpenGl | Type: Performance | ID: 0 | Severity: Low | Message:

 VBO creation for Primitive Array has failed for 26 vertices. Out of memory?

TKOpenGl | Type: Performance | ID: 0 | Severity: Low | Message:

 VBO creation for Primitive Array has failed for 26 vertices. Out of memory?

TKOpenGl | Type: Error | ID: 0 | Severity: High | Message:

 New texture intialization of size 8192x128 for textured font has failed.

TKOpenGl | Type: Error | ID: 0 | Severity: High | Message:

 Font 'Courier' - initialization of GL resources has failed!

TKOpenGl | Type: Performance | ID: 0 | Severity: Low | Message:

 VBO creation for Primitive Array has failed for 4 vertices. Out of memory?

TKOpenGl | Type: Performance | ID: 0 | Severity: Low | Message:

 VBO creation for Primitive Array has failed for 2 vertices. Out of memory?

TKOpenGl | Type: Performance | ID: 0 | Severity: Low | Message:

 VBO creation for Primitive Array has failed for 24 vertices. Out of memory?

TKOpenGl | Type: Performance | ID: 0 | Severity: Low | Message:

 VBO creation for Primitive Array has failed for 24 vertices. Out of memory?



Adam Urbanczyk

unread,
Jul 24, 2018, 10:42:29 AM7/24/18
to CadQuery
Hi Jerome,

thanks for trying. I think this is something upstream (i.e. in PythonOCC), though I am not 100% sure.. I don't have access to Mac, so I won't be able to debug this. If you feel like, you might want to try PythonOCC examples and if those give the same result submit a bug.

Best,
Adam

Op dinsdag 17 juli 2018 21:43:36 UTC+2 schreef Jérôme D:

Jérôme D

unread,
Aug 12, 2018, 10:18:18 AM8/12/18
to CadQuery
Hi Adam,

I tested the PythonOCC exemple, and I had one working correctly (a simple view, with a menu to add a pre-defined shape in it).
I have tried a bit to mix the exemple's code (the UI setup part) and the cadQueryUI code (all but the UI setup), but I couldn't get a working viewer. But I couldn't spend a lot of time on it. I will try to find more time to continue the investigation as soon as possible. I cannot promise anything for a fixed date, but I would love to help making your UI functional on a Mac : it would make cadQuery so much more pleasant to use !
(then, the next step would be to have better, more helpful error messages :-) )

Jerome

Adam Urbanczyk

unread,
Aug 14, 2018, 5:42:37 PM8/14/18
to CadQuery
Hi Jerome!

Thanks for investigating this further. The result is somewhat unexpected for me. Are you sure that the examples used the pyqt5 backend (as opposed to pyqt4 or we)? It should be reported in stdout.

BTW I was recently thinking of skipping OCC based visualization completely and using QOpenGlWidget of pyqt5. I am investigating currently how much work that would be.

Best
Adam

Jérôme D

unread,
Sep 25, 2018, 11:32:05 AM9/25/18
to CadQuery
Sorry for the long delay.
I can confirm that the backend is pyqt5.
Sadly, I have a pretty intense period a work right now, so I can find no time to investigate on that problem.
I hope I'll be able to get back to it soon !

Jerome

Adam Urbanczyk

unread,
Sep 26, 2018, 3:57:14 PM9/26/18
to CadQuery
No worries. I created an issue for this on github: https://github.com/CadQuery/CQ-editor/issues/7 I propose to move this discussion there.

Best,
Adam

Scott Lawton

unread,
Jan 6, 2019, 4:57:26 PM1/6/19
to CadQuery
Just FYI: I encountered similar problems, and posted details: https://github.com/CadQuery/CQ-editor/issues/7#issuecomment-451778603
Reply all
Reply to author
Forward
0 new messages