CQ-editor
CQ-editor copied to clipboard
Use `show_object()` in the code sample
This is the default code sample when a user opens CQ-Editor for the first time:
import cadquery as cq
result = cq.Workplane("XY" ).box(3, 3, 0.5).edges("|Z").fillet(0.125)
show_object()
is not used here so the fallback behavior is to render all object declared in variables. This can be a source of confusion for a beginner, who may think that there is no such function and the model to render must have to be declared as the result
variable.
I suggest this (or similar):
import cadquery as cq
box = cq.Workplane("XY" ).box(3, 3, 0.5)
show_object(box.edges("|Z").fillet(0.125))
In my opinion it would be better to explain what choices the editor is making by showing variables because I learned a lot experimenting in the tutorial by making a bunch of objects and toggling them on/off as they are listed on the right as a kind of "layers"
Using show_object
loses the variable name and renders some magic number in the UI. It's also buried in the docs here? because users are in the cadquery docs site not the cq-editor readme once they're in the tutorial.
The blind auto-import from the widgets/debugger path is more magic for the user.
Should a user wish to take over rendering output that could be a separate tutorial.
This can be a source of confusion for a beginner
The same applied to me. Sq-editor displays the model, even if there is no show_object()-call at all (in most cases, but not always). And during single-stepping the script, the behavior is even more confusing. It looks like the code is re-executed several times.