Links

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Links

Post by DeepSOIC »

I really like that now selecting Part highlights everything in it. I also like the way we can now select higher and higher container the more times we click the object. But that seems to work only in hierarchies behind an App::Link. Would be great if you make it work with plain Part containers too.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Links

Post by DeepSOIC »

If I have:

Code: Select all

Part
    Box
instance000 of Part
    (Box)
I can access edges of box instance using:
App.ActiveDocument.Part_i000.getSubObject("Box.Face1")
which returns me a Face1 of Box placed according to placement of instance. Great. I can also ask for Box, works like a charm. Cool!

The only complaint about it that I have is that if there are containers between Part and Box, all their names are imprinted into the sublink. Which makes it vulnerable to addition of another level of nesting in between. That was why I proposed to store instance paths - the full path can be figured out given the target workspace, and the list of instances to look through.

Apart from that, this approach seems to work somewhat well. All dependencies are fulfilled automatically because I'm linking to instance, not directly to the object.

Another subtle problem is that I now have to use PropertyLinkSub even if I wanted to link to full object. It doesn't look like a big deal.

I'm definitely not starting to code Workspace till this goodness is merged.
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: Links

Post by realthunder »

DeepSOIC wrote:
DeepSOIC wrote:What's the purpose of PartLink's Viewprovider "show in tree", I wonder... I hides a link from the tree. But what for??
I now see it's part of your first message. I didn't notice it at first. I still don't get why would one want to hide something from tree. That makes things even more confusing.
I added this feature because I didn't want to touch App::Part at that stage, so all the naming and selection enhancement only happens when you create a link to the container. The original container then becomes in the way, but still needed. If I were to enhance App::Part to do the same children linking enhancement, then no need for it. But I can definitely see other usage of it, just like hidden files in any operating system. By the way, you can easily toggle the visibility of the hidden items by right click the Document item in the tree and toggle 'Hide items' menu. The 'ShowHidden' property is stored in the Document, so the document author can decide whether to show the hidden items, and which items are hidden.
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
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: Links

Post by realthunder »

DeepSOIC wrote:Crash.
1. PartDesign Part.
2. Part Cube, move it into Part
3. Part Link the Part
4. Move Link into Part.
-> infinite recursion, crash
How to handle the detect cyclic reference is hard. Right now only minimum detection is used. We can reference how symbolic link is implemented in file system. For performance reason, normally they will just limit the depth of expansion, instead of full on searching for cyclic detection. I haven't add that limit yet.
DeepSOIC wrote:Figured out. That happens when I select linkGroups, and click the link in property editor saying "groups". That selects a deeply hidden object, "groups", which it looks like cannot be deselected easily.
Property viewer will merge properties when you select more than one items. That's FC's original behavior. Only those properties that are inside all selected items will be shown. My patch of merging the linked object's property happens when there is one and only one link item is selected. If I were to name link's placement as 'Placement', then it will hide the object's original placement property in the property view like you requested. But the link can aggregate linked object's placement as well, just toggle 'LinkTransform' property to True. Then the object's original placement takes effect, much like the children object in an App::Part. This is when you might want to modify the original object's placement. Right now, in the property view, all link's own property is in group Link at the beginning. The rest is the final linked object's property, except Label maybe.
DeepSOIC wrote:... and this latent shape is revealed if I use the link in, say, Fusion. That's a bug, I think.
Part::Link is still experimental yet. But this latent thing is by choice. May be I need to fine tune under exactly what situation the shape shall be retained. Part WB's other object also do the same. When a fusion operation failed, the previous Shape is retained if I remembered correctly. I think doing it this way can stop unnecessary recompute propagation.
DeepSOIC wrote:The only complaint about it that I have is that if there are containers between Part and Box, all their names are imprinted into the sublink. Which makes it vulnerable to addition of another level of nesting in between. That was why I proposed to store instance paths - the full path can be figured out given the target workspace, and the list of instances to look through
You can definitely build a better API around Link for navigation. Right now, only minimum is provided so that existing code without change can somewhat access the Linked object without realizing it is accessed through a Link.
DeepSOIC wrote:I really like that now selecting Part highlights everything in it. I also like the way we can now select higher and higher container the more times we click the object. But that seems to work only in hierarchies behind an App::Link. Would be great if you make it work with plain Part containers too.
That requires replacing App::Part's view provider entirely. Maybe I'll derive a class from App::Part for a proof of concept first. If @ickby is happy with it, I'll merge into App::Part. That's actually my original intention.
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
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Links

Post by DeepSOIC »

A strange thing. Selection highlighting of sketcher points seems to be slightly broken. I'm not sure if it's your branch that introduced it, or it's a master problem.
no-higlight-points-in-sketch.png
no-higlight-points-in-sketch.png (288.91 KiB) Viewed 1606 times
In this sketch, I have selected every point by clicking it. Only the points where there is only one point are shown in green.

If I select both overlapped points (using box select), the highlight shows up. Also, if I rotate the camera a little bit, the highlight shows up. But if I align the view again, the highlight disappears.

1. Open file.
no-higlight-points-in-sketch.FCStd
(5.58 KiB) Downloaded 38 times
2. Activate Body, and open Sketch001
3. Select a point on slot outline. So far so good.
4. Drag the point, so that the slot shape changes.
5. now try selecting points.
-> I get the reported behavior

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.11022 (Git)
Build type: Debug
Branch: (HEAD detached at realthunder/Link)
Hash: 3ac08cceedf68b09875aa1fc90a487962a24c6ee
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.0.0
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Links

Post by DeepSOIC »

Another problem. Display Mode Body is not respected by App::Link:
instance-of-body.png
instance-of-body.png (213.46 KiB) Viewed 1600 times
instance-of-body.FCStd
(9.59 KiB) Downloaded 40 times
Note: Body.ViewObject.DisplayModeBody is set to "Tip". This makes Sketch invisible (and everything inside Body), and body displays only its shape, as if it were plain Part::Feature. However, instance of the body still displays internal objects.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Links

Post by DeepSOIC »

Strangely, same problem with body if I create an instance of Part that contains the Body.
instance-of-part-with-body.png
instance-of-part-with-body.png (218.79 KiB) Viewed 1596 times
instance-of-part-with-body.FCStd
(10.09 KiB) Downloaded 39 times
EDIT: and same happens to Part-o-magic's Module. Module is different to Body in that it doesn't have the DisplayModeBody property; the same behavior is controlled by picking a display mode between "Flat Lines" and "Group".
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Links

Post by DeepSOIC »

Another bug.
1. Load:
just body.FCStd
(9.48 KiB) Downloaded 45 times
2. Type this into Py console, press enter:

Code: Select all

App.ActiveDocument.Body.getSubObject("Pad.Edge1")
-> a message box pops up saying "Unhandled C++ exception"
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Links

Post by wmayer »

If I select both overlapped points (using box select), the highlight shows up. Also, if I rotate the camera a little bit, the highlight shows up. But if I align the view again, the highlight disappears.
To me it looks like the famous z-fighting problem. When I rotate the sketch then in some positions the coincident points appear in red and when moving a bit further they are green.

OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6706 (Git)
Build type: Release
Branch: releases/FreeCAD-0-16
Hash: f86a4e411ff7848dea98d7242f43b7774bee8fa0
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Links

Post by DeepSOIC »

wmayer wrote:To me it looks like the famous z-fighting problem.
Yeah, looks like it. But I know that selected points should get elevated, to eliminate that very problem. Was that removed?
Post Reply