Search found 25 matches

Go to advanced search

by donjan
Mon Aug 26, 2019 12:54 pm
Forum: Python scripting and macros
Topic: Macros to python script issue
Replies: 2
Views: 581

Re: Macros to python script issue

I do a lot of bulk processing in FreeCAD and most of my macros are usable both from GUI and via script. Unfortunately there is no official way to support this nicely ("somebody" should change that). I need something similar to what Tobi has shown, so most of my scripts have this section pasted at th...
by donjan
Tue Aug 20, 2019 2:48 pm
Forum: Python scripting and macros
Topic: Abusing FeaturePython Proxy kills save files.
Replies: 0
Views: 585

Abusing FeaturePython Proxy kills save files.

Tested on FreeCAD 0.18.2 and 0.18.3 on a Debian and two different Ubuntu releases. The issue is based on bad usage of the FeaturePython.Proxy member, where the error case should be handled much more gracefully. WARNING: use a document you don't care about to test the following code. We assign a Qt w...
by donjan
Tue Aug 20, 2019 12:16 am
Forum: Developers corner
Topic: Param object editor macro
Replies: 5
Views: 537

Re: Param object editor macro

Added live updating with a global addDocumentObserver(), then filtering for my object. Seems a bit overkill, but does the job.
selector_ui.jpg
selector_ui.jpg (65.96 KiB) Viewed 260 times
by donjan
Fri Aug 16, 2019 5:40 pm
Forum: Developers corner
Topic: Param object editor macro
Replies: 5
Views: 537

Re: Param object editor macro

A few updates: - hidden variable differentiating it from other App::FeaturePython objects. This enables a nicer user interface via dropdown selection. - "used in" lookup now properly respects word boundaries in expressions. The current script creates slightly different objects and won't recognise th...
by donjan
Sun Aug 11, 2019 10:26 pm
Forum: Developers corner
Topic: Param object editor macro
Replies: 5
Views: 537

Re: Param object editor macro

Had I been aware of the DynamicData workbench a few months ago, I probably would not have written this macro. Didn't find it because I never expected anyone to want to put this kind of functionality in a workbench. It's definitely a useful plugin, but I find its UX is rather convoluted due to the mu...
by donjan
Fri Aug 09, 2019 7:56 pm
Forum: Developers corner
Topic: Param object editor macro
Replies: 5
Views: 537

Re: Param object editor macro

Added a tooltip (also text when deleting) showing labels of where the property is used:
usedin.jpg
usedin.jpg (69.73 KiB) Viewed 450 times
by donjan
Fri Jul 19, 2019 11:36 pm
Forum: Developers corner
Topic: Param object editor macro
Replies: 5
Views: 537

Param object editor macro

For a while now I've been using App::FeaturePython objects filled with values to parametrise sketches, pads, etc. conveniently from the outliner. I want to share the corresponding GUI macro as I find it quite useful and it has reached some stage of maturity. Comments welcome. Usage: run the macro, s...
by donjan
Thu Mar 14, 2019 2:26 pm
Forum: Python scripting and macros
Topic: Part::PythonFeature removeProperty fails to setExpression to None
Replies: 2
Views: 169

Part::PythonFeature removeProperty fails to setExpression to None

FreeCAD 0.17 13541 (Git) on Ubuntu 18.04. The following code illustrates a problem with using FeaturePython objects as parameter buckets and deleting a leaf dependency parameter. doc = FreeCAD.ActiveDocument p1 = doc.addObject("App::FeaturePython", "params1") p2 = doc.addObject("App::FeaturePython",...
by donjan
Thu Jan 24, 2019 4:23 pm
Forum: Python scripting and macros
Topic: FreeCAD 0.18 Python3 bindings
Replies: 3
Views: 712

Re: FreeCAD 0.18 Python3 bindings

After purging the main repo package and installing from your PPA, I get: $ export PYTHONPATH=/usr/lib/freecad/lib && python3 Python 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. import FreeCAD FreeCAD 0.18, Libs: 0....
by donjan
Wed Jan 23, 2019 6:38 pm
Forum: Python scripting and macros
Topic: FreeCAD 0.18 Python3 bindings
Replies: 3
Views: 712

FreeCAD 0.18 Python3 bindings

Testing 0.18 from the daily repo on Ubuntu: $ export PYTHONPATH=/usr/lib/freecad-daily/lib && python3 Python 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import FreeCAD Traceback (most recent call last): File "...

Go to advanced search