Dimension angle in home view gives wrong dimension

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
jfc4120
Posts: 448
Joined: Sat Jul 02, 2022 11:16 pm

Dimension angle in home view gives wrong dimension

Post by jfc4120 »

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.20.2.29177 +426 (Git)
Build type: Release
Branch: (HEAD detached from 0.20.2)
Hash: 930dd9a76203a3260b1e6256c70c1c3cad8c5cb8
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.3
Locale: English/United States (en_US)
Installed mods: 
  * Help 1.0.3
In a front or top or side view when you dimension an angle it is correct however in home view it is incorrect.

Just wondering why angle dimensions in home view does not work.

However you can dimension a line and it is correct.

Attached:

Also note that the instructions state you can pick the lines (edges) from the 3d view, and even gives a link describing 3d view here:
https://wiki.freecadweb.org/3D_view

Edit

One work around I did is to get the angle using 3 points:

Code: Select all

import FreeCAD, FreeCADGui
# -*- coding: utf-8 -*-
import FreeCAD, FreeCADGui
import Draft
import math
# from math import cos, sin, radians
from PySide import QtGui

convert = 25.4
TOTAL = 0
getDouble = QtGui.QInputDialog.getDouble
Vector, Placement = App.Vector, App.Placement
doc = App.ActiveDocument

start_point = Vector(0, 0, 0)
selX = FreeCADGui.Selection.getSelectionEx()
PrintMsg = FreeCAD.Console.PrintMessage
PrintMsg("Objects selected:\n")
KOUNT = 0
# added
for sel in selX:
    KOUNT = KOUNT + 1
    v = sel.Object.Shape
    X = v.Point.x * .039370078
    Y = v.Point.y * .039370078
    Z = v.Point.z * .039370078


    if KOUNT == 1:
        multlist = [[X, Y, Z]]
    if KOUNT > 1:
        multlist.append([X, Y, Z])

# added new


p1 = App.Vector(multlist[0][0], multlist[0][1], multlist[0][2])
p2 = App.Vector(multlist[1][0], multlist[1][1], multlist[1][2])
p3 = App.Vector(multlist[2][0], multlist[2][1], multlist[2][2])
#p = App.Vector(multlist[3][0], multlist[3][1], multlist[3][2])
#q = App.Vector(multlist[4][0], multlist[4][1], multlist[4][2])


ang1 = math.degrees((p2 - p1).getAngle(p3 - p1))
print(ang1)
#good ang2 = math.degrees((p3 - p2).getAngle(p1 - p2))
#ang2 = math.degrees((p1 - p2).getAngle(p3 - p2))
#print(ang2)
#ang3 = degrees((p1 - p3).getAngle(p2 - p3))

#The side lengths are:

#Code: Select all

#L12 = (p1 - p2).Length
L12 = (p2 - p1).Length
print(L12)
#L23 = (p2 - p3).Length
#L31 = (p3 - p1).Length

Needs some cleanup. If anyone can do this by just selecting two lines and get the same from a macro, please share.
Attachments
a1.png
a1.png (34.98 KiB) Viewed 2006 times
a2.png
a2.png (38.45 KiB) Viewed 2006 times
a3.png
a3.png (50.56 KiB) Viewed 2006 times
angle_test3.FCStd
(11.42 KiB) Downloaded 31 times
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: Dimension angle in home view gives wrong dimension

Post by Roy_043 »

Confirmed. As already explained in another post: to avoid this you need to correctly align the Draft working plane before creating the dimension. Note that it is not just the default trimetric home view (the home view depends on a user preference: Std_ViewHome) that is affected.

The current behavior is obviously inconsistent and should be improved. If the 3 angle points are not collinear the normal should be derived from those points. The collinear case does require a normal from the working plane.
jfc4120
Posts: 448
Joined: Sat Jul 02, 2022 11:16 pm

Re: Dimension angle in home view gives wrong dimension

Post by jfc4120 »

@Roy_043 okay but the thing I don't understand is if you go to part measure angular then it gives the correct dimension. And this is not part of the other post the other post was using a sketch this question is not using a sketch.

But if part angular measure works seems that draft Dimension should work.

Thanks for answering, as I am sure it is some kind of oversight in the code that hopefully will be fixed.
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: Dimension angle in home view gives wrong dimension

Post by Roy_043 »

Draft does not use code from Part_Measure_Angular.
Post Reply