Implement Analyze → Measure Perimeter.
parent
9a1ceaa5c8
commit
ff23a4a471
|
@ -8,6 +8,10 @@ New export/import features:
|
||||||
* Three.js: allow configuring projection for exported model, and initially
|
* Three.js: allow configuring projection for exported model, and initially
|
||||||
use the current viewport projection.
|
use the current viewport projection.
|
||||||
|
|
||||||
|
Other new features:
|
||||||
|
* New command for measuring total length of selected entities,
|
||||||
|
"Analyze → Measure Perimeter".
|
||||||
|
|
||||||
2.2
|
2.2
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,8 @@ const GraphicsWindow::MenuEntry GraphicsWindow::menu[] = {
|
||||||
|
|
||||||
{ 0, "&Analyze", Command::NONE, 0, TN, NULL },
|
{ 0, "&Analyze", Command::NONE, 0, TN, NULL },
|
||||||
{ 1, "Measure &Volume", Command::VOLUME, C|S|'V', TN, mAna },
|
{ 1, "Measure &Volume", Command::VOLUME, C|S|'V', TN, mAna },
|
||||||
{ 1, "Measure &Area", Command::AREA, C|S|'A', TN, mAna },
|
{ 1, "Measure A&rea", Command::AREA, C|S|'A', TN, mAna },
|
||||||
|
{ 1, "Measure &Perimeter", Command::PERIMETER, C|S|'P', TN, mAna },
|
||||||
{ 1, "Show &Interfering Parts", Command::INTERFERENCE, C|S|'I', TN, mAna },
|
{ 1, "Show &Interfering Parts", Command::INTERFERENCE, C|S|'I', TN, mAna },
|
||||||
{ 1, "Show &Naked Edges", Command::NAKED_EDGES, C|S|'N', TN, mAna },
|
{ 1, "Show &Naked Edges", Command::NAKED_EDGES, C|S|'N', TN, mAna },
|
||||||
{ 1, NULL, Command::NONE, 0, TN, NULL },
|
{ 1, NULL, Command::NONE, 0, TN, NULL },
|
||||||
|
|
|
@ -749,6 +749,30 @@ void SolveSpaceUI::MenuAnalyze(Command id) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case Command::PERIMETER: {
|
||||||
|
if(gs.n > 0 && gs.n == gs.entities) {
|
||||||
|
double perimeter = 0.0;
|
||||||
|
for(int i = 0; i < gs.entities; i++) {
|
||||||
|
Entity *e = SK.entity.FindById(gs.entity[i]);
|
||||||
|
SEdgeList *el = e->GetOrGenerateEdges();
|
||||||
|
for(const SEdge &e : el->l) {
|
||||||
|
perimeter += e.b.Minus(e.a).Magnitude();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double scale = SS.MmPerUnit();
|
||||||
|
Message("The total length of the selected entities is:\n\n"
|
||||||
|
" %.3f %s\n\n"
|
||||||
|
"Curves have been approximated as piecewise linear.\n"
|
||||||
|
"This introduces error, typically of around 1%%.",
|
||||||
|
perimeter / scale,
|
||||||
|
SS.UnitName());
|
||||||
|
} else {
|
||||||
|
Error("Bad selection for perimeter; select line segments, arcs, and curves.");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case Command::SHOW_DOF:
|
case Command::SHOW_DOF:
|
||||||
// This works like a normal solve, except that it calculates
|
// This works like a normal solve, except that it calculates
|
||||||
// which variables are free/bound at the same time.
|
// which variables are free/bound at the same time.
|
||||||
|
|
Loading…
Reference in New Issue