Allow copying and pasting of datum points.

pull/168/head
EvilSpirit 2016-11-22 00:05:43 +07:00 committed by whitequark
parent 12a1a35784
commit 5c34b3f6ef
2 changed files with 26 additions and 12 deletions

View File

@ -14,16 +14,13 @@ New sketch features:
constraining the width of text. constraining the width of text.
* Irrelevant points (e.g. arc center point) are not counted when estimating * Irrelevant points (e.g. arc center point) are not counted when estimating
the bounding box used to compute chord tolerance. the bounding box used to compute chord tolerance.
* When clicking on an entity that shares a place with other entities,
the entity from the current group is selected.
* When dragging an entity that shares a place with other entities,
the entity from a request is selected. For example, dragging a point on
a face of an extrusion coincident with the source sketch plane will
drag the point from the source sketch.
* When dragging an arc or rectangle point, it will be automatically
constrained to other points with a click.
* When adding a constraint which has a label and is redundant with another * When adding a constraint which has a label and is redundant with another
constraint, the constraint is added as a reference, avoiding an error. constraint, the constraint is added as a reference, avoiding an error.
* Datum points can be copied and pasted.
New constraint features:
* When dragging an arc or rectangle point, it will be automatically
constrained to other points with a click.
New export/import features: New export/import features:
* Three.js: allow configuring projection for exported model, and initially * Three.js: allow configuring projection for exported model, and initially
@ -47,6 +44,12 @@ Other new features:
* When zooming to fit, constraints are also considered. * When zooming to fit, constraints are also considered.
* When selecting a point and a line, projected distance to to current * When selecting a point and a line, projected distance to to current
workplane is displayed. workplane is displayed.
* When clicking on an entity that shares a place with other entities,
the entity from the current group is selected.
* When dragging an entity that shares a place with other entities,
the entity from a request is selected. For example, dragging a point on
a face of an extrusion coincident with the source sketch plane will
drag the point from the source sketch.
* In expressions, numbers can contain the digit group separator, "_". * In expressions, numbers can contain the digit group separator, "_".
* The "=" key is bound to "Zoom In", like "+" key. * The "=" key is bound to "Zoom In", like "+" key.
* The numpad decimal separator key is bound to "." regardless of locale. * The numpad decimal separator key is bound to "." regardless of locale.

View File

@ -90,7 +90,11 @@ void GraphicsWindow::CopySelection() {
if(!EntReqTable::GetEntityInfo(e->type, e->extraPoints, if(!EntReqTable::GetEntityInfo(e->type, e->extraPoints,
&req, &pts, NULL, &hasDistance)) &req, &pts, NULL, &hasDistance))
{ {
continue; if(!e->h.isFromRequest()) continue;
Request *r = SK.GetRequest(e->h.request());
if(r->type != Request::Type::DATUM_POINT) continue;
EntReqTable::GetEntityInfo((Entity::Type)0, e->extraPoints,
&req, &pts, NULL, &hasDistance);
} }
if(req == Request::Type::WORKPLANE) continue; if(req == Request::Type::WORKPLANE) continue;
@ -102,7 +106,12 @@ void GraphicsWindow::CopySelection() {
cr.font = e->font; cr.font = e->font;
cr.construction = e->construction; cr.construction = e->construction;
{for(int i = 0; i < pts; i++) { {for(int i = 0; i < pts; i++) {
Vector pt = SK.GetEntity(e->point[i])->PointGetNum(); Vector pt;
if(req == Request::Type::DATUM_POINT) {
pt = e->PointGetNum();
} else {
pt = SK.GetEntity(e->point[i])->PointGetNum();
}
pt = pt.Minus(p); pt = pt.Minus(p);
pt = pt.DotInToCsys(u, v, n); pt = pt.DotInToCsys(u, v, n);
cr.point[i] = pt; cr.point[i] = pt;
@ -182,7 +191,8 @@ void GraphicsWindow::PasteClipboard(Vector trans, double theta, double scale) {
pt = pt.Plus(p); pt = pt.Plus(p);
pt = pt.RotatedAbout(n, theta); pt = pt.RotatedAbout(n, theta);
pt = pt.Plus(trans); pt = pt.Plus(trans);
SK.GetEntity(hr.entity(i+1))->PointForceTo(pt); int j = (r->type == Request::Type::DATUM_POINT) ? i : i + 1;
SK.GetEntity(hr.entity(j))->PointForceTo(pt);
} }
if(hasDistance) { if(hasDistance) {
SK.GetEntity(hr.entity(64))->DistanceForceTo( SK.GetEntity(hr.entity(64))->DistanceForceTo(
@ -192,7 +202,8 @@ void GraphicsWindow::PasteClipboard(Vector trans, double theta, double scale) {
cr->newReq = hr; cr->newReq = hr;
MakeSelected(hr.entity(0)); MakeSelected(hr.entity(0));
for(i = 0; i < pts; i++) { for(i = 0; i < pts; i++) {
MakeSelected(hr.entity(i+1)); int j = (r->type == Request::Type::DATUM_POINT) ? i : i + 1;
MakeSelected(hr.entity(j));
} }
} }