Assembly 2 - prevent broken constraints and/or resurect them

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
OakLD
Posts: 99
Joined: Fri Jan 12, 2018 7:38 pm
Location: Brno

Assembly 2 - prevent broken constraints and/or resurect them

Postby OakLD » Sun Feb 18, 2018 3:03 pm

I understand well, that FreeCad and many of it's modules are in development, so this is no complaint at all.

When I create assemblies using Assembly 2 WB, it works quite well first time I constrain the parts. However, when I modify a part and update the assembly via pressing the update button in Assembly2 workbench, I often get broken constrains (or more precisely their appearance, they look displaced on the screen).

The typical change isadding a n extra pocket like this:

One would expect, that the face in which the pocket is hosted would keep it's ID, but looking into Constraint details and comparing it with what I see when I select the faces in "Selection View", I see that the face got a new name. When I modify the face name in the constraint (thanks to the this forum for a solution) to what I see in Selection View (i.e. Face12 instead Face33), the constraint resurects and the part takes it's correct position in the constrained direction.

EDIT: What's worse, ALL the faces of modified part get different name, even those left untached by any changes.

Many assemblies are requiring assembling and then number of iterations of components changes along the design procedure. It's invevitable even in the home project I test it on.

So I have the two questions:
1) Are there any tricks or workarounds to avoid such troubles?
2) Are there any tools or procedures to repair broken contraints?
3) Is there any tool or command to purge unused constraints (left after deleting a part instance)?

I also tested FC0.17 with Assembly3, but id doesn't work for me at all, the parts don't get updated/aligned, when constraints are applied.

OS: Windows 10, Windows 7, Opensuse Leap 42.3
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6712 (Git)
Build type: Release
Branch: releases/FreeCAD-0-16
Hash: da2d364457257a7a8c6fb2137cea12c45becd71a
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17

Regards,

Oak
Regards,

Oak
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Assembly 2 - prevent broken constraints and/or resurect them

Postby NormandC » Sun Feb 18, 2018 3:38 pm

Hello Oak,

OakLD wrote:
Sun Feb 18, 2018 3:03 pm
One would expect, that the face in which the pocket is hosted would keep it's ID, but looking into Constraint details and comparing it with what I see when I select the faces in "Selection View", I see that the face got a new name. When I modify the face name in the constraint (thanks to the this forum for a solution) to what I see in Selection View (i.e. Face12 instead Face33), the constraint resurects and the part takes it's correct position in the constrained direction.

EDIT: What's worse, ALL the faces of modified part get different name, even those left untached by any changes.
Unfortunately, that's one of the worst weaknesses of FreeCAD, inherent to the OCC geometric kernel, and it is known here as the topological naming issue. It's been mentioned countless times on the forum, a few programmers have attempted to tackle this problem over the years, but it's a complex one.

The PartDesign workbench in 0.17 brings new features that will help in building more robust models, but it will not completely eradicate the issue.

On the other hand, I'm proficient with a commercial parametric CAD program which I use daily at my job, and it too suffers from this issue, albeit to a lesser extent. Since that commercial program no doubt benefits from an army of full-time paid programmers, I'm guessing it's a very tough nut to crack. So I sometimes need to fix failed assembly relationships when the parts topology was changed. Same thing in models, I need to reattach sketches, fix external geometry. In that software I guess it would be possible to create bulletproof models, but it would require a lot more time building them; it's really a trade-off between having to occasionally fix failed features and spending a lot more time modelling the parts.

As for your specific questions about Assembly2, I'm afraid I don't use it, so I can't help.
triplus
Posts: 8786
Joined: Mon Dec 12, 2011 4:45 pm

Re: Assembly 2 - prevent broken constraints and/or resurect them

Postby triplus » Sun Feb 18, 2018 3:47 pm

OakLD wrote:
Sun Feb 18, 2018 3:03 pm
However, when I modify a part and update the assembly via pressing the update button in Assembly2 workbench, I often get broken constrains (or more precisely their appearance, they look displaced on the screen).
Hi Oak.

When you go back in design history and you add or remove geometry. Yes that is the expected behavior:

https://forum.freecadweb.org/viewtopic. ... 36#p215482
1) Are there any tricks or workarounds to avoid such troubles?
2) Are there any tools or procedures to repair broken contraints?
3) Is there any tool or command to purge unused constraints (left after deleting a part instance)?
In short. No. When you create parent <-> child relationship and you change topology (number of for example faces) of the parent. You usually need to redefine the relationship after.

P.S. In the future there will likely be some (history based) topology/geometry solution in FreeCAD. Trying to mitigate this behavior and to more accurately predict what is for example the correct face for relation to use. For now this part is entirely left up to the end user. To manage. But note that with gaining experience it gets better.
User avatar
OakLD
Posts: 99
Joined: Fri Jan 12, 2018 7:38 pm
Location: Brno

Re: Assembly 2 - prevent broken constraints and/or resurect them

Postby OakLD » Mon Feb 19, 2018 9:03 am

Thank you for both answers. We got a bit off-topic, but it's interesting nevertheless. I had a feeling myself, that the relationship structure in FreeCad is a bit troublesome. From the practical point, I doubt a user can "get used to it" and repair the relationships all the time. When I tried the procedure past weekend, I spend about 95% fixing the relationship (against 5% design time). This is simply not feasible. The only real scenario is to knowing what the result will be and model everything precisely. In case of assemblies with many members this effectively means to design the assembly elsewhere (paper, SketchUp, 2D CAD,...) at least to some level to get a good idea of the result and do the final execution of the idea in FreeCAD (parts, assemblies, drawings). This is not expected workflow from a 3D CAD and of course it' a show-stopper for most productive/commercial usage (again, this is not a criticism, just a statement), but for an opensource program in development stage is OK (has to be accepted by a user).

I had a look into FeaturePocket.cpp in the source code, but I am not good in c++ and also as I expected, it seems to have a lot of relations to other functions and features. The topology as is now was probably enforced by the way solids are defined, faces found and designated, etc. That will be a pretty complex stuff. The alhorithm of the dealing with edited faces itself is quite trivial though, it's the interpreting this alghorithm in given environmnet, which I guess is very difficult.
On the other hand, I'm proficient with a commercial parametric CAD program which I use daily at my job, and it too suffers from this issue, albeit to a lesser extent. Since that commercial program no doubt benefits from an army of full-time paid programmers
Well, let's be honest, that even though there are some ocasional glitches in most major 3D CADs, even those based on the newest parasolid, which they promised would be "flawless", there are no problems with the common stuff like a change of constraint dimension or an extra pocket. But the claim about the army of programmers is true, there's a lot of investments by Siemens or Dassault or such into 3D CAD/CAMs. Though, 5 good motivated programmers can do more than 100 employed to do the same job. In this sccope, the achievement of FreeCAD is really awsome already.
Regards,

Oak
User avatar
easyw-fc
Posts: 2689
Joined: Thu Jul 09, 2015 9:34 am

Re: Assembly 2 - prevent broken constraints and/or resurect them

Postby easyw-fc » Mon Feb 19, 2018 1:06 pm

Please have a look at Assembly 3 dev branch, this would probably cover your needs...
triplus
Posts: 8786
Joined: Mon Dec 12, 2011 4:45 pm

Re: Assembly 2 - prevent broken constraints and/or resurect them

Postby triplus » Mon Feb 19, 2018 1:45 pm

Changing constraint value is in general OK. Going back in design history to add an additional pocket changes topology. Assembly relations fur such part therefore will likely need to be redefined after. That is correct yes. Note that once FreeCAD will have some (history based) topology/geometry solution tackling this area. Things will likely improve. As for some thinking and planning ahead when using a parametric CAD. Yes you correctly identified this too. It's called design intent.

P.S. But as said it gets better with experience. ;)
User avatar
OakLD
Posts: 99
Joined: Fri Jan 12, 2018 7:38 pm
Location: Brno

Re: Assembly 2 - prevent broken constraints and/or resurect them

Postby OakLD » Mon Feb 19, 2018 2:23 pm

easyw-fc wrote:
Mon Feb 19, 2018 1:06 pm
Please have a look at Assembly 3 dev branch, this would probably cover your needs...
I did have a look, but it doesn't work at all, or I don't use it correctly. When I apply "Plane alignment" constraint, I can see new entries in the new Assembly tree within "Constraints" and "Elements" nodes, but the parts refuse to react in any way to the applied constraints. I couldn't find any information about current state of Assembly 3, so I asumed it could as well be in very early development stage.
Regards,

Oak
User avatar
OakLD
Posts: 99
Joined: Fri Jan 12, 2018 7:38 pm
Location: Brno

Re: Assembly 2 - prevent broken constraints and/or resurect them

Postby OakLD » Mon Feb 19, 2018 2:44 pm

triplus wrote:
Mon Feb 19, 2018 1:45 pm
Changing constraint value is in general OK. Going back in design history to add an additional pocket changes topology. Assembly relations fur such part therefore will likely need to be redefined after. That is correct yes. Note that once FreeCAD will have some (history based) topology/geometry solution tackling this area. Things will likely improve. As for some thinking and planning ahead when using a parametric CAD. Yes you correctly identified this too. It's called design intent.

P.S. But as said it gets better with experience. ;)
Well, I'm ipressed anyway :-). I've been glancing at the project for many years and when I tested it now after another few years, I was positively shocked at how far the project got.

I decided to use FreeCAD for some home projects like a barn I will be building this season, as an alternative to SketchUp (free version without LayOut) I'm used to. I have a model in SketchUp already (had to do it 3 years ago for a planning permision), but I estimate that for the final detailing and printing drawings, SU is worse than FreeCAD even in it's development stage. And even if the pain was to be even, I decided to do it for the sport of learning FreeCAD. Perhaps I could contribute little too. I think I will be able to finish this CAD model, even though the comments in this thread means to plan ahead some 100+ parts precisely...
Regards,

Oak
User avatar
easyw-fc
Posts: 2689
Joined: Thu Jul 09, 2015 9:34 am

Re: Assembly 2 - prevent broken constraints and/or resurect them

Postby easyw-fc » Mon Feb 19, 2018 2:55 pm

OakLD wrote:
Mon Feb 19, 2018 2:23 pm
I did have a look, but it doesn't work at all, or I don't use it correctly. When I apply "Plane alignment" constraint, I can see new entries in the new Assembly tree within "Constraints" and "Elements" nodes, but the parts refuse to react in any way to the applied constraints. I couldn't find any information about current state of Assembly 3, so I asumed it could as well be in very early development stage.
https://github.com/realthunder/FreeCAD_ ... /Readme.md
https://github.com/realthunder/FreeCAD_ ... wiki/Usage
and the A3 thread
https://forum.freecadweb.org/viewtopic.php?f=20&t=25712
triplus
Posts: 8786
Joined: Mon Dec 12, 2011 4:45 pm

Re: Assembly 2 - prevent broken constraints and/or resurect them

Postby triplus » Mon Feb 19, 2018 3:04 pm

OakLD wrote:
Mon Feb 19, 2018 2:23 pm
When I apply "Plane alignment" constraint...
That Plane relation in Assembly 3 is a tricky one indeed. I tend to avoid it for now. Hopefully it will improve a bit over time. Create Assembly feature and drag and drop two Part cubes in it. Select two points on Cubes edges and add PointCoincidence relation. If you have Auto recompute set to ON it should just work. If no press on Solve constraints command after. But note that Assembly 3 doesn't resolve the topology related behavior we discussed earlier.
Well, I'm ipressed anyway :-).
Welcome to the club. :)
I decided to use FreeCAD for some home projects like a barn I will be building this season, as an alternative to SketchUp (free version without LayOut) I'm used to.
I would likely recommend exploring Arch workbench for such project. In Architecture fully parametric approach (like in mechanical engineering) usually isn't needed. Said that in FreeCAD Arch workbench offers a lot of parametric features. And you could design a house in Part Design. If that is what you would like to do. ;)