USER FORUM
(you are viewing a thread; or go back to list of threads)
From Edit/Rotate Imported 90 to Mirror about X/Y (by cea)
Hi,
I found this Edit/Rotate Imported 90 command very useful. It is rotate about Z axis. I want to make a Mirror about X/Y axis command. Which Line I should change?
Regards,
Cean
case Command::ROTATE_90: {
SS.GW.GroupSelection();
Entity *e = NULL;
if(SS.GW.gs.n == 1 && SS.GW.gs.points == 1) {
e = SK.GetEntity(SS.GW.gs.point[0]);
} else if(SS.GW.gs.n == 1 && SS.GW.gs.entities == 1) {
e = SK.GetEntity(SS.GW.gs.entity[0]);
}
SS.GW.ClearSelection();
hGroup hg = e ? e->group : SS.GW.activeGroup;
Group *g = SK.GetGroup(hg);
if(g->type != Group::Type::LINKED) {
Error(_("To use this command, select a point or other "
"entity from an linked part, or make a link "
"group the active group."));
break;
}
SS.UndoRemember();
// Rotate by ninety degrees about the coordinate axis closest
// to the screen normal.
Vector norm = SS.GW.projRight.Cross(SS.GW.projUp);
norm = norm.ClosestOrtho();
norm = norm.WithMagnitude(1);
Quaternion qaa = Quaternion::From(norm, PI/2);
g->TransformImportedBy(Vector::From(0, 0, 0), qaa);
// and regenerate as necessary.
SS.MarkGroupDirty(hg);
break;
}
I found this Edit/Rotate Imported 90 command very useful. It is rotate about Z axis. I want to make a Mirror about X/Y axis command. Which Line I should change?
Regards,
Cean
case Command::ROTATE_90: {
SS.GW.GroupSelection();
Entity *e = NULL;
if(SS.GW.gs.n == 1 && SS.GW.gs.points == 1) {
e = SK.GetEntity(SS.GW.gs.point[0]);
} else if(SS.GW.gs.n == 1 && SS.GW.gs.entities == 1) {
e = SK.GetEntity(SS.GW.gs.entity[0]);
}
SS.GW.ClearSelection();
hGroup hg = e ? e->group : SS.GW.activeGroup;
Group *g = SK.GetGroup(hg);
if(g->type != Group::Type::LINKED) {
Error(_("To use this command, select a point or other "
"entity from an linked part, or make a link "
"group the active group."));
break;
}
SS.UndoRemember();
// Rotate by ninety degrees about the coordinate axis closest
// to the screen normal.
Vector norm = SS.GW.projRight.Cross(SS.GW.projUp);
norm = norm.ClosestOrtho();
norm = norm.WithMagnitude(1);
Quaternion qaa = Quaternion::From(norm, PI/2);
g->TransformImportedBy(Vector::From(0, 0, 0), qaa);
// and regenerate as necessary.
SS.MarkGroupDirty(hg);
break;
}
(no subject) (by cean)
(no subject) (by cean)
Post a reply to this comment: