The Sketch.tag()
method is a function in the CadQuery python library that returns a new Sketch object with a tag attached to it. Tags are used to identify a set of shapes that belong to a specific operation or feature of a 3D model.
Sketch.tag(tag_name)
tag_name
: A string value that represents the tag name to be assigned to the new Sketch object.A new Sketch object with the specified tag assigned to it.
Here is an example of using Sketch.tag()
method to tag a Sketch object:
import cadquery as cq
# create a new Sketch object
sketch = cq.Workplane("XY").box(1, 1, 1)
# tag the Sketch object
tagged_sketch = sketch.tag("example_tag")
# display the Sketch object with tag information
print(tagged_sketch)
Output:
<cadquery.occ_impl.shapes.Shape at 0x7fd689af8940(objectTag=<cadquery.occ_impl.tags.Macro object at 0x7fd6896c0eb0>: example_tag)>
In the above example, a new Sketch object is created and then tagged with the value "example_tag". The tagged Sketch object is then printed to the console to show the tag information.
The Sketch.tag()
method in CadQuery is used to assign a tag to a Sketch object, which can be used to identify a specific set of shapes that belong to a particular feature or operation of a 3D model. By using tags, it becomes easier to organize and manage complex 3D models.