Assembly3 preview

Discussion about the development of the Assembly workbench.
freecad-heini-1
Posts: 6022
Joined: Tue Jan 07, 2014 11:10 am
Contact:

Re: Assembly3 preview

Postby freecad-heini-1 » Mon Jun 18, 2018 6:48 am

easyw-fc wrote:
Sun Jun 17, 2018 1:57 pm
I'm impressed! :shock: :D 8-)
+1
triplus
Posts: 8802
Joined: Mon Dec 12, 2011 4:45 pm

Re: Assembly3 preview

Postby triplus » Mon Jun 18, 2018 10:07 am

As for the whole VBO/Render cache situation. With Assembly 3 AppImage on an old GPU i do get slightly better FPS numbers on default settings and with VBO enabled compared to FreeCAD upstream with VBO enabled.

P.S. Tested by rotating some Part workbench generated geometry.
User avatar
easyw-fc
Posts: 2692
Joined: Thu Jul 09, 2015 9:34 am

Re: Assembly3 preview

Postby easyw-fc » Mon Jun 18, 2018 10:32 am

realthunder wrote:
Fri Jun 15, 2018 5:29 am
New version released
Hi @realthunder
I noticed that in assigning color to objects, it is no more possible to use the Box selection (Shift+B)
box-sel.gif
box-sel.gif (527.7 KiB) Viewed 821 times
https://forum.freecadweb.org/viewtopic. ... 51#p187113

It would be possible to re-introduce it?

thanks again
Maurice
realthunder
Posts: 1234
Joined: Tue Jan 03, 2017 10:55 am

Re: Assembly3 preview

Postby realthunder » Mon Jun 18, 2018 11:01 am

easyw-fc wrote:
Mon Jun 18, 2018 10:32 am
I noticed that in assigning color to objects, it is no more possible to use the Box selection (Shift+B)

It would be possible to re-introduce it?
Sure, I'll add it in the next release.
Try Assembly3 (latest version 0.10.2) 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
OakLD
Posts: 99
Joined: Fri Jan 12, 2018 7:38 pm
Location: Brno

Re: Assembly3 preview

Postby OakLD » Thu Jun 21, 2018 9:59 am

Once again, Realthnder and the comunity, congratulations to the progress! It's a much better experience, testing assemblies, compared to 3-4 months ago. I tested few assemblies in the new releases and have some feedback bellow.

Following points of possible improvements are not criticism, I would like to just inspire a little discussion on the subjects, perhaps it might help little bit.

1. Singularities - even though this improved significantly, I still get a lot of errors like "Solver error", which are usually easy to resolve by re-positioning parts. Often a tiny, bearly noticeable change resolves the problem. This is probably the solver problem and it is unlikely to be possible to tackle it directly in FC. However, I'd think it should be possible and suggest to catch the error and in such an event, change the input conditions by slight modification of input conditions, which in reality means i.e. rotation by each axis by i.e. 0.5 degree. I'd perform few itterative steps like theese (perpaps with growing adjustment value), before actually telling the user, that the solver couldn't find a solution. It should not matter that positions of the parts are changed, because they are to be constraned, not positioned by user (very much like line lenghts doesn't matter in sketcher, as they are to be constrained by dimensions). It could even fall-back to the original position, if solver wouldn't succeed. This would significantly improve user experience and speed assemblying up, IMHO.

A comment to the error: Interesting thing is, that when I opened and closed FC, I got different solver error message with the same configuration "Constraint PlaneAlignment requires at least two elements.". But in that case, when the constraint was deleted and replaced (without any repositioning) the solver succesfully solved the constraint. In the same position in the previous instance of opened document, it did not converge even after many attempts to delete and replace it.
This might indicate, that at least some solver errors are caused by incorrect inputs provided by FC, because apparently same situation has different solver outputs.

2. Positioning - some constraints have multiple "solutions", that means i.e. in case of "PlaneAlignment" that both combinations of normals direction (Aligned and Opposite) are possible. Once the constraint is set, it doesn't (at least I didn't find a way) allow to flip it to the other configuration. Also, some configurations require to position the parts in certain way. Implementation of point (1) should cause, that in any case parts would be aligned (to one of possible configuration). I would suggest to add a "Flip" button, which would cause a re-alignment of one part (i.e. 180° rotation along an axis perpendicular to the normal in case of PlaneAlignment) and triger a new solution. This would allow to modify configuration if by chances was chosen incorrectly and allow a standard assembly workflow (which is not caring about part position, applying a constraint and modify the constraint to a different condition if needed).

3. Tree - it appears to me, that the "Assembly" node contains a tree, which is rather technical and unrelated to the user's needs. This has nothing to do with the structure it self, I think it works fine, but it deserves a different presentation to the user. For instance, the constraints are practically untraceable to the parts they are constraining, elements are abstract things not related to users work, parts contain whole tree which is only making things less transparent. Thus, I'd suggest a discussion about hiding this tree (in future) and replacing it with a tree (and I mean just a visual layer, not a change in assembly desing) that user wants:
Assembly --> Parts --> Constraints --> Constrained Elements
Someting like:
ATest_Assembly_tree1.PNG
ATest_Assembly_tree1.PNG (9.69 KiB) Viewed 545 times

4. "Redundant Constraints" message - I get it often in the console, but it doesn't appear to be causing any troubles. It seams that Realthnder disabled errors of redundant constraints to allow their natural combinations, like 3 perpendicular PlaneAlignments. However, this is still not completely clear to me, because the example before should not produce redundant constraint conditions and if you consider also removed rotation, that should produce a solver error, as the rotation condition cannot be fulfiled...
Is the message harmless?

5. Drawing - probably the most serious problem at this stage is that the assembly cannot be placed into drawing (or did I failed to do it correctly?). "Assembly" would allow to start "Insert ortographic projections..." command, but would result in an empty views. I think it's because it is not "Body". When creating a standalone Body, one can link there "Assembly" as a "BaseFeature", but it gives a red exclamation mark (error "Base feature has empty shape") and the drawing result is the same. So I failed to find a way or workaround to produce a drawing.
ATest_AssemblyTree.PNG
ATest_AssemblyTree.PNG (14.29 KiB) Viewed 545 times

6. Merging - is there or would there be a way to merge particular parts ("bodies") into one body, when assembled this way? One reason for that I can imagine is a FEM analysis, where one wants to assess a body with ribs and brackets as a one solid thing...

7. Moving parts - hopefully this feature wouldn't be needed that much in future. However, now it is used a lot and I experience very slow response. It takes few seconds when an object is moved or rotated to see the result on the screen. Even though I have a 4K monitor and not the best-spec graphics card, the ordinary rotation of view (so much bench-marked here in the discussion) works really fine, so I'd tempt to think it's some problem with this command code.

8. Recomputing buttons - this is a tiny detail, but I noticed, that when set to auto-recompute, it sometimes recomputes the solution and sometimes not. The same with changing constraint parameters (hitting Enter after a change is more likely to invoke recomputing). I think this option might get redundant in time, becasue one always wants to recompute, not only to see the result instantly, but most importantly to discover errors right when produced and not after he does more work.

I hope to stire only positive discussion and please pardon me, if I took any wrong assumptions.

Tested assembly (last):
ATest_Assembly.PNG
ATest_Assembly.PNG (19.04 KiB) Viewed 545 times

OS: Windows 7 (and Windows 10, but still didn't get to test it on my OpenSUSE PC)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.5235 (Git shallow)
Build type: Release
Branch: (HEAD detached at FETCH_HEAD)
Hash: 0c86e915337261dcf93e6590ec4cd8bb2c2e451b
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: Czech/CzechRepublic (cs_CZ)
Last edited by OakLD on Thu Jun 21, 2018 2:47 pm, edited 1 time in total.
Regards,

Oak
User avatar
fosselius
Posts: 346
Joined: Sat Apr 23, 2016 10:03 am

Re: Assembly3 preview

Postby fosselius » Thu Jun 21, 2018 2:12 pm

Really good feedback. I plan to spend some time getting to know the solver on my vacation in a few weeks. Will look how solvespace displays DOF and try some numerical methods and random modifications to positioning / rotations in order to get better results from the solver.
User avatar
jpg87
Posts: 278
Joined: Thu Mar 16, 2017 7:16 am
Location: Limoges - France
Contact:

Re: Assembly3 preview

Postby jpg87 » Thu Jun 21, 2018 6:44 pm

Hello,
I have the pleasure to show you this small wind turbine model designed entirely with PartDesign 0.17 and 0.18 and assembled with A3 (several levels of subassemblies).

eolienne.png
eolienne.png (35.73 KiB) Viewed 450 times
eolienne_detail.png
eolienne_detail.png (112.67 KiB) Viewed 450 times

A note for the construction of the assembly: towards the end, the solver no longer caused the placing of parts according to the constraints. I had to record, close the files. Then at the reopening of the assembly, a recalculation of the solver and everything was put in place.
I have two questions :
- Is it possible (or is it planned) to motorize some DOF to animate the whole?
- what to select in TechDraw to get projected views? I tried various possibilities without success.


Thank you in advance for possible answers and especially a big thank you to Realthunder for all this great work.
jpg87
My website : http://help-freecad-jpg87.fr updated 2018/10/17
User avatar
easyw-fc
Posts: 2692
Joined: Thu Jul 09, 2015 9:34 am

Re: Assembly3 preview

Postby easyw-fc » Thu Jun 21, 2018 7:27 pm

jpg87 wrote:
Thu Jun 21, 2018 6:44 pm
Hello,
I have the pleasure to show you this small wind turbine model designed entirely with PartDesign 0.17 and 0.18 and assembled with A3 (several levels of subassemblies).
Very nice!
jpg87 wrote:
Thu Jun 21, 2018 6:44 pm
I have two questions :
- Is it possible (or is it planned) to motorize some DOF to animate the whole?
- what to select in TechDraw to get projected views? I tried various possibilities without success.
@jpg87

Until @realthunder A3 branch will not be merged, there will be some glitches on other WBs... A3 has introduced new containers that other WBs are not aware of... the same happened when Part and Body were been introduced.

ATM you can use this macro that @realthunder gave me, to convert the A3 assembly into an 'old style' Part assembly.

Code: Select all

import FreeCAD, FreeCADGui, Part
def copy_obj(parentObj=None,doc=None,subname=''):
    if not doc:
        # 'doc' allows you to copy object into another document.
        # If not give, then use the current document.
        doc = FreeCAD.ActiveDocument

    if not parentObj:
        # If no object is given, then obtain selection from all opened document
        parentObj = []
        for sel in FreeCADGui.Selection.getSelectionEx('*'):
            parentObj.append(sel.Object)
        if not parentObj:
            return
    if isinstance(parentObj,(tuple,list)):
        if len(parentObj) == 1:
            copy = copy_obj(parentObj[0],doc)
        else:
            part = doc.addObject('App::Part','Part')
            for o in parentObj:
                copy = copy_obj(o,doc)
                if copy:
                    part.addObject(copy)
            copy = part
        if copy:
            FreeCADGui.SendMsgToActiveView("ViewFit")
            copy.recompute(True)
        return copy

    obj,matrix = parentObj.getSubObject(subname,1,FreeCAD.Matrix(),not subname)
    if not obj:
        return
    # getSubObjects() is the API for getting child of a group. It returns a list
    # of subnames, and the subname inside may contain more than one levels of
    # hierarchy. Assembly uses this API to skip hierarchy to PartGroup.
    subs = obj.getSubObjects()
    if not subs:
        # Non group object will return empty subs
        shape = Part.getShape(obj,transform=False)
        if shape.isNull():
            return
        shape.transformShape(matrix,False,True)
        copy = doc.addObject('Part::Feature',obj.Name)
        copy.Label = obj.Label
        copy.Shape = shape
        copy.ViewObject.mapShapeColors(obj.Document)
        return copy

    part = doc.addObject('App::Part',obj.Name)
    part.Label = obj.Label
    part.Placement = FreeCAD.Placement(matrix)
    for sub in subs:
        sobj,parent,childName,_ = obj.resolve(sub)
        if not sobj:
            continue
        copy = copy_obj(obj,doc,sub)
        if not copy:
            continue
        vis = parent.isElementVisible(childName)
        if vis < 0:
            copy.Visibility = sobj.Visibility
        else:
            copy.Visibility = vis>0
        part.addObject(copy)
    return part

copy_obj()
Just select the main A3 container and run the macro.
Then you will have all A3 containers changed to 'Part' containers and you will able to use this new assembly to interact with TechDraw WB.
realthunder
Posts: 1234
Joined: Tue Jan 03, 2017 10:55 am

Re: Assembly3 preview

Postby realthunder » Thu Jun 21, 2018 11:45 pm

OakLD wrote:
Thu Jun 21, 2018 9:59 am
Once again, Realthnder and the comunity, congratulations to the progress! It's a much better experience, testing assemblies, compared to 3-4 months ago. I tested few assemblies in the new releases and have some feedback bellow.

Following points of possible improvements are not criticism, I would like to just inspire a little discussion on the subjects, perhaps it might help little bit.
Thanks for your lengthy feedback.

1. Singularities - even though this improved significantly, I still get a lot of errors like "Solver error", which are usually easy to resolve by re-positioning parts. Often a tiny, bearly noticeable change resolves the problem. This is probably the solver problem and it is unlikely to be possible to tackle it directly in FC. However, I'd think it should be possible and suggest to catch the error and in such an event, change the input conditions by slight modification of input conditions
I actually tried this in early stage of development, when the solver didn't work quite well yet. And the results is not that good at the time. I may try that again some time. Maybe study more about how SolveSpace itself handle this situation.

A comment to the error: Interesting thing is, that when I opened and closed FC, I got different solver error message with the same configuration "Constraint PlaneAlignment requires at least two elements."
This sounds like a bug. It would be better if you can post a file to demonstrate the problem. And maybe some screencast to show your steps.

2. Positioning - some constraints have multiple "solutions", that means i.e. in case of "PlaneAlignment" that both combinations of normals direction (Aligned and Opposite) are possible. Once the constraint is set, it doesn't (at least I didn't find a way) allow to flip it to the other configuration.
You can either a) turn off auto recompute, and use mover to (roughly) pre-align the part to your desired configuration, and then hit recompute button, or b) turn on auto recompute, and use mover to rotate the part. When rotate pass some threshold, it will flip. What the software does behind the scene is that, it will move the part with your mouse, and call the solver. If the solver fail (which is made silent and hidden from user), the part position will be reset. So the end user won't see the movement, but it does move behind the scene, kind of like method a), and I believe that is how SolveSpace handle this, too.

Also, some configurations require to position the parts in certain way. Implementation of point (1) should cause, that in any case parts would be aligned (to one of possible configuration). I would suggest to add a "Flip" button
For some constraint, this can work, and I'll try it someday. Maybe you can open an issue in github for that.

3. Tree - it appears to me, that the "Assembly" node contains a tree, which is rather technical and unrelated to the user's needs. This has nothing to do with the structure it self, I think it works fine, but it deserves a different presentation to the user. For instance, the constraints are practically untraceable to the parts they are constraining, elements are abstract things not related to users work, parts contain whole tree which is only making things less transparent. Thus, I'd suggest a discussion about hiding this tree (in future) and replacing it with a tree (and I mean just a visual layer, not a change in assembly desing) that user wants:
Assembly --> Parts --> Constraints --> Constrained Elements
You suggestion will not work well in nested assemblies. Remember that a 'part' can be repeatedly used in many different places, say a screw. The screw has the same geometry element for constraining with others, but each instance will certainly connect to an element of a different part. In other word, one of the elements in the constraint will be different each time the instance is used, so it cannot be grouped with the 'part'.

The logic of my assembly's grouping is this. The constraint group groups the configuration of its owner assembly. The element group groups which element the owner assembly can be constrained with other higher level assemblies. The proper way of doing assembly, IMO, is to put each part object into an assembly container, even though the part itself do not need any assembling. Because in A3, assembly container serves a double purpose of part container. Then, the part author should manually specify which geometry element this part can be connected to, and give them meaningful names. Repeat this process to create composite parts that contain sub-assemblies. When assembling, only connect the parts at their declared elements. I probably should add a property to optionally enforce this behavior (i.e. let the part author decide). The above workflow is not strictly enforced, in case the user just want some quick single hierarchy assembling. But for mult-hierarchy assembling, it will quickly become hard to track without some 'rules', or 'workflows', or whatever.

Finally, there is a way to trace the element to its owner part. When A3 workbench is active, right click the element of the constraint in the tree view, and choose 'Link actions -> Select linked object'. This will locate the element in the sub assembly's element group. In case there are more hierarchy down below, use 'Select linked object' again to go down. If you want to jump straight to the final geometry model object that actually owns the geometry element of the constraint, then choose 'Link actions -> Select final linked object'.

4. "Redundant Constraints" message
Is the message harmless?
If you see this message, then there is definitely redundancy. It is not always intuitive, but if you carefully count the DOFs, you'll see. But yeah, I probably should not make that as a warning message.

5. Drawing - probably the most serious problem at this stage is that the assembly cannot be placed into drawing (or did I failed to do it correctly?). "Assembly" would allow to start "Insert ortographic projections..." command, but would result in an empty views.
I'll add that support in Techdraw later.

EDIT, you can also set the 'BuildShape' property of an assembly to 'Compound', and TechDraw will then have no problem with it.

6. Merging - is there or would there be a way to merge particular parts ("bodies") into one body, when assembled this way? One reason for that I can imagine is a FEM analysis, where one wants to assess a body with ribs and brackets as a one solid thing...
Switch to Part workbench. Select the assembly you want to merge in the tree view. In the Main window menu, select 'Part -> Create a copy -> Create simple copy'. You will get a single Shape of that assembly.

7. Moving parts - hopefully this feature wouldn't be needed that much in future. However, now it is used a lot and I experience very slow response. It takes few seconds when an object is moved or rotated to see the result on the screen.
Well, it is because I added the delay to not overload the system with recompute of every tiny move. I'll expose the delay in setting later.

8. Recomputing buttons - this is a tiny detail, but I noticed, that when set to auto-recompute, it sometimes recomputes the solution and sometimes not. The same with changing constraint parameters (hitting Enter after a change is more likely to invoke recomputing). I think this option might get redundant in time, becasue one always wants to recompute, not only to see the result instantly, but most importantly to discover errors right when produced and not after he does more work.
I'll improve that later.
Last edited by realthunder on Fri Jun 22, 2018 9:01 am, edited 1 time in total.
Try Assembly3 (latest version 0.10.2) 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: 1234
Joined: Tue Jan 03, 2017 10:55 am

Re: Assembly3 preview

Postby realthunder » Thu Jun 21, 2018 11:53 pm

jpg87 wrote:
Thu Jun 21, 2018 6:44 pm
A note for the construction of the assembly: towards the end, the solver no longer caused the placing of parts according to the constraints. I had to record, close the files. Then at the reopening of the assembly, a recalculation of the solver and everything was put in place.
That is most likely a bug. I'd appreciate if you can post a file to demonstrate this problem. Or, since the problem is gone after reopen the file, maybe recall the steps triggering this problem.

- Is it possible (or is it planned) to motorize some DOF to animate the whole?
Yes, I'll definitely add that function later.

- what to select in TechDraw to get projected views? I tried various possibilities without success.
I'll add that support in TechDraw later. Meanwhile, you can either use the Macro easyw-fc mentioned, or go to Part workbench, and use menu action Part -> Create a copy -> Create simple copy to get a merged shape.

EDIT, you can change the 'BuildShape' property of an assembly to 'Compound', and then TechDraw will have no problem with it.
Last edited by realthunder on Fri Jun 22, 2018 8:59 am, edited 1 time in total.
Try Assembly3 (latest version 0.10.2) 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