← Back to team overview

kicad-developers team mailing list archive

[PATCH] - Add x/y measurements to PCB ruler tool

 

Most of the time I wish to use the ruler tool to display x/y measurements.

This simple patch displays dx and dy on the ruler tool.
From 8a4f58580530b06d2161218e3e2b33a343e4ff97 Mon Sep 17 00:00:00 2001
From: Oliver <oliver.henry.walters@xxxxxxxxx>
Date: Sat, 25 Aug 2018 21:59:21 +1000
Subject: [PATCH] Add x/y dimensions to PCB ruler

- Display dx and dy in addition to euclidian distance and angle
---
 common/preview_items/ruler_item.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/common/preview_items/ruler_item.cpp b/common/preview_items/ruler_item.cpp
index 2442a17..21c24da 100644
--- a/common/preview_items/ruler_item.cpp
+++ b/common/preview_items/ruler_item.cpp
@@ -45,6 +45,9 @@ static void drawCursorStrings( KIGFX::VIEW* aView, const VECTOR2D& aCursor,
     // draw the cursor labels
     std::vector<wxString> cursorStrings;
 
+    cursorStrings.push_back( DimensionLabel( "x", aRulerVec.x, aUnits ) );
+    cursorStrings.push_back( DimensionLabel( "y", aRulerVec.y, aUnits ) );
+
     cursorStrings.push_back( DimensionLabel( "r", aRulerVec.EuclideanNorm(), aUnits ) );
 
     double degs = RAD2DECIDEG( -aRulerVec.Angle() );
-- 
2.7.4


Follow ups