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!
Koemi
Posts: 145
Joined: Thu Dec 28, 2017 11:13 am
Location: The Netherlands

Re: Another approach to assembly solver (A2plus)

Post by Koemi »

Koemi wrote: Fri Sep 14, 2018 10:04 am Unfortunately also A2 is not functional 100% either, especially adapting angle constraints lead to unjustified constraint faillure
I know you also have certain problems with angles constraints (something with avoiding 0°or 180°).

Just to show you this problem with A2. Maybe it helps with solving things with AS2:

Image

This plate is connected to a hole in a plate in the colomb with a circular edge constraint with 2,5mm offset.

Then I have created an angular constraint and changed the angular offset a few times. The first efforts no error appears. But a few attempts more and... error.

Python console:

Code: Select all

>>> FreeCAD.getDocument("Unnamed").getObject("angleConstraint01").angle = 0.00
>>> FreeCAD.getDocument("Unnamed").getObject("angleConstraint01").angle = 8.00
>>> FreeCAD.getDocument("Unnamed").getObject("angleConstraint01").angle = -8.00
>>> FreeCAD.getDocument("Unnamed").getObject("angleConstraint01").angle = 0.00
>>> FreeCAD.getDocument("Unnamed").getObject("angleConstraint01").angle = -8.00
>>> FreeCAD.getDocument("Unnamed").getObject("angleConstraint01").angle = 0.00
>>> FreeCAD.getDocument("Unnamed").getObject("angleConstraint01").angle = 8.00
Report view:

Code: Select all

UNABLE TO SOLVE CONSTRAINTS! info:<AngleUnion System V0_16_A2_SAM_Statief_kolom_Ophangplaat_01:Face18-Flat_panel_statief_kolom_200x100_01:Face19 heirachy 10> abs( self.constraintEq_value(self.X) ) > tol [1.142230e+00 > 1.000000e-09]. Constraint Tree:
<AngleUnion System V0_16_A2_SAM_Statief_kolom_Ophangplaat_01:Face18-Flat_panel_statief_kolom_200x100_01:Face19 heirachy 10>
    <PlaneOffsetUnion System V0_16_A2_SAM_Statief_kolom_Ophangplaat_01:Edge71-Glijstrip_TV55inch_beugel_kolom_zijde_01:Edge10 heirachy 9> 1 degrees of freedom:
      <AxisRotation DegreeOfFreedom V0_16_A2_SAM_Statief_kolom_Ophangplaat_01 axis:[ -1.00000000e+00   1.47525983e-08  -1.51093658e-08] value:0.128660>
        <AxisDistanceUnion System V0_16_A2_SAM_Statief_kolom_Ophangplaat_01:Edge71-Glijstrip_TV55inch_beugel_kolom_zijde_01:Edge10 heirachy 8> 2 degrees of freedom:
          <AxisRotation DegreeOfFreedom V0_16_A2_SAM_Statief_kolom_Ophangplaat_01 axis:[ -1.00000000e+00   1.47525983e-08  -1.51093658e-08] value:0.128660>
          <LinearMotion DegreeOfFreedom V0_16_A2_SAM_Statief_kolom_Ophangplaat_01 direction:[ -1.00000000e+00   1.47525983e-08  -1.51093658e-08] value:-0.000013>
            <AxisAlignmentUnion System V0_16_A2_SAM_Statief_kolom_Ophangplaat_01:Edge71-Glijstrip_TV55inch_beugel_kolom_zijde_01:Edge10 heirachy 7> 4 degrees of freedom:
              <Placement DegreeOfFreedom V0_16_A2_SAM_Statief_kolom_Ophangplaat_01-x value:-0.000001>
              <Placement DegreeOfFreedom V0_16_A2_SAM_Statief_kolom_Ophangplaat_01-y value:-108.716164>
              <Placement DegreeOfFreedom V0_16_A2_SAM_Statief_kolom_Ophangplaat_01-z value:835.951091>
              <AxisRotation DegreeOfFreedom V0_16_A2_SAM_Statief_kolom_Ophangplaat_01 axis:[ -1.00000000e+00   1.47525983e-08  -1.51093658e-08] value:0.128660>
                <FreeObjectSystem V0_16_A2_SAM_Statief_kolom_Ophangplaat_01> 6 degrees of freedom:
                  <Placement DegreeOfFreedom V0_16_A2_SAM_Statief_kolom_Ophangplaat_01-x value:-0.000001>
                  <Placement DegreeOfFreedom V0_16_A2_SAM_Statief_kolom_Ophangplaat_01-y value:-108.716164>
                  <Placement DegreeOfFreedom V0_16_A2_SAM_Statief_kolom_Ophangplaat_01-z value:835.951091>
                  <Placement DegreeOfFreedom V0_16_A2_SAM_Statief_kolom_Ophangplaat_01-azimuth value:1.570796>
                  <Placement DegreeOfFreedom V0_16_A2_SAM_Statief_kolom_Ophangplaat_01-elavation value:0.709122>
                  <Placement DegreeOfFreedom V0_16_A2_SAM_Statief_kolom_Ophangplaat_01-rotation value:3.141593>
                <PlaneOffsetUnion System Glijstrip_TV55inch_beugel_kolom_zijde_01:Face1-Flat_panel_statief_kolom_200x100_01:Face24 heirachy 6> 0 degrees of freedom:
                    <AxisAlignmentUnion System Glijstrip_TV55inch_beugel_kolom_zijde_01:Face1-Flat_panel_statief_kolom_200x100_01:Face24 heirachy 5> 1 degrees of freedom:
                      <LinearMotion DegreeOfFreedom Glijstrip_TV55inch_beugel_kolom_zijde_01 direction:[ -4.44089210e-16   1.00000000e+00   0.00000000e+00] value:-10.000000>
                        <PlaneOffsetUnion System Glijstrip_TV55inch_beugel_kolom_zijde_01:Face2-Flat_panel_statief_kolom_200x100_01:Face31 heirachy 4> 1 degrees of freedom:
                          <LinearMotion DegreeOfFreedom Glijstrip_TV55inch_beugel_kolom_zijde_01 direction:[ -4.44089210e-16   1.00000000e+00   0.00000000e+00] value:-10.000000>
                            <AxisAlignmentUnion System Glijstrip_TV55inch_beugel_kolom_zijde_01:Face2-Flat_panel_statief_kolom_200x100_01:Face31 heirachy 3> 2 degrees of freedom:
                              <LinearMotion DegreeOfFreedom Glijstrip_TV55inch_beugel_kolom_zijde_01 direction:[ -1.00000000e+00   1.22464680e-16   0.00000000e+00] value:-97.500000>
                              <LinearMotion DegreeOfFreedom Glijstrip_TV55inch_beugel_kolom_zijde_01 direction:[ -1.83697020e-16  -1.00000000e+00   0.00000000e+00] value:10.000000>
                                <PlaneOffsetUnion System Glijstrip_TV55inch_beugel_kolom_z�Unhandled Base::Exception caught in GUIApplication::notify.
The error message is: Nested recomputes of a document are not allowed
After this error I can only delete the constrain and add it again, but then the error appears immediately.

I am not asking for a solution about this problem. Maybe someone sees what is going on, learns from it and makes sure it does not appear as a bug in A2P 8-)
Attachments
test.FCStd
(59.79 KiB) Downloaded 37 times
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Another approach to assembly solver (A2plus)

Post by wandererfan »

kbwbe wrote: Wed Sep 12, 2018 2:19 pm 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.
Sorry not much time for A2p this week. This may be old news, but I finally got a chance to look at importer and read the comments here;

Issues raised by @Koemi
- "I discovered that parts made with FC_V0.16 also cannot be used with A2Plus without 'convert'..."
>>> this is true for v017 also. A2p expects parts in its own format, so they must be imported or converted.
- Message: "Import error: no visible part to import found. Aborting operation". Report view notification: "imported Object is empty/none"
>>> fixed

- metal_strip.fcstd imports normally now

- metal_strip.fcstd:Pocket converts normally (but leaves sketch behind as usual. This would be a good feature request - after converting a PartDesign::Feature, remove the associated "debris" - sketches, preceeding features)

- "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... :?:"
>>> sketch does not belong to Pocket_001 as Pocket_001 is no longer a PD::Feature

- "So I understand that at this moment it is not possible (for me) to add earlier created parts ( < FC_V0.17) inside A2P?"
>>> they can be imported or converted to A2p form

separate post to follow re @kbwbe's issues.

wf
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Another approach to assembly solver (A2plus)

Post by wandererfan »

kbwbe wrote: Wed Sep 12, 2018 2:19 pm Please can you have a look at the code of the importer regarding FC16.
issues raised by @Kbwbe:

- @Koemicould not import the file being attached (metal_strip.fcstd). It is done with pure FC16.
>>> metal_strip.fcstd imports/converts normally now

- In importer, we need the section for:
obj.isDerivedFrom("PartDesign::Feature") for FC16 parts. Obs are filtered out at moment.
>>> v0.16 PD::Features import now.
>>> PR to address potential non-import due to Group membership is in your Q

- Please can you have a look at the code of the importer regarding FC16. Are my changes correct?
>>> seem to work just like 017 as far as importing/converting goes

- Also it should be able to copy the objects, atm it doesn't.
>>> converted/import objects can be copied for 16&17
>>> unconverted v016 parts can not be copied as they are missing properties. This is the same as v017.

- I noticed, that, because we don't copy the parts, placement operations are done on original import file.
>>> v016 doesn't have global placement, but it doesn't have Containers either so that is a wash
>>> PR to consolidate placement logic apply to copy of original shape is in your queue

- Please can you have a look at the code of the importer regarding FC16.
>>> visible, but non top level v016 PD::F are skipped "accidently" because they have non-empty inlists that
contain an invisible object. Would probably be better for PD::F16s to only take them if inList is empty or contains only a
Group. PR is in your Q.
>>> in v017+ top PD::F (ie tip) has non-empty inlist due to PD::Body.
>>> for 017 PD we are importing whichever PD::F is marked visible. We should be importing the Body or the Tip (but not both)
PR in your Q handles this as well.
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Another approach to assembly solver (A2plus)

Post by wandererfan »

I've created a github repo for test files . @kbwbe, @turro75 and @ManuelKrause are "collaborators" and should be able to push updates.

If you have any interesting/useful test files please consider putting a copy into this repo.

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

Re: Another approach to assembly solver (A2plus)

Post by manuelkrause »

wandererfan wrote: Sat Sep 15, 2018 4:10 pm I've created a github repo for test files . @kbwbe, @turro75 and @ManuelKrause are "collaborators" and should be able to push updates.

If you have any interesting/useful test files please consider putting a copy into this repo.

wf
Thank you for initiating this. We have missed this easy occasion for too long.
Would you consider "A2plus-Man" and my engine assembly worth adding? Maybe I need to rework the latter due to all your suggestions regarding the piston pin axis (it's still at the problematic state).

Do we need additional info added, like "created with FC v.", "converted to A2plus: yes/no" ? Just want to ask before messing up your good idea... ;-)
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Another approach to assembly solver (A2plus)

Post by wandererfan »

manuelkrause wrote: Sun Sep 16, 2018 1:08 pm Would you consider "A2plus-Man" and my engine assembly worth adding? Maybe I need to rework the latter due to all your suggestions regarding the piston pin axis (it's still at the problematic state).

Do we need additional info added, like "created with FC v.", "converted to A2plus: yes/no" ? Just want to ask before messing up your good idea... ;-)
We seem to be using those 2 files for testing, so sure, upload them.

I've been putting version number and (a2p/FC) in the file title to try to keep them organized, but if you have a tidy way to add notes about the file's provenance then please implement it.

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

Re: Another approach to assembly solver (A2plus)

Post by manuelkrause »

wandererfan wrote: Sun Sep 16, 2018 2:13 pm
manuelkrause wrote: Sun Sep 16, 2018 1:08 pm Would you consider "A2plus-Man" and my engine assembly worth adding? Maybe I need to rework the latter due to all your suggestions regarding the piston pin axis (it's still at the problematic state).

Do we need additional info added, like "created with FC v.", "converted to A2plus: yes/no" ? Just want to ask before messing up your good idea... ;-)
We seem to be using those 2 files for testing, so sure, upload them.

I've been putting version number and (a2p/FC) in the file title to try to keep them organized, but if you have a tidy way to add notes about the file's provenance then please implement it.

wf
I get this "Uploads are disabled: File uploads require push access to this repository." when accessing over the web GUI although I' logged in.
Can you please check or clarify on how to push properly.

Thanks in advance!
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Another approach to assembly solver (A2plus)

Post by wandererfan »

manuelkrause wrote: Sun Sep 16, 2018 4:23 pm I get this "Uploads are disabled: File uploads require push access to this repository." when accessing over the web GUI although I' logged in.
Can you please check or clarify on how to push properly.
You should get an email with an "invitation link". When you click on the link, it will add you to the collaborators list.
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: Sat Sep 15, 2018 4:10 pm I've created a github repo for test files . @kbwbe, @turro75 and @ManuelKrause are "collaborators" and should be able to push updates.

If you have any interesting/useful test files please consider putting a copy into this repo.

wf
Hi wandererfan,
good idea, i will participate when back from holiday.

@Turro75,
master branch now uses your DOF-library for standard solver, but without merging of rigids. Long chains of fully constrained parts are much faster now.

There is a new release v0.1.2, which already contains the modified solver.
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 »

kbwbe wrote: Mon Sep 17, 2018 2:54 pm
wandererfan wrote: Sat Sep 15, 2018 4:10 pm I've created a github repo for test files . @kbwbe, @turro75 and @ManuelKrause are "collaborators" and should be able to push updates.

If you have any interesting/useful test files please consider putting a copy into this repo.

wf
Hi wandererfan,
good idea, i will participate when back from holiday.

@Turro75,
master branch now uses your DOF-library for standard solver, but without merging of rigids. Long chains of fully constrained parts are much faster now.

There is a new release v0.1.2, which already contains the modified solver.
Hi Kbwbe,

Regarding merging rigids, unless we find a way to perfectly join 2 objs, it is better move them apart as You did.

Regarding tempfixing:
I tried a lot of combinations, no way, tempfixing on some assemblies generates unresolved results.
I found that the solver moves the involved objs to a position in between them. Tempfixing, make only free to move objs moving to the target.

I'm doing some quick test on rigid.calcmovedata, instead of ignoring tempfixed obj, it perform calculation as all other objs but, the actual movement is limited to 1/2 of current accuracy.

I found the frame-4parts, always solved at 1.0e-5mm accuracy, the drawback is that it is quite slower, I need more test on that.
Using last master solver (yesterday release), I found it quickly solved but never better than 1.0e-3 accuracy.

I 'll keep You updated on that
Post Reply