Break Command
Posted: Thu Mar 20, 2014 4:25 pm
I have created a new command to break entities. It is very similar to 'Break out Segment', but instead of automatically selecting the nearest intersections, the command prompts the user to select the object to break, followed by two break points. Because the user selects the points manually, I have called this 'Break out Manual' in the 'Modify' menu, with the shortcut 'B2'.
The points which you select can be anywhere in the drawing. The command projects the points onto the closest point on the selected object, and uses that point as the break point. As you move the cursor around, a temporary line is drawn from the cursor position to the nearest point on the entity. (You can also select points on the entity. The temporary line is drawn using the 'Auxiliary Shapes' colour. You can change this in 'Edit->Application Preferences->Graphics View->Colors'.)
You can break lines, arcs, circles, ellipses or elliptical arcs. If you select another type of objrect, a warning message is shown.
If one breakpoint maps onto an endpoint and the other breakpoint maps to the other endpoint then the whole entity is removed. If both breakpoints map to the same endpoint then nothing is removed. If one breakpoint maps to an endpoint and the other breakpoint maps to a point on the entity then that portion of the entity is removed. If both breakpoints map to the same point on the entity then the entity is divided, but nothing is removed.
For circles and full ellipses, after choosing the two breakpoints you are prompted to select the part of the circle or ellipse, to remove. (This doesn't use the selection point, or direction of circle/ellipse to determine which part to remove.) If both breakpoints map to the same point on a circle, the circle is replaced with an arc, and you are not prompted to remove anything. For ellipses, the ellipse is replaced with another ellipse. When the startpoint and endpoint of an ellipse are the same then QCAD draws an ellipse rather than an elliptical arc.
There is one option in the options toolbar, a checkbox 'Remove segment'. The default is checked. If you uncheck it the part between the breakpoints is not removed, but the entity is divided at the breakpoints.
I have attached the file 'Break.zip', which contains the 'Break' directory. Copy this directory to the 'scripts/modify' directory.
Hope you find this useful.
riverbuoy
The points which you select can be anywhere in the drawing. The command projects the points onto the closest point on the selected object, and uses that point as the break point. As you move the cursor around, a temporary line is drawn from the cursor position to the nearest point on the entity. (You can also select points on the entity. The temporary line is drawn using the 'Auxiliary Shapes' colour. You can change this in 'Edit->Application Preferences->Graphics View->Colors'.)
You can break lines, arcs, circles, ellipses or elliptical arcs. If you select another type of objrect, a warning message is shown.
If one breakpoint maps onto an endpoint and the other breakpoint maps to the other endpoint then the whole entity is removed. If both breakpoints map to the same endpoint then nothing is removed. If one breakpoint maps to an endpoint and the other breakpoint maps to a point on the entity then that portion of the entity is removed. If both breakpoints map to the same point on the entity then the entity is divided, but nothing is removed.
For circles and full ellipses, after choosing the two breakpoints you are prompted to select the part of the circle or ellipse, to remove. (This doesn't use the selection point, or direction of circle/ellipse to determine which part to remove.) If both breakpoints map to the same point on a circle, the circle is replaced with an arc, and you are not prompted to remove anything. For ellipses, the ellipse is replaced with another ellipse. When the startpoint and endpoint of an ellipse are the same then QCAD draws an ellipse rather than an elliptical arc.
There is one option in the options toolbar, a checkbox 'Remove segment'. The default is checked. If you uncheck it the part between the breakpoints is not removed, but the entity is divided at the breakpoints.
I have attached the file 'Break.zip', which contains the 'Break' directory. Copy this directory to the 'scripts/modify' directory.
Hope you find this useful.
riverbuoy