Draft Label bugs in Py3

A forum dedicated to the Draft, Arch and BIM workbenches development.
jmaustpc
Posts: 10562
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Draft Label bugs in Py3

Postby jmaustpc » Sat Apr 20, 2019 1:46 pm

Hi all
Yorik, I've been trying out Draft Label and I've found a few odd things that i wonder if they are Py3 issues.

1) I get a "b" before the value and the value within single inverted commas. For example, something like this b'1000.00mm'. That seems to happen no matter what the value type or even if it is a custom value, both for an attached label or a non-attached label.
2) I tried attaching a label to a default Part Cube with a full selection so it defaulted to volume and worked with the bug above but otherwise as expected, however then I tried doing the same thing but selecting "area" expecting it would give me the surface area of the cube but I got an error in Python and an error mark in treeview on the label icon

Code: Select all

Pick text position:
Traceback (most recent call last):
  File "/usr/share/freecad/Mod/Draft/Draft.py", line 6407, in execute
    if "Face" in obj.Target[1][0]:
<class 'IndexError'>: list index out of range
Traceback (most recent call last):
  File "/usr/share/freecad/Mod/Draft/Draft.py", line 6407, in execute
    if "Face" in obj.Target[1][0]:
<class 'IndexError'>: list index out of range

3) if I toggle to volume it works, but if I toggle back to area it gives the same Python error, puts the error icon in treeview but does actually calculate the correct total surface area.

4) an interesting thing, If you select something like "material" that has an empty value, after a recompute it still shows the last displayed text rather than going blank, also similarly, if you select Position, you get three correct values however if you then change back to something else it only changes the first of those 3 former position values where the new value is displayed, the Y and Z values remain.

This is just a simple file I was playing around with.
draftlabelstestsonacube.FCStd
(5.75 KiB) Downloaded 8 times

I'll write up tickets if you want?

Jim

OS: Ubuntu 18.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.1.
Build type: Release
Python version: 3.6.7
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Australia (en_AU)
User avatar
yorik
Site Admin
Posts: 12148
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels, Belgium
Contact:

Re: Draft Label bugs in Py3

Postby yorik » Mon Apr 22, 2019 2:27 pm

Hmm yes several bugs there, and probably a mix of py3-related and "common" bugs... Yeah, if you could open a bug report and assign it to me, I'd be grateful, as I can't look right now and 'might' forget :?
jmaustpc
Posts: 10562
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Draft Label bugs in Py3

Postby jmaustpc » Mon Apr 22, 2019 3:02 pm

yorik wrote:
Mon Apr 22, 2019 2:27 pm
Hmm yes several bugs there, and probably a mix of py3-related and "common" bugs... Yeah, if you could open a bug report and assign it to me, I'd be grateful, as I can't look right now and 'might' forget :?
no worries! :)

done
issue #3941