Draft offset tool says module 'draftutils.utils' has no attribute 'param'

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
hko
Posts: 96
Joined: Thu Apr 23, 2020 10:44 pm

Draft offset tool says module 'draftutils.utils' has no attribute 'param'

Post by hko »

  1. Create a new document and select the Draft workbench.
  2. Draw an arbitrary draft wire.
  3. Click Draft offset tool
  4. Observe that you get the Python backtrace backtrace shown below

Code: Select all

Running the Python command 'Draft_Offset' failed:
Traceback (most recent call last):
  File "/usr/local/freecad/Mod/Draft/draftguitools/gui_offset.py", line 84, in Activated
    self.proceed()
  File "/usr/local/freecad/Mod/Draft/draftguitools/gui_offset.py", line 101, in proceed
    occmode = utils.param.GetBool("Offset_OCC", False)

module 'draftutils.utils' has no attribute 'param'
I don't know if it's because of this or because I don't know how to use the tool but I can't figure out how to make it do anything. It says "Offset direction is not defined. Please move the mouse on either side of the object first to indicate a direction" but no amount of moving the mouse has any effect.

Code: Select all

OS: Ubuntu 20.04.5 LTS (KDE/plasma)
Word size of FreeCAD: 64-bit
Version: recent master, see hash
Build type: Debug
Branch: master
Hash: 862bc58809166b5a555742870fc1782d259d9edc
Python 3.8.10, Qt 5.12.8, Coin 4.0.0, Vtk 7.1.1, OCC 7.3.0
Locale: English/United States (en_US)
Installed mods: 
  * dodo 1.0.0
  * BIM.backup1663296114.5945559
  * BIM 2021.12.0
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Draft offset tool says module 'draftutils.utils' has no attribute 'param'

Post by onekk »

hko wrote: Tue Jan 24, 2023 2:17 am ...

Code: Select all

OS: Ubuntu 20.04.5 LTS (KDE/plasma)
Word size of FreeCAD: 64-bit
Version: recent master, see hash
Build type: Debug
Branch: master
Hash: 862bc58809166b5a555742870fc1782d259d9edc
Python 3.8.10, Qt 5.12.8, Coin 4.0.0, Vtk 7.1.1, OCC 7.3.0
Locale: English/United States (en_US)
Installed mods: 
  * dodo 1.0.0
  * BIM.backup1663296114.5945559
  * BIM 2021.12.0
Seems strange as version number, or better, no version number in the output, so probably is a distribution complied version or something else, see below for a proper version numbering, from a working AppImage.

Code: Select all

OS: Artix Linux (openbox)
Word size of FreeCAD: 64-bit
Version: 0.20.2.29603 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 0.20.2)
Hash: 930dd9a76203a3260b1e6256c70c1c3cad8c5cb8
Python 3.10.8, Qt 5.15.4, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: Italian/Italy (it_IT)
Installed mods: 
  * QuickMeasure 2022.10.28
  * Assembly4 0.12.4
  * fasteners 0.4.24
  * toSketch 1.0.1
  * Curves 0.6.1
  * Help 1.0.3
Probably trying to use an AppImage to verify that everything is working (most probably it will work) is the better way of doing things, see here for the AppImage 'official' repository:

https://github.com/FreeCAD/FreeCAD/releases/

If you version is supplied by the distribution, you have to report the bug so the distribution so they can correct it as it is "out of control" of FreeCAD developers what distribution packagers are doing.


Regards

Carlo D.
Last edited by onekk on Tue Jan 24, 2023 2:44 pm, edited 1 time in total.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: Draft offset tool says module 'draftutils.utils' has no attribute 'param'

Post by Roy_043 »

This problem was introduced with one of my recent commits:
https://github.com/FreeCAD/FreeCAD/pull/8207

I'll fix it ASAP.

For now you can replace the 4 occurrences of:

Code: Select all

utils.param
in gui_offset.py with:

Code: Select all

utils.param_draft

The Draft_Offset command is a bit tricky. Please read the linked Wiki page first.
hko
Posts: 96
Joined: Thu Apr 23, 2020 10:44 pm

Re: Draft offset tool says module 'draftutils.utils' has no attribute 'param'

Post by hko »

onekk wrote: Tue Jan 24, 2023 8:13 am Seems strange as version number, or better, no version number in the output, so probably is a distribution complied version or something else, see below for a proper versioning number, from a working AppImage.
I build from the master branch myself. For some reason (I recall someone had an explanation in another thread) the build system creates incorrect version and hash for me, at least when not doing builds from scratch, so I just replace them manually. It would be nice to the fix the build system but there are more important things.

Thanks for the quick fix, I fetched the PR, created a new build and tested it. Works fine now, indeed this problem prevented it from working as described.
Post Reply