Skip to content

.tag mutates but other methods don't? #1862

Answered by lorenzncode
cacsar asked this question in Q&A
Discussion options

You must be logged in to vote

However, this does not appear to be the case for tag

Correct. The Workplane modeling context is updated. Example:


In [1]: import cadquery as cq

In [2]: r = cq.Workplane().box(1, 1, 1)

In [3]: r.ctx.tags
Out[3]: {}

In [4]: r.faces(">Z").tag("f1")
Out[4]: <cadquery.cq.Workplane at 0x7f77038777d0>

In [5]: r.ctx.tags
Out[5]: {'f1': <cadquery.cq.Workplane at 0x7f77038777d0>}

See also https://cadquery.readthedocs.io/en/latest/workplane.html#an-introspective-example

In this example it says We can tag the Workplane that contains this basic box now:

part = part.tag("base")

saying it can work without assignment and it's special?

I think that makes sense. The example does go on to say it i…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by adam-urbanczyk
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants