Align working plane to face fails in git build

A forum dedicated to the Draft, Arch and BIM workbenches development.
sanderboer
Posts: 26
Joined: Fri Aug 30, 2019 9:47 am

Align working plane to face fails in git build

Postby sanderboer » Sun Sep 08, 2019 9:20 pm

Hi,

I built today's git tree and this happens when I want to align the working plane to a face :

Code: Select all

Running the Python command 'Draft_SelectPlane' failed:
Traceback (most recent call last):
  File "/opt/freecad-190908/Mod/Draft/DraftSelectPlane.py", line 78, in Activated
    if self.handle():
  File "/opt/freecad-190908/Mod/Draft/DraftSelectPlane.py", line 242, in handle
    FreeCAD.DraftWorkingPlane.alignToFace(sel.SubObjects[0], self.taskd.form.fieldOffset.Value)

'Draft_SelectPlane' object has no attribute 'taskd'
self.handle() is called before self.taskd is declared in Activated()
vocx
Posts: 4599
Joined: Thu Oct 18, 2018 9:18 pm

Re: Align working plane to face fails in git build

Postby vocx » Sun Sep 08, 2019 9:39 pm

sanderboer wrote:
Sun Sep 08, 2019 9:20 pm
Hi,

self.handle() is called before self.taskd is declared in Activated()
This definitely seems like a bug. Recently Yorik moved the Draft SelectPlane code outside the DraftTools.py file, and into its own file. He also placed the graphical interface in a TaskSelectPlane.ui file, instead of hard coding this in DraftGui.py. Maybe he missed a few things.

Give it a few days for him to fix it.
Always add the important information to your posts if you need help.
To support the documentation effort, and code development, your donation is appreciated: paypal.
User avatar
bernd
Posts: 10460
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Align working plane to face fails in git build

Postby bernd » Mon Sep 09, 2019 4:54 am

sanderboer
Posts: 26
Joined: Fri Aug 30, 2019 9:47 am

Re: Align working plane to face fails in git build

Postby sanderboer » Mon Sep 09, 2019 8:36 am

I figured it out,
Cmake does not copy the Resources dir in /src/Mod/Draft/Resources over to the installed directory.
If you do it by hand, the align to face works.
sanderboer
Posts: 26
Joined: Fri Aug 30, 2019 9:47 am

Re: Align working plane to face fails in git build

Postby sanderboer » Mon Sep 09, 2019 1:08 pm

Of course I thought wrong. I tested my August 4th build, this is before the change in ui organisation. However, I cannot grep fieldOffset in Draft_rc.py, seems like something qt-y went wrong in compiling Draft_rc, I think..
hvfrancesco
Posts: 16
Joined: Mon Sep 23, 2019 7:40 am

Re: Align working plane to face fails in git build

Postby hvfrancesco » Tue Sep 24, 2019 8:51 am

A small temporary workaround in the attached patch. not sure it's the right approach to it, but it's usable
Attachments
DraftSelectPlane.patch.txt
(2.23 KiB) Downloaded 16 times
hvfrancesco
Posts: 16
Joined: Mon Sep 23, 2019 7:40 am

Re: Align working plane to face fails in git build

Postby hvfrancesco » Tue Sep 24, 2019 9:38 am

This is a slightly better patch, that works with 3 points plane selection too and preserves the optional offset. It's still probably just a workaround because I suppose Yorik had not finished yet the refactoring, but it seems to work
Attachments
DraftSelectPlane.patch.txt
(3.85 KiB) Downloaded 13 times
User avatar
Roy_043
Posts: 1530
Joined: Thu Dec 27, 2018 12:28 pm

Re: Align working plane to face fails in git build

Postby Roy_043 » Tue Sep 24, 2019 11:23 am

@hvfrancesco:
Can you post the DraftSelectPlane.py file with your modifications? It would be very helpful as this bug is quite problematic for most Arch/BIM workflows.
hvfrancesco
Posts: 16
Joined: Mon Sep 23, 2019 7:40 am

Re: Align working plane to face fails in git build

Postby hvfrancesco » Tue Sep 24, 2019 1:34 pm

Sure, here it is. Let me know if it works for you.
Attachments
DraftSelectPlane.py.txt
(20.59 KiB) Downloaded 18 times
User avatar
bernd
Posts: 10460
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Align working plane to face fails in git build

Postby bernd » Tue Sep 24, 2019 4:02 pm

if it fixes the problem, it would be good to go for a PR on https://github.com/FreeCAD/FreeCAD/pulls