Draft Label bugs in Py3

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
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Draft Label bugs in Py3

Post by jmaustpc »

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 16 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
Founder
Posts: 13664
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Draft Label bugs in Py3

Post by yorik »

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
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Draft Label bugs in Py3

Post by jmaustpc »

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
Post Reply