realthunder wrote: ↑Mon Jun 01, 2020 6:14 am
...I didn't change the old links' python output.
I'm mostly talking about this behavior of picking subelements from the Link dialog. That's what I mean. This behavior that you show in your GIF, being able to select subelements of different objects, and across documents is only available in the XLink variants, not in the old ones. Is this right? Meaning that if we want to have this in scripted objects, we need to migrate the property to use XLink instead of, say, LinkSubListGlobal, or any of the older types.
By the way, I'm not considering any "subobjects" here. Imagine that I have simple boxes in the root of the document. I am interested in the picking of subelements through the Link dialog. As far as I can tell there is no way of doing this with the older properties. If I want to set one of these, I need to do it from the Python console.
Code: Select all
App.ActiveDocument.Box.LinkSub = [App.ActiveDocument.Another, ["Edge1"]]
2) The link editor dialog allows you to select multiple sub-objects (and/or sub-elements), as long as all the sub-objects belong to the same top-parent object, while for PropertyXLink you can only select one sub-object, but is allowed to select multiple sub-elements (i.e. vertices, edges, faces)...
This is what I find confusing.
In the terminal, XLink prints only one Subelement, but in the Property editor, it shows the three selected Edges that I picked. Why is there a difference? Isn't that confusing?
Code: Select all
>>> App.ActiveDocument.Box.XLink
(<Part::PartFeature>, 'Edge10')

- Multiple_XLink_1_alone.png (11.08 KiB) Viewed 5859 times
PropertyXLinkSubList is implemented using a list of internal PropertyXLink, so it supports multiple top-parents, multiple sub-objects/sub-elements. And PropertyXLinkList is derived from PropertyXLinkSubList and only differs in Python output.
Okay, but if I want to pick edges, I can only use XLinkSubList then.
Basically, I want to pick a single edge of a single geometrical object from the Link dialog. The two alternatives that I see are XLinkSub and XLink. I don't want to use XLinkSubList because I don't want the user to pick multiple objects, just a single object and just a single edge. In my view, XLinkSub appears correctly in the property editor because it shows me all subelements just as in the Python terminal. XLink works but it shows me several edges in the property editor, but only one in the Python console.
So for my use, I would get the value of XLinkSub, and if the user picks multiple edges, I need to discard all of them except the first one, which should be an Edge. And if the user doesn't do it right (selects a face), I need to warn him or her to make a new selection.