diff --git a/src/Mod/TechDraw/CMakeLists.txt b/src/Mod/TechDraw/CMakeLists.txt
index c1309e731f..1678c83be8 100644
--- a/src/Mod/TechDraw/CMakeLists.txt
+++ b/src/Mod/TechDraw/CMakeLists.txt
@@ -20,6 +20,7 @@ set(TechDraw_ToolsScripts
TechDrawTools/__init__.py
TechDrawTools/CommandMoveView.py
TechDrawTools/CommandShareView.py
+ TechDrawTools/CommandAxoLengthDimension.py
TechDrawTools/TaskMoveView.py
TechDrawTools/TaskShareView.py
TechDrawTools/TDToolsUtil.py
diff --git a/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc b/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc
index 366dd40768..b142946ba5 100644
--- a/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc
+++ b/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc
@@ -28,6 +28,7 @@
icons/actions/TechDraw_Line2Points.svgicons/actions/TechDraw_Midpoints.svgicons/actions/TechDraw_MoveView.svg
+ icons/actions/TechDraw_AxoLengthDimension.svgicons/actions/TechDraw_Multiview.svgicons/actions/TechDraw_PageDefault.svgicons/actions/TechDraw_PageTemplate.svg
diff --git a/src/Mod/TechDraw/Gui/Resources/icons/actions/TechDraw_AxoLengthDimension.svg b/src/Mod/TechDraw/Gui/Resources/icons/actions/TechDraw_AxoLengthDimension.svg
new file mode 100644
index 0000000000..4beb683668
--- /dev/null
+++ b/src/Mod/TechDraw/Gui/Resources/icons/actions/TechDraw_AxoLengthDimension.svg
@@ -0,0 +1,259 @@
+
+
diff --git a/src/Mod/TechDraw/Gui/Workbench.cpp b/src/Mod/TechDraw/Gui/Workbench.cpp
index f1e4cd3c2e..9ba7b30a03 100644
--- a/src/Mod/TechDraw/Gui/Workbench.cpp
+++ b/src/Mod/TechDraw/Gui/Workbench.cpp
@@ -152,6 +152,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const
*annotations << "TechDraw_Annotation";
*annotations << "TechDraw_RichTextAnnotation";
*annotations << "TechDraw_Balloon";
+ *annotations << "TechDraw_AxoLengthDimension";
// stacking
Gui::MenuItem* stacking = new Gui::MenuItem;
@@ -280,6 +281,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
// *dims << "TechDraw_VerticalExtentDimension";
*dims << "TechDraw_LinkDimension";
*dims << "TechDraw_Balloon";
+ *dims << "TechDraw_AxoLengthDimension";
*dims << "TechDraw_LandmarkDimension";
// *dims << "TechDraw_Dimension"
*dims << "TechDraw_DimensionRepair";
@@ -428,6 +430,7 @@ Gui::ToolBarItem* Workbench::setupCommandBars() const
// *dims << "TechDraw_VerticalExtentDimension";
*dims << "TechDraw_LinkDimension";
*dims << "TechDraw_Balloon";
+ *dims << "TechDraw_AxoLengthDimension";
*dims << "TechDraw_LandmarkDimension";
// *dims << "TechDraw_Dimension";
*dims << "TechDraw_DimensionRepair";
diff --git a/src/Mod/TechDraw/TechDrawTools/CommandAxoLengthDimension.py b/src/Mod/TechDraw/TechDrawTools/CommandAxoLengthDimension.py
new file mode 100644
index 0000000000..75f52c167a
--- /dev/null
+++ b/src/Mod/TechDraw/TechDrawTools/CommandAxoLengthDimension.py
@@ -0,0 +1,124 @@
+# ***************************************************************************
+# * Copyright (c) 2023 edi *
+# * *
+# * This program is free software; you can redistribute it and/or modify *
+# * it under the terms of the GNU Lesser General Public License (LGPL) *
+# * as published by the Free Software Foundation; either version 2 of *
+# * the License, or (at your option) any later version. *
+# * for detail see the LICENCE text file. *
+# * *
+# * This program is distributed in the hope that it will be useful, *
+# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+# * GNU Library General Public License for more details. *
+# * *
+# * You should have received a copy of the GNU Library General Public *
+# * License along with this program; if not, write to the Free Software *
+# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
+# * USA *
+# * *
+# ***************************************************************************
+"""Provides the TechDraw AxoLengthDimension GuiCommand."""
+
+__title__ = "TechDrawTools.CommandAxoLengthDimension"
+__author__ = "edi"
+__url__ = "https://www.freecadweb.org"
+__version__ = "00.01"
+__date__ = "2023/02/01"
+
+from PySide.QtCore import QT_TRANSLATE_NOOP
+
+import FreeCAD as App
+import FreeCADGui as Gui
+
+import TechDrawTools
+
+import TechDraw
+from math import degrees
+
+class CommandAxoLengthDimension:
+ """Creates a 3D length dimension."""
+
+ def __init__(self):
+ """Initialize variables for the command that must exist at all times."""
+ pass
+
+ def GetResources(self):
+ """Return a dictionary with data that will be used by the button or menu item."""
+ return {'Pixmap': 'actions/TechDraw_AxoLengthDimension.svg',
+ 'Accel': "",
+ 'MenuText': QT_TRANSLATE_NOOP("TechDraw_AxoLengthDimension", "Axonometric length dimension"),
+ 'ToolTip': QT_TRANSLATE_NOOP("TechDraw_AxoLengthDimension", "Create an axonometric length dimension \
+ - select first edge to define direction and length of the dimension line \
+ - select second edge to define the direction of the extension lines \
+ - optional: select two more vertexes which define the measurement instead of the length \
+ of the first selected edge")}
+
+ def Activated(self):
+ """Run the following code when the command is activated (button press)."""
+ if self.selectionTest():
+ (edges,vertexes) = self.selectionTest()
+ view = Gui.Selection.getSelection()[0]
+ StartPt, EndPt = edges[1].Vertexes[0].Point, edges[1].Vertexes[1].Point
+ extLineVec = EndPt.sub(StartPt)
+ StartPt, EndPt = edges[0].Vertexes[0].Point, edges[0].Vertexes[1].Point
+ dimLineVec = EndPt.sub(StartPt)
+ xAxis = App.Vector(1,0,0)
+ extAngle = degrees(extLineVec.getAngle(xAxis))
+ lineAngle = degrees(dimLineVec.getAngle(xAxis))
+ if extLineVec.y < 0.0:
+ extAngle = 180-extAngle
+ if dimLineVec.y < 0.0:
+ lineAngle = 180-lineAngle
+ if abs(extAngle-lineAngle)>0.1:
+ distanceDim=TechDraw.makeDistanceDim(view,'Distance',vertexes[0].Point,vertexes[1].Point)
+ distanceDim.AngleOverride = True
+ distanceDim.LineAngle = lineAngle
+ distanceDim.ExtensionAngle = extAngle
+ distanceDim.X = (vertexes[0].Point.x+vertexes[1].Point.x)/2
+ distanceDim.Y = (vertexes[0].Point.y+vertexes[1].Point.y)/2
+ distanceDim.recompute()
+ view.requestPaint()
+ Gui.Selection.clearSelection()
+
+ def IsActive(self):
+ """Return True when the command should be active or False when it should be disabled (greyed)."""
+ if App.ActiveDocument:
+ return TechDrawTools.TDToolsUtil.havePage() and TechDrawTools.TDToolsUtil.haveView()
+ else:
+ return False
+
+ def selectionTest(self):
+ '''test correct selection'''
+ if not Gui.Selection.getSelection():
+ return False
+ view = Gui.Selection.getSelection()[0]
+
+ if not Gui.Selection.getSelectionEx():
+ return False
+ objectList = Gui.Selection.getSelectionEx()[0].SubElementNames
+
+ if not len(objectList)>=2:
+ return False
+
+ edges = []
+ vertexes = []
+ for objectString in objectList:
+ if objectString[0:4] == 'Edge':
+ edges.append(view.getEdgeBySelection(objectString))
+ elif objectString[0:6] == 'Vertex':
+ vertexes.append(view.getVertexBySelection(objectString))
+ if not len(edges) >= 2:
+ return False
+
+ if len(vertexes)<2:
+ vertexes = []
+ vertexes.append(edges[0].Vertexes[0])
+ vertexes.append(edges[0].Vertexes[1])
+ return(edges,vertexes)
+
+
+#
+# The command must be "registered" with a unique name by calling its class.
+Gui.addCommand('TechDraw_AxoLengthDimension', CommandAxoLengthDimension())
+
diff --git a/src/Mod/TechDraw/TechDrawTools/__init__.py b/src/Mod/TechDraw/TechDrawTools/__init__.py
index 2f9eabde85..37cabe6849 100644
--- a/src/Mod/TechDraw/TechDrawTools/__init__.py
+++ b/src/Mod/TechDraw/TechDrawTools/__init__.py
@@ -33,5 +33,6 @@ from .TDToolsMovers import *
from .TDToolsUtil import *
from .CommandShareView import CommandShareView
from .CommandMoveView import CommandMoveView
+from .CommandAxoLengthDimension import CommandAxoLengthDimension
from .TaskShareView import TaskShareView
from .TaskMoveView import TaskMoveView