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!
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Another approach to assembly solver (A2plus)

Post by Kunda1 »

@kbwbe perhaps you may be interested to use the Github releases/tag features so it's easier to follow the evolution of A2plus + create appimages for it for testing (just like realthunder does for asm3 ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Turro75
Posts: 179
Joined: Mon Aug 15, 2016 10:23 pm

Re: Another approach to assembly solver (A2plus)

Post by Turro75 »

kbwbe wrote: Sun Sep 02, 2018 11:43 am
manuelkrause wrote:
Hi Manuel,
your assemblies are always useful to find strange problems. I was hunting a problem with axial constraints within your motor, but found a problem within your piston part.

Please find 3 files attached:
- modified piston
- stable assembly
- instable assembly

Open the assemblies and hit the solve button. you see what happens.

Stable assembly:
I modified the piston "Kolben" and inserted an axis. This axis is used for an axialConstraint

Instable assembly:
Instead of the newly inserted axis, the surface of the drilling hole in piston is used for same axialConstraint.
The problem i found is that the center of surface is 5 meters !!! away from piston part. Is there anythin special with that drilling hole ? Is it a cone with very small angle ?

Please test the files...
instable still having a lot of errors even with last getMovement.

EDIT:

during solving a2+man I got exception on vec3.normalize()

Code: Select all

#project this vector to the own axis
        #This marks the beginning of the moveVecotr
        dot = vec2.dot(ownAxis)
        vec3 = Base.Vector(ownAxis)
        vec3.normalize()  -->EXCEPTION DUE TO NULL VECTOR
        vec3.multiply(dot)
        #Sub both vectors to geht the movevector shortest way between both axes
        moveVector = vec2.sub(vec3)
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 04, 2018 10:19 pm
instable still having a lot of errors even with last getMovement.
during solving a2+man I got exception on vec3.normalize()

Code: Select all

#project this vector to the own axis
        #This marks the beginning of the moveVecotr
        dot = vec2.dot(ownAxis)
        vec3 = Base.Vector(ownAxis)
        vec3.normalize()  -->EXCEPTION DUE TO NULL VECTOR
        vec3.multiply(dot)
        #Sub both vectors to geht the movevector shortest way between both axes
        moveVector = vec2.sub(vec3)
Hi Turro, thank you for feedback. I will have a look.
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 »

Kunda1 wrote: Tue Sep 04, 2018 9:07 pm @kbwbe perhaps you may be interested to use the Github releases/tag features so it's easier to follow the evolution of A2plus + create appimages for it for testing (just like realthunder does for asm3 ?
Hi Kunda1,
with next master-update, there will be release tags.

Edit: Appimages are making no sense for this python WB. A simple git pull updates the WB to new versions.
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
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Another approach to assembly solver (A2plus)

Post by Kunda1 »

kbwbe wrote: Wed Sep 05, 2018 8:43 am Hi Kunda1,
with next master-update, there will be release tags.

Edit: Appimages are making no sense for this python WB. A simple git pull updates the WB to new versions.
Awesome.
Re:appimage
Great that it's pure python so testing is easier. Says the word and ill add it to the add-on manager under alpha status for others to test as well.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
manuelkrause
Posts: 442
Joined: Thu Jul 05, 2018 7:16 pm

Re: Another approach to assembly solver (A2plus)

Post by manuelkrause »

Kunda1 wrote: Wed Sep 05, 2018 11:17 am
kbwbe wrote: Wed Sep 05, 2018 8:43 am Hi Kunda1,
with next master-update, there will be release tags.

Edit: Appimages are making no sense for this python WB. A simple git pull updates the WB to new versions.
Awesome.
Re:appimage
Great that it's pure python so testing is easier. Says the word and ill add it to the add-on manager under alpha status for others to test as well.
Simply: nice!
Given the simplicity to add, the convenience to work with and the proved results, it's a worthy alternative to asm3, that many FC users would like to have! And so far we're only talking about ~3 months of development, on top of hamish2014's work of course.

I again want to express my thankfulness @kbwbe for having taken this job!
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, @manuelkrause, @wandererfan

Hi Guy's,

i got axialConstraint stable now. It solves Manuel's problematic motor assembly now without problems.
I switched back to old calculation of axial.getMovement(), but adjusted the refPoints during loadSystem().
Now the refPoint of axial is set near to the BoundBox.Center of the referenced surface.

@Turro75: there is a new function inside axial dependency:
.

Code: Select all

    def adjustRefPoints(self,obj,sub,refPoint,axis):
        if sub.startswith("Edge"): return refPoint
        face = getObjectFaceFromName(obj,sub)
        bbCenter = face.BoundBox.Center
        if bbCenter.distanceToLine(refPoint,axis) < 1.0e-12:
            return bbCenter
        v1 = bbCenter.sub(refPoint)
        v2 = Base.Vector(axis)
        v2.normalize()
        dot = v1.dot(v2)
        v2.multiply(dot)
        refPoint = refPoint.add(v2)
        return refPoint
.
which has to be called here:
.

Code: Select all

	.... Dependency.Create()....

        elif c.Type == "axial":
            dep1 = DependencyAxial(c, "pointAxis")
            dep2 = DependencyAxial(c, "pointAxis")

            ob1 = doc.getObject(c.Object1)
            ob2 = doc.getObject(c.Object2)
            dep1.refPoint = getPos(ob1,c.SubElement1)
            dep2.refPoint = getPos(ob2,c.SubElement2)
            axis1 = getAxis(ob1, c.SubElement1)
            axis2 = getAxis(ob2, c.SubElement2)
            if dep2.direction == "opposed":
                axis2.multiply(-1.0)
                
            dep1.refPoint = dep1.adjustRefPoints(ob1,c.SubElement1,dep1.refPoint,axis1)    
            dep2.refPoint = dep2.adjustRefPoints(ob2,c.SubElement2,dep2.refPoint,axis2)    
                
            dep1.refAxisEnd = dep1.refPoint.add(axis1)
            dep2.refAxisEnd = dep2.refPoint.add(axis2)
.
Hi all,
because of this important bugfix, v0.0.2 has been released.
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: Wed Sep 05, 2018 4:12 pm @Turro75, @manuelkrause, @wandererfan

Hi Guy's,

i got axialConstraint stable now. It solves Manuel's problematic motor assembly now without problems.
I switched back to old calculation of axial.getMovement(), but adjusted the refPoints during loadSystem().
Now the refPoint of axial is set near to the BoundBox.Center of the referenced surface.

@Turro75: there is a new function inside axial dependency:
.

Code: Select all

    def adjustRefPoints(self,obj,sub,refPoint,axis):
        if sub.startswith("Edge"): return refPoint
        face = getObjectFaceFromName(obj,sub)
        bbCenter = face.BoundBox.Center
        if bbCenter.distanceToLine(refPoint,axis) < 1.0e-12:
            return bbCenter
        v1 = bbCenter.sub(refPoint)
        v2 = Base.Vector(axis)
        v2.normalize()
        dot = v1.dot(v2)
        v2.multiply(dot)
        refPoint = refPoint.add(v2)
        return refPoint
.
which has to be called here:
.

Code: Select all

	.... Dependency.Create()....

        elif c.Type == "axial":
            dep1 = DependencyAxial(c, "pointAxis")
            dep2 = DependencyAxial(c, "pointAxis")

            ob1 = doc.getObject(c.Object1)
            ob2 = doc.getObject(c.Object2)
            dep1.refPoint = getPos(ob1,c.SubElement1)
            dep2.refPoint = getPos(ob2,c.SubElement2)
            axis1 = getAxis(ob1, c.SubElement1)
            axis2 = getAxis(ob2, c.SubElement2)
            if dep2.direction == "opposed":
                axis2.multiply(-1.0)
                
            dep1.refPoint = dep1.adjustRefPoints(ob1,c.SubElement1,dep1.refPoint,axis1)    
            dep2.refPoint = dep2.adjustRefPoints(ob2,c.SubElement2,dep2.refPoint,axis2)    
                
            dep1.refAxisEnd = dep1.refPoint.add(axis1)
            dep2.refAxisEnd = dep2.refPoint.add(axis2)
.
Hi all,
because of this important bugfix, v0.0.2 has been released.
Just made a quick test, now it works perfectly.
One more step to the first release :-)
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 »

Kunda1 wrote: Wed Sep 05, 2018 11:17 am Says the word and ill add it to the add-on manager under alpha status for others to test as well.
Hi Kunda1,
have a little bit patience, we are very near to this point, but not completely.
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
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Another approach to assembly solver (A2plus)

Post by Kunda1 »

kbwbe wrote: Wed Sep 05, 2018 4:57 pm
Kunda1 wrote: Wed Sep 05, 2018 11:17 am Says the word and ill add it to the add-on manager under alpha status for others to test as well.
Hi Kunda1,
have a little bit patience, we are very near to this point, but not completely.
:thumbsup:
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply