Another approach to assembly solver (A2plus)

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
jbe
Posts: 368
Joined: Sun Nov 10, 2013 4:18 pm
Location: France, Châteauroux

Re: Another approach to assembly solver (A2plus)

Post by jbe »

Don't worry, I just found the error.
The name of the file was : Coupole supérieur, and when I rename the file as Coupole Superieur, ( no accent on e form superieur), all is correct.
Three hours to find this error ....

Conclusion: No accent in the name of the file for A2plus.

Best regard
jbe
Posts: 368
Joined: Sun Nov 10, 2013 4:18 pm
Location: France, Châteauroux

Re: Another approach to assembly solver (A2plus)

Post by jbe »

Hello
I would like to know, if is it possible to add an assembly do with A2plus, to a body of Part Design, and then to use this assembly like a part of FreeCAD.
My problem is to do and hole between all the assembly.

Best regard.
assemblage mur et coupole.FCStd
(19.02 KiB) Downloaded 64 times
kbwbe
Veteran
Posts: 1052
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Another approach to assembly solver (A2plus)

Post by kbwbe »

jbe wrote: Fri Oct 25, 2019 4:16 pm I would like to know, if is it possible to add an assembly do with A2plus, to a body of Part Design, and then to use this assembly like a part of FreeCAD.
My problem is to do and hole between all the assembly.
Hi jbe,
In standard mode this will probably cause problems. A2+ tries to generate solids. But often this is not possible and the resulting assembly will be a shell. If this happens, you cannot do holes through it.

But you can activate the option "use solid union..." in preferences. With this option, all parts are "fused" to a solid and you can use the assembly as base feature for a part design body. Part Design will work as long as there are no gaps between the parts. It requires one continous solid. If Part Design fails due to this, you could work with the Part WB to do your holes.
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
Turro75
Posts: 179
Joined: Mon Aug 15, 2016 10:23 pm

Re: Another approach to assembly solver (A2plus)

Post by Turro75 »

Hi All,

I made a small modification on partslibrary macro, now it runs in my system (details below).

I changed the behavior of double click, now it imports files as a2p objects.

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16117 (Git)
Build type: Release
Branch: releases/FreeCAD-0-18
Hash: dbb4cc6415bac848a294f03b80f65e888d531742
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Italian/Italy (it_IT)
Attachments
PartsLibrary.FCMacro
(17.09 KiB) Downloaded 49 times
User avatar
Vincent B
Veteran
Posts: 4713
Joined: Sun Apr 05, 2015 9:02 am
Location: La Rochelle, France

Re: Another approach to assembly solver (A2plus)

Post by Vincent B »

Hi,
I'm trying to hole 2 parts after their assembly.
I use bodies cloned for do that.
But the second part seems not be an expected behavior: it don't move if I change the first part (the bloc start).
Here my files. Change the BlocDépart 's pocket position to check out that. ;)
...
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18644 (Git)
Build type: Release
Branch: master
Hash: 481870be2b48ef95b59acf1440b069d42b6fad23
Python version: 3.6.7
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: French/France (fr_FR)
Attachments
PièceFixée.FCStd
(9.45 KiB) Downloaded 50 times
BlocDépart.FCStd
(14.69 KiB) Downloaded 53 times
assemby_drilled.FCStd
(35.5 KiB) Downloaded 49 times
Capture.PNG
Capture.PNG (93.52 KiB) Viewed 2201 times
kbwbe
Veteran
Posts: 1052
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Another approach to assembly solver (A2plus)

Post by kbwbe »

GlouGlou wrote: Fri Nov 01, 2019 4:03 pm
Hi @GlouGlou,
usually it is no good idea to mix up work with A2plus and other workbenches in one file.

Problem 1 here: After cloning, the clone get's an independent (decoupled) placement of its original. If the original is moved, the clone is not. As the A2plus constraints are only operating at the originals, the clones are not moved accordingly.

Problem 2: I tried to follow your hints and moved the pocket in the block depart. When updating the assembly, the sketches in "body def drill" jumped to false positions. For sure some toponaming issue. See here:
.
test.png
test.png (91.41 KiB) Viewed 2126 times
.
It would be better, if you do such a small assembly completey with the PartDesign WB. If you need it later in a bigger assembly, you can import it complete or only single part of it to a main assembly.
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
Vincent B
Veteran
Posts: 4713
Joined: Sun Apr 05, 2015 9:02 am
Location: La Rochelle, France

Re: Another approach to assembly solver (A2plus)

Post by Vincent B »

thanks for that. It's a try to modify an assembly afterward. ;)
https://forum.freecadweb.org/viewtopic.php?f=12&t=40353
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Another approach to assembly solver (A2plus)

Post by Kunda1 »

A2plus Workbench wiki page doesn't have a Scripting section on the wiki. Can we start to document scripting in A2plus ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Another approach to assembly solver (A2plus)

Post by Kunda1 »

Kunda1 wrote: Sun Nov 03, 2019 5:52 pm A2plus Workbench wiki page doesn't have a Scripting section on the wiki. Can we start to document scripting in A2plus ?
Bump.
Reason: users aren't aware it's possible to animate assemblies. See https://forum.freecadweb.org/viewtopic. ... 11#p348308
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Another approach to assembly solver (A2plus)

Post by vocx »

Kunda1 wrote: Tue Nov 19, 2019 12:52 pm Reason: users aren't aware it's possible to animate assemblies. See https://forum.freecadweb.org/viewtopic. ... 11#p348308
dcapeletti wrote: Mon May 20, 2019 11:37 pm I made an engine and assembly with some parts and a script to run the animation. You can see the gif and the repository of the project.

https://gitlab.com/dcapeletti/ejercicio ... A2Plus.gif

https://gitlab.com/dcapeletti/ejercicio ... %20tiempos
The script is pretty simple

Code: Select all

from a2p_solversystem import SolverSystem
import time
import FreeCADGui

class Motor():
    def __init__(self):
        self.angulo = 0
        self.solver = SolverSystem()

    def iniciar_animacion(self):
        for val in range(0, 90):
            self.angulo = val*4
            FreeCAD.ActiveDocument.b_Ciguenal_001_.Placement = App.Placement(App.Vector(0,0,0),App.Rotation(App.Vector(0,0,1),self.angulo))
            self.solver.solveSystem(App.ActiveDocument)
            FreeCADGui.updateGui()
            time.sleep(0.01)

    def stop(self):
        self.angulo = 0
        FreeCAD.ActiveDocument.b_Ciguenal_001_.Placement = App.Placement(App.Vector(0,0,0),App.Rotation(App.Vector(0,0,1),0))
        self.solver.solveSystem(App.ActiveDocument)

motor = Motor()
motor.iniciar_animacion()
# It stops after a while or can be stopped with a method as well
motor.stop()
There isn't much "scripting" from A2plus going on to be honest. From A2plus it's just one command, the rest are generic FreeCAD commands.

These are the steps
  • It creates a class to encapsulate everything. In this class it creates an instance of A2plus's SolverSystem.
  • Then a method is defined to cycle a few times. In this cycle the placement of the body is changed; the change could be in the base placement, in the rotation, or both. In this example it's the angle of rotation the only thing that changes.
  • After the change in placement, it solves the system again with solver.solveSytem(App.ActiveDocument).
  • Then it updates the graphical interface with FreeCADGui.updateGui()
  • Finally, to finish the cycle it makes a tiny pause of 0.01 seconds. This can be changed to control the rate of update of the frames in the animation.
  • The animation will stop itself after the number of cycles is completed. However, a method is defined to stop the animation at any time, by resetting the angle of rotation, and solving the system again only once.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
Post Reply