*sketchedit
Edits the sketch entity by adding/removing/modifying entities with various operations.
Syntax
*sketchedit <select_type>=<selection> operation=<value> <option1>=<value1> <option2>=<value2> ... <optionN>=<valueN>
Type
HyperMesh Tcl Modify Command
Description
Edits the sketch entity by adding/removing/modifying entities with various operations. Different operations require a different set of arguments. See the Examples section for details on how to use the function.
Inputs
- <select_type>=<selection>
- The entity or entities that are to be queried. There are several ways to provide the
entities to be queried. Only one option can be used at a time:
- id=<sketch_id>
- The ID of the sketch entity.
- name=<sketch_name>
- The name of the sketch entity.
- operation=<value>
- The operation to perform. Valid values are:
- add - Add the new entities into the sketch.
- modify - Modify the existing entity data in the sketch.
- split - Split the entity into multiple entities.
- fillet - Add the fillet to the corner points.
- offset - Offset entities by offsetting chain with offset distance.
- trim - Trim the entities.
- mirror - Mirror entities.
- remove - Remove the entity/entities from the sketch.
- extend - Extend the line/arc entity.
- transform - Transform the entities to a new position.
- clone - Creating entities from cloning existing entities.
- entity_type=<value>
- The entity type to be created. Valid only for operation="add". Valid values are point, line, circle, arc, ellipse, elliptic_arc, spline, polyline, pattern, constraint, dimension, rectangle, parallelogram, and polygon.
- creation_method=<value>
- The method of creation of the entity. Valid only for operation="add".
- point_position=<value>
- The x, y coordinates on the sketch plane defining the point position.
- position_list=<value>
- The list of x, y coordinates on the sketch plane defining multiple point positions.
- curve_id=<value>
- The UID of a line, circle, ellipse, or spline.
- line_position=<value>
- The x, y coordinates on the sketch plane defining the line origin.
- line_direction=<value>
- The x, y vector components on the sketch plane defining the line direction.
- point_id=<value>
- The UID of the point defining the line origin.
- start_position=<value>
- The x, y coordinates on the sketch plane defining the start position of the line.
- end_position=<value>
- The x, y coordinates on the sketch plane defining the end position of the line.
- start_point=<value>
- The UID of the point defining the start position of the line.
- end_point=<value>
- The UID of the point defining the end position of the line.
- angle=<value>
- The angle between the horizontal axis and the line in degrees or radians depending on the selected sketching units.
- length=<value>
- The line length in the sketching units.
- center_position=<value>
- The x, y coordinates on the sketch plane defining the center position.
- radius=<value>
- The radius of the circle.
- center_point=<value>
- The UID of the point defining the center position of the circle, ellipse, or arc.
- curve_position=<value>
- The x, y coordinates on the sketch plane defining a position on circle curve.
- curve_point=<value>
- The UID of the point on the circle curve position.
- opposite_position=<value>
- The x, y coordinates on the sketch plane defining the opposite position on the circle curve.
- opposite_point=<value>
- The UID of the point on the opposite position on the circle curve.
- first_position=<value>
- The x, y coordinates on the sketch plane defining the first position on the circle.
- second_position=<value>
- The x, y coordinates on the sketch plane defining the second position on the circle.
- third_position=<value>
- The x, y coordinates on the sketch plane defining the third position on the circle.
- first_point=<value>
- The UID of the point defining the first position on the circle.
- second_point=<value>
- The UID of the point defining the second position on the circle.
- third_point=<value>
- The UID of the point defining the third position on the circle.
- is_periodic=<value>
- The flag defining if the curve is periodic.
- arc_direction=<value>
- The list of integers defining the arc direction in a polyline (0 - tangent upward, 1 - tangent downward, 2 - normal upward, 3 - normal downward).
- type_list=<value>
- The list of integers defining the type of polyline segments (0 - line, 1 - arc).
- entity_list=<value>
- The list of UIDs of input lines used to create the pattern.
- pattern_dir=<value>
- The UID of the line defining the pattern direction.
- pattern_distance=<value>
- The length of the pattern.
- number_copies=<value>
- The number of copies to define one directional pattern.
- is_symmetric=<value>
- The flag defining if the pattern is symmetric.
- dir1_copies_count=<value>
- The number of copies in the first direction.
- dir1_distance=<value>
- The pattern distance in the first direction.
- dir1_is_symmetric=<value>
- The flag defining if the pattern is symmetric in the first direction.
- pattern_dir1=<value>
- The UID of the line defining the first pattern direction.
- dir2_copies_count=<value>
- The number of copies in the second direction.
- dir2_distance=<value>
- The pattern distance in the second direction.
- dir2_is_symmetric=<value>
- The flag defining if the pattern is symmetric in the second direction.
- pattern_dir2=<value>
- The UID of the line defining the second pattern direction.
- pattern_angle=<value>
- The angle of the pattern in degrees.
- is_counterclockwise=<value>
- The flag defining the direction the arc is created between the start and end position.
- invert_tangent=<value>
- The flag to invert the tangent of the arc.
- name=<value>
- The name of the sketch entity to edit.
- is_interpolated=<value>
- The flag defining if the spline passes through the fit points or is approximated by the control points.
- corner_position=<value>
- The x, y coordinates on the sketch plane defining the corner position of the rectangle.
- corner_position2=<value>
- The x, y coordinates on the sketch plane defining the second corner position of the rectangle.
- length_position=<value>
- The x, y coordinates on the sketch plane defining the length position of the rectangle.
- width_position=<value>
- The x, y coordinates on the sketch plane defining the width position of the rectangle.
- lower_left=<value>
- The x, y coordinates on the sketch plane defining the lower left corner of the rectangle.
- lower_right=<value>
- The x, y coordinates on the sketch plane defining the lower right corner of the rectangle.
- upper_right=<value>
- The x, y coordinates on the sketch plane defining the upper right corner of the rectangle.
- circle_position=<value>
- The x, y coordinates on the sketch plane defining the position of the circle.
- number_sides=<value>
- The number of polygon sides (3-8).
- midside_mode=<value>
- The flag defining if the polygon is defined at a midside position or a vertex position.
- entity_id=<value>
- The UID of the entity to be modified.
- constraint_type=<value>
- The type of constraint. List of supported constraint types:
Table 2. constraint_fixed constraint_collinear constraint_major_radius constraint_horizontal constraint_distance_aligned constraint_minor_radius constraint_vertical constraint_distance_horizontal constraint_offset_distance constraint_coincident constraint_distance_vertical constraint_pattern_angle constraint_parallel constraint_radius constraint_pattern_distance constraint_perpendicular constraint_diameter_aligned constraint_pattern_distance_2 constraint_equal constraint_diameter_horizontal constraint_pattern_linear constraint_tangent constraint_diameter_vertical constraint_pattern_circular constraint_concentric constraint_angle - first_entity=<value>
- The UID of the first entity to be constrained.
- second_entity=<value>
- The UID of the second entity to be constrained.
- dim_position=<value>
- The x, y coordinates on the sketch plane defining the position of the dimension.
- is_fixed=<value>
- The flag defining if an entity is fixed (1) or not (0).
- is_construction=<value>
- The flag defining if an entity is construction (1) or not (0).
- start_angle=<value>
- The start angle of a circle in degrees or radians depending on the selected sketching units.
- end_angle=<value>
- The end angle of a circle in degrees or radians depending on the selected sketching units.
- sweep_angle=<value>
- The sweep angle of a circle in degrees or radians depending on the selected sketching units.
- major_radius=<value>
- The major radius of the ellipse.
- minor_radius=<value>
- The minor radius of the ellipse.
- variable_name=<value>
- The variable name present in the variable manager. Valid only for dimension constraints.
- dim_value=<value>
- The dimension constraint value.
- is_dimdriven=<value>
- The flag defining if a constraint is dimension driven (1) or not (0).
- operation_method=<value>
- The operation methods. List of supported operation methods:
Table 3. split_position mirror_single translate_list fillet_single mirror_list rotate_list_position fillet_list remove_single rotate_list_point offset_position remove_list clone_single trim_position extend_position clone_list - split_position=<value>
- The x, y coordinates on the sketch plane defining the position at which curve entity is split.
- point_list=<value>
- The list of point UIDs.
- geom_position=<value>
- The x, y coordinates on the sketch plane on curve entity for selecting the chain of entities offset.
- offset_distance=<value>
- The offset distance.
- trim_position=<value>
- The x, y coordinates on the sketch plane defining the position for picking the curve segment to be removed from the curve.
- mirror_axis=<value>
- The UID of the line defining the mirror axis.
- extend_position=<value>
- The x, y coordinates on the sketch plane defining the position on other entity to which the selected curve is extended/shortened.
- translate_direction=<value>
- The x, y vector components on the sketch plane defining the translation direction.
- translate_distance=<value>
- The translation distance.
- keep_relations=<value>
- The flag defining if the relations are kept after the transformation (1) or not (0).
- rotate_angle=<value>
- The angle in degrees or radians depending on the selected sketching units by which the entities are rotated around the origin.
- delete_original=<value>
- The flag defining if the original entities are deleted after the transformation (1) or not (0).
- major_axis=<value>
- The x, y vector components defining the major axis of the ellipse.
- majoraxis_line=<value>
- The UID of the line defining the major axis of the ellipse.
- minoraxis_line=<value>
- The UID of the line defining the minor axis of the ellipse.
- majoraxis_position=<value>
- The x, y coordinates on the sketch plane defining the position of the major axis of the ellipse.
- minoraxis_position=<value>
- The x, y coordinates on the sketch plane defining the position of the minor axis of the ellipse.
Examples
- Examples - Add Operation
-
- Add a point
- To create a point at (10.0, 20.0) in the sketch with ID
1:
*sketchedit id=1 operation=add entity_type=point creation_method=point_position_single point_position={10.0 20.0} - Add a line
- To create an infinite line with origin at (10.0, 20.0) and direction (1.0,
0.0) in the sketch with ID
1:
*sketchedit id=1 operation=add entity_type=line creation_method=line_position_direction line_position={10.0 20.0} line_direction={1.0 0.0} - Add a circle
- To create a circle with center at (10.0, 20.0) and radius 5.0 in the sketch
with ID
1:
*sketchedit id=1 operation=add entity_type=circle creation_method=circle_centerposition_radius center_position={10.0 20.0} radius=5.0 - Add an arc
- To create an arc with start position at (10.0, 20.0), end position at (30.0,
40.0), and curve position at (20.0, 30.0) in the sketch with ID
1:
*sketchedit id=1 operation=add entity_type=arc creation_method=arc_three_positions start_position={10.0 20.0} end_position={30.0 40.0} curve_position={20.0 30.0} - Add an ellipse
- To create an ellipse with center position at (0.0, 0.0), major axis direction
in (0.0, 1.0), major radius of 5.0, and minor radius of 3.0 in the sketch with
ID
1:
*sketchedit id=1 operation=add entity_type=ellipse creation_method=ellipse_center_axis_radius center_position={0.0 0.0} major_axis={0.0 1.0} major_radius=5.0 minor_radius=3.0 - Add an elliptic arc
- To create an elliptic arc with center position at (0.0, 0.0), major axis
position in (0.0, 1.0), minor axis position in (1.0, 0.0), start position at
(5.0, 0.0), end position at (-5.0, 0.0) in counterclockwise direction in the
sketch with ID
1:
*sketchedit id=1 operation=add entity_type=elliptic_arc creation_method=ellipticarc_center_axis_position center_position={0.0 0.0} majoraxis_position={0.0 1.0} minoraxis_position={1.0 0.0} start_position={5.0 0.0} end_position={-5.0 0.0} is_counterclockwise=1 - Add a spline
- To create a spline with control points at (0.0, 0.0), (1.0, 1.0), and (2.0,
0.0) which is not periodic, with degree 3 and passing through the control points
in the sketch with ID
1:
*sketchedit id=1 operation=add entity_type=spline creation_method=spline_position_list position_list={{0.0 0.0} {1.0 1.0} {2.0 0.0}} is_periodic=0 degree=3 is_interpolated=0 - Add a polyline
- To create a polyline with positions coordinates (0.0, 0.0), (1.0, 1.0), and
(2.0, 0.0) in the sketch with ID
1:
*sketchedit id=1 operation=add entity_type=polyline creation_method=polyline_lines_list position_list={{0.0 0.0} {1.0 1.0} {2.0 0.0}} - Add a pattern
- To create a linear pattern using lines with UIDs 1, 2, and 3 as input lines,
line with UID 4 as the pattern direction, with pattern distance of 5.0, with 3
copies, and symmetric pattern in the sketch with ID
1:
*sketchedit id=1 operation=add entity_type=pattern creation_method=pattern_linear_one_direction entity_list={1 2 3} pattern_dir=4 pattern_distance=5.0 number_copies=3 is_symmetric=1 - Add a constraint
- To create a horizontal constraint on line with UID 1 in the sketch with ID
1:
*sketchedit id=1 operation=add entity_type=constraint creation_method=constraint_on_entity entity_id=1 constraint_type=constraint_horizontal - Add a dimension
- To create a radius dimension on circle with UID 1 at position (10.0, 20.0) in
the sketch with ID
1:
*sketchedit id=1 operation=add entity_type=dimension creation_method=dimension_on_entity entity_id=1 dim_position={10.0 20.0} constraint_type=constraint_radius - Add a rectangle
- To create a rectangle with first corner position at (10.0, 20.0), second
corner position at (20.0, 20.0) in the sketch with ID
1:
*sketchedit id=1 operation=add entity_type=rectangle creation_method=rectangle_diagonal_positions corner_position={10.0 20.0} corner_position2={20.0 20.0} - Add a parallelogram
- To create a parallelogram with lower left corner at position (10.0, 20.0),
lower right corner at position (20.0, 20.0), and upper right corner at position
(25.0, 30.0) in the sketch with ID
1:
*sketchedit id=1 operation=add entity_type=parallelogram creation_method=parallelogram_three_positions lower_left={10.0 20.0} lower_right={20.0 20.0} upper_right={25.0 30.0} - Add a polygon
- To create a polygon with center at position (10.0, 10.0), circle position at
(15.0, 10.0) using vertex mode, and with 6 sides in the sketch with ID
1:
*sketchedit id=1 operation=add entity_type=polygon creation_method=polygon_center_position_sides center_position={10.0 10.0} circle_position={15.0 10.0} number_sides=6 midside_mode=0
- Examples - Modify Operations
-
- Modify an ellipse
- Modify the ellipse with UID 3 by setting its major radius to 3.0, its minor
radius to 2.0, and its center in the sketch with ID
1:
*sketchedit id=1 operation=modify entity_id=3 major_radius=3.0 minor_radius=2.0
- Examples - Split Operation
-
- Split a curve
- Split the curve with UID 3 at position (10.0, 20.0) in the sketch with ID
1:
*sketchedit id=1 operation=split operation_method=split_position entity_id=3 split_position={10.0 20.0}
- Examples - Fillet Operation
-
- To create a fillet
- To create a fillet at point with UID 20 with radius 0.2 in the sketch with ID
1:
*sketchedit id=1 operation=fillet operation_method=fillet_single point_id=20 radius=0.2
- Examples - Offset Operation
-
- Offset a curve
- Offset the curve with UID 3 by 5.0 units in the sketch with ID
1:
*sketchedit id=1 operation=offset operation_method=offset_single entity_id=3 offset_distance=5.0
- Examples - Trim Operation
-
- Trim a curve
- Trim a curve at position (10.0, 20.0) in the sketch with ID
1:
*sketchedit id=1 operation=trim operation_method=trim_position trim_position={10.0 20.0}
- Examples - Mirror Operation
-
- Mirror a curve
- Mirror a curve with UID 3 along the line with UID 5 in the sketch with ID
1:
*sketchedit id=1 operation=mirror operation_method=mirror_single entity_id=3 mirror_axis=5
- Examples - Remove Operation
-
- Remove entities from a sketch
- Remove a single entity with UID 3 from the sketch with ID
1:
*sketchedit id=1 operation=remove operation_method=remove_single entity_id=3
- Examples - Extend Operation
-
- Extend a curve
- Extend a curve with UID 3 at position (10.0, 20.0) to meet another entity at
position (15.0, 25.0) in the sketch with ID
1:
*sketchedit id=1 operation=extend operation_method=extend_position entity_id=3 geom_position={10.0 20.0} extend_position={15.0 25.0}
- Examples - Transform Operation
-
- Transform entities in a sketch
- Translate an entity with UID 3 in direction (1.0, 0.0) by 5.0 while keeping
the relations in the sketch with ID
1:
*sketchedit id=1 operation=transform operation_method=translate_list entity_list={3} translate_direction={1.0 0.0} translate_distance=5.0 keep_relations=1
- Examples - Clone Operation
-
- Clone entities in a sketch
- Clone a single entity with UID 3 by translating it in the direction (1.0, 0.0)
and rotating it by 90 degrees, deleting the original entity in the sketch with
ID
1:
*sketchedit id=1 operation=clone operation_method=clone_single entity_id=3 delete_original=1 translate_direction={1.0 0.0} rotate_angle=90.0
Errors
Incorrect usage results in a Tcl error. To detect
errors, you can use the catch
command:
if { [ catch {command_name...} ] } {
# Handle error
}Version History
2021.2