Skip to content

Commit

Permalink
Merge pull request openscad#4813 from gsohler/measure
Browse files Browse the repository at this point in the history
Adding interactive measurement abilities to OpenSCAD.
  • Loading branch information
t-paul authored Dec 27, 2023
2 parents b1a2adf + eec7b37 commit e2d9a1b
Show file tree
Hide file tree
Showing 24 changed files with 1,404 additions and 14 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,7 @@ set(GUI_SOURCES
src/gui/LaunchingScreen.cc
src/gui/LibraryInfoDialog.cc
src/gui/MainWindow.cc
src/gui/Measurement.cc
src/gui/Animate.cc
src/gui/MouseSelector.cc
src/gui/OctoPrint.cc
Expand Down
4 changes: 4 additions & 0 deletions resources/common.qrc.in
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,9 @@
<file>icons/svg-default/vcr-control-step-forward-white.svg</file>
<file>icons/svg-default/vcr-control-end.svg</file>
<file>icons/svg-default/vcr-control-end-white.svg</file>
<file>icons/svg-default/measure-dist.svg</file>
<file>icons/svg-default/measure-dist-white.svg</file>
<file>icons/svg-default/measure-ang.svg</file>
<file>icons/svg-default/measure-ang-white.svg</file>
</qresource>
</RCC>
37 changes: 37 additions & 0 deletions resources/icons/svg-default/icons.scad
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ icons = [
["vcr-control-pause"],
["vcr-control-step-forward"],
["vcr-control-end"],
["measure-dist"],
["measure-ang"]
];

icon(selected_icon) {
Expand Down Expand Up @@ -121,6 +123,8 @@ icon(selected_icon) {
vcr_control_pause();
vcr_control_step_forward();
vcr_control_end();
measure_dist();
measure_ang();
}

if (list_icons) {
Expand Down Expand Up @@ -733,3 +737,36 @@ module vcr_control_end(){
translate([x, 0]) square([thick, 0.4 * width], center = true);
}
}

module measure_dist(){
x = 0.75 * width /2;
a = width*0.2;
t = thin*0.1;
offset(rounding)
translate([width/2,height/2]){
for(mirr=[1,0,0]) mirror([mirr,0,0]) {
translate([x, 0]) square([t, 0.8 * width], center = true);
polygon([[x-t,-15],[x-a-t,a-15],[x-a-t,-a-15]]);
}
translate([0,-15]) square([2*x, thin], center = true);
}
translate([25,50])
resize([40, 40], true)
text("10", 40, font = export_font);

}

module measure_ang() {
x = 0.75 * width /2;
a = width*0.2;
offset(rounding)
translate([width/2,height/2]){
for(mirr=[1,0,0]) mirror([mirr,0,0]) {
translate([0, -x]) rotate([0,0,45]) square([thin, 0.8 * width/sqrt(2)]);
}
}
translate([width*0.5,width*0.6]) scale(0.7) curved_arrow();
translate([30,30])
resize([40, 40], true)
text("45", 40, font = export_font);
}
278 changes: 278 additions & 0 deletions resources/icons/svg-default/measure-ang-white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
278 changes: 278 additions & 0 deletions resources/icons/svg-default/measure-ang.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions resources/icons/svg-default/measure-dist-white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e2d9a1b

Please sign in to comment.