Sketch
#
- class ansys.geometry.core.sketch.sketch.Sketch(plane: ansys.geometry.core.math.plane.Plane = Plane())#
Provides for building 2D sketch elements.
Overview#
Translate the origin location of the active sketch plane. |
|
Translate the origin location of the active sketch plane by offsets. |
|
Translate the origin location active sketch plane by distance. |
|
Get a list of shapes with a given tag. |
|
Add a sketch face to the sketch. |
|
Add a sketch edge to the sketch. |
|
Add all objects that match provided tags to the current context. |
|
Add a segment sketch object to the sketch plane. |
|
Add a segment to the sketch plane starting from the previous end point. |
|
Add a segment to the sketch starting from a given starting point. |
|
Add a segment to the sketch starting from the previous end point. |
|
Add an arc to the sketch plane. |
|
Add an arc to the sketch starting from the previous end point. |
|
Add an arc to the sketch plane from three given points. |
|
Add an arc from the start, end points and a radius. |
|
Add an arc from the start, center point, and angle. |
|
Add a triangle to the sketch using given vertex points. |
|
Add a trapezoid to the sketch using given vertex points. |
|
Add a circle to the plane at a given center. |
|
Create a box on the sketch. |
|
Create a slot on the sketch. |
|
Create an ellipse on the sketch. |
|
Create a polygon on the sketch. |
|
Create a dummy gear on the sketch. |
|
Create a spur gear on the sketch. |
|
Add a tag to the active selection of sketch objects. |
|
Plot all objects of the sketch to the scene. |
|
Plot the current selection to the scene. |
|
Get polydata configuration for all objects of the sketch. |
|
Get polydata configuration for all faces of the sketch to the scene. |
|
Get polydata configuration for all edges of the sketch to the scene. |
Import detail#
from ansys.geometry.core.sketch.sketch import Sketch
Property detail#
- property Sketch.plane: ansys.geometry.core.math.plane.Plane#
Sketch plane configuration.
- property Sketch.edges: list[ansys.geometry.core.sketch.edge.SketchEdge]#
List of all independently sketched edges.
Notes
Independently sketched edges are not assigned to a face. Face edges are not included in this list.
- property Sketch.faces: list[ansys.geometry.core.sketch.face.SketchFace]#
List of all independently sketched faces.
Method detail#
- Sketch.translate_sketch_plane(translation: ansys.geometry.core.math.vector.Vector3D) Sketch #
Translate the origin location of the active sketch plane.
- Parameters:
- translation
Vector3D
Vector defining the translation. Meters is the expected unit.
- translation
- Returns:
Sketch
Revised sketch state ready for further sketch actions.
- Sketch.translate_sketch_plane_by_offset(x: pint.Quantity | ansys.geometry.core.misc.measurements.Distance = Quantity(0, DEFAULT_UNITS.LENGTH), y: pint.Quantity | ansys.geometry.core.misc.measurements.Distance = Quantity(0, DEFAULT_UNITS.LENGTH), z: pint.Quantity | ansys.geometry.core.misc.measurements.Distance = Quantity(0, DEFAULT_UNITS.LENGTH)) Sketch #
Translate the origin location of the active sketch plane by offsets.
- Parameters:
- x
Quantity
|Distance
, default:Quantity
(0,DEFAULT_UNITS.LENGTH
) Amount to translate the origin of the x-direction.
- y
Quantity
|Distance
, default:Quantity
(0,DEFAULT_UNITS.LENGTH
) Amount to translate the origin of the y-direction.
- z
Quantity
|Distance
, default:Quantity
(0,DEFAULT_UNITS.LENGTH
) Amount to translate the origin of the z-direction.
- x
- Returns:
Sketch
Revised sketch state ready for further sketch actions.
- Sketch.translate_sketch_plane_by_distance(direction: ansys.geometry.core.math.vector.UnitVector3D, distance: pint.Quantity | ansys.geometry.core.misc.measurements.Distance) Sketch #
Translate the origin location active sketch plane by distance.
- Parameters:
- direction
UnitVector3D
Direction to translate the origin.
- distance
Quantity
|Distance
Distance to translate the origin.
- direction
- Returns:
Sketch
Revised sketch state ready for further sketch actions.
- Sketch.get(tag: str) list[SketchObject] #
Get a list of shapes with a given tag.
- Parameters:
- tag
str
Tag to query against.
- tag
- Sketch.face(face: ansys.geometry.core.sketch.face.SketchFace, tag: str | None = None) Sketch #
Add a sketch face to the sketch.
- Sketch.edge(edge: ansys.geometry.core.sketch.edge.SketchEdge, tag: str | None = None) Sketch #
Add a sketch edge to the sketch.
- Sketch.segment(start: ansys.geometry.core.math.point.Point2D, end: ansys.geometry.core.math.point.Point2D, tag: str | None = None) Sketch #
Add a segment sketch object to the sketch plane.
- Sketch.segment_to_point(end: ansys.geometry.core.math.point.Point2D, tag: str | None = None) Sketch #
Add a segment to the sketch plane starting from the previous end point.
- Parameters:
- Returns:
Sketch
Revised sketch state ready for further sketch actions.
Notes
The starting point of the created edge is based upon the current context of the sketch, such as the end point of a previously added edge.
- Sketch.segment_from_point_and_vector(start: ansys.geometry.core.math.point.Point2D, vector: ansys.geometry.core.math.vector.Vector2D, tag: str | None = None)#
Add a segment to the sketch starting from a given starting point.
- Parameters:
- Returns:
Sketch
Revised sketch state ready for further sketch actions.
Notes
Vector magnitude determines the segment endpoint. Vector magnitude is assumed to use the same unit as the starting point.
- Sketch.segment_from_vector(vector: ansys.geometry.core.math.vector.Vector2D, tag: str | None = None)#
Add a segment to the sketch starting from the previous end point.
- Parameters:
- Returns:
Sketch
Revised sketch state ready for further sketch actions.
Notes
The starting point of the created edge is based upon the current context of the sketch, such as the end point of a previously added edge.
Vector magnitude determines the segment endpoint. Vector magnitude is assumed to use the same unit as the starting point in the previous context.
- Sketch.arc(start: ansys.geometry.core.math.point.Point2D, end: ansys.geometry.core.math.point.Point2D, center: ansys.geometry.core.math.point.Point2D, clockwise: bool = False, tag: str | None = None) Sketch #
Add an arc to the sketch plane.
- Parameters:
- start
Point2D
Starting point of the arc.
- end
Point2D
Ending point of the arc.
- center
Point2D
Center point of the arc.
- clockwisebool, default:
False
Whether the arc spans the angle clockwise between the start and end points. When
False `` (default), the arc spans the angle counter-clockwise. When ``True
, the arc spans the angle clockwise.- tag
str
, default:None
User-defined label for identifying the edge.
- start
- Returns:
Sketch
Revised sketch state ready for further sketch actions.
- Sketch.arc_to_point(end: ansys.geometry.core.math.point.Point2D, center: ansys.geometry.core.math.point.Point2D, clockwise: bool = False, tag: str | None = None) Sketch #
Add an arc to the sketch starting from the previous end point.
- Parameters:
- end
Point2D
Ending point of the arc.
- center
Point2D
Center point of the arc.
- clockwisebool, default:
False
Whether the arc spans the angle clockwise between the start and end points. When
False
(default), the arc spans the angle counter-clockwise. WhenTrue
, the arc spans the angle clockwise.- tag
str
, default:None
User-defined label for identifying the edge.
- end
- Returns:
Sketch
Revised sketch state ready for further sketch actions.
Notes
The starting point of the created edge is based upon the current context of the sketch, such as the end point of a previously added edge.
- Sketch.arc_from_three_points(start: ansys.geometry.core.math.point.Point2D, inter: ansys.geometry.core.math.point.Point2D, end: ansys.geometry.core.math.point.Point2D, tag: str | None = None) Sketch #
Add an arc to the sketch plane from three given points.
- Sketch.arc_from_start_end_and_radius(start: ansys.geometry.core.math.point.Point2D, end: ansys.geometry.core.math.point.Point2D, radius: pint.Quantity | ansys.geometry.core.misc.measurements.Distance | ansys.geometry.core.typing.Real, convex_arc: bool = False, clockwise: bool = False, tag: str | None = None) Sketch #
Add an arc from the start, end points and a radius.
- Parameters:
- start
Point2D
Starting point of the arc.
- end
Point2D
Ending point of the arc.
- radius
Quantity
|Distance
|Real
Radius of the arc.
- convex_arcbool, default:
False
Whether the arc is convex. The default is
False
. WhenFalse
, the arc spans the concave version of the arc. WhenTrue
, the arc spans the convex version of the arc.- clockwisebool, default:
False
Whether the arc spans the angle clockwise between the start and end points. When
False
, the arc spans the angle counter-clockwise. WhenTrue
, the arc spans the angle clockwise.- tag
str
, default:None
User-defined label for identifying the edge.
- start
- Returns:
Sketch
Revised sketch state ready for further sketch actions.
- Sketch.arc_from_start_center_and_angle(start: ansys.geometry.core.math.point.Point2D, center: ansys.geometry.core.math.point.Point2D, angle: pint.Quantity | ansys.geometry.core.misc.measurements.Angle | ansys.geometry.core.typing.Real, clockwise: bool = False, tag: str | None = None) Sketch #
Add an arc from the start, center point, and angle.
- Parameters:
- start
Point2D
Starting point of the arc.
- center
Point2D
Center point of the arc.
- angle
Quantity
|Angle
|Real
Angle of the arc.
- clockwisebool, default:
False
Whether the arc spans the angle clockwise. The default is
False
. WhenFalse
, the arc spans the angle counter-clockwise. WhenTrue
, the arc spans the angle clockwise.
- start
- Returns:
Sketch
Revised sketch state ready for further sketch actions.
- Sketch.triangle(point1: ansys.geometry.core.math.point.Point2D, point2: ansys.geometry.core.math.point.Point2D, point3: ansys.geometry.core.math.point.Point2D, tag: str | None = None) Sketch #
Add a triangle to the sketch using given vertex points.
- Parameters:
- Returns:
Sketch
Revised sketch state ready for further sketch actions.
- Sketch.trapezoid(base_width: pint.Quantity | ansys.geometry.core.misc.measurements.Distance | ansys.geometry.core.typing.Real, height: pint.Quantity | ansys.geometry.core.misc.measurements.Distance | ansys.geometry.core.typing.Real, base_angle: pint.Quantity | ansys.geometry.core.misc.measurements.Angle | ansys.geometry.core.typing.Real, base_asymmetric_angle: pint.Quantity | ansys.geometry.core.misc.measurements.Angle | ansys.geometry.core.typing.Real | None = None, center: ansys.geometry.core.math.point.Point2D = ZERO_POINT2D, angle: pint.Quantity | ansys.geometry.core.misc.measurements.Angle | ansys.geometry.core.typing.Real = 0, tag: str | None = None) Sketch #
Add a trapezoid to the sketch using given vertex points.
- Parameters:
- base_width
Quantity
|Distance
|Real
Width of the lower base of the trapezoid.
- height
Quantity
|Distance
|Real
Height of the slot.
- base_angle
Quantity
|Distance
|Real
Angle for trapezoid generation. Represents the angle on the base of the trapezoid.
- base_asymmetric_angle
Quantity
|Angle
|Real
|None
, default:None
Asymmetrical angles on each side of the trapezoid. The default is
None
, in which case the trapezoid is symmetrical. If provided, the trapezoid is asymmetrical and the right corner angle at the base of the trapezoid is set to the provided value.- center: Point2D, default: ZERO_POINT2D
Center point of the trapezoid.
- angle
Quantity
|Angle
|Real
, default: 0 Placement angle for orientation alignment.
- tag
str
, default:None
User-defined label for identifying the face.
- base_width
- Returns:
Sketch
Revised sketch state ready for further sketch actions.
Notes
If an asymmetric base angle is defined, the base angle is applied to the left-most angle, and the asymmetric base angle is applied to the right-most angle.
- Sketch.circle(center: ansys.geometry.core.math.point.Point2D, radius: pint.Quantity | ansys.geometry.core.misc.measurements.Distance | ansys.geometry.core.typing.Real, tag: str | None = None) Sketch #
Add a circle to the plane at a given center.
- Sketch.box(center: ansys.geometry.core.math.point.Point2D, width: pint.Quantity | ansys.geometry.core.misc.measurements.Distance | ansys.geometry.core.typing.Real, height: pint.Quantity | ansys.geometry.core.misc.measurements.Distance | ansys.geometry.core.typing.Real, angle: pint.Quantity | ansys.geometry.core.misc.measurements.Angle | ansys.geometry.core.typing.Real = 0, tag: str | None = None) Sketch #
Create a box on the sketch.
- Parameters:
- Returns:
Sketch
Revised sketch state ready for further sketch actions.
- Sketch.slot(center: ansys.geometry.core.math.point.Point2D, width: pint.Quantity | ansys.geometry.core.misc.measurements.Distance | ansys.geometry.core.typing.Real, height: pint.Quantity | ansys.geometry.core.misc.measurements.Distance | ansys.geometry.core.typing.Real, angle: pint.Quantity | ansys.geometry.core.misc.measurements.Angle | ansys.geometry.core.typing.Real = 0, tag: str | None = None) Sketch #
Create a slot on the sketch.
- Parameters:
- Returns:
Sketch
Revised sketch state ready for further sketch actions.
- Sketch.ellipse(center: ansys.geometry.core.math.point.Point2D, major_radius: pint.Quantity | ansys.geometry.core.misc.measurements.Distance | ansys.geometry.core.typing.Real, minor_radius: pint.Quantity | ansys.geometry.core.misc.measurements.Distance | ansys.geometry.core.typing.Real, angle: pint.Quantity | ansys.geometry.core.misc.measurements.Angle | ansys.geometry.core.typing.Real = 0, tag: str | None = None) Sketch #
Create an ellipse on the sketch.
- Parameters:
- center: Point2D
Center point of the ellipse.
- major_radius
Quantity
|Distance
|Real
Semi-major axis of the ellipse.
- minor_radius
Quantity
|Distance
|Real
Semi-minor axis of the ellipse.
- angle
Quantity
|Angle
|Real
, default: 0 Placement angle for orientation alignment.
- tag
str
, default:None
User-defined label for identifying the face.
- Returns:
Sketch
Revised sketch state ready for further sketch actions.
- Sketch.polygon(center: ansys.geometry.core.math.point.Point2D, inner_radius: pint.Quantity | ansys.geometry.core.misc.measurements.Distance | ansys.geometry.core.typing.Real, sides: int, angle: pint.Quantity | ansys.geometry.core.misc.measurements.Angle | ansys.geometry.core.typing.Real = 0, tag: str | None = None) Sketch #
Create a polygon on the sketch.
- Parameters:
- center: Point2D
Center point of the polygon.
- inner_radius
Quantity
|Distance
|Real
Inner radius (apothem) of the polygon.
- sides
int
Number of sides of the polygon.
- angle
Quantity
|Angle
|Real
, default: 0 Placement angle for orientation alignment.
- tag
str
, default:None
User-defined label for identifying the face.
- Returns:
Sketch
Revised sketch state ready for further sketch actions.
- Sketch.dummy_gear(origin: ansys.geometry.core.math.point.Point2D, outer_radius: pint.Quantity | ansys.geometry.core.misc.measurements.Distance | ansys.geometry.core.typing.Real, inner_radius: pint.Quantity | ansys.geometry.core.misc.measurements.Distance | ansys.geometry.core.typing.Real, n_teeth: int, tag: str | None = None) Sketch #
Create a dummy gear on the sketch.
- Parameters:
- Returns:
Sketch
Revised sketch state ready for further sketch actions.
- Sketch.spur_gear(origin: ansys.geometry.core.math.point.Point2D, module: ansys.geometry.core.typing.Real, pressure_angle: pint.Quantity | ansys.geometry.core.misc.measurements.Angle | ansys.geometry.core.typing.Real, n_teeth: int, tag: str | None = None) Sketch #
Create a spur gear on the sketch.
- Parameters:
- origin
Point2D
Origin of the spur gear.
- module
Real
Module of the spur gear. This is also the ratio between the pitch circle diameter in millimeters and the number of teeth.
- pressure_angle
Quantity
|Angle
|Real
Pressure angle of the spur gear.
- n_teeth
int
Number of teeth of the spur gear.
- tag
str
, default:None
User-defined label for identifying the face.
- origin
- Returns:
Sketch
Revised sketch state ready for further sketch actions.
- Sketch.tag(tag: str) None #
Add a tag to the active selection of sketch objects.
- Parameters:
- tag
str
Tag to assign to the sketch objects.
- tag
- Sketch.plot(view_2d: bool = False, screenshot: str | None = None, use_trame: bool | None = None, selected_pd_objects: list[pyvista.PolyData] = None, **plotting_options: dict | None)#
Plot all objects of the sketch to the scene.
- Parameters:
- view_2dbool, default:
False
Whether to represent the plot in a 2D format.
- screenshot
str
,optional
Path for saving a screenshot of the image that is being represented.
- use_tramebool, default:
None
Whether to enables the use of trame. The default is
None
, in which case theansys.tools.visualization_interface.USE_TRAME
global setting is used.- **plotting_options
dict
,optional
Keyword arguments for plotting. For allowable keyword arguments, see the
Plotter.add_mesh
method.
- view_2dbool, default:
- Sketch.plot_selection(view_2d: bool = False, screenshot: str | None = None, use_trame: bool | None = None, **plotting_options: dict | None)#
Plot the current selection to the scene.
- Parameters:
- view_2dbool, default:
False
Whether to represent the plot in a 2D format.
- screenshot
str
,optional
Path for saving a screenshot of the image that is being represented.
- use_tramebool, default:
None
Whether to enables the use of trame. The default is
None
, in which case theansys.tools.visualization_interface.USE_TRAME
global setting is used.- **plotting_options
dict
,optional
Keyword arguments for plotting. For allowable keyword arguments, see the
Plotter.add_mesh
method.
- view_2dbool, default:
- Sketch.sketch_polydata() list[pyvista.PolyData] #
Get polydata configuration for all objects of the sketch.
- Sketch.sketch_polydata_faces() list[pyvista.PolyData] #
Get polydata configuration for all faces of the sketch to the scene.
- Sketch.sketch_polydata_edges() list[pyvista.PolyData] #
Get polydata configuration for all edges of the sketch to the scene.