Another approach to assembly solver (A2plus)

Discussion about the development of the Assembly workbench.
kbwbe
Posts: 875
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Another approach to assembly solver (A2plus)

Postby kbwbe » Thu Aug 02, 2018 4:40 pm

@Turro75, @manuelkrause

Branch "devel" has been updated.
- convergency check has been modified to simple compare of error/lastError.
- console output has been reduced. Modify a2plib.A2P_DEBUG_LEVEL if you want to see more...

Code: Select all

# DEFINE DEBUG LEVELS FOR CONSOLE OUTPUT
A2P_DEBUG_NONE      = 0
A2P_DEBUG_1         = 1
A2P_DEBUG_2         = 2
A2P_DEBUG_3         = 3

A2P_DEBUG_LEVEL = A2P_DEBUG_NONE
Next i will try to switch solver mode from "partial processing" to "solving all together" method automatically, if partial processing does not work. Due to convergency check, it should be possible. So user does not need to decide which method is better to use. Many users will not know what is the difference between these modes.
KBWBE

https://github.com/kbwbe/A2plus
latest release: v0.4.29, installable via FreeCAD's addon manager
Tutorials:
Paul Randall: https://youtu.be/mnkecA9S7kc
anisim (deutsch): https://www.youtube.com/watch?v=vDcaFq6IEJM
User avatar
manuelkrause
Posts: 442
Joined: Thu Jul 05, 2018 7:16 pm

Re: Another approach to assembly solver (A2plus)

Postby manuelkrause » Thu Aug 02, 2018 5:04 pm

kbwbe wrote:
Thu Aug 02, 2018 4:40 pm
@Turro75, @manuelkrause

Branch "devel" has been updated.
- convergency check has been modified to simple compare of error/lastError.
- console output has been reduced. Modify a2plib.A2P_DEBUG_LEVEL if you want to see more...

Code: Select all

# DEFINE DEBUG LEVELS FOR CONSOLE OUTPUT
A2P_DEBUG_NONE      = 0
A2P_DEBUG_1         = 1
A2P_DEBUG_2         = 2
A2P_DEBUG_3         = 3

A2P_DEBUG_LEVEL = A2P_DEBUG_NONE
Next i will try to switch solver mode from "partial processing" to "solving all together" method automatically, if partial processing does not work. Due to convergency check, it should be possible. So user does not need to decide which method is better to use. Many users will not know what is the difference between these modes.
Hi @kbwbe,
thank you for the update! :-)
Maybe the DEBUG_LEVEL would be worth an entry on the A2plus preferences page?! (Even unexperienced users would understand "DEBUG" and thus leave it at the default setting.)
Your next step sounds quite reasonable and usable. I encountered scenarios, where "partial solving" was unhappy but "magnetic/ alltogether solving" did the job in reasonable time. We're speaking of about a second -- what makes me astonished about the recent speed improvements!!!

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

Re: Another approach to assembly solver (A2plus)

Postby kbwbe » Thu Aug 02, 2018 5:39 pm

@Turro75, @ManuelKrause,

branch "devel" is updated again:
- solver switches automatically from mode 'partial' to mode 'magnetic', if 'partial' failes...
KBWBE

https://github.com/kbwbe/A2plus
latest release: v0.4.29, installable via FreeCAD's addon manager
Tutorials:
Paul Randall: https://youtu.be/mnkecA9S7kc
anisim (deutsch): https://www.youtube.com/watch?v=vDcaFq6IEJM
User avatar
manuelkrause
Posts: 442
Joined: Thu Jul 05, 2018 7:16 pm

Re: Another approach to assembly solver (A2plus)

Postby manuelkrause » Thu Aug 02, 2018 7:14 pm

kbwbe wrote:
Thu Aug 02, 2018 5:39 pm
@Turro75, @ManuelKrause,

branch "devel" is updated again:
- solver switches automatically from mode 'partial' to mode 'magnetic', if 'partial' failes...
Thank you again, @kbwbe! I'd try it at once.

ATM I'm really annoyed about the missing topology consistency within FreeCAD, again. It goes as deep as to the sketcher, when deriving objects from previous (then depending on) ones. Seems like even FreeCAD was annoyed, so it crashed.
Sorry, this was OFFTOPIC, nothing to do with A2plus.

Manuel
User avatar
manuelkrause
Posts: 442
Joined: Thu Jul 05, 2018 7:16 pm

Re: Another approach to assembly solver (A2plus)

Postby manuelkrause » Thu Aug 02, 2018 7:41 pm

@kbwbe:
Hehehe, now Report view comes up with:
-->
Solvermode = partialProcessing !
Writing visual hierarchy to: /home/manuel/assembly_hierarchy.html
Running the Python command 'a2p_updateImportedParts' failed:
Traceback (most recent call last):
File "/home/manuel/.FreeCAD/Mod/A2plus/a2p_importpart.py", line 307, in Activated
updateImportedParts(doc)
File "/home/manuel/.FreeCAD/Mod/A2plus/a2p_importpart.py", line 299, in updateImportedParts
solversystem.solveConstraints(doc)
File "/home/manuel/.FreeCAD/Mod/A2plus/solversystem.py", line 1125, in solveConstraints
ss.solveSystem(doc)
File "/home/manuel/.FreeCAD/Mod/A2plus/solversystem.py", line 253, in solveSystem
systemSolved = self.solveSystemWithMode(doc,mode)
File "/home/manuel/.FreeCAD/Mod/A2plus/solversystem.py", line 224, in solveSystemWithMode
systemSolved = self.calculateChain(doc, mode)
File "/home/manuel/.FreeCAD/Mod/A2plus/solversystem.py", line 296, in calculateChain
solutionFound = self.calculateWorkList(doc, workList, mode)
File "/home/manuel/.FreeCAD/Mod/A2plus/solversystem.py", line 334, in calculateWorkList
w.calcMoveData(doc, self)
File "/home/manuel/.FreeCAD/Mod/A2plus/solversystem.py", line 601, in calcMoveData
rotation = dep.getRotation(solver)
File "/home/manuel/.FreeCAD/Mod/A2plus/solversystem.py", line 1085, in getRotation
DebugMsg(A2P_DEBUG_3, "{} - rotate by {}\n".format(self, axis.Length))

'NoneType' object has no attribute 'Length'
<--

Don't bother with it any more. It's useless to let unfixable constraints (after user changed imported parts) be detected or even be fixed by the assembly solver.

If one is careful and can estimate the culprit, what need not be the last constrained one, both solver methods lead to the desired result.

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

Re: Another approach to assembly solver (A2plus)

Postby kbwbe » Thu Aug 02, 2018 7:43 pm

@ManuelKrause,
found the bug too, just uploaded a bugfix version...
KBWBE

https://github.com/kbwbe/A2plus
latest release: v0.4.29, installable via FreeCAD's addon manager
Tutorials:
Paul Randall: https://youtu.be/mnkecA9S7kc
anisim (deutsch): https://www.youtube.com/watch?v=vDcaFq6IEJM
User avatar
manuelkrause
Posts: 442
Joined: Thu Jul 05, 2018 7:16 pm

Re: Another approach to assembly solver (A2plus)

Postby manuelkrause » Thu Aug 02, 2018 9:13 pm

Mmh. Now another problem.

I'm able to attach angledPlaneConstraint, and the object actually moves in the view, but the solver says:

===== Start Solving System ======
Solvermode = partialProcessing !
Writing visual hierarchy to: /home/manuel/assembly_hierarchy.html
Could not solve system with partial processing, swith to 'magnetic' mode
Writing visual hierarchy to: /home/manuel/assembly_hierarchy.html
System not solvable, convergency is to bad !
If you are using solverMode partialProcessing, try solverMode allAtOnce !
===== Could not solve system ======

===== Start Solving System ======
Solvermode = solve all Parts at once !
Writing visual hierarchy to: /home/manuel/assembly_hierarchy.html
System not solvable, convergency is to bad !
If you are using solverMode partialProcessing, try solverMode allAtOnce !
===== Could not solve system ======

Screenshot_20180802_225933.png
Screenshot_20180802_225933.png (188.79 KiB) Viewed 163 times


I have no idea.
Is it really needed to remove ALL constraints to changed parts?
kbwbe
Posts: 875
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Another approach to assembly solver (A2plus)

Postby kbwbe » Thu Aug 02, 2018 9:35 pm

manuelkrause wrote:
Thu Aug 02, 2018 9:13 pm
I have no idea.
Is it really needed to remove ALL constraints to changed parts?
Yes. It is the most safe way to do.
Your assembly is not really big. Please try to reassemble. If it is not possible to do this, please post the files and i will try to do it and look for perhaps unknown problems.
KBWBE

https://github.com/kbwbe/A2plus
latest release: v0.4.29, installable via FreeCAD's addon manager
Tutorials:
Paul Randall: https://youtu.be/mnkecA9S7kc
anisim (deutsch): https://www.youtube.com/watch?v=vDcaFq6IEJM
User avatar
manuelkrause
Posts: 442
Joined: Thu Jul 05, 2018 7:16 pm

Re: Another approach to assembly solver (A2plus)

Postby manuelkrause » Thu Aug 02, 2018 10:09 pm

kbwbe wrote:
Thu Aug 02, 2018 9:35 pm
manuelkrause wrote:
Thu Aug 02, 2018 9:13 pm
I have no idea.
Is it really needed to remove ALL constraints to changed parts?
Yes. It is the most safe way to do.
Your assembly is not really big. Please try to reassemble. If it is not possible to do this, please post the files and i will try to do it and look for perhaps unknown problems.
Of course I'm able to kill and redo any constraint... But I don't want to, ATM; I'm just glad to have found somekind of a shape for the arm (just didn't know that "loft" would be so easy in FreeCAD).

See attached the current assembly file.

TIA,
Manuel
Attachments
ZB.A2plus-Man.1.fcstd
(81.22 KiB) Downloaded 8 times
kbwbe
Posts: 875
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Another approach to assembly solver (A2plus)

Postby kbwbe » Thu Aug 02, 2018 10:37 pm

manuelkrause wrote:
Thu Aug 02, 2018 10:09 pm
See attached the current assembly file.
TIA,
Manuel
I can reproduce the problem. I will have a look why this happens...
KBWBE

https://github.com/kbwbe/A2plus
latest release: v0.4.29, installable via FreeCAD's addon manager
Tutorials:
Paul Randall: https://youtu.be/mnkecA9S7kc
anisim (deutsch): https://www.youtube.com/watch?v=vDcaFq6IEJM