Problem with a2+ import.

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: Problem with a2+ import.

Post by easyw-fc »

kbwbe wrote: Thu May 09, 2019 8:05 pm There seems to be a problem of converting single spherical faces of a shell to a solid.
Hi @kbwbe
this is a small issue in python wrapper for the function Part.makeShell ... it can be solved using the code in the following example:

Code: Select all

App.newDocument("Unnamed")
Gui.activateWorkbench("PartWorkbench")
App.ActiveDocument.addObject("Part::Sphere","Sphere")
App.ActiveDocument.ActiveObject.Label = "Sphere"
App.ActiveDocument.recompute()
Gui.SendMsgToActiveView("ViewFit")
f=App.ActiveDocument.Sphere.Shape.Faces[0]
Part.makeShell(f)
print('This is giving an Error on a single face')
Part.makeShell([f])
print('This is fine in all cases :)')
sh=Part.makeShell([f])
s=Part.Solid(sh)
Part.show(s)
Gui.getDocument("Unnamed").getObject("Sphere").Visibility=False
Part.makeShell(f) is failing if there is only one face (like in a Sphere)
but if you put a list within only one face, the result will be just fine
Part.makeShell([f])

I have made a new PR280 @devel branch accordingly... please do some testing...
Maurice
fcaduser
Posts: 448
Joined: Wed Feb 19, 2014 6:53 pm
Location: Near Paris, France

Re: Problem with a2+ import.

Post by fcaduser »

I may found a reproducible yet simple example.

A_Bearing is the assembly with two drafts of parts.
After modification of its geometry, nut flange isn't updated, for example.
Why both source file *and* part displayed into the tree ? I would expect only the first one.
Attachments
Ball joint.fcstd
(12.79 KiB) Downloaded 34 times
Nut flange.fcstd
(10.26 KiB) Downloaded 29 times
A_Bearing.fcstd
(9.65 KiB) Downloaded 35 times
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: Problem with a2+ import.

Post by easyw-fc »

fcaduser wrote: Fri May 10, 2019 9:18 am I may found a reproducible yet simple example.

A_Bearing is the assembly with two drafts of parts.
After modification of its geometry, nut flange isn't updated, for example.
Why both source file *and* part displayed into the tree ? I would expect only the first one.
Hi @fcaduser
your issue is there because you have mixed an A2 part with an A2p part.
NEVER create assemblies using old A2 workbench parts, if you want a fully working assembly in A2p
-
ab-wrong.png
ab-wrong.png (98.2 KiB) Viewed 1314 times
ab-correct.png
ab-correct.png (99.13 KiB) Viewed 1314 times
kbwbe
Veteran
Posts: 1052
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Problem with a2+ import.

Post by kbwbe »

easyw-fc wrote: Fri May 10, 2019 9:03 am Part.makeShell(f) is failing if there is only one face (like in a Sphere)
but if you put a list within only one face, the result will be just fine
Part.makeShell([f])

I have made a new PR280 @devel branch accordingly... please do some testing...
Maurice
Hi Maurice,
that sounds very good. I will test it.
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
fcaduser
Posts: 448
Joined: Wed Feb 19, 2014 6:53 pm
Location: Near Paris, France

Re: Problem with a2+ import.

Post by fcaduser »

This forum is highly reactive ! ;) Thank.

Yes, I suspected some "legacy" problems. A2+ was introduced as an extension work of A2. I started my project with A2 then shifted (and never reverted to it), so I have a bunch of old parts and assemblies made of A2. Can I convert my old parts/assemblies to A2+ ?
kbwbe
Veteran
Posts: 1052
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Problem with a2+ import.

Post by kbwbe »

fcaduser wrote: Fri May 10, 2019 9:18 am
easyw-fc wrote: Fri May 10, 2019 9:29 am Hi @fcaduser
your issue is there because you have mixed an A2 part with an A2p part.
NEVER create assemblies using old A2 workbench parts, if you want a fully working assembly in A2p
Unfortunately this is not quite correct. The "Ball_joint"-object within the assembly "A_Bearing.fcstd" is in fact of A2plus type, but a very old one. Even the property "subAssemblyImport" is missing. It seems to be created with a very old A2plus version from projects beginning.

For sure it is better, to replace such old objects by a fresh A2plus import. But i will have look whether i can prevent this problem somehow.
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
fcaduser
Posts: 448
Joined: Wed Feb 19, 2014 6:53 pm
Location: Near Paris, France

Re: Problem with a2+ import.

Post by fcaduser »

@kwbe

Can I safely use the convert function (the icon with red and yellow part) and apply it to each problematic old part ? I mean, I don't know which one will be the future assembly module, so I may have to do again my assemblies from zero, but I definitely don't want my parts irreversibly altered (there is a lot of work), making it specific. A2+ save zero information into a part, exact ? Just to be sure.
kbwbe
Veteran
Posts: 1052
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Problem with a2+ import.

Post by kbwbe »

fcaduser wrote: Fri May 10, 2019 10:53 am A2+ save zero information into a part, exact ? Just to be sure.
Yes. Converting of objects to A2plus only applies to the assembled things. The original (external) parts are not touched.
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
fcaduser
Posts: 448
Joined: Wed Feb 19, 2014 6:53 pm
Location: Near Paris, France

Re: Problem with a2+ import.

Post by fcaduser »

Heterogeneity brings problem indeed breaking the import mechanism. So I manually re-import each old part (fortunately the icons lead me because they have changed) and then things seem working again. Fastidious but doable.
kbwbe
Veteran
Posts: 1052
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Problem with a2+ import.

Post by kbwbe »

easyw-fc wrote: Fri May 10, 2019 9:03 am
kbwbe wrote: Thu May 09, 2019 8:05 pm There seems to be a problem of converting single spherical faces of a shell to a solid.
Hi @kbwbe
this is a small issue in python wrapper for the function Part.makeShell ... it can be solved using the code in the following example:

Code: Select all

App.newDocument("Unnamed")
Gui.activateWorkbench("PartWorkbench")
App.ActiveDocument.addObject("Part::Sphere","Sphere")
App.ActiveDocument.ActiveObject.Label = "Sphere"
App.ActiveDocument.recompute()
Gui.SendMsgToActiveView("ViewFit")
f=App.ActiveDocument.Sphere.Shape.Faces[0]
Part.makeShell(f)
print('This is giving an Error on a single face')
Part.makeShell([f])
print('This is fine in all cases :)')
sh=Part.makeShell([f])
s=Part.Solid(sh)
Part.show(s)
Gui.getDocument("Unnamed").getObject("Sphere").Visibility=False
Part.makeShell(f) is failing if there is only one face (like in a Sphere)
but if you put a list within only one face, the result will be just fine
Part.makeShell([f])

I have made a new PR280 @devel branch accordingly... please do some testing...
Maurice
Hi Maurice,
also using this code the spheres vanish without using my fallback mechanism using a shell instead of a solid.

I did a post with a test here: https://forum.freecadweb.org/viewtopic.php?f=22&t=36296 and asked the forum.

For me it seems, that not the creation of the shell is the problem, but the Part.Solid(shell) conversion.
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
Post Reply