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.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: PR#2862: Configuration Table using Spreadsheet

Post by realthunder »

To make an instance of a configurable object you can use either App::Link, or The SubShapeBinder. You aren't supposed to copy the object. The link (or binder) can reside in a different document if you like. Once you've created Link, change its property LinkCopyOnChange to 'Enable' to import configuration property from the linked object, and you can then select a different configuration. Same goes for binder, where the property is named 'BindCopyOnChange'. The difference between binder and link is that Link will keep the object hierarchy, while binder will flatten the hierarchy into a single shape compound.

phpBB [video]
Try Assembly3 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
skintigh
Posts: 14
Joined: Mon Mar 28, 2022 3:56 pm

Re: PR#2862: Configuration Table using Spreadsheet

Post by skintigh »

Thank you for the slower video :) I am now 90% of the way there, but either I'm trying to do something impossible or missing something, or maybe this is just impossible with gears.

In your example, if you were to modify the top level spreadsheet entry table for lego "44" and then change the second Body to use config "44" would you see the change you just made? Or will it be ignored?

And assuming it doesn't ignore changes, how did you put those bodies together to make it work AND make it nice and tidy?

If I try to mimic what you are doing, I start with: Parameters spreadsheet, Data spreadsheet, Body, and a copy of the gear that is the ghost of BaseFeature of the Body so I can't delete it. Then I make a link, set it to link copy on change, change which config it's pointing at, and now I have:

Parameters
Data
Body
involutegear1 ghost
Body001
Data001
Parameters001
involutegear002 ghost
Body002 ghost

That's just the top level, for just 1 link. If I try using a Shape instead of a Body, I get 7 entries instead of 9. Shape actually only makes a single top level entry, until I change which table entry it uses and then it makes 3 more entries.

I've tried many experiments with my gear and 2 spreadsheets (1 with a config table): grouping them in shapes, bodies, groups, or all top level, or just the gear in one of the former and the spreadsheet at top level, and different attempts at making the config table for the gear or for whatever shape/body it is inside. The results are always 1 of these 2: lots of copies for a single link, or once I was able to make a nice and tidy single copy using Part... but it ignored all updates/new entries to the spreadsheet :(
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: PR#2862: Configuration Table using Spreadsheet

Post by realthunder »

skintigh wrote: Tue May 03, 2022 2:58 am Thank you for the slower video :) I am now 90% of the way there, but either I'm trying to do something impossible or missing something, or maybe this is just impossible with gears.
Can you please post your file here, and maybe try to make a screen cast to show your intention clearer?

PS. maybe this post will give you some idea on syncing changes between the original and the linked configurable objects.
Try Assembly3 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
skintigh
Posts: 14
Joined: Mon Mar 28, 2022 3:56 pm

Re: PR#2862: Configuration Table using Spreadsheet

Post by skintigh »

Here are 2 versions I tried, I can't seem to upload the version I made with a part, I get an HTTP error.
I made them with FreeCAD-asm3-Daily-Win-Conda-Py3.9-20220430-x86_64.7z
I can get a single part to work with a config table, but any link copies ignore configuration changes and will only mimic the first gear.

I just want to be able to make multiple different gears from that config table, and if I change a column I want the gears to change.

Thanks for all your help.
Last edited by skintigh on Thu May 12, 2022 7:25 pm, edited 1 time in total.
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: PR#2862: Configuration Table using Spreadsheet

Post by realthunder »

I notice you explicitly excluded the Parameters and Data spreadsheet from CopyOnChange objects. That's why it didn't work. Just create a Link and enable LinkCopyOnChange without any special setup, and it will work. The Link needs to make private copy to the configuration spreadsheets (and all necessary depending objects for that matter) in order for the whole thing to work. If you make changes to the original Parameters spreadsheet, the Link will change its icon to signal the divergence. Just Alt click the icon to sync the changes.
Try Assembly3 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
skintigh
Posts: 14
Joined: Mon Mar 28, 2022 3:56 pm

Re: PR#2862: Configuration Table using Spreadsheet

Post by skintigh »

I swear that's what I did! Sorry if I'm driving you crazy, I promise I'm not usually a moron...

I just tried again: I clicked on the body, clicked "make a link" (mouse hover says it's Std_LinkMake), set that link's "copy on change" to "enabled." If I tell it to use a different line of config and it does nothing, except "link copy on change" automatically switches to "owned." If I change the original to use a different config, the link changes too.

I also tried it in the save file where I don't use a Body and I made a link to the gear. Got the same behavior. I also tried selecting all 3 components and making a link, same behavior. I tried like 50 other combos, too.

I'm using the Realthunder branch right now:

OS: Windows 10 (10.0)
Word size of FreeCAD: 64-bit
Version: 2022.430.26244 +4758 (Git)
Build type: Release
Branch: LinkDaily
Hash: b024b876480a533018fdc702145e9e38f8c54ba6
Python version: 3.9.12
Qt version: 5.12.9
Coin version: 4.0.1
OCC version: 7.5.3
Locale: English/United States (en_US)

Is that what I should be using?



If I switch to the vanilla 0.20 build, I can get the config tables to work perfectly (though I have to also enable "Link Transform" for the gears to move to the correct place). But if I change the first spreadsheet, the others do not update.

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.20.27422 (Git)
Build type: Release
Branch: master
Hash: d938733eaf2c2ce7cb18d1cbb56147185c473530
Python version: 3.8.6+
Qt version: 5.15.2
Coin version: 4.0.1
OCC version: 7.5.3
Locale: English/United States (en_US)

Am I doing something dumb? Or should I try a different version or a different computer?

Thanks again!!!
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: PR#2862: Configuration Table using Spreadsheet

Post by realthunder »

Please check the screen cast video below. Do you remember manually change the configurable object setup? As shown in the video, you've somehow unselected 'Parameters' and 'Data' spreadsheet. This exclude copying the spreadsheet when changing configuration, which means the link and the original object shares the same spreadsheet, and therefore shares the same configuration choice.

By right, you should be able to just select those two spreadsheets in the dialog. But there is a bug causing crash. I've already fixed this bug. Before the next release, you can work around it by manually remove the setup property named '_CopyOnChangeControl' in those two spreadsheets as shown in the video. After done, 'Alt + Click' the refresh button in the Link to sync the changes.

phpBB [video]
Try Assembly3 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
skintigh
Posts: 14
Joined: Mon Mar 28, 2022 3:56 pm

Re: PR#2862: Configuration Table using Spreadsheet

Post by skintigh »

Thank you so much for this, everything is working now! Thank you so much!!!

Is it possible to write a macro to refresh everything that needs refreshed? I know I can recompute and update the gui, but I couldn't find a way to refresh.
Thanks again!
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: PR#2862: Configuration Table using Spreadsheet

Post by realthunder »

skintigh wrote: Fri May 13, 2022 6:42 pm Is it possible to write a macro to refresh everything that needs refreshed? I know I can recompute and update the gui, but I couldn't find a way to refresh.
Thanks again!
You can set LinkCopyOnChange to 'Tracking' for auto refreshing, as described in details here.
Try Assembly3 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
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: PR#2862: Configuration Table using Spreadsheet

Post by adrianinsaval »

realthunder wrote: Sat May 14, 2022 1:53 am
could you create a wiki page describing the use of this feature? even if it's unformated, I think this isn't documented right now

Also did the variant link stuff end up getting merged too?
Post Reply