ACTIONS_README.md
This pull request includes several handy actions for entities editing and modification (see below).
Actions are:
The following actions are included:
This action draws cross for selected circle, arc, ellipse or ellipse arc. Intersection of cross lines is located in the center point of entity.
Cross is drawn using active pen and layer.
Options:
X - horizontal size value
Y - vertical size value
Angle - angle used to rotate the cross (between x-axis and horizontal line)
Type - defines type of cross size calculation. There are the following size types:
If there are selected entities during action's invocation, cross for each applicable entity type is created based previously on saved settings.
Action is not fully scriptable, as requires mouse selection of entity.
cross or cx
No additional commands
No support
This action draws a star with given amount of rays. It is possible to create symmetric or non-symmetric star, and specify rounding radiuses for outer and inner vertexes.
Star is drawn using active pen and layer.
Symmetric - flag that indicates whether star is symmetric
Number - number of rays (min is 3)
Radius Outer - Rounding radius for outer vertexes of rays (if any)
Radius Inner Rounding radius for inner vertexes of rays (if any)
Polyline Flag indicates whether all elements of start should be drawn as individual entities or as single polyline.
No support
Action is fully scriptable and operations may be performed via command widget only.
star or st
Positions for center of star, outer ray vertex and inner ray vertex may be entered as coordinates. Also, the following commands are supported:
number - specified amount of rays
radius - allows to specify rounding radiuses
sym - specified that star is symmetric
nosym - specifies that start is not symmetric
nopoly - do not create polyline
usepoly - draw star as single polyline
For setting center point of star state of the action, allows snapping center to relative zero point.
This action draws a rectangle of specified size and places it into specified insertion point.
Rectangle is drawn using active pen and layer.
Width - width of rectangle
Height - height of rectangle
Snap - defines which part of rectangle will be used as as snap point (and so it will be placed into insertion point)
there are the following options for snap:
Base Angle - rotation angle of rectangle (betwen x-axis and bottom edge)
Polyline - Flag indicates whether all elements of rectangle should be drawn as individual entities or as single polyline.
Corners - Defines now corners of rectangle should be drawn. The following options are available:
Edges - for Straight corner mode, allows to specify which edges of rectangle should be shown. If not all edges are set, it is possible to draw 2 parallel lines. Options are:
Radius - for Round corners mode, radius of rounding corners arcs
Snap Shift - for Round corners mode, flag indicates that normal snap point should be adjusted and be located, say, not at the corner of rect, but in the center point of rounding arc
Size inner - for Round corners mode, if set this flag indicates that size of rectangle should be applied not to outer size of rectangle, but for size between centers of rounding arcs.
Length X - for Bevel corners mode, specifies bevel size by x-axis
Length Y - for Bevel corners mode, specifies bevel size by y-axis
No support
Action is fully scriptable and operations may be performed via command widget only.
rect1 or re1
Position for insertion point may be entered as coordinates.
Also, the following commands are supported:
width - initiates entering width
height - initiates entering height
size - initiates entering size of rect (as width, height pair, similar to coordinates)
pos - switches to entering insertion point coordinates
snap1 - initiates entering snap mode for insertion point. Commands for snap point type are:
topl, top, topr, left, middle, right, bottoml, bottom, bottomr
snapcorner - switches to snap to corner mode (opposite to snapshift)
snapshift - switches to snap to center of rounded corner arc mode (opposite to snapshift)
sizeout - switches sizes calculation relating to corners (opposite to sizein)
sizein - switches sizes calculation relating to centers of rounding arcs (opposite to sizeout)
angle - initiates entering of base angle of rect (angle from corner1 to corner2)
radius - initiates entering rounding radius for corners
bevels - initiates entering of bevels or setting bevels corners mode
corners - initiates entering corners mode. Command values for corners are: str, round, bevels
edges - initiates entering corners mode. Command values for corners are: both, hor, vert
usepoly - draw rectangle as single polyline
usepoly - disables drawing rect as polyline (so all elements are individual entities)
If relative zero point is valid, uses it as rectangle insertion point.
This action draws a rectangle by specifying positions of two snap points (specified by settings) of rectangle. Such customizable snapping mode allows better positioning of created rectangle.
Rectangle is drawn using active pen and layer.
No support
Action is fully scriptable and operations may be performed via command widget only.
rect2 or re2
Position for start snap point and end snap point may be entered as coordinates.
Also, the following commands are supported:
snap1 - starts entering of snap mode for point 1. Options for snap point type are:
corner, mid-vert, mid-hor, middle
snap2 - starts entering of snap mode for point 1. Options for snap point type are:
corner, mid-vert, mid-hor, middle
size - initiates entering size of rect (as width, height pair, similar to coordinates)
pos - switches to entering insertion point coordinates
snapcorner - switches to snap to corner mode (opposite to snapshift)
snapshift - switches to snap to center of rounded corner arc mode (opposite to snapshift)
angle - initiates entering of base angle of rect (angle from corner1 to corner2)
radius - initiates entering rounding radius for corners
bevels - initiates entering of bevels or setting bevels corners mode
corners - initiates entering corners mode. Command values for corners are: str, round, bevels
edges - initiates entering corners mode. Command values for corners are: both, hor, vert
usepoly - draw rectangle as single polyline
usepoly - disables drawing rect as polyline (so all elements are individual entities)
Depends on state of the action.
This action draws a rectangle or quadrangle by specifying positions of 3 corner points.
Rectangle is drawn using active pen and layer.
No support
Action is fully scriptable and operations may be performed via command widget only.
rect3 or re3
Position for start snap point and end snap point may be entered as coordinates.
Also, the following commands are supported:
pos - switches to entering insertion point coordinates
quad - sets quadrangle mode
noquad - sets rectangle mode
angle_inner - starts entering of inner angle for quadrangle (and enables quadrangle mode)
width - starts entering width value
height - starts entering height value
size - initiates entering size of rect (as width, height pair, similar to coordinates)
snapcorner - switches to snap to corner mode (opposite to snapshift)
snapshift - switches to snap to center of rounded corner arc mode (opposite to snapshift)
angle - initiates entering of base angle of rect (angle from corner1 to corner2)
radius - initiates entering rounding radius for corners
bevels - initiates entering of bevels or setting bevels corners mode
corners - initiates entering corners mode. Command values for corners are: str, round, bevels
edges - initiates entering corners mode. Command values for corners are: both, hor, vert
usepoly - draw rectangle as single polyline
usepoly - disables drawing rect as polyline (so all elements are individual entities)
Depends on state of the action.
This action draws a set of points located on the same line. Distance between points may be either fixed or calculated based on specified number of points.
Rectangle is drawn using active pen and layer.
No support
Action is fully scriptable and operations may be performed via command widget only.
linepoints or lpoints
Position for start point of line and end point line may be entered as coordinates.
The following commands are supported:
angle - initiates entering of line angle
x - fixes direction of line to horizontal and ask for entering line length
y - fixes direction of line to vertical and ask for entering line length
p - switches line to free direction (point) as it is supported by default line drawing action. Default directions mode
number - initiates entering number of points
dist_fixed - switches to fixed distance mode between points
dist_flex - switches to calculated distance mode between points (opposite to dist_fixed)
distance - for Fixed Points Distance mode, initiates entering distance between points
fit - for fixed distance mode, ensures that all point are within the line defined by start and end point. Option for number of points is ignored.
nofit - for fixed distance mode, indicates creation of point according to distance between points and number of points starting from start point of line. Endpoint of line is used for specifying line direction only.
edges - initiates entering edge points mode. Command values for corners are: none, both, start, end. There is also shortcuts for edge points mode, single commands as edge_none, edge_both, edge_start, edge_end
Depends on state of the action.
This action draws a set of line segments (similar to standard draw line action). The major intent of this action - simpler usage via command widget, as well as support of fixed angle direction. Action is the most suitable for drawing the set of horizontal/vertical lines, as it automatically switch direction mode.
Rectangle is drawn using active pen and layer.
Also, it's possible to close line, create polyline and perform undo/redo operations via options buttons.
No support
Action is fully scriptable and operations may be performed via command widget only.
sline or sli or sl
Position for start point of line and end point of line segment may be entered as coordinates.
The following commands are supported:
x - fixes direction of line to horizontal and ask for entering segment length
y - fixes direction of line to vertical and ask for entering segment length
p - switches line to free direction (point) as it is supported by default line drawing action. Default directions mode
angle - initiates entering of line angle
anglerel - specifies that relative angle should be used
close - closes the line if possible (by connecting enpoint of last segment and start point of first segment)
undo - perform undo operation and removes last segment
redo - performs re-do operation if possible
start - switches action to setting new start point of line segment
polylineor pl - creates polyline
Depends on state of the action.
This action is actually the same as Snake Line, except that it starts new segment series with X-mode enabled by default, so it is convenient for drawing horizontal lines.
slinex or slix or slx
This action is actually the same as Snake Line, except that it starts new segment series with Y-mode enabled by default, so it is convenient for drawing vertical lines.
sliney or sliy or sly
This action draws a line that is directed by specific angle to selected line. In general, it is similar to Relative Angle action, however:
Line is drawn using active pen and layer.
No support
Action is not scriptable, as it requires selection of base line by mouse.
angleline or aline
No additional commands are supportes.
Uses alternative mirrored angle (180-angle) instead of specified one.
This action is actually the same as Angle From Line, except that angle is fixed and is 90 degrees so it is convenient for creation of perpendicular lines.
ortline or oline
This action draws a line from selected point to specified target line, with possibility to specify the angle of intersection of base line and created line.
Line is drawn using active pen and layer.
No support
Action is not scriptable, as it requires selection of target line by mouse.
point2line or p2l
No additional commands are supported.
Uses alternative mirrored angle (180-angle) instead of specified one (for non-orthogonal mode).
This is combined action, that allows to draw specified number of tick lines along selected target line using specified length and angle to target line, and also optionally divides target line by points of ticks intersections. If tick length is set to 0, may just divide target line to the set of line segments.
In general, this action may be also used as a replacement to "Divide" plugin.
Tick lines ares drawn using active pen and layer, if entity is divided - original attributes are used for created segments.
No support
Action is not scriptable, as it requires selection of target entity by mouse.
slicel or sll
No additional commands are supported.
Uses alternative mirrored angle (180-angle) for tick lines instead of specified one.
The action is similar to Slice/Divide Line action, yet instead of line it operates with circles and arcs. This is combined action, that allows to draw specified number of tick lines along selected target circle or arc using specified length and angle to entity, and also optionally divides target line by points of ticks intersections. If tick length is set to 0, may just divide target sentity to the set of arc segments.
Line is drawn using active pen and layer.
No support
Action is not scriptable, as it requires selection of target entity by mouse.
slicec or slc
No additional commands are supported.
Uses alternative mirrored angle (180-angle) for tick lines instead of specified one.
Simple action that creates circle based on selected arc entity (or ellipse by ellipse arc). Center of circle is the same as center of arc, radius of created circle may be either the same of with specified offset to arc's radius. Also, it is possible to specify:
If there are selected entities on action's invocation, for arcs creates circles based on previously saved settings.
Action is not scriptable, as it requires selection of target arc by mouse.
circlebyarc or cba
No additional commands are supported.
No support
Creates duplicate of entity with optional offset and possibility to specify which layer and pen should be applied. Action may be considered as a kind of shortcut for copying via "Move/Copy" action.
If there are selected entities on actions' invocation, duplicates for them will be created based on previously specified settings.
Action is not scriptable, as it requires selection of source entities by mouse.
duplicate or dup
No additional commands are supported.
No support
Joins to selected line to their intersection point. Based on options, action may
For lines that lies on the same ray, it is possible to merge them into one line.
No support
Action is not scriptable, as it requires selection of source entities by mouse.
linejoin or lj
No additional commands are supported.
No support
Action allows to break or divide selected line, arc or circle to segments based on intersection points with another entities.
No support
Action is not scriptable, as it requires selection of source entities by mouse.
breakdivide or bd
No additional commands are supported.
No support
Action creates gap in specified line.
No support
Action is not scriptable, as it requires selection of line by mouse.
gapline or gl
No additional commands are supported.
If Line Snap is not Free, mirrors edges of line (i.e setting for start edge of line are applied to end edge, and vise versa).
There is convenient base classes with predefined lifecycles and utility methods:
Also, a couple of convenient utility functions were added:
Video for settings is there: https://youtu.be/_f-mgKy449c
There are several issues that might be discussed and implemented:
Such approach does not rely on static fields, as action creates and holds the reference to options widget. Examples - actions within pull request.
In general, there is support for relative zero point in command (via shortcut and relative coordinates settings).
However, it is not possible to snap to relative zero point using mouse (say, use existing relative zero as starting point for line etc.)
New actions (where practical) lets the user start the action with relative zero point as initial point (if SHIFT is pressed during mouse move) event.
Adding such functionality to existing actions may deliver better user experience and be convenient for the user.