We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have a file in CQ Editor containing the invoker code:
import cadquery as cq import os import sys lib_path = os.path.abspath("./") # relativer Pfad zu einem absoluten Pfad umwandeln if lib_path not in sys.path: sys.path.append(lib_path) from show_test import *
which is just importing show_test.py.
show_test.py contains:
import cadquery as cq show_object (cq.Workplane ("XY").box(30,20,10))
Running the invoker in CQ-Editor brings up the following error: NameError: name 'show_object' is not defined
The same code works fine if it is directly in CQ-Editor.
This is a big nuisance because I need show_object for debugging and my project is spread across multiple files.
Is there a simple solution to use show_object in a file which is invoked from CQ-Editor but which is not in CQ-Editor directly?
I use on Windows 11.
The text was updated successfully, but these errors were encountered:
Hi @DeBalog
Here is one way to solve the issue (pass the show_object function around):
show_object
# Script running inside CQ-editor from second_module import make_box make_box(show_object)
# Imported module ("second_module") import cadquery as cq def make_box(show_object): print(globals()) result = cq.Workplane().box(10, 10, 10) show_object(result)
I also tried injecting show_object into globals() which works in some contexts, but does not seem to in this one.
globals()
Sorry, something went wrong.
Hi @jmwright, thanks for you solution, I give it a try and report here.
No branches or pull requests
I have a file in CQ Editor containing the invoker code:
which is just importing show_test.py.
show_test.py contains:
Running the invoker in CQ-Editor brings up the following error:
NameError: name 'show_object' is not defined
The same code works fine if it is directly in CQ-Editor.
This is a big nuisance because I need show_object for debugging and my project is spread across multiple files.
Is there a simple solution to use show_object in a file which is invoked from CQ-Editor but which is not in CQ-Editor directly?
I use
on Windows 11.
The text was updated successfully, but these errors were encountered: