LinkGroup Auto Unlink question

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
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

LinkGroup Auto Unlink question

Post by Roy_043 »

I am trying to understand the new LinkGroup. I have a question regarding the 'Auto Unlink' Link Mode.

Test:
  1. Create a Part_Box.
  2. Create a Part_Cylinder.
  3. Select the box ('Cube') and create a Link to is with Std_LinkMake.
  4. Deselect the created Link.
  5. Right click in the Tree and select: Link actions > Make link group > Simple group
  6. Drag the box Link into the group.
  7. Change the Link Mode of the group to 'Auto Unlink'.
  8. Drag the cylinder into the group, a Link to the cylinder will be created inside the group.
  9. OK so far.
  10. Compare the properties of the two Links. Make sure to check the 'Show all' option in the context menu of the Properties editor. They appear to be the same (apart of course from the specific box and cylinder related properties).
  11. Drag the box Link out of the group and onto the document node.
  12. Do the same for the cylinder Link.
  13. Result: The box Link is still available, but the Cylinder Link has been erased. I do not understand this difference. Which unexposed property is responsible for this behavior?

Code: Select all

OS: Windows 8.1 (6.3)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.23074 (Git)
Build type: Release
Branch: master
Hash: 74b866ed3022fd1452c534dae31a721bcc668f2f
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Dutch/Netherlands (nl_NL)
paullee
Veteran
Posts: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: LinkGroup Auto Unlink question

Post by paullee »

Roy_043 wrote: Tue Dec 01, 2020 10:33 am I am trying to understand the new LinkGroup. I have a question regarding the 'Auto Unlink' Link Mode.
Happen to drop into this when searching about LinkGroup again.

There was a discussion - [ LinkGroup ] Help, Wiki or Tutorial ?

And found in Realthunder github a table, portion extracted below -


Screenshot from 2021-07-30 18-57-52.png
Screenshot from 2021-07-30 18-57-52.png (45.82 KiB) Viewed 1824 times
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: LinkGroup Auto Unlink question

Post by Roy_043 »

Thanks for your answer, but I do not understand how this explains the behavior I have described. Both links are dragged out of the same group that has its Link Mode set to 'Auto Unlink'. You would then expect the same result. But somehow the link that was in the group before the setting was changed is treated differently.
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: LinkGroup Auto Unlink question

Post by Roy_043 »

One strange thing: The Visibility of the Cylinder link create at step 8 is set to false, although the object is visible. You can't change the setting to true: if you try it is immediately changed back to false.
paullee
Veteran
Posts: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: LinkGroup Auto Unlink question

Post by paullee »

Maybe the difference is in the moment the mode is when an object is dropped into the LinkGroup ?

Probably ping Realthunder to have a look ? :)

Sometime it may be a bug? Like visibility I find also /
sometime it can't be controlled by spacebar, re-open the file it works again.
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: LinkGroup Auto Unlink question

Post by Roy_043 »

realthunder wrote: pinged by pinger macro
Can you have a look at this issue?
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: LinkGroup Auto Unlink question

Post by realthunder »

The behavior is correct. There is some internal variable to mark whether the child link is owned by the link group or not. But there is indeed some problem. I should have made this internal variable a property so that it can be properly restored when the document is opened again. I'll make a PR about this.

About the visibility, this is the correct behavior. The visibility of a child inside link group is stored inside the link group property VisibilityList. If the child is not claimed by any other non link type object, its 'Visibility' is forced to be 'False' to avoid confusion. Because otherwise, the user may find another instance of the object in a different placement in the 3D view if the link group itself has some placement.
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
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: LinkGroup Auto Unlink question

Post by Roy_043 »

I have a hard time understanding this. At step 8 there are two links in the same group. Both link to objects outside the group. I do not see a good reason for the different Auto Unlink behavior or the different visibility behavior (the visibility of the box Link is true, can be changed to false, but not back to true).

Maybe changing the Link Mode of the group should result in an update of the internal property/new property you mention?
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: LinkGroup Auto Unlink question

Post by realthunder »

The unique feature of LinkGroup is that it can share object among different groups, meaning that the exact same object can be added to different link group without conflict. And because of this, the link group provides its own visibility control to its children, otherwise, hiding a child will hides it in all link groups which makes the group less usable. In addition, link group itself can have placement, and all its children will move together with the group.

With those in mind, here is the explanation. You manually create one link to the box and then add that link to the link group without changing its link mode, so this link is considered as a shared object. You then change the link mode and add the cylinder. The link group auto creates a link to the cylinder, and this auto created link is considered owned, which can be safely deleted when the child is removed.

The visibility property of an object controls that object's visibility. If an object, say a box, is claimed only by the link group, then you can only find the box item under the link group item in the tree view. If the box is allowed to toggle its own visibility property, and the link group happens to have some offset placement, you'll find two instances of the box with the same amount of offset between each other in the 3D view. When the user selects one of the instance in the 3D view, how shall the tree view reflect the selection without causing confusion? What's worse is that if the link group has no offset placement, and those two instances will then occupy the exact same place in the 3D view. Neither the tree view nor the 3D view can disambiguate the selection. The other type of group (e.g. App::Part) solve this problem by forcing its children to appear only in one group, which implies that any other object that claims the child must also be in the group as well, e.g. a fusion that fuses the box. Link group has no such restriction. If the box is claimed by another non link type object (e.g. the fusion), then it is allowed to be shown, because the tree view can now reflect the correct instance being selected in the 3D view. There are still corner cases which can cause confusion, but the force hiding bit is the best I can think of.
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
paullee
Veteran
Posts: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: LinkGroup Auto Unlink question

Post by paullee »

Thanks, understand better for me :)

Though still quite complicated :oops:
Post Reply