Add "lock point where dragged" constraint, in either 2d or 3d.
And call the cubic things splines, not segments, since that's what they are now. [git-p4: depot-paths = "//depot/solvespace/": change = 2135]solver
parent
ef7f6c6057
commit
4628048d45
|
@ -36,6 +36,7 @@ char *Constraint::DescriptionString(void) {
|
||||||
case EQUAL_RADIUS: s = "eq-radius"; break;
|
case EQUAL_RADIUS: s = "eq-radius"; break;
|
||||||
case EQUAL_ANGLE: s = "eq-angle"; break;
|
case EQUAL_ANGLE: s = "eq-angle"; break;
|
||||||
case EQUAL_LINE_ARC_LEN:s = "eq-line-len-arc-len"; break;
|
case EQUAL_LINE_ARC_LEN:s = "eq-line-len-arc-len"; break;
|
||||||
|
case WHERE_DRAGGED: s = "lock-where-dragged"; break;
|
||||||
case COMMENT: s = "comment"; break;
|
case COMMENT: s = "comment"; break;
|
||||||
default: s = "???"; break;
|
default: s = "???"; break;
|
||||||
}
|
}
|
||||||
|
@ -646,6 +647,19 @@ void Constraint::MenuConstrain(int id) {
|
||||||
AddConstraint(&c);
|
AddConstraint(&c);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GraphicsWindow::MNU_WHERE_DRAGGED:
|
||||||
|
if(gs.points == 1 && gs.n == 1) {
|
||||||
|
c.type = WHERE_DRAGGED;
|
||||||
|
c.ptA = gs.point[0];
|
||||||
|
} else {
|
||||||
|
Error("Bad selection for lock point where dragged constraint. "
|
||||||
|
"This constraint can apply to:\n\n"
|
||||||
|
" * a point\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
AddConstraint(&c);
|
||||||
|
break;
|
||||||
|
|
||||||
case GraphicsWindow::MNU_COMMENT:
|
case GraphicsWindow::MNU_COMMENT:
|
||||||
SS.GW.pending.operation = GraphicsWindow::MNU_COMMENT;
|
SS.GW.pending.operation = GraphicsWindow::MNU_COMMENT;
|
||||||
SS.GW.pending.description = "click center of comment text";
|
SS.GW.pending.description = "click center of comment text";
|
||||||
|
|
|
@ -690,6 +690,24 @@ void ConstraintBase::GenerateReal(IdList<Equation,hEquation> *l) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case WHERE_DRAGGED: {
|
||||||
|
EntityBase *ep = SK.GetEntity(ptA);
|
||||||
|
if(workplane.v == EntityBase::FREE_IN_3D.v) {
|
||||||
|
ExprVector ev = ep->PointGetExprs();
|
||||||
|
Vector v = ep->PointGetNum();
|
||||||
|
|
||||||
|
AddEq(l, ev.x->Minus(Expr::From(v.x)), 0);
|
||||||
|
AddEq(l, ev.y->Minus(Expr::From(v.y)), 1);
|
||||||
|
AddEq(l, ev.z->Minus(Expr::From(v.z)), 2);
|
||||||
|
} else {
|
||||||
|
Expr *u, *v;
|
||||||
|
ep->PointGetExprsInWorkplane(workplane, &u, &v);
|
||||||
|
AddEq(l, u->Minus(Expr::From(u->Eval())), 0);
|
||||||
|
AddEq(l, v->Minus(Expr::From(v->Eval())), 1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case COMMENT:
|
case COMMENT:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -284,10 +284,13 @@ void TextWindow::DescribeSelection(void) {
|
||||||
Printf(true, " distance = %Fi%s", SS.MmToString(d));
|
Printf(true, " distance = %Fi%s", SS.MmToString(d));
|
||||||
}
|
}
|
||||||
} else if(gs.n == 0 && gs.stylables > 0) {
|
} else if(gs.n == 0 && gs.stylables > 0) {
|
||||||
Printf(true, "%FtSELECTED:%E comment text");
|
Printf(false, "%FtSELECTED:%E comment text");
|
||||||
|
} else if(gs.n == 0 && gs.constraints == 1) {
|
||||||
|
Printf(false, "%FtSELECTED:%E %s",
|
||||||
|
SK.GetConstraint(gs.constraint[0])->DescriptionString());
|
||||||
} else {
|
} else {
|
||||||
int n = SS.GW.selection.n;
|
int n = SS.GW.selection.n;
|
||||||
Printf(true, "%FtSELECTED:%E %d item%s", n, n == 1 ? "" : "s");
|
Printf(false, "%FtSELECTED:%E %d item%s", n, n == 1 ? "" : "s");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(shown.screen == SCREEN_STYLE_INFO &&
|
if(shown.screen == SCREEN_STYLE_INFO &&
|
||||||
|
|
|
@ -601,6 +601,25 @@ void Constraint::DrawOrGetDistance(Vector *labelPos) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case WHERE_DRAGGED: {
|
||||||
|
Vector p = SK.GetEntity(ptA)->PointGetNum(),
|
||||||
|
u = p.Plus(gu.WithMagnitude(8/SS.GW.scale)).Plus(
|
||||||
|
gr.WithMagnitude(8/SS.GW.scale)),
|
||||||
|
uu = u.Minus(gu.WithMagnitude(5/SS.GW.scale)),
|
||||||
|
ur = u.Minus(gr.WithMagnitude(5/SS.GW.scale));
|
||||||
|
// Draw four little crop marks, uniformly spaced (by ninety
|
||||||
|
// degree rotations) around the point.
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < 4; i++) {
|
||||||
|
LineDrawOrGetDistance(u, uu);
|
||||||
|
LineDrawOrGetDistance(u, ur);
|
||||||
|
u = u.RotatedAbout(p, gn, PI/2);
|
||||||
|
ur = ur.RotatedAbout(p, gn, PI/2);
|
||||||
|
uu = uu.RotatedAbout(p, gn, PI/2);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case SAME_ORIENTATION: {
|
case SAME_ORIENTATION: {
|
||||||
for(int i = 0; i < 2; i++) {
|
for(int i = 0; i < 2; i++) {
|
||||||
Entity *e = SK.GetEntity(i == 0 ? entityA : entityB);
|
Entity *e = SK.GetEntity(i == 0 ? entityA : entityB);
|
||||||
|
|
|
@ -92,7 +92,7 @@ const GraphicsWindow::MenuEntry GraphicsWindow::menu[] = {
|
||||||
{ 1, "&Rectangle\tR", MNU_RECTANGLE, 'R', mReq },
|
{ 1, "&Rectangle\tR", MNU_RECTANGLE, 'R', mReq },
|
||||||
{ 1, "&Circle\tC", MNU_CIRCLE, 'C', mReq },
|
{ 1, "&Circle\tC", MNU_CIRCLE, 'C', mReq },
|
||||||
{ 1, "&Arc of a Circle\tA", MNU_ARC, 'A', mReq },
|
{ 1, "&Arc of a Circle\tA", MNU_ARC, 'A', mReq },
|
||||||
{ 1, "&Bezier Cubic Segment\tB", MNU_CUBIC, 'B', mReq },
|
{ 1, "&Bezier Cubic Spline\tB", MNU_CUBIC, 'B', mReq },
|
||||||
{ 1, NULL, 0, NULL },
|
{ 1, NULL, 0, NULL },
|
||||||
{ 1, "&Text in TrueType Font\tT", MNU_TTF_TEXT, 'T', mReq },
|
{ 1, "&Text in TrueType Font\tT", MNU_TTF_TEXT, 'T', mReq },
|
||||||
{ 1, NULL, 0, NULL },
|
{ 1, NULL, 0, NULL },
|
||||||
|
@ -116,6 +116,7 @@ const GraphicsWindow::MenuEntry GraphicsWindow::menu[] = {
|
||||||
{ 1, "Para&llel / Tangent\tL", MNU_PARALLEL, 'L', mCon },
|
{ 1, "Para&llel / Tangent\tL", MNU_PARALLEL, 'L', mCon },
|
||||||
{ 1, "&Perpendicular\t[", MNU_PERPENDICULAR, '[', mCon },
|
{ 1, "&Perpendicular\t[", MNU_PERPENDICULAR, '[', mCon },
|
||||||
{ 1, "Same Orient&ation\tX", MNU_ORIENTED_SAME, 'X', mCon },
|
{ 1, "Same Orient&ation\tX", MNU_ORIENTED_SAME, 'X', mCon },
|
||||||
|
{ 1, "Lock Point Where &Dragged\t]", MNU_WHERE_DRAGGED, ']', mCon },
|
||||||
{ 1, NULL, 0, NULL },
|
{ 1, NULL, 0, NULL },
|
||||||
{ 1, "Comment\t;", MNU_COMMENT, ';', mCon },
|
{ 1, "Comment\t;", MNU_COMMENT, ';', mCon },
|
||||||
|
|
||||||
|
|
1
sketch.h
1
sketch.h
|
@ -545,6 +545,7 @@ public:
|
||||||
static const int ARC_LINE_TANGENT = 123;
|
static const int ARC_LINE_TANGENT = 123;
|
||||||
static const int CUBIC_LINE_TANGENT = 124;
|
static const int CUBIC_LINE_TANGENT = 124;
|
||||||
static const int EQUAL_RADIUS = 130;
|
static const int EQUAL_RADIUS = 130;
|
||||||
|
static const int WHERE_DRAGGED = 200;
|
||||||
|
|
||||||
static const int COMMENT = 1000;
|
static const int COMMENT = 1000;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ static const struct {
|
||||||
{ Icon_rectangle, GraphicsWindow::MNU_RECTANGLE, "Sketch rectangle" },
|
{ Icon_rectangle, GraphicsWindow::MNU_RECTANGLE, "Sketch rectangle" },
|
||||||
{ Icon_circle, GraphicsWindow::MNU_CIRCLE, "Sketch circle" },
|
{ Icon_circle, GraphicsWindow::MNU_CIRCLE, "Sketch circle" },
|
||||||
{ Icon_arc, GraphicsWindow::MNU_ARC, "Sketch arc, or tangent arc at selected point" },
|
{ Icon_arc, GraphicsWindow::MNU_ARC, "Sketch arc, or tangent arc at selected point" },
|
||||||
{ Icon_bezier, GraphicsWindow::MNU_CUBIC, "Sketch cubic Bezier section" },
|
{ Icon_bezier, GraphicsWindow::MNU_CUBIC, "Sketch cubic Bezier spline" },
|
||||||
{ Icon_point, GraphicsWindow::MNU_DATUM_POINT, "Sketch datum point" },
|
{ Icon_point, GraphicsWindow::MNU_DATUM_POINT, "Sketch datum point" },
|
||||||
{ Icon_construction, GraphicsWindow::MNU_CONSTRUCTION, "Toggle construction" },
|
{ Icon_construction, GraphicsWindow::MNU_CONSTRUCTION, "Toggle construction" },
|
||||||
{ Icon_trim, GraphicsWindow::MNU_SPLIT_CURVES, "Split lines / curves where they intersect" },
|
{ Icon_trim, GraphicsWindow::MNU_SPLIT_CURVES, "Split lines / curves where they intersect" },
|
||||||
|
|
1
ui.h
1
ui.h
|
@ -363,6 +363,7 @@ public:
|
||||||
MNU_PARALLEL,
|
MNU_PARALLEL,
|
||||||
MNU_PERPENDICULAR,
|
MNU_PERPENDICULAR,
|
||||||
MNU_ORIENTED_SAME,
|
MNU_ORIENTED_SAME,
|
||||||
|
MNU_WHERE_DRAGGED,
|
||||||
MNU_COMMENT,
|
MNU_COMMENT,
|
||||||
// Analyze
|
// Analyze
|
||||||
MNU_VOLUME,
|
MNU_VOLUME,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
add checked/unchecked checkbox and radio button
|
add checked/unchecked checkbox and radio button
|
||||||
fix bug with rotation in plane where green line stays displayed
|
fix bug with rotation in plane where green line stays displayed
|
||||||
lock point where dragged constraint
|
expose transformed point stuff in library
|
||||||
expose transformed point stuff in library, and email McNeel
|
|
||||||
|
|
||||||
-----
|
-----
|
||||||
rounding, as a special group
|
rounding, as a special group
|
||||||
|
|
Loading…
Reference in New Issue