.tag mutates but other methods don't? #1862
-
I'm just starting to use to CadQuery moving over from a small amount of OpenSCAD, and I've run into an oddity that I can't seem to find an answer to in the documentation, although I have not yet read the code. In essence the Fluent API does not appear to mutate the objects and so splitting it across lines requires assignment to a variable. This makes sense and is discussed in the concepts section. However, this does not appear to be the case for I ran into this while trying to add features to check that I was tagging the correct faces (ie using If so, would it be reasonable to update the example to something like the below and add a note to
A snippet from my code
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Correct. The
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")
I think that makes sense. The example does go on to say it is unusual: the tag() method has returned the same object at 0xaa90. This is unusual for a Workplane method. Perhaps it can also mention tagging without assignment: part.tag("base") |
Beta Was this translation helpful? Give feedback.
-
Note that few other methods mutate as well, e.g. |
Beta Was this translation helpful? Give feedback.
Correct. The
Workplane
modeling context is updated. Example: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:
I think that makes sense. The example does go on to say it i…