Copy a part body that depends on a spreadsheet

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
iogui
Posts: 90
Joined: Tue Mar 19, 2019 3:44 pm
Location: São Paulo
Contact:

Copy a part body that depends on a spreadsheet

Postby iogui » Tue Apr 30, 2019 7:54 pm

I'm working on a part in part design but in order to reuse some parameters in other parts I've put all those common parameters in a spreadsheet that is referenced by all the parts of my document.
Now I want to build a part that is similar to the part that I've modeled before but with difference in just one of it's properties. Then I've made a copy of the original Part Body to build a second PartBody but when I paste it, a copy of the spreadsheet is automatically made by freecad.
Considering that I just want to have one spreadsheet centralizing all main parameters, that is an odd behavior.
Conceptually am I doing it the wrong way? Or is it a bug?

The file is:
cavalete-mandala-redonda-60.FCStd
(78.21 KiB) Downloaded 3 times
The body I'm trying to copy is the one named BodyBaseEstrutural.

------------------------

OS: Ubuntu 16.04.6 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.1.
Build type: Release
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Portuguese/Brazil (pt_BR)
Be the change you want to see in the world. - Mahatma Gandhi
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Copy a part body that depends on a spreadsheet

Postby NormandC » Wed May 01, 2019 3:49 am

On very quick inspection, although a duplicate spreadsheet is created, the second Body actually links to the original spreadsheet. Have a look at the dependency graph. So I think you can safely delete the duplicate spreadsheet.


OS: Ubuntu 18.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.1.
Build type: Release
Python version: 3.6.7
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: French/Canada (fr_CA)
kisolre
Posts: 712
Joined: Wed Nov 21, 2018 1:13 pm

Re: Copy a part body that depends on a spreadsheet

Postby kisolre » Wed May 01, 2019 6:33 am

Shouldn't copying everything down the dependency graph and properly changing links to the new objects be the expected behavior? What if I wanted to make two completely independent copies? Should I change all the expressions to point to the new spreadcheet? It might be worth special treatment of the spreadsheets in the copy operation - ask the user what is current desired behavior?
User avatar
iogui
Posts: 90
Joined: Tue Mar 19, 2019 3:44 pm
Location: São Paulo
Contact:

Re: Copy a part body that depends on a spreadsheet

Postby iogui » Wed May 01, 2019 5:28 pm

NormandC wrote:
Wed May 01, 2019 3:49 am
On very quick inspection, although a duplicate spreadsheet is created, the second Body actually links to the original spreadsheet. Have a look at the dependency graph. So I think you can safely delete the duplicate spreadsheet.
In my environment, if you already have two bodies referencing the same spreadsheet and you try to copy one of the bodies the new body links to the original spreadsheet but the body that wasn't copied gets all its links updated to the new spreadsheet. A bizarre behavior!
cavalete-mandala-redonda-60_original.FCStd
The file before the copy
(35.46 KiB) Not downloaded yet
cavalete-mandala-redonda-60_error_copy.FCStd
The same file after the copy
(62.38 KiB) Not downloaded yet
This behavior is really bad because if you have many bodies referencing one centralizing spreadsheet and you make a copy of one of the bodies, you will have a massive rework to correct all things to reproduce the desired result. With this behavior I will have to completely avoid coping things so I will have a lot more work because I will not be able to reuse similar shapes.
Be the change you want to see in the world. - Mahatma Gandhi
User avatar
iogui
Posts: 90
Joined: Tue Mar 19, 2019 3:44 pm
Location: São Paulo
Contact:

Re: Copy a part body that depends on a spreadsheet

Postby iogui » Wed May 01, 2019 5:45 pm

kisolre wrote:
Wed May 01, 2019 6:33 am
Shouldn't copying everything down the dependency graph and properly changing links to the new objects be the expected behavior?
I don't think so...
kisolre wrote:
Wed May 01, 2019 6:33 am
What if I wanted to make two completely independent copies? Should I change all the expressions to point to the new spreadcheet? It might be worth special treatment of the spreadsheets in the copy operation - ask the user what is current desired behavior?
I think a better behavior would be a conditional one:
  • If the user selects just the body, the copied object should be just the selected body and all it's links should then reference to the same spreadsheet. (At least that's what I was expecting to happen)
  • If the user selects both the body and the spreadsheet, then both objects should be copied and then FreeCAD could have one of two behaviors: 1) Make a copy of both features and automatically reference the body to the new copied spreadsheet or 2) Ask the user what the current desired behavior (to update the references to the new copies or maintain the old references)
I understand though that to implement this conditional behavior is not so easy and it can exist use cases that I'm not thinking about now. But I agree with you when you say that spreadsheets should require special treatment in copy operations.
Last edited by iogui on Wed May 01, 2019 5:52 pm, edited 2 times in total.
Be the change you want to see in the world. - Mahatma Gandhi
kisolre
Posts: 712
Joined: Wed Nov 21, 2018 1:13 pm

Re: Copy a part body that depends on a spreadsheet

Postby kisolre » Wed May 01, 2019 5:50 pm

iogui wrote:
Wed May 01, 2019 5:28 pm
In my environment, if you already have two bodies referencing the same spreadsheet and you try to copy one of the bodies the new body links to the original spreadsheet but the body that wasn't copied gets all its links updated to the new spreadsheet. A bizarre behavior!
Now that you mention that I remember discusing similar behavior in the past with one of my designs but can't find the thread :(