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!
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 »

dan-miel wrote: Thu Feb 28, 2019 12:53 am I looked at a2p_constraintDialog.py but I haven't found anything that looks out of place. Looks like I might be the only one with this problem.
I'm using:
Windows 10
FreeCad .17 32 bit
Whatever version of Python that comes with FreeCAD ver 17
Should I update to newer versions?
Hi Dan,
nevertheless, whether the error exists or not, i very strongly recomment use of FC0.18. It will be released very soon and it is much better than FC0.17. I do not work with any other version of FC anymore.

BR,
Klaus
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
Syres
Veteran
Posts: 2893
Joined: Thu Aug 09, 2018 11:14 am

Re: Another approach to assembly solver (A2plus)

Post by Syres »

Afternoon Klaus,

With regard to the FreeCAD version starting to be a factor would this be a step too far, changing the beginning of InitGui.py - def Initialize(self) from

Code: Select all

    def Initialize(self):
        import sys
to

Code: Select all

    def Initialize(self):
        import FreeCAD
        from PySide import QtGui
        FC_MINOR_VER_REQUIRED = 17
        FC_COMMIT_REQUIRED = 13500
        FC_MINOR_VER_RECOMMENDED = 18
        FC_COMMIT_RECOMMENDED = 14575
        ver = FreeCAD.Version()
        gitver = ver[2].split()[0]
        if gitver != 'Unknown':
            gitver = int(gitver)
        else:
            gitver = FC_COMMIT_REQUIRED
        if int(ver[0]) == 0 and (int(ver[1]) < FC_MINOR_VER_REQUIRED or (int(ver[1]) == FC_MINOR_VER_REQUIRED and gitver < FC_COMMIT_REQUIRED)):
            fc_msg = "FreeCAD version ({}.{}.{}) must be at least {}.{}.{} to be used with the A2P workbench".format(int(ver[0]), int(ver[1]), gitver, 0, FC_MINOR_VER_REQUIRED, FC_COMMIT_REQUIRED)
            print(fc_msg)
            diag = QtGui.QMessageBox(QtGui.QMessageBox.Critical,u"Error Message",fc_msg )
            diag.exec_()
        elif int(ver[0]) == 0 and (int(ver[1]) < FC_MINOR_VER_RECOMMENDED or (int(ver[1]) == FC_MINOR_VER_RECOMMENDED and gitver < FC_COMMIT_RECOMMENDED)):
            fc_msg = "While FreeCAD version ({}.{}.{}) will work with the A2P workbench, it is recommended to use {}.{}.{} or above".format(int(ver[0]), int(ver[1]), gitver, 0, FC_MINOR_VER_RECOMMENDED, FC_COMMIT_RECOMMENDED)
            print(fc_msg)
            diag = QtGui.QMessageBox(QtGui.QMessageBox.Warning,u"Advisory",fc_msg )
            diag.exec_()
        else:
            fc_msg = "This version {}.{}.{} of FreeCAD meets the recommended version {}.{}.{} to work with the A2P workbench".format(int(ver[0]), int(ver[1]), gitver, 0, FC_MINOR_VER_RECOMMENDED, FC_COMMIT_RECOMMENDED)
            print(fc_msg)
	
        import sys
Note: I just came up with arbitrary version numbers for me to carry out some testing so you would need to amend these to suit and I'm sure you could code it much cleaner, I was just looking at something to help.
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 »

Syres wrote: Thu Feb 28, 2019 4:00 pm
Hi @Syres,
thank you for contributing and sorry for my late answer. I integrated your code (with some reformattings) to the devel branch.

Thanks again,
Klaus
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
detlet
Posts: 85
Joined: Sun Sep 25, 2011 5:54 pm
Location: Lauenstein, Germany

Re: Another approach to assembly solver (A2plus)

Post by detlet »

Hi,

I have the problem, that sub-assemblies lose their colors if I import them in other assemblies. I have always the current version of FreeCAD and a2plus from git, and I may be totally wrong, but I think that since a few days ago all worked like as expected and the colors where kept. Is there something in the configuration that I may messed up?

Cheers Detlef

OS: Debian GNU/Linux buster/sid
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16050 (Git)
Build type: Unknown
Branch: master
Hash: 56cc7e791304b4ac575fafd98c4f5f9083b6cd09
Python version: 2.7.16
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
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 »

detlet wrote: Tue Mar 05, 2019 4:21 pm
Hi,
please make sure that the within the mainassembly, the subassembly object has the property "update Colors" set to True. Then touch once the subassembly file (open and save it) and update the 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
detlet
Posts: 85
Joined: Sun Sep 25, 2011 5:54 pm
Location: Lauenstein, Germany

Re: Another approach to assembly solver (A2plus)

Post by detlet »

kbwbe wrote: Tue Mar 05, 2019 4:50 pm Hi,
please make sure that the within the mainassembly, the subassembly object has the property "update Colors" set to True. Then touch once the subassembly file (open and save it) and update the main assembly.
Hi, thank you for the hint. In the mean time I've pulled the new version of a2plus from git and now adding parts to the assembly throw the following error message :(

Code: Select all

Running the Python command 'a2p_ImportPart' failed:
Traceback (most recent call last):
  File "/home/det/.FreeCAD/Mod/A2plus/a2p_importpart.py", line 307, in Activated
    importedObject = importPartFromFile(doc, filename)
  File "/home/det/.FreeCAD/Mod/A2plus/a2p_importpart.py", line 139, in importPartFromFile
    importDoc.save() # useless without saving...

Object attribute 'FileName' is not set
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 »

detlet wrote: Tue Mar 05, 2019 5:22 pm Hi, thank you for the hint. In the mean time I've pulled the new version of a2plus from git and now adding parts to the assembly throw the following error message :(

Code: Select all

Running the Python command 'a2p_ImportPart' failed:
Traceback (most recent call last):
  File "/home/det/.FreeCAD/Mod/A2plus/a2p_importpart.py", line 307, in Activated
    importedObject = importPartFromFile(doc, filename)
  File "/home/det/.FreeCAD/Mod/A2plus/a2p_importpart.py", line 139, in importPartFromFile
    importDoc.save() # useless without saving...

Object attribute 'FileName' is not set
Hi,
this only happens if you have the option "Recalculate imported parts before updating them (experimental)" in preferences. Do you really need this ?
Otherwise deactivate this option. (It was intended for people who are working with master spreadsheets, related to multiple files.) But nevertheless, as error message says, some file has not been saved with a name.
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
detlet
Posts: 85
Joined: Sun Sep 25, 2011 5:54 pm
Location: Lauenstein, Germany

Re: Another approach to assembly solver (A2plus)

Post by detlet »

kbwbe wrote: Tue Mar 05, 2019 5:44 pm this only happens if you have the option "Recalculate imported parts before updating them (experimental)" in preferences. Do you really need this ?
Otherwise deactivate this option. (It was intended for people who are working with master spreadsheets, related to multiple files.) But nevertheless, as error message says, some file has not been saved with a name.
Oh, this configuration was left from testing around, to bring it back to work... By deactivating it the error message is gone and adding parts work again. Thank you!

But also with your explention of the steps to import sub-assemblies the colors further get removed. The "update Colors" property is always for all pars on true. I've also tested to set it to false and back to true before import a sub-assembly but that also doesn't helped. All changes to the sub-assemblies get updated but not the colors... The strange thing is, that with an other sub-assembly the colors will be kept. Both are of the same kind, a simple PartDesing part connected with two step file parts. Also the properties of the parts in the working assembly and the one that fails, are in the relevant parts equal. The one which makes problems I have attached. The step files you can download from https://www.hiwin.de/de/Produkte/Profil ... MGNR/21097
Attachments
Hauptspindel komplett.FCStd
(152.33 KiB) Downloaded 52 times
Dirtygoyty
Posts: 4
Joined: Tue Mar 05, 2019 8:15 pm

Re: Another approach to assembly solver (A2plus)

Post by Dirtygoyty »

Hi,

I'm a new freecad user here, and first, I would like to give a big thank for this workbench to the creator. I use 0.17, and I have a big issue with colors and materials when using your assembly tool (I don't know if this already been report).

When importing new objects to assemble them, it's seems that the material I applied before when creating disappears, the colour seems to stay.

But when I try a raytracing render using Povray, Everything appears white, no more color, even less material.

I'm doing wrong somewhere?
Thanks in advance.
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 »

detlet wrote: Tue Mar 05, 2019 6:38 pm
There seems to be a problem of the conservation of colors of imported stepfiles.

See first screenshot here: colors of guide rails are not ok when original step import is used over 3 stages of assembly.
.
colors-subassemblies.png
colors-subassemblies.png (78.59 KiB) Viewed 1449 times
.
Then i set a color manually to the imported guide rail. (it was imported to a separate file). Doing this, the color is preserved over all stages of subassemblies.
.
step-file-recolored.png
step-file-recolored.png (85.39 KiB) Viewed 1449 times
.
When there is time for it, i will try to find out what happens with the original step colors. At moment you should set a color for an imported step part manually.
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