Assembly3 preview

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
kwahoo
Posts: 679
Joined: Fri Nov 29, 2013 3:09 pm
Contact:

Re: Assembly3 preview

Post by kwahoo »

Jee-Bee wrote: Fri May 20, 2022 9:45 am I understand that i as user should adapt to the CAD package. to some point yes. I do for example i like to explicit over constrain hole patterns to be sure that there are no mistakes. This works great in Creo or NX, but SolidWorks can't handle this. Or Locking items in Solidworks(temporary) when flipping otherwise SW explode.

I would consider this as a bug (Since it is a basic CAD operation). And Assembly 3 need a better DOF filtering mechanism....
Probably relevant:
Assembly3: Consider enabling SolveSpace flag Group.allowRedundant

One of Creo tricks is sequential solving. It does not solve all constraints at the same time, but only constraints between part 2 (can move) and 1 (already locked), then locks part 2 and solves constraints between part 3 and locked parts (1 and 2), and so on.

But this does not explain why solver never fails if two parts are overconstrained. Maybe it divides constraints in smaller groups internally and compares results (positions calculated by solver) of each group?
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: Assembly3 preview

Post by realthunder »

kwahoo wrote: Mon Jul 04, 2022 9:12 pm Probably relevant:
Assembly3: Consider enabling SolveSpace flag Group.allowRedundant
I've checked that flag. It mostly seem to be used by the SolverSpace GUI to not report redundant constraint as error. The solver itself does not use that flag, and will report status as 'solve with redundancy', which is recognized by asm3 and will only report as warning. It's just that the solver does have a limit on how much redundancy it can handle.
One of Creo tricks is sequential solving. It does not solve all constraints at the same time, but only constraints between part 2 (can move) and 1 (already locked), then locks part 2 and solves constraints between part 3 and locked parts (1 and 2), and so on.
That will only work if the pair of parts are completely fixed with each other by a set of constrains. asm3 has a limited implementation for that, and it work only works for Attachment constraint, which is the only single constraint that fixes a pair of parts. Right now, breaking down bigger assembly into smaller isolated and fixed sub-assembly can consider a manually way of achieving the same result.

But this does not explain why solver never fails if two parts are overconstrained. Maybe it divides constraints in smaller groups internally and compares results (positions calculated by solver) of each group?
asm3 has some limited implementation to auto relax redundant constraints, for example, you can fix two objects by two holes using two plane coincident constraint. It recognize this common use case, and will change the second plane coincident to a more relaxing one. I am not aware of any systematic ways to handle all possible redundancies. I guess other CAD just have more elaborated algorithm to detect more use cases.
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
kwahoo
Posts: 679
Joined: Fri Nov 29, 2013 3:09 pm
Contact:

Re: Assembly3 preview

Post by kwahoo »

realthunder wrote: Thu Jul 07, 2022 3:00 am asm3 has a limited implementation for that, and it work only works for Attachment constraint, which is the only single constraint that fixes a pair of parts.
After applying Attachment constraint matches implicit coordinate systems of selected Elements. It results that at least 1 part is moved, if Elements weren't already coincident. After this an user has to manually add offset/rotation to one of Elements.

What do you think about implementing Attachment that preserves current position of parts? It would have to calculate necessary Element offset and rotation.

The user workflow could be like this:
1. Use other constraints to set position of 2 parts
2. Apply "preserving position" Attachment
3. Disable earlier (before Attachmnent) constraints
User avatar
FBXL5
Posts: 957
Joined: Sat Aug 03, 2019 8:45 pm

Re: Assembly3 preview

Post by FBXL5 »

kwahoo wrote: Thu Jul 07, 2022 4:15 pm What do you think about implementing Attachment that preserves current position of parts? It would have to calculate necessary Element offset and rotation.
That is what I expected how Attachment works, too.
But it could overlap with the "Freeze Assembly" function.
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: Assembly3 preview

Post by realthunder »

kwahoo wrote: Thu Jul 07, 2022 4:15 pm The user workflow could be like this:
1. Use other constraints to set position of 2 parts
2. Apply "preserving position" Attachment
3. Disable earlier (before Attachmnent) constraints
This is actually a pretty good feature that I find myself wanting it some times. So I just added it. You can update the asm3 module through add-on manager to try it. It is added in the form of a new 'AttachmentOffset' constraint. Right now, it does not auto disable other constraints of the same pair of parts. You will get some warning of skipping fixed parts in some constraints (because of the Attachment). You can manually disable those constraints to get rid off the warning. Using relation view makes it easier to find out the constrains that involving a given part. The reason of not auto disabling is because some constraint can involve more than one pair of parts. So disabling it may cause unwanted movement in other parts.

Once you've created the AttachmentOffset contrstraint and want to change the relative placement of the parts later. You can manually change the element offset by right click any of the element grouped under the constraint, and select 'Offset element'. Or, hold 'Ctrl' key (to bypass auto solving) and then drag the part to a new location using the mover tool, and then right click the AttachmentOffset constraint, and select 'Update element offset'.
Screenshot from 2022-07-15 10-21-53.png
Screenshot from 2022-07-15 10-21-53.png (85.97 KiB) Viewed 17296 times
Screenshot from 2022-07-15 10-23-30.png
Screenshot from 2022-07-15 10-23-30.png (45.69 KiB) Viewed 17296 times
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
kwahoo
Posts: 679
Joined: Fri Nov 29, 2013 3:09 pm
Contact:

Re: Assembly3 preview

Post by kwahoo »

realthunder wrote: Fri Jul 15, 2022 2:46 am This is actually a pretty good feature that I find myself wanting it some times. So I just added it.
Superb! This is really game changer for me.

But I found something, that does not work as intended IMO. In the file:
attachment-offset-test.FCStd
(98.26 KiB) Downloaded 102 times
There are 3 bodies (Body, Body001 and Body002) connected with attachment offtet and next 2 (Body003 and Body004) connected in similar way.
And there is a Plane Coincident constraint between Body002 and Body003 to create "a hinge."

And now, if Body003 and Body004 are connected using Attachment, the "hinge" works as expected when Body004 is dragged:
Image

But if I use Attachment Offset, Body003 and Body004 do not seem constrained:

Image
User avatar
jpg87
Posts: 808
Joined: Thu Mar 16, 2017 7:16 am
Location: Limoges - France
Contact:

Re: Assembly3 preview

Post by jpg87 »

kwahoo wrote: Thu Jul 07, 2022 4:15 pm The user workflow could be like this:
1. Use other constraints to set position of 2 parts
2. Apply "preserving position" Attachment
3. Disable earlier (before Attachmnent) constraints
realthunder wrote: Fri Jul 15, 2022 2:46 am This is actually a pretty good feature that I find myself wanting it some times. So I just added it. You can update the asm3 module through add-on manager to try it.
Thank you @realthunder for this addition : I had already tried the procedure quoted by @kwahoo , but it did not work each time.
My website : http://help-freecad-jpg87.fr updated 2023/11/06
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: Assembly3 preview

Post by realthunder »

kwahoo wrote: Fri Jul 15, 2022 4:50 pm And now, if Body003 and Body004 are connected using Attachment, the "hinge" works as expected when Body004 is dragged:
But if I use Attachment Offset, Body003 and Body004 do not seem constrained:
I have just fixed problem. Note that in your case, AttachmentOffset (or Attachment) will be converted to PlainCoincident with locked angle and feed to solver. In theory, it should be possible to isolate those parts that are completely fixed with each other by Attachment and treat them as single sub-assembly for solving. I haven't implement that yet. Right now, the Attachment(Offset) constraint will bypass solver if and only if it is directly attached to a Locked part, or indirectly through some part that is attached to a Locked part, and so forth.
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
kwahoo
Posts: 679
Joined: Fri Nov 29, 2013 3:09 pm
Contact:

Re: Assembly3 preview

Post by kwahoo »

realthunder wrote: Sat Jul 16, 2022 8:42 am I have just fixed problem. Note that in your case, AttachmentOffset (or Attachment) will be converted to PlainCoincident with locked angle and feed to solver.
Thank you.
This change is enough to improve the workflow a lot. It seems, an user does not need to be super careful about overconstraining any more, since every group of constraints for a rigid pair of parts can be replaced with a single constraint.
An user needs still be careful where kinematics is involved, but hey, "kinematic constrains" are not reliable in commercial CAD software too.
catman
Posts: 412
Joined: Fri Jan 11, 2019 10:42 pm

Re: Assembly3 preview

Post by catman »

realthunder wrote: Fri Jul 15, 2022 2:46 am This is actually a pretty good feature that I find myself wanting it some times. So I just added it.
Excellent feature. Thanks a lot!

What you say about the risks of automatical deletion is true. Maybe a a Temp mode can be an intuitive solution and a very cool feature by itself:

Use case;
  • Press the "Temp Constraint" button.
    Its a toggle button clearly showing the active state by an inverse image
  • Add any number of constraints. They are used and work as usual
    Internally a non-persistent flag is set to new constraints and new elements.
  • Release "Temp Constraint" button
    All tagged constraints and elements are deleted. The Assembly is re-calculated. As result the new part positions remain where no old constraints are affects.
  • Set Attachment Offset between the now properly positioned parts
Wouldn't that be the same than a manual move of components by mouse? I think its its safe against unwanted side effects because only new items are deleted and the user is fully aware (and in control) of the mode. Its even safer than manual deletion because it does not delete an element that was used in another constraint.
The tooltip is enough to explain the feature, e.g. "Toggles Temp Mode. During Temp Mode all added constrains and elements are lost when Temp Mode is ended. Its automatically ended when you close the workbench"


Its even very useful without the "Attachment Offset" constaint, i.e. to just quickly position parts or during design to test different placement options. I would often use constraints for one-time placements but its too complicated to manually delete the contraints and all involved elements (incl. identifying them).
Post Reply