Break expression links

Post here for help on using FreeCAD's graphical user interface (GUI).
jaisejames
Posts: 73
Joined: Sat Sep 24, 2016 6:51 am

Break expression links

Postby jaisejames » Wed Apr 19, 2017 5:07 am

Is there any way to break all expression links & hold corresponding values only ?
triplus
Posts: 4988
Joined: Mon Dec 12, 2011 4:45 pm

Re: Break expression links

Postby triplus » Wed Apr 19, 2017 11:43 am

There was a plan to have global overlay of all expressions. But the plan didn't materialize yet.
DeepSOIC
Posts: 4670
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Break expression links

Postby DeepSOIC » Wed Apr 19, 2017 11:57 am

If just in spreadsheet, try this:

Code: Select all

obj = Gui.Selection.getSelection()[0]
for prop in obj.PropertiesList:
    try:
        expr = obj.getContents(prop) #raises ValueError if not a cell
    except ValueError:
        continue
    if expr.startswith('='):
        obj.set(prop, str(getattr(obj, prop)))
jaisejames
Posts: 73
Joined: Sat Sep 24, 2016 6:51 am

Re: Break expression links

Postby jaisejames » Wed Apr 19, 2017 1:22 pm

Thanks for support. I will try.