Model.sketchedit#
- Model.sketchedit(id=0, operation='', entity_type='', creation_method='', point_position=hwCouple(DBL_MAX, DBL_MAX), position_list=hwCoupleList(), curve_id=0, line_position=hwCouple(DBL_MAX, DBL_MAX), line_direction=hwCouple(0.0, 0.0), point_id=0, start_position=hwCouple(DBL_MAX, DBL_MAX), end_position=hwCouple(DBL_MAX, DBL_MAX), start_point=0, end_point=0, angle=DBL_MAX, length=0.0, center_position=hwCouple(DBL_MAX, DBL_MAX), radius=0.0, center_point=0, curve_position=hwCouple(DBL_MAX, DBL_MAX), curve_point=0, opposite_position=hwCouple(DBL_MAX, DBL_MAX), opposite_point=0, first_position=hwCouple(DBL_MAX, DBL_MAX), second_position=hwCouple(DBL_MAX, DBL_MAX), third_position=hwCouple(DBL_MAX, DBL_MAX), first_point=0, second_point=0, third_point=0, is_periodic=-1, degree=0, arc_direction=hwIntList(), type_list=hwIntList(), entity_list=hwIntList(), pattern_dir=0, pattern_distance=DBL_MAX, number_copies=0, is_symmetric=-1, dir1_copies_count=0, dir1_distance=DBL_MAX, dir1_is_symmetric=-1, pattern_dir1=0, dir2_copies_count=0, dir2_distance=DBL_MAX, dir2_is_symmetric=-1, pattern_dir2=0, pattern_angle=DBL_MAX, is_counterclockwise=-1, invert_tangent=-1, name='', is_interpolated=-1, corner_position=hwCouple(DBL_MAX, DBL_MAX), corner_position2=hwCouple(DBL_MAX, DBL_MAX), length_position=hwCouple(DBL_MAX, DBL_MAX), width_position=hwCouple(DBL_MAX, DBL_MAX), lower_left=hwCouple(DBL_MAX, DBL_MAX), lower_right=hwCouple(DBL_MAX, DBL_MAX), upper_right=hwCouple(DBL_MAX, DBL_MAX), circle_position=hwCouple(DBL_MAX, DBL_MAX), number_sides=0, midside_mode=-1, entity_id=0, constraint_type='', first_entity=0, second_entity=0, dim_position=hwCouple(DBL_MAX, DBL_MAX), is_fixed=-1, is_construction=-1, start_angle=DBL_MAX, end_angle=DBL_MAX, sweep_angle=DBL_MAX, major_radius=0.0, minor_radius=0.0, variable_name='', dim_value=DBL_MAX, is_dimdriven=-1, operation_method='', split_position=hwCouple(DBL_MAX, DBL_MAX), point_list=hwIntList(), geom_position=hwCouple(DBL_MAX, DBL_MAX), offset_distance=0.0, trim_position=hwCouple(DBL_MAX, DBL_MAX), mirror_axis=0, extend_position=hwCouple(DBL_MAX, DBL_MAX), translate_direction=hwCouple(0.0, 0.0), translate_distance=DBL_MAX, keep_relations=-1, rotate_angle=DBL_MAX, delete_original=-1, major_axis=hwCouple(0.0, 0.0), majoraxis_line=0, minoraxis_line=0, majoraxis_position=hwCouple(DBL_MAX, DBL_MAX), minoraxis_position=hwCouple(DBL_MAX, DBL_MAX))#
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.
- Parameters:
id (int) – The ID of the sketch entity to edit. Sketch entities are created/modified depending on the type of operation specified and the additional significant data names which controls the entity creation/modification/deletion.
operation (hwString) –
The operation to perform. Valid values are:
add - Add new entities into the sketch
modify - Modify existing sketch entity data
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 new position
clone - Creating entities from cloning existing entities
entity_type (hwString) – 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, polygon, parallelogram.creation_method (hwString) –
The method of creation of the entity. Valid only for
operation="add".List of supported creation methods
Entity Type
Creation Method
Description
point
point_position_single
Single point created on the position coordinates specified.
point_position_list
Multiple points are created on the list of position coordinates specified.
point_curve_middle
Points are created on middle of the curve entity specified.
line
line_position_direction
Infinite line is created with origin position and direction of line.
line_point_direction
Infinite line is created with origin point specified and direction of line.
line_end_positions
Line is created from start and end position coordinates.
line_end_points
Line is created from start and end points.
line_angle_length
Line is created from the start position and the end position is calculated from the angle and line length.
circle
circle_centerposition_radius
Circle is created from the center position and the radius.
circle_centerpoint_radius
Circle is created from the center point and the radius.
circle_center_curve_position
Circle is created from center position and a position on the circle.
circle_center_curve_point
Circle is created from the center point and a point on the circle.
circle_diagonal_positions
Circle is created from two diametrically opposite positions.
circle_diagonal_points
Circle is created from the two diametrically opposite points.
circle_three_positions
Circle is created from the three positions on the circumference of the circle.
circle_three_points
Circle is created from three points on the circumference of the circle.
arc
arc_three_positions
Arc is created from the three position coordinates, start and end position and position on the curve specifies the direction of the curve.
arc_three_points
Arc is created from the three points, start and end position and position on the curve specifies the direction of the curve.
arc_center_two_positions
Arc is created from the center and start and end position coordinates.
arc_center_two_points
Arc is created from the center and start and end points.
arc_tangent_two_positions
Arc is created from the tangent to the curve and the start and end positions.
arc_tangent_two_points
Arc is created from the tangent to the curve and the start and end points.
ellipse
ellipse_center_axis_radius
Ellipse is created from the center position and the major and minor radius.
ellipse_center_axis_lines
Ellipse is created from the center point and the major and minor axis lines.
elliptic arc
ellipticarc_center_axis_position
Elliptic arc is created from the center position and the major and minor position and the bounded points.
ellipticarc_center_axis_lines
Elliptic arc is created from the center position and the major axis and minor lines and the bounded points.
spline
spline_position_list
Create spline based on the coordinates specified.
spline_point_list
Create spline based on the points specified.
polyline
polyline_lines_list
Creating the continuosly connected lines from the list of position coordinates.
polyline_lines_arcs_list
Creating continuosly connected lines and arcs from the list of position coordinates.
pattern
pattern_linear_one_direction
Create linear pattern in one direction.
pattern_linear_two_direction
Create linear pattern in two directions.
pattern_circular
Create circular pattern.
constraint
constraint_on_entity
Create constraint on single entity.
constraint_two_entities
Create constraint between two entities.
dimension
dimension_on_entity
Create dimension on a entity.
dimension_two_entities
Create dimension constraint between two entities.
rectangle
rectangle_diagonal_positions
Create rectangle using diagonal positions.
rectangle_center_corner
Create rectangle using center corner method.
rectangle_center_length_width
Create rectangle using center length/width method.
rectangle_three_positions
Create rectangle using three positions.
parallelogram
parallelogram_three_positions
Create parallelogram with 3 positions.
polygon
polygon_center_position_sides
Create polygon using center position and sides.
point_position (hwCouple) – The x, y coordinates on the sketch plane defining the point position.
position_list (hwCoupleList) – The list of x, y coordinates on the sketch plane defining multiple point positions.
curve_id (int) – The UID of a line, circle, ellipse, or spline.
line_position (hwCouple) – The x, y coordinates on the sketch plane defining the line origin.
line_direction (hwCouple) – The x, y vector components on the sketch plane defining the line direction.
point_id (int) – The UID of the point defining the line origin.
start_position (hwCouple) – The x, y coordinates on the sketch plane defining the start position of the line.
end_position (hwCouple) – The x, y coordinates on the sketch plane defining the end position of the line.
start_point (int) – The UID of the point defining the start position of the line.
end_point (int) – The UID of the point defining the end position of the line.
angle (double) – The angle between the horizontal axis and the line in degrees or radians depending on the selected sketching units.
length (double) – The line length in the sketching units.
center_position (hwCouple) – The x, y coordinates on the sketch plane defining the center position.
radius (double) – The radius of the circle.
center_point (int) – The UID of the point defining the center position of the circle, ellipse, or arc.
curve_position (hwCouple) – The x, y coordinates on the sketch plane defining a position on circle curve.
curve_point (int) – The UID of the point on the circle curve position.
opposite_position (hwCouple) – The x, y coordinates on the sketch plane defining the opposite position on the circle curve.
opposite_point (int) – The UID of the point on the opposite position on the circle curve.
first_position (hwCouple) – The x, y coordinates on the sketch plane defining the first position on the circle.
second_position (hwCouple) – The x,y coordinates on the sketch plane defining the second position on the circle.
third_position (hwCouple) – The x, y coordinates on the sketch plane defining the third position on the circle.
first_point (int) – The UID of the point defining the first position on the circle.
second_point (int) – The UID of the point defining the second position on the circle.
third_point (int) – The UID of the point defining the third position on the circle.
is_periodic (int) – The flag defining if the curve is periodic.
degree (int) – The degree of the spline.
arc_direction (hwIntList) – 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 (hwIntList) – The list of integers defining the type of polyline segments (0 - line, 1 - arc).
entity_list (hwIntList) – The list of UIDs of input lines used to create the pattern.
pattern_dir (int) – The UID of the line defining the pattern direction.
pattern_distance (double) – The length of the pattern.
number_copies (int) – The number of copies to define one directional pattern.
is_symmetric (int) – The flag defining if the pattern is symmetric.
dir1_copies_count (int) – The number of copies in the first direction.
dir1_distance (double) – The pattern distance in the first direction.
dir1_is_symmetric (int) – The flag defining if the pattern is symmetric in the first direction.
pattern_dir1 (int) – The UID of the line defining the first pattern direction.
dir2_copies_count (int) – The number of copies in the second direction.
dir2_distance (double) – The pattern distance in the second direction.
dir2_is_symmetric (int) – The flag defining if the pattern is symmetric in the second direction.
pattern_dir2 (int) – The UID of the line defining the second pattern direction.
pattern_angle (double) – The angle of the pattern in degrees.
is_counterclockwise (int) – The flag defining the direction the arc is created between the start and end position.
invert_tangent (int) – The flag to invert the tangent of the arc.
name (hwString) – The name of the sketch entity to edit.
is_interpolated (int) – The flag defining if the spline passes through the fit points or is approximated by the control points.
corner_position (hwCouple) – The x, y coordinates on the sketch plane defining the corner position of the rectangle.
corner_position2 (hwCouple) – The x, y coordinates on the sketch plane defining the second corner position of the rectangle.
length_position (hwCouple) – The x, y coordinates on the sketch plane defining the length position of the rectangle.
width_position (hwCouple) – The x, y coordinates on the sketch plane defining the width position of the rectangle.
lower_left (hwCouple) – The x, y coordinates on the sketch plane defining the lower left corner of the rectangle.
lower_right (hwCouple) – The x, y coordinates on the sketch plane defining the lower right corner of the rectangle.
upper_right (hwCouple) – The x, y coordinates on the sketch plane defining the upper right corner of the rectangle.
circle_position (hwCouple) – The x, y coordinates on the sketch plane defining the position of the circle.
number_sides (int) – The number of polygon sides (3-8).
midside_mode (int) – The flag defining if the polygon is defined at a midside position or a vertex position.
entity_id (int) – The UID of the entity to be modified.
constraint_type (hwString) –
The type of constraint.
List of supported constraint types
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 (int) – The UID of the first entity to be constrained.
second_entity (int) – The UID of the second entity to be constrained.
dim_position (hwCouple) – The x, y coordinates on the sketch plane defining the position of the dimension.
is_fixed (int) – The flag defining if an entity is fixed (1) or not (0).
is_construction (int) – The flag defining if an entity is construction (1) or not (0).
start_angle (double) – The start angle of a circle in degrees or radians depending on the selected sketching units.
end_angle (double) – The end angle of a circle in degrees or radians depending on the selected sketching units.
sweep_angle (double) – The sweep angle of a circle in degrees or radians depending on the selected sketching units.
major_radius (double) – The major radius of the ellipse.
minor_radius (double) – The minor radius of the ellipse.
variable_name (hwString) – The variable name present in the variable manager. Valid only for dimension constraints.
dim_value (double) – The dimension constraint value.
is_dimdriven (int) – The flag defining if a constraint is dimension driven (1) or not (0).
operation_method (hwString) –
The operation methods.
List of supported operation methods
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 (hwCouple) – The x, y coordinates on the sketch plane defining the position at which curve entity is split.
point_list (hwIntList) – The list of point UIDs.
geom_position (hwCouple) – The x, y coordinates on the sketch plane on curve entity for selecting the chain of entities offset.
offset_distance (double) – The offset distance.
trim_position (hwCouple) – The x, y coordinates on the sketch plane defining the position for picking the curve segment to be removed from the curve.
mirror_axis (int) – The UID of the line defining the mirror axis.
extend_position (hwCouple) – The x, y coordinates on the sketch plane defining the position on other entity to which the selected curve is extended/shortened.
translate_direction (hwCouple) – The x, y vector components on the sketch plane defining the translation direction.
translate_distance (double) – The translation distance.
keep_relations (int) – The flag defining if the relations are kept after the transformation (1) or not (0).
rotate_angle (double) – The angle in degrees or radians depending on the selected sketching units by which the entities are rotated around the origin.
delete_original (int) – The flag defining if the original entities are deleted after the transformation (1) or not (0).
major_axis (hwCouple) – The x, y vector components defining the major axis of the ellipse.
majoraxis_line (int) – The UID of the line defining the major axis of the ellipse.
minoraxis_line (int) – The UID of the line defining the minor axis of the ellipse.
majoraxis_position (hwCouple) – The x, y coordinates on the sketch plane defining the position of the major axis of the ellipse.
minoraxis_position (hwCouple) – The x, y coordinates on the sketch plane defining the position of the minor axis of the ellipse.
Examples - Add Operation#
Add a point
Create a point at (10.0, 20.0) in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="point", creation_method="point_position_single", point_position=hm.hwCouple(10.0, 20.0) )
Create multiple points at locations (10.0, 20.0), (30.0, 40.0) in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="point", creation_method="point_position_list", position_list=hm.hwCoupleList([hm.hwCouple(10.0, 20.0),hm.hwCouple(30.0, 40.0)]) )
Create a point in the middle of the line with ID 1 in the sketch with UID 13#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="point", creation_method="point_curve_middle", curve_id=13 )
Add a line
Create an infinite line with origin at (10.0, 20.0) and direction (1.0, 0.0) in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="line", creation_method="line_position_direction", line_position=hm.hwCouple(10.0, 20.0), line_direction=hm.hwCouple(1.0, 0.0) )
Create an infinite line with origin at point with UID 5 and direction (1.0, 0.0) in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="line", creation_method="line_point_direction", point_id=5, line_direction=hm.hwCouple(1.0, 0.0) )
Create a line with start position (10.0, 20.0) and end position (30.0, 40.0) in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="line", creation_method="line_end_positions", start_position=hm.hwCouple(10.0, 20.0), end_position=hm.hwCouple(30.0, 40.0) )
Create a line with start position at point with UID 5 and end position at point with UID 6 in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="line", creation_method="line_point_positions", start_point=5, end_point=6 )
Create a line with start position (10.0, 20.0), at 45.0 angle from horizontal axis, and length 50.0 in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="line", creation_method="line_angle_length", start_position=hm.hwCouple(10.0, 20.0), angle=45.0, length=50.0 )
Add a circle
Create a circle with center at (10.0, 20.0) and radius 5.0 in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="circle", creation_method="circle_centerposition_radius", center_position=hm.hwCouple(10.0, 20.0), radius=5.0 )
Create a circle with center at point with UID 3 and radius 5.0 in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="circle", creation_method="circle_centerpoint_radius", center_point=3, radius=5.0 )
Create a circle with center at (10.0, 20.0) and a position on the circle at (15.0, 20.0) in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="circle", creation_method="circle_center_curve_position", center_position=hm.hwCouple(10.0, 20.0), curve_position=hm.hwCouple(15.0, 20.0) )
Create a circle with center at point with UID 3 and a position on the circle at point with UID 4 in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="circle", creation_method="circle_center_curve_position", center_point=3, curve_point=4 )
Create a circle with two diametrically opposite positions at (10.0, 20.0) and (10.0, 30.0) in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="circle", creation_method="circle_diagonal_positions", curve_position=hm.hwCouple(10.0, 20.0), opposite_position=hm.hwCouple(10.0, 30.0) )
Create a circle with two diametrically opposite positions at points with UID 4 and 5 in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="circle", creation_method="circle_diagonal_positions", curve_point=4, opposite_point=5 )
Create a circle from three positions on the circumference (0.0, 0.0), (1.0, 0.0), and (0.0, 1.0) in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="circle", creation_method="circle_three_positions ", first_position=hm.hwCouple(0.0, 0.0), second_position=hm.hwCouple(1.0, 0.0), third_position=hm.hwCouple(0.0, 1.0) )
Create a circle from three positions on the circumference at points with UID 3, 4, and 5 in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="circle", creation_method="circle_three_positions ", first_point=3, second_point=4, third_point=5 )
Add an arc
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#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="arc", creation_method="arc_three_positions", start_position=hm.hwCouple(10.0, 20.0), end_position=hm.hwCouple(30.0, 40.0), curve_position=hm.hwCouple(20.0, 30.0) )
Create an arc with start position at point with UID 3, end position at point with UID 4, and curve position at point with UID 5 in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="arc", creation_method="arc_three_points", start_point=3, end_point=4, curve_point=5 )
Create an arc with start position at (0.0, 0.0), end position at (10.0, 20.0), and center position at (0.0, 10.0) in clockwise direction in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="arc", creation_method="arc_center_two_positions", start_position=hm.hwCouple(0.0, 0.0), end_position=hm.hwCouple(10.0, 20.0), center_position=hm.hwCouple(0.0, 10.0), is_counterclockwise=0 )
Create an arc with start position at point with UID 3, end position at point with UID 4, and center position at point with UID 5 in clockwise direction in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="arc", creation_method="arc_center_two_points", start_point=3, end_point=4, center_point=5, is_counterclockwise=0 )
Create an arc with start position at (0.0, 0.0), end position at (10.0, 20.0), and tangent to the curve with UID 4 without inverting the tangent in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="arc", creation_method="arc_tangent_two_positions", curve_id=4, start_position=hm.hwCouple(0.0, 0.0), end_position=hm.hwCouple(10.0, 20.0), invert_tangent=0 )
Create an arc with start position at points with UID 3, end position at point with UID 5, and with inverted tangent to the curve with UID 4 in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="arc", creation_method="arc_tangent_two_points", curve_id=4, start_point=3, end_point=5, invert_tangent=1 )
Add an ellipse
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#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="ellipse", creation_method="ellipse_center_axis_radius", center_position=hm.hwCouple(0.0, 0.0), major_axis=hm.hwCouple(0.0, 1.0), major_radius=5.0, minor_radius=3.0 )
Create an ellipse with center position at point with UID 6, major axis defined by line with UID 10, and minor axis defined by line with UID 11 in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="ellipse", creation_method="ellipse_center_axis_lines", center_position=hm.hwCouple(0.0, 0.0), majoraxis_line=10, minoraxis_line=11 )
Add an elliptic arc
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#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="elliptic_arc", creation_method="elliptic_arc_center_axis_position", center_position=hm.hwCouple(0.0, 0.0), majoraxis_position=hm.hwCouple(0.0, 1.0), minoraxis_position=hm.hwCouple(1.0, 0.0), start_position=hm.hwCouple(5.0, 0.0), end_position=hm.hwCouple(-5.0, 0.0), is_counterclockwise=1 )
Create an elliptical 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#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="elliptic_arc", creation_method="elliptic_arc_center_axis_position", center_position=hm.hwCouple(0.0, 0.0), majoraxis_position=hm.hwCouple(0.0, 1.0), minoraxis_position=hm.hwCouple(1.0, 0.0), start_position=hm.hwCouple(5.0, 0.0), end_position=hm.hwCouple(-5.0, 0.0), is_counterclockwise=1 )
Create an elliptical arc with center at point with UID 6, major axis defined by line with UID 10, minor axis defined by line with UID 11, start position at point with UID 12, end position at point with UID 13 in clockwise direction in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="elliptic_arc", creation_method="elliptic_arc_center_axis_position", center_point=6, majoraxis_line=10, minoraxis_line=11, start_point=12, end_point=13, is_counterclockwise=0 )
Add a spline
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#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="spline", creation_method="spline_position_list", position_list=hm.hwCoupleList([hm.hwCouple(0.0, 0.0), hm.hwCouple(1.0, 1.0), hm.hwCouple(2.0, 0.0)]), is_periodic=0, degree=3, is_interpolated=0 )
Create a spline with control points with UID 6, 7, and 8 which is not periodic, with degree 3 and not passing through the control points in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="spline", creation_method="spline_point_list", point_list=[6, 7, 8], is_periodic=0, degree=3, is_interpolated=1 )
Add a polyline
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#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="polyline", creation_method="polyline_lines_list", position_list=hm.hwCoupleList([hm.hwCouple(0.0, 0.0), hm.hwCouple(1.0, 1.0), hm.hwCouple(2.0, 0.0)]) )
Create a polyline starting at position (0.0, 0.0), passing through positions (3.0, 4.0), (5.0, 6.0), and (7.0, 8.0) where first segment is a line, second segment is an arc, and third segment is a line, with the arc direction being normal downward in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="polyline", creation_method="polyline_lines_arcs_list", start_position=hm.hwCouple(0.0, 0.0), position_list=hm.hwCoupleList([hm.hwCouple(3.0, 4.0), hm.hwCouple(5.0, 6.0), hm.hwCouple(7.0, 8.0)]), type_list=[0, 1, 0], arc_direction=[3] )
Add a pattern
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 dinstace of 5.0, with 3 copies, and symmetric pattern in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.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 )
Create a linear pattern in two directions using lines with UIDs 1, 2, and 3 as input lines, line with UID 4 as the first pattern direction, with pattern distance in the first direction of 5.0, with 3 copies in the first direction, asymmetric pattern in the first direction, line with UID 5 as the second pattern direction, with pattern distance in the second direction of 10.0, with 2 copies in the second direction, and asymmetric pattern in the second direction in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="pattern", creation_method="pattern_linear_two_direction", entity_list=[1, 2, 3], pattern_dir1=4, dir1_distance=5.0, dir1_copies_count=3, dir1_is_symmetric=0, pattern_dir2=5, dir2_distance=10.0, dir2_copies_count=2, dir2_is_symmetric=0 )
Create a circular asymmetric pattern using lines with UIDs 1, 2, and 3 as input lines, with center at point with UID 7, with pattern angle of 30.0 degrees, 3 copies in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="pattern", creation_method="pattern_circular", entity_list=[1, 2, 3], center_point=7, number_copies=3, pattern_angle=30.0, is_symmetric=0 )
Add a constraint
Create a horizontal constraint on line with UID 1 in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="constraint", creation_method="constraint_on_entity", entity_id=1, constraint_type="constraint_horizontal", )
Create a collinear constraint between lines with UIDs 1 and 2 in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="constraint", creation_method="constraint_two_entities", first_entity=1, second_entity=2, constraint_type="constraint_collinear", )
Add a dimension
Create a radius dimension on circle with UID 1 at position (10.0, 20.0) in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="dimension", creation_method="dimension_on_entity", entity_id=1, dim_position=hm.hwCouple(10.0, 20.0), constraint_type="constraint_radius", )
Create an angle dimension constraint between lines with UIDs 1 and 2 at position (10.0, 20.0) in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="dimension", creation_method="dimension_two_entities", first_entity=1, second_entity=2, dim_position=hm.hwCouple(10.0, 20.0), constraint_type="constraint_angle", )
Add a rectangle
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#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="rectangle", creation_method="rectangle_diagonal_positions", corner_position=hm.hwCouple(10.0, 20.0), corner_position2=hm.hwCouple(20.0, 20.0) )
Create a rectangle with the center at position (10.0, 10.0) and corner at position (15.0, 15.0) in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="rectangle", creation_method="rectangle_center_corner", center_position=hm.hwCouple(10.0, 10.0), corner_position=hm.hwCouple(15.0, 15.0) )
Create a rectangle with the center at position (10.0, 10.0), the length position at (15.0, 10.0), and the width position at (10.0, 12.0) in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="rectangle", creation_method="rectangle_center_length_width", center_position=hm.hwCouple(10.0, 10.0), length_position=hm.hwCouple(15.0, 10.0), width_position=hm.hwCouple(10.0, 12.0) )
Create a rectangle with the lower left corner at position (10.0, 20.0), the lower right corner at position (20.0, 20.0), and the upper right corner at position (20.0, 30.0) in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="rectangle", creation_method="rectangle_three_positions", lower_left=hm.hwCouple(10.0, 20.0), lower_right=hm.hwCouple(20.0, 20.0), upper_right=hm.hwCouple(20.0, 30.0) )
Add a parallelogram
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#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="parallelogram", creation_method="parallelogram_three_positions", lower_left=hm.hwCouple(10.0, 20.0), lower_right=hm.hwCouple(20.0, 20.0), upper_right=hm.hwCouple(25.0, 30.0) )
Add a polygon
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#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="add", entity_type="polygon", creation_method="polygon_center_position_sides", center_position=hm.hwCouple(10.0, 10.0), circle_position=hm.hwCouple(15.0, 10.0), number_sides=6, midside_mode=0 )
Examples - Modify Operation#
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#import hm import hm.entities as ent model = hm.Model() model.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#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="split", operation_method="split_position", entity_id=3, split_position=hm.hwCouple(10.0, 20.0) )
Examples - Fillet Operation#
Create a fillet
Create a fillet at point with UID 20 with radius 0.2 in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="fillet", operation_method="fillet_single", point_id=20, radius=0.2 )
Create a fillet at points with UID 20, 21, and 22 with radius 0.2 in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="fillet", operation_method="fillet_list", point_list=[20, 21, 22], 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#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="offset", operation_method="offset_single", entity_id=3, offset_distance=5.0 )
Offset the curves with UIDs 4, 5, and 6 by 10.0 units in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="offset", operation_method="offset_list", entity_list=[4, 5, 6], offset_distance=10.0 )
Examples - Trim Operation#
Trim a curve
Trim a curve at position (10.0, 20.0) in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="trim", operation_method="trim_position", trim_position=hm.hwCouple(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#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="mirror", operation_method="mirror_single", entity_id=3, mirror_axis=5 )
Mirror multiple curves with UIDs 4, 5, and 6 along the line with UID 7 in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="mirror", operation_method="mirror_list", entity_list=[4, 5, 6], mirror_axis=7 )
Examples - Remove Operation#
Remove entities from a sketch
Remove a single entity with UID 3 from the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="remove", operation_method="remove_single", entity_id=3 )
Remove multiple entities with UIDs 4, 5, and 6 from the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="remove", operation_method="remove_list", entity_list=[4, 5, 6] )
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#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="extend", operation_method="extend_position", entity_id=3, geom_position=hm.hwCouple(10.0, 20.0), extend_position=hm.hwCouple(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 relationsin the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="transform", operation_method="translate_list", entity_list=[3], translate_direction=hm.hwCouple(1.0, 0.0), translate_distance=5.0, keep_relations=1 )
Rotate entities with UIDs 4 and 5 around the center position (1.0, 1.0) by 180 degrees while keeping the relations in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="transform", operation_method="rotate_list_position", entity_list=[4, 5], center_position=hm.hwCouple(1.0, 1.0), rotate_angle=180.0, keep_relations=1 )
Rotate entities with UIDs 6 and 7 around the center point with UID 8 by 90 degrees while keeping the relations in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="transform", operation_method="rotate_list_point", entity_list=[6, 7], center_point=8, rotate_angle=90.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#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="clone", operation_method="clone_single", entity_id=3, delete_original=1, translate_direction=hm.hwCouple(1.0, 0.0), rotate_angle=90.0 )
Clone multiple entities with UIDs 4, 5, and 6 by translating them in the direction (3.0, 0.0) and rotating them by 135 degrees, deleting the original entities in the sketch with ID 1#import hm import hm.entities as ent model = hm.Model() model.sketchedit( id=1, operation="clone", operation_method="clone_list", entity_list=[4, 5, 6], delete_original=1, translate_direction=hm.hwCouple(3.0, 0.0), rotate_angle=135.0 )