You're completely right with "not enough constraints". I recently reworked this crankshaft assembly and noticed, that the solver was much happier when applying some additional pointIdentity constraints (what logically did the same as lockRotation would/ should do in these places).Turro75 wrote: ↑Tue Aug 21, 2018 5:00 pm @Kbwbe,
there is 1 constraint solved at stage 2, all other are solved all together in the stage 5 because there are not enough constraint to match stages 1 or 2,
the attached file adds several lockrotation so some constraint are solved alone, and it finally solve it.
I think even master fails on it, or I'm wrong?
cranckshaft_reworked.gif
Another approach to assembly solver (A2plus)
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
- manuelkrause
- Posts: 442
- Joined: Thu Jul 05, 2018 7:16 pm
Re: Another approach to assembly solver (A2plus)
- manuelkrause
- Posts: 442
- Joined: Thu Jul 05, 2018 7:16 pm
Re: Another approach to assembly solver (A2plus)
Ah, yes! That was the information needed to work with. Thank you!kbwbe wrote: ↑Tue Aug 21, 2018 10:29 amHi Manuel,manuelkrause wrote: ↑Tue Aug 21, 2018 7:58 am Mmm. That's not enough info for me to find my mistakes. I'd attach the current devel-branch based changed files and a .diff patch as well for reference.
Please retry and then, please, find more descriptive words than your "no success" and "not run correctly".
TIA
Yesterday, i stopped debugging early. Sorry for missing informations.
Thank you for your files. I opened new branch "improve-color-import", based on "devel" branch and inserted your files.
Quicktest-result:
- import of subassemblies works, colors are imported, transparency not. ( I think it is not possible )
- import of single parts does not work anymore, see console output: (you have to check that a property exists before accessing it)
Find attached the part, which can not be importedCode: Select all
Running the Python command 'a2p_ImportPart' failed: Traceback (most recent call last): File "/home/klaus/.FreeCAD/Mod/a2plus/a2p_importpart.py", line 316, in Activated importedObject = importPartFromFile(doc, filename) File "/home/klaus/.FreeCAD/Mod/a2plus/a2p_importpart.py", line 172, in importPartFromFile importableObjects.extend(getImpPartsFromDoc(importDoc)) #visible parts only File "/home/klaus/.FreeCAD/Mod/a2plus/a2p_importpart.py", line 89, in getImpPartsFromDoc impPartList = filterImpParts(obj) File "/home/klaus/.FreeCAD/Mod/a2plus/a2p_importpart.py", line 143, in filterImpParts elif obj.subassemblyImport == True: # assem item 'PrimitivePy' object has no attribute 'subassemblyImport'
Your replacements of "unicode()" to "str()" breaks unicode handling on Py2 machines. So our french user @JBE could use accents anymore. It has to be replaced dependent on PyVersion...
Code: Select all
PyVersion=sys.version_info[0] if PyVersion == 2: ... else: ...
Locally I've fixed it and most likely this would also fix your missing subassembly transparency (as importPartFromFile is involved).
Please leave me some time to learn into github, so things can be handled easier and less time consuming.
Thank you for your time and work!
- wandererfan
- Veteran
- Posts: 6326
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: Another approach to assembly solver (A2plus)
This thread has a whole bunch of git/github suggestions.,manuelkrause wrote: ↑Tue Aug 21, 2018 8:01 pm Please leave me some time to learn into github, so things can be handled easier and less time consuming.
- manuelkrause
- Posts: 442
- Joined: Thu Jul 05, 2018 7:16 pm
Re: Another approach to assembly solver (A2plus)
@wandererfan,wandererfan wrote: ↑Tue Aug 21, 2018 8:30 pmThis thread has a whole bunch of git/github suggestions.,manuelkrause wrote: ↑Tue Aug 21, 2018 8:01 pm Please leave me some time to learn into github, so things can be handled easier and less time consuming.
many thanks for that link! It provides the summary of information I needed.
Perfect collaboration on here!
I'd set it up tomorrow.
Re: Another approach to assembly solver (A2plus)
.manuelkrause wrote: ↑Tue Aug 21, 2018 7:55 pmYou're completely right with "not enough constraints". I recently reworked this crankshaft assembly and noticed, that the solver was much happier when applying some additional pointIdentity constraints (what logically did the same as lockRotation would/ should do in these places).Turro75 wrote: ↑Tue Aug 21, 2018 5:00 pm @Kbwbe,
there is 1 constraint solved at stage 2, all other are solved all together in the stage 5 because there are not enough constraint to match stages 1 or 2,
the attached file adds several lockrotation so some constraint are solved alone, and it finally solve it.
I think even master fails on it, or I'm wrong?
cranckshaft_reworked.gif
Hi Manuel, hi Turro !
i pushed a bugfix to devel branch. It now solves the unreworked crankshaft too !
- Attachments
-
- crankshaft-manuel-disrupted.fcstd
- (41.87 KiB) Downloaded 30 times
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
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
- wandererfan
- Veteran
- Posts: 6326
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: Another approach to assembly solver (A2plus)
This fastener set is 4 separate pieces in the source file. When we import it, it gets sub-assembled into 1 item. But we should support importing a set of pieces, no?
I can see how to program the importer to bring the fasteners in as 4 pieces, but how should the program decide that importFile1 should be merged into a sub-assembly, but importFile2 should be left as separate items? A separate "import as pieces" command seems excessive. Any thoughts?
I can see how to program the importer to bring the fasteners in as 4 pieces, but how should the program decide that importFile1 should be merged into a sub-assembly, but importFile2 should be left as separate items? A separate "import as pieces" command seems excessive. Any thoughts?
- Attachments
-
- FastenerSet.png (21.32 KiB) Viewed 1121 times
Re: Another approach to assembly solver (A2plus)
How about a question dialog to ask what to do whenever found a multi shape obj?wandererfan wrote: ↑Tue Aug 21, 2018 11:58 pm This fastener set is 4 separate pieces in the source file. When we import it, it gets sub-assembled into 1 item. But we should support importing a set of pieces, no?
I can see how to program the importer to bring the fasteners in as 4 pieces, but how should the program decide that importFile1 should be merged into a sub-assembly, but importFile2 should be left as separate items? A separate "import as pieces" command seems excessive. Any thoughts?
One request, does it can be added a command to transform a shape already in the fcstd to a valid asplus obj which can now be "seen" by constraints?
Re: Another approach to assembly solver (A2plus)
Hi wandererfan,wandererfan wrote: ↑Tue Aug 21, 2018 11:58 pm This fastener set is 4 separate pieces in the source file. When we import it, it gets sub-assembled into 1 item. But we should support importing a set of pieces, no?
Which usecase do you see for a "import as pieces" ?
I think it will complicate future releases of A2Plus regarding reimporting of edited parts. (Especially when we try a kind of topological naming)
I would not do this ATM, if there are no clear applications for that feature.
Our state now, being able to import multi shape parts (afterwards combined to one shape), is already going beyond the capabilities of Hamish's A2 WB.
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
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
Re: Another approach to assembly solver (A2plus)
Hi Turro, wandererfan,
this could be somehow useful, as for working e.g. fasteners from correspoding WB.
@wandererfan: Is it possible to adapt your import-algo to convert a shape within assembly to a valid A2plus importPart ?
Property "sourceFile" has to be handled differently later, as no reimport is possible.
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
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
- wandererfan
- Veteran
- Posts: 6326
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: Another approach to assembly solver (A2plus)
Yes, I believe this would be fairly straight forward.
This would be a shape that didn't pass though importer to be added? Maybe a base shape for the assembly?