Open jmwright opened 6 years ago
@jmwright
A replacement for the CadQuery module/workbench for FreeCAD. This requires an editor pane and a 3D view pane side-by-side to allow for editing and re-executing scripts
I agree; I think it's important for an author to have both an editor, and viewer on the screen at the same time. However, I think the editor should be optional.
To illustrate what I mean, this is what I can do now using cqparts.display
.
The display
function in a command line environment, starts a http
service, and hosts an export of the model.
I imagine the cadquery-gui
could achieve the same dynamic:
cadquery
makes a connection to cadquery-gui
(possibly opening a new instance), and displays the model.I've raised fragmuffin/cqparts#46 to improve the cqparts web service, but ideally it would be completely replaced by cadquery-gui
In the above screenshot, the displayed webpage could have a link to the cadquery-gui
, something like improve your viewing experience with cadquery-gui
.
A platform for experimenting with code-mouse interaction, where what you do in one pane effects the other.
That is very cool, and would be excellent while people are learning (I would have loved that). Could this be achieved with an Atom.io plugin?
Atom? It's actually very plausible that the display, and the display's interaction with an editor window could all be achieved with an atom plugin!
cadquery
oh!, hey... look! https://github.com/apla/atom-jscad I just tried it, and it works. it seems to have similar CPU/GPU usage issues to #1, but they're fixable.
To illustrate what I mean, this is what I can do now using cqparts.display.
If we added file watcher code to automatically re-render the 3D view and threw some 3D controls on the page, I guess I'm having a hard time seeing any advantage in doing cadquery-gui over what you have there. Your solution would make more since to distribute with the CadQuery library as well, which would be a big advantage for some users.
I guess I'm having a hard time seeing any advantage in doing cadquery-gui over what you have there
One big :+1: for the cadquery-gui
is a new user's familiarity with the process of learning a new thing:
cadquery
.pip install cadquery
(or similar).cadquery-gui
in its current form
that is appealing
The alternative I've proposed
Or if they choose to use the Atom plugin:
pip install cadquery
they also run sudo apt install atom
and apm install cadquery
Do we have to choose? If we carefully compartmentalise each aspect of this GUI, I believe we can do both... or rather, all 3 (standalone, an ad hoc web service, atom.io plugin) quite easily!
Packages that must be there in some form are denoted with a :star:
each released as an npm package
cqparts
here)that may be overboard, but you get the idea
maybe as pip
packages (?)
cadquery
knows to "display" via a network connection of some sort :star:REPL
that sends debug info along pipelinecadquery-gui
cadquery-gui
, still using electron would simply be a skeleton that uses all of the above "plugins" as pre-requisites, and includes all of them.
A front-end app that gets built using npm
and compiled with webpack
(or something similar) to create a static page to be hosted by the ad-hoc service.
The back-end is implemented by having the pip
packages as pre-requisites (an advantage of the back-end being implemented in Python)
Similar implementation as the ad-hoc service
As a huge added bonus to implementing as separate packages, people could host models on their own pages, and choose how their audience interacts with them... for example:
You'd get all of that for free, and if people so desired, they could fork and create their own modified plugins to do exactly what they want under their name.
oh!, and I just thought of another scenario:
Then it's just 1 step to create a gateway python service (that uses the transmitter) to update positions on a miller, or 3d printer (or anything) to show its position realtime.
I've actually done this, so I can submit that code.
receiver : new content geometry & render data 3d render window (could have more than one instance, eg: a 2x2 orthogonal view along x/y/z and free) camera controls : orbital
I think this list is all rolled into the 3D viewer that I'm working on revamping now. I think that for it to work with Electron properly there would have to be two-way communication (probably via websockets). Would the receiver just be some Javascript that runs client-side that receives data from the back-end? I'm not quite sure what "new content geometry & render data" would look like in that context. It seems like the back-end would take care of running the script and converting the results to JSON for transport to the receiver on the front-end. Am I missing something?
Am I missing something?
No; that's exactly what I was thinking.
But, rather than exporting to JSON, I strongly recommend glTF, I think it'll make our lives so much easier.
Did you ever take a look at the glTF exporter for cqparts
?
Did you ever take a look at the glTF exporter for cqparts?
I read the issue when you posted about it, but I haven't tried to use it. How do we integrate that on the back-end? Will the back-end always need to include cqparts in order to export models to gITF?
I'm wondering if we need to create an umbrella project on GitHub to organize all these npm packages. Kind of like PyQode did. I'm not sure what we'd call it. Something like "Open Web CAD Toolkit" or something like that? I'm horrible at picking names for projects, and it could be used for a lot more than just CAD I guess.
How do we integrate that on the back-end?
Ultimately the glTF should be a format available for cadquery
exporting.
(I've created fragmuffin/cqparts#49 to move as much as possible of this over to cadquery
)
The cqparts
glTF exporter is built to deal with a hierarchy of parts, because glTF as a format is arranged in the same format. Models are indexed in a scene with children, each child has a matrix transform in relation to its parent.
glTF demo
I just made this gist to show a single layer, and a hierarchical .gltf
output from cqparts
if your'e interested.
I'm wondering if we need to create an umbrella project on GitHub to organize all these npm packages
I think we just need proof of concept first, if this won't work the way I think it will, then we'll just have some well structured code that's all compiled together.
I'm sure we'll be able to move the origin of a package, both in npm
and pip
.
I'm overhauling parts of this app right now, and will convert it's viewer system to being the proof-of-concept for glTF functionality based on your demo. I'll likely need advice during the process though.
@fragmuffin Based on conversations on the cqparts and cadquery issue trackers, I think we might be wanting different things out of this GUI. I'd like to start a discussion here to figure out a high level path forward for how this UI will work.
What You Would Like to See
If I understand correctly, you would like for the GUI to be view only, but allow the user to adjust parameters though the GUI. Is that correct?
What I Would Like to See
I'm interested in that mode of operation, but I'm also interested in a couple of others.
A Possible Path Forward
Right now what I'm thinking is this:
Additional Design Goals
There are a few other goals that I think are work pursuing.
There's also been talk in the community of a single installer for a CadQuery GUI as well as the command line. Something similar to what you get with OpenSCAD and FreeCAD. Should we try to do that at some point with this GUI?
Far Future
Something in the back of my mind is other modes of operation for the GUI such as a generative design mode, but I'm a long ways from having time to start that. It's not feasible to cover expanded use cases at this point, but it's worth noting that this GUI lends itself to being expanded for other uses later.