Skip to content

Commit

Permalink
Allow copying and pasting of datum points.
Browse files Browse the repository at this point in the history
  • Loading branch information
Evil-Spirit authored and whitequark committed Jan 14, 2017
1 parent 12a1a35 commit 5c34b3f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
19 changes: 11 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@ New sketch features:
constraining the width of text.
* Irrelevant points (e.g. arc center point) are not counted when estimating
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
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:
* Three.js: allow configuring projection for exported model, and initially
Expand All @@ -47,6 +44,12 @@ Other new features:
* When zooming to fit, constraints are also considered.
* When selecting a point and a line, projected distance to to current
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, "_".
* The "=" key is bound to "Zoom In", like "+" key.
* The numpad decimal separator key is bound to "." regardless of locale.
Expand Down
19 changes: 15 additions & 4 deletions src/clipboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ void GraphicsWindow::CopySelection() {
if(!EntReqTable::GetEntityInfo(e->type, e->extraPoints,
&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;

Expand All @@ -102,7 +106,12 @@ void GraphicsWindow::CopySelection() {
cr.font = e->font;
cr.construction = e->construction;
{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.DotInToCsys(u, v, n);
cr.point[i] = pt;
Expand Down Expand Up @@ -182,7 +191,8 @@ void GraphicsWindow::PasteClipboard(Vector trans, double theta, double scale) {
pt = pt.Plus(p);
pt = pt.RotatedAbout(n, theta);
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) {
SK.GetEntity(hr.entity(64))->DistanceForceTo(
Expand All @@ -192,7 +202,8 @@ void GraphicsWindow::PasteClipboard(Vector trans, double theta, double scale) {
cr->newReq = hr;
MakeSelected(hr.entity(0));
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));
}
}

Expand Down

0 comments on commit 5c34b3f

Please sign in to comment.