Draft.scale no longer works

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
duckmug
Posts: 126
Joined: Mon Jun 07, 2021 12:26 am

Draft.scale no longer works

Post by duckmug »

I am trying this very simple example after coming across a thread:

Code: Select all

import Draft

obj = FreeCADGui.Selection.getSelection()[0]

Draft.scale(obj, delta=App.Vector(2,2,2), center=App.Vector(0,0,0), legacy=True)
It results to an error:

Code: Select all

TypeError: scale() got an unexpected keyword argument 'delta'
I also tried to use the help command but I can't find anything useful about this.

My FreeCAD version details:

Code: Select all

OS: Ubuntu 20.04.2 LTS (ubuntu:GNOME/ubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.
Build type: Release
Branch: unknown
Hash: 0d9536ed3e8c7f40197b5606e1b7873625e1d6fe
Python version: 3.8.10
Qt version: 5.12.8
Coin version: 4.0.0
OCC version: 7.5.2
Locale: English/United States (en_US)
duckmug
Posts: 126
Joined: Mon Jun 07, 2021 12:26 am

Re: Draft.scale no longer works

Post by duckmug »

Update: Removing the keywords delta and legacy did the trick:

Code: Select all

import Draft

obj = FreeCADGui.Selection.getSelection()[0]

Draft.scale(obj, App.Vector(2,2,2), center=App.Vector(0,0,0), forcedraft=True)

FreeCAD.ActiveDocument.recompute()
chrisb
Veteran
Posts: 54197
Joined: Tue Mar 17, 2015 9:14 am

Re: Draft.scale no longer works

Post by chrisb »

The second parameter is called "scale". You can see these in the docs popping up in Python console.

Edit: using positional arguments without the names works of course as well.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Roy_043
Veteran
Posts: 8550
Joined: Thu Dec 27, 2018 12:28 pm

Re: Draft.scale no longer works

Post by Roy_043 »

The forcedraft argument surprises me. I can't find it in scale.py.
Post Reply