Invalid A2+-assembly of valid objects

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
wandererfan
Veteran
Posts: 6324
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Invalid A2+-assembly of valid objects

Post by wandererfan »

kbwbe wrote:ping
Roland wrote:ping
I may be on to something. Fixing the tolerances in the parts, turning the shells into solids and fusing the result gives something that passes Check Geometry without a peep. Not sure if this is a general solution yet, but it looks promising.

I've attached a couple of well behaved assemblies. The result passes and can be fused to another part without complaints.

If you run into more problematic assemblies, please pass them to me. I can always use more test data.

wf
Attachments
screwjack_assmbly_fixed.FCStd
(238.57 KiB) Downloaded 35 times
GeometryTest_fixed.FCStd
(56.41 KiB) Downloaded 30 times
User avatar
Roland
Posts: 333
Joined: Fri Aug 21, 2015 2:20 pm

Re: Invalid A2+-assembly of valid objects

Post by Roland »

Not bad, Wanderfan!
Actually very good.

Let's look into this soon.
I am not a coder, but rather a sort of heavy user. I may come across challenges.

Best regards,

Roland
kbwbe
Veteran
Posts: 1052
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Invalid A2+-assembly of valid objects

Post by kbwbe »

wandererfan wrote: Mon Sep 02, 2019 1:22 am I may be on to something. Fixing the tolerances in the parts, turning the shells into solids and fusing the result gives something that passes Check Geometry without a peep. Not sure if this is a general solution yet, but it looks promising.
Hi wandererfan, thank you for your proposal. I think it is only a solution for very small assemblies of non complex parts. Fixing and fusing of all parts of an assembly takes a lot processor time. Think of a complex engine of a car. A second problem is that the fuse operation changes the number of geometric elements. This breaks the constraints due to the topogical naming issue. Also the color handling will break too.

As the link branch has been merged now, it could be a a solution to use links instead of shells within A2p. Or merging A2p with A4.
KBWBE

https://github.com/kbwbe/A2plus
latest release: v0.4.56, installable via FreeCAD's addon manager
Tutorial: gripper assembly https://www.youtube.com/watch?v=QMxcQ5tssWk
Documentation: https://www.freecadweb.org/wiki/A2plus_Workbench
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: Invalid A2+-assembly of valid objects

Post by easyw-fc »

kbwbe wrote: Tue Sep 03, 2019 6:50 am instead of shells within A2p
in A2p there is an option to use solids instead of shells
-
use-solids.png
use-solids.png (46.96 KiB) Viewed 1164 times
kbwbe
Veteran
Posts: 1052
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Invalid A2+-assembly of valid objects

Post by kbwbe »

easyw-fc wrote: Tue Sep 03, 2019 7:26 am in A2p there is an option to use solids instead of shells
It does not help up from second level assembly. Solid generation fails very often and shells are used as fall back.

P.S: Using Solid union slows down the assembly, breaks coloring and toponaming. As described before.
KBWBE

https://github.com/kbwbe/A2plus
latest release: v0.4.56, installable via FreeCAD's addon manager
Tutorial: gripper assembly https://www.youtube.com/watch?v=QMxcQ5tssWk
Documentation: https://www.freecadweb.org/wiki/A2plus_Workbench
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: Invalid A2+-assembly of valid objects

Post by easyw-fc »

kbwbe wrote: Tue Sep 03, 2019 8:26 am It does not help up from second level assembly. Solid generation fails very often and shells are used as fall back.
P.S: Using Solid union slows down the assembly, breaks coloring and toponaming. As described before.
Yes, it could be, but it is the only way to get a Solid assembly result without issues.
I used this approach also on A2 wb, to assembly parts that I needed to export to STEP.
User avatar
wandererfan
Veteran
Posts: 6324
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Invalid A2+-assembly of valid objects

Post by wandererfan »

kbwbe wrote: Tue Sep 03, 2019 6:50 am Hi wandererfan, thank you for your proposal. I think it is only a solution for very small assemblies of non complex parts. Fixing and fusing of all parts of an assembly takes a lot processor time. Think of a complex engine of a car. A second problem is that the fuse operation changes the number of geometric elements. This breaks the constraints due to the topogical naming issue. Also the color handling will break too.
I see this technique being used in TD (behind the scenes). It would be nice if A2P delivered "clean" assemblies, but it isn't essential.

The OCC HLR routines are much happier with valid shapes, so TD produces good views of massaged assemblies. And I'm not sure the topo-naming and constraint breaking aspects are relevant to producing a drawing, since TD is only interested in the end result, not how we got there.

HLR is slow anyway, so the extra processing may not be so noticeable.
User avatar
wandererfan
Veteran
Posts: 6324
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Invalid A2+-assembly of valid objects

Post by wandererfan »

Roland wrote: Mon Sep 02, 2019 11:28 pm I am not a coder, but rather a sort of heavy user. I may come across challenges.
If you want to experiment on your own, here are the 2 py routines I have been using in my experiments. Some times, fixToleranceAll.py is enough, sometimes you also need fixShellsAll.py.

Code: Select all

#!/usr/bin/env python
# -*- coding: utf-8 -*-

# fixToleranceAll.py
# fix tolerance of all shapes in assembly document

import FreeCAD
import Part

items = App.ActiveDocument.Objects

pfShapes = list()
for i in items:
    if i.isDerivedFrom("Part::Feature"):
        pfShapes.append(i.Shape)

for s in pfShapes:
    s.fixTolerance(0.001)

print("{} shapes fixed".format(len(pfShapes)))

Code: Select all

#!/usr/bin/env python
# -*- coding: utf-8 -*-

# fixShellsAll.py
# make solids from shells in assembly document

import FreeCAD
import Part

items = App.ActiveDocument.Objects

pfShapes = list()
for i in items:
    if i.isDerivedFrom("Part::Feature"):
        pfShapes.append(i.Shape)

newShapes = list()
for s in pfShapes:
    solids = list()
    for sl in s.Shells:
        sls = Part.makeSolid(sl)
        solids.append(sls)
    if len(solids) == 1:
        newShapes.append(solids[0])
    elif len(solids) > 1: 
        singleSolid = solids[0].generalFuse(solids[1:], 0.001)
        newShapes.append(singleSolid)

for ns in newShapes:
    if type(ns) is list:
        Part.show(ns[0])
    else:
        Part.show(ns)

print("newShapes: {}".format(len(newShapes)))
User avatar
Roland
Posts: 333
Joined: Fri Aug 21, 2015 2:20 pm

Re: Invalid A2+-assembly of valid objects

Post by Roland »

Thanks for your codes, Wanderfan.
May come in helpful.

Greetz

Roland
Post Reply