PR#2862: Configuration Table using Spreadsheet

Post here if you have re-based and finalised code to integrate into master, which was discussed, agreed to and tested in other forums. You can also submit your PR directly on github.
realthunder
Posts: 2037
Joined: Tue Jan 03, 2017 10:55 am

Re: PR#2862: Configuration Table using Spreadsheet

Post by realthunder »

Zolko wrote: Sat Sep 11, 2021 11:38 am Why not use a hidden temporary Document to contain the deep copy : with a new hidden temporary document, you are sure that it's empty, thus all copied names will be preserved.? If you copy into the current document, existing names will be changed to keep the unique name principle of FreeCAD, so how do you track the changed (variant) variables ?
Temporary document are not saved, while variant copy is meant to be preserved. The SubShapeBinder supports variant binding as well, and it does indeed use a temporary document for that purpose, because the binder does not need to preserve the variant copies, only the combined shape.

The naming conflict is a common problem that must be solved in order for normal copy to work. You know, when you copy a body and paste it into the same document, FreeCAD must change the reference according to name changes. Similar things happen here. In addition, since this is actually a replace operation, it will also change reference in existing objects. Similar logic has already been implemented in 'Link replace' action in upstream.
Also, is this variant link a C++ construct or a Python object ?
It is implemented in Link using C++.
Try Assembly3 (latest version 2021.10.15) along with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
User avatar
Zolko
Posts: 1534
Joined: Mon Dec 17, 2018 10:02 am

Re: PR#2862: Configuration Table using Spreadsheet

Post by Zolko »

realthunder wrote: Sat Sep 11, 2021 2:10 pm It is implemented in Link using C++.
I think that variant links should be implemented in Python, and I have proposed a possible implementation (see here and here). I will (try to) do this now with Assembly4, and for 0.19 if possible
try the Assembly4 workbench for FreCAD v0.19
install with Tools > Addon Manager > Assembly4 — tutorials here and here
paullee
Posts: 3809
Joined: Wed May 04, 2016 3:58 pm

Re: PR#2862: Configuration Table using Spreadsheet

Post by paullee »

Looks exciting :) Though probabaly not understanding the usecases.

Can have a simple example, e.g. a Sketch with 4 edges to demonstrate ?

Thanks.
carlopav
Posts: 1961
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: PR#2862: Configuration Table using Spreadsheet

Post by carlopav »

Zolko wrote: Sat Sep 11, 2021 6:29 pm I think that variant links should be implemented in Python
Can you elaborate?

I will (try to) do this now with Assembly4, and for 0.19 if possible
Sound like duplicated effort... I've tested this PR and "variant subshapebinder" in realthunder fork quite a lot and it works very good in my user opinion...
follow my experiments on BIM modelling for architecture design
galou_breizh
Posts: 369
Joined: Wed Sep 15, 2010 9:38 am

Re: PR#2862: Configuration Table using Spreadsheet

Post by galou_breizh »

Thanks realthunder for this nice feature.

I didn't manage to have it work though. I'm attaching a sample where I think I did everything as you wrote but changing the property marked "CopyOnChange" (Pad.Length) still modifies the original object.
copy_on_change.fcstd
(15.45 KiB) Downloaded 30 times
I'm using the AppImage from 2021-09-16 (FreeCAD-asm3-Daily-Conda-Py3-Qt5-20210916-glibc2.12-x86_64.AppImage).

Thanks,
Gaël

OS: Ubuntu 20.04.3 LTS (i3/i3)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 2021.916.24301 +4152 (Git) AppImage
Build type: Release
Branch: LinkDaily
Hash: 7fd36f96f4db17db4f8d058eab22588cca8f9d5c
Python version: 3.9.7
Qt version: 5.12.9
Coin version: 4.0.1
OCC version: 7.5.2
Locale: English/United States (en_US)
realthunder
Posts: 2037
Joined: Tue Jan 03, 2017 10:55 am

Re: PR#2862: Configuration Table using Spreadsheet

Post by realthunder »

galou_breizh wrote: Thu Sep 16, 2021 7:11 am I didn't manage to have it work though. I'm attaching a sample where I think I did everything as you wrote but changing the property marked "CopyOnChange" (Pad.Length) still modifies the original object.
The attached file is broken somehow. I couldn't find the original Body object, and the original Pad is moved outside. Can you please describe your steps? Or maybe make a screencast.

Based on your description, I guess you linked to the body, but mark the Pad.Length as CopyOnCange? The CopyOnChange property only works in the linked object, not any of its sub-objects. You are supposed to create a new property in the linked object, the body, I presume, and then use expression to access the property in various sub-object. To avoid cyclic dependency problem, use 'href()' function. See the screencast below.

phpBB [video]
Try Assembly3 (latest version 2021.10.15) along with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
galou_breizh
Posts: 369
Joined: Wed Sep 15, 2010 9:38 am

Re: PR#2862: Configuration Table using Spreadsheet

Post by galou_breizh »

Thanks for the reply. I got it now.
realthunder wrote: Tue Sep 21, 2021 1:51 am you linked to the body, but mark the Pad.Length as CopyOnCange? The CopyOnChange property only works in the linked object, not any of its sub-objects.
This is the first thing I was doing wrong. I was indeed setting "Pad.Length" as "CopyOnChange". Here, it should rather "The CopyOnChange property only works at the root of the linked object not in any of its sub-objects or sub-features".
realthunder wrote: Tue Sep 21, 2021 1:51 am You are supposed to create a new property in the linked object, the body
This is the second thing I was doing wrong (actually I was not doing it and I should have).

It now works wonderfully.

The only thing that could be improved is that it looks that you're doing something that you shouldn't because you need to show things that are normally hidden. I guess the user interface will improve with the time.

Thanks again,
Gaël
User avatar
Zolko
Posts: 1534
Joined: Mon Dec 17, 2018 10:02 am

Re: PR#2862: Configuration Table using Spreadsheet

Post by Zolko »

carlopav wrote: Sun Sep 12, 2021 9:16 pm
Zolko wrote: Sat Sep 11, 2021 6:29 pm I think that variant links should be implemented in Python
Can you elaborate?
done, works with FreeCAD v0.19:

https://forum.freecadweb.org/viewtopic.php?f=24&t=62558

Anything that can be done in Python should be done in Python. My implementation doesn't need the href() magic that circumvents the real problem of cyclic dependencies. The Part::FeaturePython object takes care of it in its execute() method : it overwrites manu-military its own parameters into the variant (which is a copy of the source object in a hidden temporary document)

There still is an error on restore that I'm not able to intercept, which is scary red but harmless.
try the Assembly4 workbench for FreCAD v0.19
install with Tools > Addon Manager > Assembly4 — tutorials here and here
carlopav
Posts: 1961
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: PR#2862: Configuration Table using Spreadsheet

Post by carlopav »

Zolko wrote: Wed Sep 29, 2021 3:44 pm done, works with FreeCAD v0.19:
relevant commit: https://github.com/Zolko-123/FreeCAD_As ... eaef7e99d7

Can you make a screen recording to demonstrate how it works?

PS perhaps in a new topic and linking the new topic here... (?)
follow my experiments on BIM modelling for architecture design
Post Reply