Align working plane to face fails in git build

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
sanderboer
Posts: 26
Joined: Fri Aug 30, 2019 9:47 am

Align working plane to face fails in git build

Post by sanderboer »

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
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Align working plane to face fails in git build

Post by vocx »

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. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Align working plane to face fails in git build

Post by bernd »

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

Re: Align working plane to face fails in git build

Post by sanderboer »

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

Post by sanderboer »

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: 17
Joined: Mon Sep 23, 2019 7:40 am

Re: Align working plane to face fails in git build

Post by hvfrancesco »

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 38 times
hvfrancesco
Posts: 17
Joined: Mon Sep 23, 2019 7:40 am

Re: Align working plane to face fails in git build

Post by hvfrancesco »

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 37 times
User avatar
Roy_043
Veteran
Posts: 8551
Joined: Thu Dec 27, 2018 12:28 pm

Re: Align working plane to face fails in git build

Post by Roy_043 »

@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: 17
Joined: Mon Sep 23, 2019 7:40 am

Re: Align working plane to face fails in git build

Post by hvfrancesco »

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

Re: Align working plane to face fails in git build

Post by bernd »

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