Sketch
#
- class ansys.geometry.core.sketch.sketch.Sketch(plane: beartype.typing.Optional[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 triangle 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: beartype.typing.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: beartype.typing.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: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.measurements.Distance] = Quantity(0, DEFAULT_UNITS.LENGTH), y: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.measurements.Distance] = Quantity(0, DEFAULT_UNITS.LENGTH), z: beartype.typing.Union[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
Union
[Quantity
,Distance
], default:Quantity
(0,DEFAULT_UNITS.LENGTH
) Amount to translate the origin of the x-direction.
- y
Union
[Quantity
,Distance
], default:Quantity
(0,DEFAULT_UNITS.LENGTH
) Amount to translate the origin of the y-direction.
- z
Union
[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: beartype.typing.Union[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
Union
[Quantity
,Distance
] Distance to translate the origin.
- direction
- Returns:
Sketch
Revised sketch state ready for further sketch actions.
- Sketch.get(tag: str) beartype.typing.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: beartype.typing.Optional[str] = None) Sketch #
Add a sketch face to the sketch.
- Sketch.edge(edge: ansys.geometry.core.sketch.edge.SketchEdge, tag: beartype.typing.Optional[str] = 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: beartype.typing.Optional[str] = None) Sketch #
Add a segment sketch object to the sketch plane.
- Sketch.segment_to_point(end: ansys.geometry.core.math.point.Point2D, tag: beartype.typing.Optional[str] = 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: beartype.typing.Optional[str] = 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: beartype.typing.Optional[str] = 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: beartype.typing.Optional[bool] = False, tag: beartype.typing.Optional[str] = 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: beartype.typing.Optional[bool] = False, tag: beartype.typing.Optional[str] = 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: beartype.typing.Optional[str] = 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: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.measurements.Distance, ansys.geometry.core.typing.Real], convex_arc: beartype.typing.Optional[bool] = False, clockwise: beartype.typing.Optional[bool] = False, tag: beartype.typing.Optional[str] = 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
Union
[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: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.measurements.Angle, ansys.geometry.core.typing.Real], clockwise: beartype.typing.Optional[bool] = False, tag: beartype.typing.Optional[str] = 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
Union
[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: beartype.typing.Optional[str] = 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(width: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.measurements.Distance, ansys.geometry.core.typing.Real], height: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.measurements.Distance, ansys.geometry.core.typing.Real], slant_angle: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.measurements.Angle, ansys.geometry.core.typing.Real], nonsymmetrical_slant_angle: beartype.typing.Optional[beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.measurements.Angle, ansys.geometry.core.typing.Real]] = None, center: beartype.typing.Optional[ansys.geometry.core.math.point.Point2D] = ZERO_POINT2D, angle: beartype.typing.Optional[beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.measurements.Angle, ansys.geometry.core.typing.Real]] = 0, tag: beartype.typing.Optional[str] = None) Sketch #
Add a triangle to the sketch using given vertex points.
- Parameters:
- width
Union
[Quantity
,Distance
,Real
] Width of the slot main body.
- height
Union
[Quantity
,Distance
,Real
] Height of the slot.
- slant_angle
Union
[Quantity
,Angle
,Real
] Angle for trapezoid generation.
- nonsymmetrical_slant_angle
Union
[Quantity
,Angle
,Real
], default:None
Asymmetrical slant angles on each side of the trapezoid. The default is
None
, in which case the trapezoid is symmetrical.- center
Point2D
, default: (0, 0) Center point of the trapezoid.
- angle
Optional
[Union
[Quantity
,Angle
,Real
]], default: 0 Placement angle for orientation alignment.
- tag
str
, default:None
User-defined label for identifying the face.
- width
- Returns:
Sketch
Revised sketch state ready for further sketch actions.
- Sketch.circle(center: ansys.geometry.core.math.point.Point2D, radius: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.measurements.Distance, ansys.geometry.core.typing.Real], tag: beartype.typing.Optional[str] = None) Sketch #
Add a circle to the plane at a given center.
- Sketch.box(center: ansys.geometry.core.math.point.Point2D, width: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.measurements.Distance, ansys.geometry.core.typing.Real], height: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.measurements.Distance, ansys.geometry.core.typing.Real], angle: beartype.typing.Optional[beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.measurements.Angle, ansys.geometry.core.typing.Real]] = 0, tag: beartype.typing.Optional[str] = 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: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.measurements.Distance, ansys.geometry.core.typing.Real], height: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.measurements.Distance, ansys.geometry.core.typing.Real], angle: beartype.typing.Optional[beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.measurements.Angle, ansys.geometry.core.typing.Real]] = 0, tag: beartype.typing.Optional[str] = None) Sketch #
Create a slot on the sketch.
- Parameters:
- center: Point2D
Center point of the slot.
- width
Union
[Quantity
,Distance
,Real
] Width of the slot.
- height
Union
[Quantity
,Distance
,Real
] Height of the slot.
- angle
Union
[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.ellipse(center: ansys.geometry.core.math.point.Point2D, major_radius: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.measurements.Distance, ansys.geometry.core.typing.Real], minor_radius: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.measurements.Distance, ansys.geometry.core.typing.Real], angle: beartype.typing.Optional[beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.measurements.Angle, ansys.geometry.core.typing.Real]] = 0, tag: beartype.typing.Optional[str] = None) Sketch #
Create an ellipse on the sketch.
- Parameters:
- center: Point2D
Center point of the ellipse.
- major_radius
Union
[Quantity
,Distance
,Real
] Semi-major axis of the ellipse.
- minor_radius
Union
[Quantity
,Distance
,Real
] Semi-minor axis of the ellipse.
- angle
Union
[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: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.measurements.Distance, ansys.geometry.core.typing.Real], sides: int, angle: beartype.typing.Optional[beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.measurements.Angle, ansys.geometry.core.typing.Real]] = 0, tag: beartype.typing.Optional[str] = None) Sketch #
Create a polygon on the sketch.
- Parameters:
- center: Point2D
Center point of the polygon.
- inner_radius
Union
[Quantity
,Distance
,Real
] Inner radius (apothem) of the polygon.
- sides
int
Number of sides of the polygon.
- angle
Union
[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: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.measurements.Distance, ansys.geometry.core.typing.Real], inner_radius: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.measurements.Distance, ansys.geometry.core.typing.Real], n_teeth: int, tag: beartype.typing.Optional[str] = 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: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.measurements.Angle, ansys.geometry.core.typing.Real], n_teeth: int, tag: beartype.typing.Optional[str] = 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
Union
[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: beartype.typing.Optional[bool] = False, screenshot: beartype.typing.Optional[str] = None, use_trame: beartype.typing.Optional[bool] = None, selected_pd_objects: beartype.typing.List[pyvista.PolyData] = None, **plotting_options: beartype.typing.Optional[dict])#
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 theUSE_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: beartype.typing.Optional[bool] = False, screenshot: beartype.typing.Optional[str] = None, use_trame: beartype.typing.Optional[bool] = None, **plotting_options: beartype.typing.Optional[dict])#
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 theUSE_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() beartype.typing.List[pyvista.PolyData] #
Get polydata configuration for all objects of the sketch.
- Returns:
List
[PolyData
]List of the polydata configuration for all edges and faces in the sketch.
- Sketch.sketch_polydata_faces() beartype.typing.List[pyvista.PolyData] #
Get polydata configuration for all faces of the sketch to the scene.
- Returns:
List
[PolyData
]List of the polydata configuration for faces in the sketch.
- Sketch.sketch_polydata_edges() beartype.typing.List[pyvista.PolyData] #
Get polydata configuration for all edges of the sketch to the scene.
- Returns:
List
[PolyData
]List of the polydata configuration for edges in the sketch.