Add a shortcut for drawing construction line segments.

Almost all construction requests are lines, and allowing to
draw them as construction obviates the need to select them one
by one afterwards to convert them. Also, it removes the "not closed
contour" error message, which is a nice usability improvement.
This commit is contained in:
whitequark 2015-07-06 05:45:28 +03:00
parent e40929afca
commit 8c2e94a01a
3 changed files with 6 additions and 0 deletions

View File

@ -113,6 +113,7 @@ const GraphicsWindow::MenuEntry GraphicsWindow::menu[] = {
{ 1, "&Workplane", MNU_WORKPLANE, 0, IN, mReq },
{ 1, NULL, 0, 0, IN, NULL },
{ 1, "Line &Segment", MNU_LINE_SEGMENT, 'S', IN, mReq },
{ 1, "C&onstruction Line Segment", MNU_CONSTR_SEGMENT, S|'S', IN, mReq },
{ 1, "&Rectangle", MNU_RECTANGLE, 'R', IN, mReq },
{ 1, "&Circle", MNU_CIRCLE, 'C', IN, mReq },
{ 1, "&Arc of a Circle", MNU_ARC, 'A', IN, mReq },
@ -954,6 +955,7 @@ void GraphicsWindow::MenuRequest(int id) {
case MNU_ARC: s = "click point on arc (draws anti-clockwise)"; goto c;
case MNU_DATUM_POINT: s = "click to place datum point"; goto c;
case MNU_LINE_SEGMENT: s = "click first point of line segment"; goto c;
case MNU_CONSTR_SEGMENT: s = "click first point of construction line segment"; goto c;
case MNU_CUBIC: s = "click first point of cubic segment"; goto c;
case MNU_CIRCLE: s = "click center of circle"; goto c;
case MNU_WORKPLANE: s = "click origin of workplane"; goto c;

View File

@ -808,7 +808,9 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) {
break;
case MNU_LINE_SEGMENT:
case MNU_CONSTR_SEGMENT:
hr = AddRequest(Request::LINE_SEGMENT);
SK.GetRequest(hr)->construction = (pending.operation == MNU_CONSTR_SEGMENT);
SK.GetEntity(hr.entity(1))->PointForceTo(v);
ConstrainPointByHovered(hr.entity(1));
@ -1051,6 +1053,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) {
// Create a new line segment, so that we continue drawing.
hRequest hr = AddRequest(Request::LINE_SEGMENT);
SK.GetRequest(hr)->construction = SK.GetRequest(pending.request)->construction;
SK.GetEntity(hr.entity(1))->PointForceTo(v);
// Displace the second point of the new line segment slightly,
// to avoid creating zero-length edge warnings.

View File

@ -377,6 +377,7 @@ public:
MNU_DATUM_POINT,
MNU_WORKPLANE,
MNU_LINE_SEGMENT,
MNU_CONSTR_SEGMENT,
MNU_CIRCLE,
MNU_ARC,
MNU_RECTANGLE,