Comments (18)
- cadquery = Core library that provides the Python CAD scripting API. It doesn't provide a GUI, it's just designed to be used from the command line and/or in Python scripts.
- cadquery-freecad-module = Workbench/plugin for FreeCAD that wraps the core cadquery library to provide a CadQuery development GUI inside FreeCAD.
- FreeCAD scripting (macros) = Can be mixed with CadQuery scripting, but is a separate API. FreeCAD macros are often used for data conversion and GUI manipulation (document tabs). Here is an example of mixing FreeCAD scripting with CadQuery scripting. The CadQuery objects have to be at a lower level, so there's more code than it takes to do the same in pure CadQuery scripting.
from cadquery-freecad-module.
I tried to run it via
CadQuery -> OpenScript and got this error
Running the Python command 'CadQueryOpenScript' failed:
Traceback (most recent call last):
File "/home/kammutierspule/.FreeCAD/Mod/cadquery_module/CQGui/Command.py", line 298, in Activated
ImportCQ.open(filename[0])
File "/home/kammutierspule/.FreeCAD/Mod/cadquery_module/CQGui/ImportCQ.py", line 51, in open
from pyqode.core.modes import FileWatcherMode
File "/home/kammutierspule/.FreeCAD/Mod/cadquery_module/Libs/pyqode/core/modes/__init__.py", line 6, in <module>
from .autocomplete import AutoCompleteMode
File "/home/kammutierspule/.FreeCAD/Mod/cadquery_module/Libs/pyqode/core/modes/autocomplete.py", line 5, in <module>
from pyqode.core.api import TextHelper
File "/home/kammutierspule/.FreeCAD/Mod/cadquery_module/Libs/pyqode/core/api/__init__.py", line 6, in <module>
from .code_edit import CodeEdit
File "/home/kammutierspule/.FreeCAD/Mod/cadquery_module/Libs/pyqode/core/api/code_edit.py", line 18, in <module>
from pyqode.core.managers import BackendManager
File "/home/kammutierspule/.FreeCAD/Mod/cadquery_module/Libs/pyqode/core/managers/__init__.py", line 15, in <module>
from .backend import BackendManager
File "/home/kammutierspule/.FreeCAD/Mod/cadquery_module/Libs/pyqode/core/managers/backend.py", line 9, in <module>
from pyqode.core.api.client import JsonTcpClient, BackendProcess
File "/home/kammutierspule/.FreeCAD/Mod/cadquery_module/Libs/pyqode/core/api/client.py", line 15, in <module>
from pyqode.qt import QtCore, QtNetwork
File "/home/kammutierspule/.FreeCAD/Mod/cadquery_module/Libs/pyqode/qt/QtNetwork.py", line 18, in <module>
from PySide2.QtNetwork import *
No module named PySide2.QtNetwork
from cadquery-freecad-module.
For the QtNetwork error, see the documentation here.
You mentioned Linux Mint in the other issue. How are you installing FreeCAD? Is it an AppImage, using one of the FreeCAD PPAs, or some other method?
Please be aware that's there's not full support for FreeCAD 0.18 yet. There's a separate issue for that here.
from cadquery-freecad-module.
I installed it via PPAs, stable and nightly. It can run the two versions on same system.
from cadquery-freecad-module.
Ok, that's the way I install FreeCAD on Ubuntu 18.04.
from cadquery-freecad-module.
I solved the issue with QtNetwork and I am now able to run it over the "CadQuery -> OpenScript -> F2" on booth versions!
Thanks! Sorry I didn't noticed that in documentation...
I still get the issue when I run via command line:
Exception while processing file: ./test.py ['NoneType' object has no attribute 'addObject']
from cadquery-freecad-module.
When you have show()
in your script, it's expecting to be run from within the FreeCAD GUI. It's trying to access the active document, so it won't run correctly from the command line.
from cadquery-freecad-module.
Makes sense, but I am starting FreeCad to go to GUI (not to run headless).
Also I can reproduce in GUI by opening the script using the other GUI window tool ( the icon while on the CadQuery mode ) by selecting the script and press run it.
from cadquery-freecad-module.
When you say "command line" do you mean the Python console within FreeCAD, or the Linux terminal? I want to make sure we're thinking of the same thing here.
from cadquery-freecad-module.
from cadquery-freecad-module.
When you say "command line" do you mean the Python console within FreeCAD, or the Linux terminal? I want to make sure we're thinking of the same thing here.
I mean Linux terminal:
$freecad ./test.py
from cadquery-freecad-module.
@KammutierSpule @easyw Thanks for the information.
You're both running the CadQuery script in a way that I never anticipated. I didn't know that the scripts would work properly from within the macro editor. It's interesting that it worked in the tagged v1.2.0 commit, but not in the current commit on master.
@easyw Are you running it from the macro editor as part of the KiCAD model generation framework your team created?
from cadquery-freecad-module.
Actually I am trying to follow something similar how KiCad model generation is doing to create shapes.
I found that running FreeCad on terminal to run a script it takes a lot to start, I will look if I can run script in a headless mode, so I hopping that cadquery still work that way.
Otherwise, I will run scripts manually on the gui.
from cadquery-freecad-module.
@KammutierSpule Depending on what you want, you can run a CadQuery script without the show()
call and just do an export to file directly from the script. The file types supported are listed here. Not sure if that's what you're looking for or not, but that would allow the scripts to be run from the command line without the FreeCAD GUI.
from cadquery-freecad-module.
@easyw Are you running it from the macro editor as part of the KiCAD model generation framework your team created?
yes, we launch our scripts by command line to be able to script all the process.
It's interesting that it worked in the tagged v1.2.0 commit, but not in the current commit on master.
I'm not sure if this worked before... to let this work it is enough to create an empty FC document and then run the code...
We do that in our scripts and you probably do it in your CQ private editor, when you run a script
from cadquery-freecad-module.
@KammutierSpule Depending on what you want, you can run a CadQuery script without the
show()
call and just do an export to file directly from the script. The file types supported are listed here. Not sure if that's what you're looking for or not, but that would allow the scripts to be run from the command line without the FreeCAD GUI.
I would like to export it to a mesh file, giving some "quality options", maybe to proprietary format.
I have some difficult at moment to distinguish what are CadQuery, CadQuery-freecad-module and FreeCad scripting, so I am not sure about this dependencies and what can I do with which one.
from cadquery-freecad-module.
@KammutierSpule
you can simply run the script inside FC and CQ FC module.
All the scripts can run through FC standard console... for your script to run you miss only the need to create a new doc, if not existing one in FC already, and then apply your CQ and FC python code...
You don't need to start it from command line as we do in our scripts, you can simply open your .py file in FC and then Run it through the standard 'Execute Macro' green button command.
test.py.txt (rename it to test.py)
from cadquery-freecad-module.
In #136 I've added a work-around for showing CadQuery objects from the macro editor. Updating via the FreeCAD add-on manager should pull the new version. Be aware though that there are significant changes in this version of the workbench, the most disruptive probably being the new code editor. Please see the changelog for details.
from cadquery-freecad-module.
Related Issues (20)
- save dialog on exit HOT 3
- Soliciting Community Feedback: Do You Use the Built-In Code Editor? HOT 9
- show cqparts within FreeCad HOT 9
- Certain imports break on script re-execution. HOT 4
- os.environ.get("MYSCRIPT_DIR") is None HOT 9
- Update Settings Documentation
- error on startup CQ_Logo.svg does not exists HOT 15
- FreeCAD Addon Manager needs a proper .svg icon for this WB/Addon HOT 1
- How to write STEP file from Surf or volume use this cadquery package ? HOT 15
- ImportError: dynamic module does not define module export function (PyInit_FreeCAD) HOT 1
- ModuleNotFoundError: No module named 'FreeCAD' HOT 5
- Update to support of CQ 2.0 HOT 8
- Examples not running - module 'time' has no attribute 'clock' HOT 8
- show() not defined HOT 7
- suppress_stdout_stderr seems to suppress too much
- Cannot import name 'Assembly' from 'cadquery' HOT 4
- No module named 'ExportCQ' HOT 7
- Rotation of assembly or imported step HOT 2
- module 'collections' has no attribute 'MutableMapping' HOT 17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cadquery-freecad-module.