Assembly3 preview

Discussion about the development of the Assembly workbench.
catman
Posts: 260
Joined: Fri Jan 11, 2019 10:42 pm

Re: Assembly3 preview

Postby catman » Sat Feb 22, 2020 9:28 pm

In a bit larger assemblies I find it a challenge to avoid redundant constraints. As realthunder described earlier the solver is able to take a few redundant constraints but if its too much it will fail. For me it starts to get difficult once I get acrosss 50 elements. At some point the solver would fail with "inconsistent constraints", where the cause seems to be rather too many "redundant constraints" (just a guess). At least this happended several times when adding a constraint to a part that did not have any constraint before.

While its great to have the "disable" function in the context menu (A2plus was missing that), the hard thing is to find out which ones are the redundant constraints. The last one added might not be the cause of the failure. I tried the AssemblyObject/Properties/Verbose=true but I was not yet able to understand which bits from the several pages of information in the report view I need to find the faulty parts.

So I thought instread of uploading large files with linked assemblies, maybe its helpful to discuss about how to constraint simple situations so that redundant constraints are avoided.

For example, how to constrain two parts made to be attached to each other with srews?
The image below is a simple case that yields the error "inconsistent constraints", at least after misaligning the parts. I think the problem is about DegreesOfFreedom (DOF). We need to get from 6 to 0 to be fully constraint, but not below 0. Also we should constrain each axis once, and only once. That requires a good understanding about which DOF each constraint removes.
ProperAsm3Constraints_1.jpg
ProperAsm3Constraints_1.jpg (43.72 KiB) Viewed 857 times

So above we have
  • Axis alignment, leaving 2 DOF. It takes all but axis rotation and axis movement
  • PlaneCoincident, leaving 1DOF, it takes all but axis rotation
That means we take away 4+5=9 DOF, but we only have 6. On the other hand we leave out 1, so the part is not properly constraint.

The PlaneCoincident constrains offer the property "lock angle" which takes all 6 DOF, but in the case above we do not have a reference for 0°. There is not simple way to define that, so a proper constaint set for this case is not trivial.

Another solution might be to align one axis and the the bottom faces. This does not work, because the two parts are not straight, so the holes would not align when the two bottom faces would be aligned. But even in cases where this is not a problem there are still have redundant constraints, so this
  • Axis alignment, leaving 2 DOF. It takes all but axis rotation and axis movement
  • PlaneAlignment,leaving 3 DOF, it takes away axis translation and both non-axis rotations.
does not work, because it still leaves the axis rotation unconstraint, but causes redundant constraints for the non-axis rotations.

What I found to work is
  • Axis alignment, leaving 2 DOF. It takes all but axis rotation and axis movement
  • PointsDistance, leaving 5 DOF, it works in spherical space and takes away radial distance and axis translation and both non-axis rotations.
While the system says there is still one DOF open, the part is fully constraint for practical use ;). The second constraint is applied by selecting the two circles of the yet unconstraint hole. By selecting the PointsDistance constraint the system knows to use their invisible center points. Maybe there is a way to set up FreeCAD to also show center point on selection? In this case it would be useful.
ProperAsm3Constraints_2.jpg
ProperAsm3Constraints_2.jpg (40.25 KiB) Viewed 857 times
Working attachment with 2 hole aligned without redundant constraints (hopefully). This file is attached.

I am not sure about the best solution, but from this exmple I think that to master Assembly3 its a required step to learn which DOFs each constraint takes away (not only how many). As its not very intuitive to think about that for each constraint step, I guess its quite helpful to to come up with some optimized solutions for the current Assembly3 solver for standard situations like
  • align at one corner and faces
  • mount on a suface aligning faces
  • attaching a srew
  • align a part at two hole
  • mount axial aligning one face
  • mount axial aligning a radial (line)

etc.

This is the file with the last solution
ProperAsm3Constraints_1.FCStd
(52.33 KiB) Downloaded 6 times
realthunder
Posts: 1752
Joined: Tue Jan 03, 2017 10:55 am

Re: Assembly3 preview

Postby realthunder » Sat Feb 22, 2020 11:51 pm

catman wrote:
Fri Feb 21, 2020 12:42 pm
Yesterday, I noted that when importing FastenerWB parts with 'Ctrl-drag' to an assembly container they were not imported as link. Thus I could not use the "ElementCount" property. So I made multiple copies and pulled them into the assembly, but it felt a bit like an inefficient way of doing things. I noted that Zolko had added special buttons in his Assembly4 workbench for adding Fasteners with an LCS features.
Is there a workaround to utilize "ElementCount" for FastenerWB items or does it make sense to port such a function to Assembly3 as well?
I will add the active assembly feature in the future, probably not for the current pending release, but the next. Once there is an active assembly, newly created object will be automatically added to the container. Meanwhile, you can change an existing part inside an assembly to a link using the tree view context menu 'Link actions -> Replace with link'. Just right click the part you want to change to a Link.

catman wrote:
Sat Feb 22, 2020 9:28 pm
I was not yet able to understand which bits from the several pages of information in the report view I need to find the faulty parts.
Yes, it needs some improvement. Just like compiler error output, the solver output is not intuitive in many cases. It is not easy to improve, though.

catman wrote:
Sat Feb 22, 2020 9:28 pm
For example, how to constrain two parts made to be attached to each other with srews
If two parts are constrained using only one screw, and one of them is fixed by 'Lock' constraint, the best constraint to use is 'Attachment' constraint, which does not use the expensive algebra solver if possible. It can also work if neither parts is fixed, but one of them is indirectly fixed by another 'Attachment'. If the condition cannot be met, the attachment constraint will be treated as PlaneCoincience with locked angle, and passed to solver.

catman wrote:
Sat Feb 22, 2020 9:28 pm
Maybe there is a way to set up FreeCAD to also show center point on selection? In this case it would be useful.
There is a way to display it. It's quite new, and does not work quite well in my latest release. I have fixed in in the pending release. You can show the 'LCS' of each element by either change the element object's 'ShowCS' property in the View (not Data) property page, or use the following toolbar button to show it for all elements.
Screenshot from 2020-02-23 07-37-50.png
Screenshot from 2020-02-23 07-37-50.png (25.26 KiB) Viewed 839 times

catman wrote:
Sat Feb 22, 2020 9:28 pm
I am not sure about the best solution, but from this exmple I think that to master Assembly3 its a required step to learn which DOFs each constraint takes away (not only how many). As its not very intuitive to think about that for each constraint step, I guess its quite helpful to to come up with some optimized solutions for the current Assembly3 solver for standard situations like
align at one corner and faces
mount on a suface aligning faces
attaching a srew
align a part at two hole
mount axial aligning one face
mount axial aligning a radial (line)
asm3 does have special logic for common situation because of the difficulty in DOF counting, most notably the two holes problem. If there are two PlaneCoincidence constraints applied to the same pair of parts, the second one will be reduced to either PointsHorizontal or PointsVertical, which is quite counter intuitive.

There are similar handling for multiple PlaneAlignment constraints (the three-face-alignment problem, probably the same as your aligning at corner problem). The first one is treated as Orientation + PointInPlane, the second one reduced to Parallel of plane normals that are projected (i.e. 2D parallel) to the plane of the first PlaneCoincidence, and the third one PointInPlane. Extra PlaneAliengments are ignored.

For multiple AxialAginment, the first one is Parallel + PointOnLine, and the second one is reduced to just PointOnLine. This can cover your last two axial alignment cases.

For screw attaching, you can try the 'Attachment' plus the constraint multiplication feature.
Try Assembly3 (latest version 0.11) along 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
OficineRobotica
Posts: 324
Joined: Thu Feb 21, 2019 8:17 am

Re: Assembly3 preview

Postby OficineRobotica » Sun Feb 23, 2020 6:12 am

realthunder wrote:
Sat Feb 22, 2020 11:51 pm
There is a way to display it. It's quite new, and does not work quite well in my latest release. I have fixed in in the pending release. You can show the 'LCS' of each element by either change the element object's 'ShowCS' property in the View (not Data) property page, or use the following toolbar button to show it for all elements.
It is a bit of time that I think about this. As FC is a local coordinate system aware software there was no way that one could instantly visualize the coordinates of a given selection. As there is a duplication of global coordinates display in the viewport (the top cube and the bottom arrow coordinate display) why not make the bottom one always display the LCS for the current selection instead of the global coordinates? From a usability stand point that would be a great plus for all workbenches if implemented at the base level not just for asm3. Perhaps with a small text underneath it "LCS" to avoid confusion. As of the current implementation , if i select an element with the "show LCS" option enabled , the lcs is highlighted in green and i cannot tel which axis is which. Imagine how much easier manual rotations about an axis would be with a clear representation of the selection LCS.

asm3CoordinateSystem.jpeg
asm3CoordinateSystem.jpeg (280.58 KiB) Viewed 803 times

Thank you for your great work.
Cheers.
realthunder
Posts: 1752
Joined: Tue Jan 03, 2017 10:55 am

Re: Assembly3 preview

Postby realthunder » Sun Feb 23, 2020 7:22 am

OficineRobotica wrote:
Sun Feb 23, 2020 6:12 am
Imagine how much easier manual rotations about an axis would be with a clear representation of the selection LCS.
It's a bit more complex than just show the LCS, because the actual transformation may happen in a different context. asm3 mover is implemented with this difference in mind.

When you select any geometry element of a part (face, edge, vertx), and start the axial mover, the dragger axis will be shown under the LCS of that element, not the part object's, but the geometry element's LCS. The difficult part is to determine under which context shall the transformation be applied, in other word, which object's Placement to change. By default, asm3 mover changes the part Placement in the top level assembly. The actual owner of the selected element may live deep down the part hierarchy. The user can change the context by adding a second selection of an intermediate assembly container before activating the mover.

I can maybe implement this mover logic within the FC core somehow.
Try Assembly3 (latest version 0.11) along 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
OficineRobotica
Posts: 324
Joined: Thu Feb 21, 2019 8:17 am

Re: Assembly3 preview

Postby OficineRobotica » Sun Feb 23, 2020 9:51 am

realthunder wrote:
Sun Feb 23, 2020 7:22 am
It's a bit more complex than just show the LCS, because the actual transformation may happen in a different context. asm3 mover is implemented with this difference in mind.

I understand now your point. If I select a face the LCS of that face will be displayed but the rotation will happen in the body context. But we also have this great system where clicking again on the face will select the upper parent. If one is aware of the chain of interaction , having the coordinate system of the selection displayed in the bottom corner would be of great visual help. It would be awesome if you could manage to implement it in this simple form. Just display the LCS of the selection. If one needs to understand the positioning of a 3d component continues to click it until it reaches the desired upper parent. Thank you for your quick response
User avatar
jpg87
Posts: 414
Joined: Thu Mar 16, 2017 7:16 am
Location: Limoges - France
Contact:

Re: Assembly3 preview

Postby jpg87 » Sun Feb 23, 2020 10:18 am

realthunder wrote:
Fri Feb 21, 2020 7:56 am
Check out this. You can add dynamic properties of any type to any object. You can remove them too, but that should be done with caution in case it is not added by you, even though it can be undone.
Thank you for the link. I discovered very interesting novelties, in particular deepenings for Link, very interesting additions for PartDesign (multi solid, possibility of applying a transformation to the whole body and not only to the active function in particular the total symmetry which PDN misses a lot ...). So I subscribed to your You Tube channel!

I would like to take this opportunity to make a suggestion: wouldn't it be wiser for the highlighting in PartDesign to be applied to the only function selected in the tree rather than the entire body? Perhaps it is difficult to set up?

It is always a great pleasure to discover your contributions to FreeCAD. Thank you again for the work accomplished.
My website : http://help-freecad-jpg87.fr updated 2020/10/17
catman
Posts: 260
Joined: Fri Jan 11, 2019 10:42 pm

Re: Assembly3 preview

Postby catman » Mon Feb 24, 2020 12:37 pm

realthunder wrote:
Sat Feb 22, 2020 11:51 pm
catman wrote:
Fri Feb 21, 2020 12:42 pm
Is there a workaround to utilize "ElementCount" for FastenerWB items or does it make sense to port such a function to Assembly3 as well?
Meanwhile, you can change an existing part inside an assembly to a link using the tree view context menu 'Link actions -> Replace with link'.
Well, that is not a workaround, that is the solution :D . No need for further changes, because it does a) group all screws of the same type in one folder and b) allows to use the ElementCount to create more cheap instances with individual placement. The only drawback is that one grey copy of each type of screw imported remains outside the Assembly container, but this is a very minor snag.


realthunder wrote:
Sat Feb 22, 2020 11:51 pm
catman wrote:
Sat Feb 22, 2020 9:28 pm
I was not yet able to understand which bits from the several pages of information in the report view I need to find the faulty parts.
Yes, it needs some improvement. Just like compiler error output, the solver output is not intuitive in many cases. It is not easy to improve, though.
I see that this will not be an easy part. I guess the constraints part will remain a construction site for a bit longer because it can be quite complex. No idea if that makes sense with the constraint algorithm, but is a "single Step mode" mode like in a debugger a possible idea? With a visual feedback in the tree one could see each constraint completed at a time and possible see "redundant constraints" or "not convergent" items. At this time I tend to throw away files that did not work and re-do them, because it seems quicker than to track down problems. As I am trying to build rather steel hierachies that is quick to do and assures there are clean files. But being able to repair cad constraint choices would be an important part of the work flow, I guess.

realthunder wrote:
Sat Feb 22, 2020 11:51 pm
catman wrote:
Sat Feb 22, 2020 9:28 pm
For example, how to constrain two parts made to be attached to each other with srews
If two parts are constrained using only one screw, and one of them is fixed by 'Lock' constraint, the best constraint to use is 'Attachment' constraint, which does not use the expensive algebra solver if possible. It can also work if neither parts is fixed, but one of them is indirectly fixed by another 'Attachment'. If the condition cannot be met, the attachment constraint will be treated as PlaneCoincience with locked angle, and passed to solver.
The case with one screw is the trivial one, unfortunately. Its the standard case to for adding "screws" themselfs, though. Please see my comments for "Attachment" 2 sections below.

realthunder wrote:
Sat Feb 22, 2020 11:51 pm
catman wrote:
Sat Feb 22, 2020 9:28 pm
Maybe there is a way to set up FreeCAD to also show center point on selection? In this case it would be useful.
You can show the 'LCS' of each element by either change the element object's 'ShowCS' property in the View (not Data) property page, or use the following toolbar button to show it for all elements.
Sorry, I meant something different, for example in this screenshot.
FreeCAD_SelectionWithCenter.jpg
FreeCAD_SelectionWithCenter.jpg (2.83 KiB) Viewed 671 times
Here I selected a circular edge, but the system marks the center of the circle and offers me the center point to select as well. When your constraints work with points such as "Points-on-Line" it would be intuitive if the user is presented with points (2D circles) and lines (3D cylinders like holes) for selection. Probably that requires an assembly-only selection mode and more core changes. But in the long term, that is something any assembly solution would really require anyway, imho.

realthunder wrote:
Sat Feb 22, 2020 11:51 pm
asm3 does have special logic for common situation because of the difficulty in DOF counting, most notably the two holes problem. If there are two PlaneCoincidence constraints applied to the same pair of parts, the second one will be reduced to either PointsHorizontal or PointsVertical, which is quite counter intuitive.
There are similar handling for multiple PlaneAlignment constraints (the three-face-alignment problem, probably the same as your aligning at corner problem). The first one is treated as Orientation + PointInPlane, the second one reduced to Parallel of plane normals that are projected (i.e. 2D parallel) to the plane of the first PlaneCoincidence, and the third one PointInPlane. Extra PlaneAliengments are ignored.
For multiple AxialAginment, the first one is Parallel + PointOnLine, and the second one is reduced to just PointOnLine. This can cover your last two axial alignment cases.
For screw attaching, you can try the 'Attachment' plus the constraint multiplication feature.
It is very interesting to learn that your included intelligence to modify constraints from less-than-optimal user selections. I am not sure yet whether its a good thing or a bad one, because in other areas than CAD I saw users working against complex algorithms (because not fully understanding what they did), ending up with a very unstable solution which got worse by adding complexity instread of cleaning up the initial setup. What I was trying to do with selecting constraints for standard cases was under the assumption that those were applied as selected. I am not sure, does this apporach work against your traget to solve the issue in the background. Specifically: is it better for you to feed back errors/bugs to you from applying two "AlxisAlignment" constrataints for the two hole example case (https://forum.freecadweb.org/posting.ph ... 5#pr371280) to hone out that algorithm or is it better to try to find a solution that works for the solver natively?

I have tested the "Attachment" constraint for attaching parts that are attached with multiple screws in real life. The most important info was that Attachment constraint saves on solver time, which I was not aware of. Maybe I am wrong, but this seems to be the counterpart of Zolkos Assembly4 LCS, just presented as constraint?
So its usable, but its really not fun, because your are forced to click though this usability-nightmare-of-a-default-orientation property, because whatever you do, your part will be misaligned. After two clicks got get your part close to its final destination you need heaps of clicks to get to the 'angle' field of one of the element, then enter manually an even number (15°deg, 45°, 90° steps or the negaitve conterparts) and each time click elsewhere to see where your are (I might be a bit biased because there was little love between me and this dialog from the first use :oops:).
So for assembly purposes I am convinced that we should use instread of this
FreeCAD_DefaultPlacementProperty.png
FreeCAD_DefaultPlacementProperty.png (10.97 KiB) Viewed 671 times
rather a variant of this
FreeCAD_ZolkosRotationDialog.jpg
FreeCAD_ZolkosRotationDialog.jpg (30.59 KiB) Viewed 671 times
Obviousey the top part could be used to allow selection which of the elements are to be used and maybe what the step sizes are. This is the more important, because if this is really the best constraints to save resources in the solver.
If that is quick and intuitive to use there is another advantage: it only requires two selections to fully constrain a part. Less constraints and a clear relation in the tree: 1 constraint to 1 connection.


PS: sorry for the long post.
catman
Posts: 260
Joined: Fri Jan 11, 2019 10:42 pm

Re: Assembly3 preview

Postby catman » Mon Feb 24, 2020 2:51 pm

realthunder wrote:
Sat Feb 22, 2020 11:51 pm
For screw attaching, you can try the 'Attachment' plus the constraint multiplication feature.
That works very nicely also with the "Attachment" constraint. This feature can be added to the fun-to-work-with collection :P
realthunder
Posts: 1752
Joined: Tue Jan 03, 2017 10:55 am

Re: Assembly3 preview

Postby realthunder » Fri Feb 28, 2020 1:30 am

catman wrote:
Mon Feb 24, 2020 12:37 pm
The only drawback is that one grey copy of each type of screw imported remains outside the Assembly container, but this is a very minor snag.
Well, here is another hidden treasure for you. You can toggle the 'ShowElement' property of a Link to collapse all array elements, and group that greyed icon under Link instead. The real purpose of this 'collapse' feature is to save resources, in case of large amount of elements.

realthunder wrote:
Sat Feb 22, 2020 11:51 pm
I see that this will not be an easy part. I guess the constraints part will remain a construction site for a bit longer because it can be quite complex. No idea if that makes sense with the constraint algorithm, but is a "single Step mode" mode like in a debugger a possible idea?
I actually wanted to do something similar, at least to show DOF left for each part. Just haven't found time to do it yet.

realthunder wrote:
Sat Feb 22, 2020 11:51 pm
Here I selected a circular edge, but the system marks the center of the circle and offers me the center point to select as well. When your constraints work with points such as "Points-on-Line" it would be intuitive if the user is presented with points (2D circles) and lines (3D cylinders like holes) for selection. Probably that requires an assembly-only selection mode and more core changes. But in the long term, that is something any assembly solution would really require anyway, imho.
This 'feature' may be counterproductive IMO. asm3 can interpret the same geometry element in many ways, depending on which constraints are used. An element used inside a Point related constraint will use the bound box center of its geometry. So for a circle, it will be its center point, and for an edge, the middle point. For a face element used in constraint requiring a line, it uses its z normal. I haven't really tested, but by now, I think an element will always have a valid interpretation in any constraints. One thing you may not know, and I think many other CAD don't support, is that you can dynamically change the type of an existing constraint, using its 'ConstraintType' property. And in many case, you don't need to change its constraining elements because of this dynamic nature in element interpretation. Asking user to make more restrictive selection defeats its purpose.

realthunder wrote:
Sat Feb 22, 2020 11:51 pm
It is very interesting to learn that your included intelligence to modify constraints from less-than-optimal user selections. I am not sure yet whether its a good thing or a bad one
It's more of matter of documentation. I should mention those auto relaxing logic in the document. If the user really cares about DOF and stuff, he'll read the document. If not, well, he definitely needs help from auto relaxing. Another fact is that, I did optimization only on those composite constraints that I created. The underlying SolveSpace solver only supports basic constraints, which are all exposed by asm3. So the user is free choose the hard way.

I have tested the "Attachment" constraint for attaching parts that are attached with multiple screws in real life. The most important info was that Attachment constraint saves on solver time, which I was not aware of. Maybe I am wrong, but this seems to be the counterpart of Zolkos Assembly4 LCS, just presented as constraint?
Yes, it is about the same. In fact, it is added as a result of discussion in one of his thread, before he made asm4.

So its usable, but its really not fun, because your are forced to click though this usability-nightmare-of-a-default-orientation property
Maybe I can add a context menu action for element to let user manipulate its transformation, similar to axial mover.
Try Assembly3 (latest version 0.11) along 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
Posts: 1752
Joined: Tue Jan 03, 2017 10:55 am

Re: Assembly3 preview

Postby realthunder » Fri Feb 28, 2020 1:36 am

jpg87 wrote:
Sun Feb 23, 2020 10:18 am
I would like to take this opportunity to make a suggestion: wouldn't it be wiser for the highlighting in PartDesign to be applied to the only function selected in the tree rather than the entire body? Perhaps it is difficult to set up?
I also want that. And that is what all the other CAD are doing. Yes, it is not easy to do, but most of the required functionalities are more or less there already. I think it'll happen soon.
Try Assembly3 (latest version 0.11) along 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