CadQuery / CadQuery/cadquery

How to get information on the stack?

Open
#323 14 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Python
Stars
5.8k
Forks
541
Avg merge
3d 2h
Merged PRs (30d)
5

Description

Hi all,

For debugging, I would like to trace what is in the CQ stack. So I am considering using the stack API described [here](https://cadquery.readthedocs.io/en/latest/apireference.html#stack-and-selector-methods).

I have looked also at the [code](https://github.com/CadQuery/cadquery/blob/master/cadquery/cq.py):

```
class CQ(object):
def all(self): # Return a list of all CQ objects on the stack.
return [self.newObject([o]) for o in self.objects]
def size(self): # Return the number of objects currently on the stack
return len(self.objects)
```

I have tried:

```
import cadquery as cq
wp = cq.Workplane("XY").rect(1,2).workplane()
s = cq.size() # AttributeError : module 'cadquery' has no attribute 'size'
s = cq.CQ.size() # TypeError : size() missing 1 required positional argument: 'self'
s = cq.CQ.size(wp) # OK, result is: 1
```

So, I can have the size of an object, but how can I have the size of the stack? This is related to my efforts to debug ["ValueError: More than one wire is required"](https://github.com/CadQuery/cadquery/issues/319).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.