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 »

Turro75 wrote: Tue Sep 11, 2018 11:59 pm
Turro75 wrote: Tue Sep 11, 2018 9:10 pm
kbwbe wrote: Tue Sep 11, 2018 8:42 pm
Turro75 wrote: ping
Hi Turro,
one question: Is it possible for you to do a PR with the two solver solution to devel branch next days ? Or do we have to merge manually ?
Important: the PR should only include your core modifications so that there is no big impact to current devel state. Our standard solver should keep on working as before.
let me try
PR sent
Thank you, this was fast!
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
Koemi
Posts: 150
Joined: Thu Dec 28, 2017 11:13 am
Location: The Netherlands

Re: Another approach to assembly solver (A2plus)

Post by Koemi »

kbwbe wrote: Tue Sep 11, 2018 3:14 pm Hi Koemi,
if you put e.g. a fastener from fasteners WB to A2plus file, at first moment it is no correct A2p import part. You can select the new fastener, hit the "convert" button and the fastener turns to be a A2p part. From this point on, you can correctly set constraints to it and do all usual A2p operations.
Well...

I discovered that parts made with FC_V0.16 also cannot be used with A2Plus without 'convert'...

Message: "Import error: no visible part to import found. Aborting operation". Report view notification: "imported Object is empty/none"

But there IS a part visible... :(

So, I made a copy of the part (just in case); opened it; clicked the 'convert' button; saved it. And after this procedure the part is accepted with A2Plus.

Then I tried if the converted part still functions in FC_V0.16: it did :D
Then I tried if the converted part still functions in A2 (no plus): it did :D

I am used to the fact that updated software eats any older version file and files created with updated software cannot be opened with an older version. Now I have the opposite :shock:

I now say carefully that parts will not be damaged after conversion with A2Plus
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 »

Koemi wrote: Wed Sep 12, 2018 8:05 am I discovered that parts made with FC_V0.16 also cannot be used with A2Plus without 'convert'...
Hi Koemi,
in this case, there seems to be a problem with the file importer. It is not intended. We will check...
Please post a not importable file.
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
Koemi
Posts: 150
Joined: Thu Dec 28, 2017 11:13 am
Location: The Netherlands

Re: Another approach to assembly solver (A2plus)

Post by Koemi »

Ok. Here's that file. I also added the file which was converted.

I also noticed that after conversion the part and corresponding sketch are on the same level in the tree... It looks like if the sketch does not belong anymore to the part... :?:
Attachments
metal strip converted.FCStd
(7.31 KiB) Downloaded 30 times
metal strip.FCStd
(7.25 KiB) Downloaded 30 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 »

Koemi wrote: Wed Sep 12, 2018 9:18 am Ok. Here's that file. I also added the file which was converted.

I also noticed that after conversion the part and corresponding sketch are on the same level in the tree... It looks like if the sketch does not belong anymore to the part... :?:
A2p is not intended to be used an a single part document. It is only for use with A2p assembly files. If using on wrong files, they could be damaged.
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
Koemi
Posts: 150
Joined: Thu Dec 28, 2017 11:13 am
Location: The Netherlands

Re: Another approach to assembly solver (A2plus)

Post by Koemi »

kbwbe wrote: Wed Sep 12, 2018 9:33 am
Koemi wrote: Wed Sep 12, 2018 9:18 am Ok. Here's that file. I also added the file which was converted.

I also noticed that after conversion the part and corresponding sketch are on the same level in the tree... It looks like if the sketch does not belong anymore to the part... :?:
A2p is not intended to be used an a single part document. It is only for use with A2p assembly files. If using on wrong files, they could be damaged.
eehrr... This is the message when i swipe over the convert button....

Image

:?: :?:

So I understand that at this moment it is not possible (for me) to add earlier created parts ( < FC_V0.17) inside A2P?
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 »

Koemi wrote: Wed Sep 12, 2018 9:49 am So I understand that at this moment it is not possible (for me) to add earlier created parts ( < FC_V0.17) inside A2P?
Please keep patiently, i am working on that problem...
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
Koemi
Posts: 150
Joined: Thu Dec 28, 2017 11:13 am
Location: The Netherlands

Re: Another approach to assembly solver (A2plus)

Post by Koemi »

I am so very patient... :D

And now I found another bug, sorry... :roll:

The following happens:

I call the file "Alu_profiel 30x15x3_150" and save it.

When I add this file in A2P the file is known as: "Alu_profiel 30x15x3_001".

What happended to my "150"?

This effect happens if I create a part using FC_V0.16 and converted it with A2P AND If I create a body (...) with FC_V0.17
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 »

wandererfan wrote: ping
Hi wandererfan,
@Koemi, see posts before, could not import the file being attached. It is done with pure FC16.

In importer, we need the section for:
obj.isDerivedFrom("PartDesign::Feature") for FC16 parts. Obs are filtered out at moment.

I tried to modify the importer:

Code: Select all

def filterImpParts(obj):
    impPartsOut = list()
    if obj.isDerivedFrom("Sketcher::SketchObject"):
        pass
    elif obj.isDerivedFrom("PartDesign::Body"):
        # we want bodies that are top level in the document or top level in a container(App::Part)
        # we don't want bodies that are inside other bodies.
        if ((not(obj.InList)) or  \
            ((len(obj.InList) == 1) and (obj.InList[0].hasExtension("App::GroupExtension")))):  #top of group
            plmGlobal = obj.getGlobalPlacement();
            plmLocal  = obj.Placement;
            if (plmGlobal != plmLocal):
                obj.Placement = plmGlobal             # should obj be a copy here?  not in orig doc - maybe no problem?
            impPartsOut.append(obj)
    elif obj.hasExtension("App::GroupExtension"):     # App::Part container.  GroupEx contents are already in list,
        pass                                          # don't need to find them
    elif obj.isDerivedFrom("PartDesign::Feature"):
        plmGlobal = obj.Placement
        try:
            plmGlobal = obj.getGlobalPlacement();
        except:
            pass
        if (
            hasattr(obj,"ViewObject") and
            obj.ViewObject.isVisible() and
            hasattr(obj,"Shape") and
            len(obj.Shape.Faces) > 0
            ):
            obj.Placement = plmGlobal
            impPartsOut.append(obj)
    elif obj.isDerivedFrom("Part::Feature"):
        plmGlobal = obj.Placement
        try:
            plmGlobal = obj.getGlobalPlacement();
        except:
            pass
        if not(obj.InList):
            obj.Placement = plmGlobal
            impPartsOut.append(obj)                  # top level in within Document
        elif (len(obj.InList) == 1) and (obj.InList[0].hasExtension("App::GroupExtension")):
            obj.Placement = plmGlobal
            impPartsOut.append(obj)                  # top level within Group
        elif a2plib.isA2pPart(obj):                  # imported part
            impPartsOut.append(obj)
        else:
            pass                                     # more odd PF cases?? BaseFeature in body??
    else:
        pass                                         # garbage objects - Origins, Axis, etc
    return impPartsOut

The code is not completely tested out. I noticed, that, because we don't copy the parts, placement operations are done on original import file. Please can you have a look at the code of the importer regarding FC16. Are my changes correct? Also it should be able to copy the objects, atm it doesn't.
Attachments
metal strip.FCStd
(7.25 KiB) Downloaded 31 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
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 »

Koemi wrote: Wed Sep 12, 2018 8:05 am
kbwbe wrote: Tue Sep 11, 2018 3:14 pm Hi Koemi,
if you put e.g. a fastener from fasteners WB to A2plus file, at first moment it is no correct A2p import part. You can select the new fastener, hit the "convert" button and the fastener turns to be a A2p part. From this point on, you can correctly set constraints to it and do all usual A2p operations.
Well...

I discovered that parts made with FC_V0.16 also cannot be used with A2Plus without 'convert'...

Message: "Import error: no visible part to import found. Aborting operation". Report view notification: "imported Object is empty/none"

But there IS a part visible... :(

So, I made a copy of the part (just in case); opened it; clicked the 'convert' button; saved it. And after this procedure the part is accepted with A2Plus.

Then I tried if the converted part still functions in FC_V0.16: it did :D
Then I tried if the converted part still functions in A2 (no plus): it did :D

I am used to the fact that updated software eats any older version file and files created with updated software cannot be opened with an older version. Now I have the opposite :shock:

I now say carefully that parts will not be damaged after conversion with A2Plus
Find a bugfix v0.1.1 release on github for this error. Please update A2plus...
I will be offline for perhaps 2 or 3 days. Next bug, you found, i will work on later.
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