Assembly 2 workbench for FreeCAD v0.15

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
hamish
Posts: 72
Joined: Wed Nov 12, 2014 7:08 am

Assembly 2 workbench for FreeCAD v0.15

Post by hamish »

Hi Everyone,

I have written an assembly workbench for FreeCAD v0.15, which I am posting here for everyone's perusal.
The assembly2 wb is available together with a detailed description at
https://github.com/hamish2014/FreeCAD_assembly2

I realize that there is mostly likely heavy development on FreeCAD's inbuilt assembly wb, which i could have just used for my assembly needs.
However since FreeCAD provides such an excellent environment for building custom wbs, I decided to rather write my own wb exactly tailored to my needs.
Writing the assembly2 wb furthermore gave me a chance to play around with the maths behind CAD assembly codes, math which I have always wondered about...

Hope someone else finds the assembly2 wb useful
danielfalck
Posts: 395
Joined: Fri Oct 07, 2011 8:58 pm
Location: Beaverton,Oregon, USA
Contact:

Re: Assembly 2 workbench for FreeCAD v0.15

Post by danielfalck »

I have been using this today and have found it to have some features that I like. I wasn't able to get any of the constraints to work and I do have numpy and scipy installed. But, I really like the import part and reload part commands that you have. That has been very useful for me today. Just being able to import FreeCAD objects into my assembly file and being able to reload them after I have edited them in their original file is very nice.
I did comment out lines 61 through 64 (the lines that randomly place the part on import) in importPart.py because since I couldn't get assembly constraints to work, I prefer to know where my parts are located to begin with.

Good job.
danielfalck
Posts: 395
Joined: Fri Oct 07, 2011 8:58 pm
Location: Beaverton,Oregon, USA
Contact:

Re: Assembly 2 workbench for FreeCAD v0.15

Post by danielfalck »

This was the error that I got when trying to constrain two planes on two parts that had been imported using your new commands:

Code: Select all

creating planeConstraint01
assembly2solver parsing planeConstraint01
violated constraints: planeConstraint01
objects associated to these constraints: Unnamed_import01, block2_import01
repective connectivety [1, 1] 
variableManager.getValues() [6.84337598002, 3.18146, 93.4783563956, 0.0, 0.0, 0.0]
{'imode': 9, 'smode': 'Iteration limit exceeded', 'fOpt': nan, 'iter': 161, 'xOpt': [nan, nan, nan, nan, nan, nan]}
{'imode': 9, 'smode': 'Iteration limit exceeded', 'fOpt': nan, 'iter': 161, 'xOpt': [nan, nan, nan, nan, nan, nan]}
{'imode': 9, 'smode': 'Iteration limit exceeded', 'fOpt': nan, 'iter': 161, 'xOpt': [nan, nan, nan, nan, nan, nan]}
{'imode': 9, 'smode': 'Iteration limit exceeded', 'fOpt': nan, 'iter': 161, 'xOpt': [nan, nan, nan, nan, nan, nan]}
{'imode': 9, 'smode': 'Iteration limit exceeded', 'fOpt': nan, 'iter': 161, 'xOpt': [nan, nan, nan, nan, nan, nan]}
{'imode': 9, 'smode': 'Iteration limit exceeded', 'fOpt': nan, 'iter': 161, 'xOpt': [nan, nan, nan, nan, nan, nan]}
{'imode': 9, 'smode': 'Iteration limit exceeded', 'fOpt': nan, 'iter': 161, 'xOpt': [nan, nan, nan, nan, nan, nan]}
UNABLE TO SOLVE ASSEMBLY CONSTRAINTS. Info:
  optimization algorithm could not minimize the norm of constraint errors
    optimization algorithm used  : scipy.optimize.fmin_slsqp (Sequential Least SQuares Programming)
    optimization warning message : Iteration limit exceeded
    imode: 9
    smode: Iteration limit exceeded
    fOpt: nan
    iter: 161
    xOpt: [nan, nan, nan, nan, nan, nan]
UNABLE TO SOLVE ASSEMBLY CONSTRAINTS. refer to the Report View window for info

hamish
Posts: 72
Joined: Wed Nov 12, 2014 7:08 am

Re: Assembly 2 workbench for FreeCAD v0.15

Post by hamish »

Hi danielfalck, glad you found the wb useful :)

Regarding the constraint solver breaking down, please pm FreeCAD assembly file with the parts already imported and the constraints setup. I will then see if i can fix the bug.
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Assembly 2 workbench for FreeCAD v0.15

Post by jmaustpc »

Hi Hamish
Can I offer you a tip on using Git? :) Its best to keep you "master" branch in your repository in sync with official FreeCAD master, and then do all your development in a branch.

Jim
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Assembly 2 workbench for FreeCAD v0.15

Post by looo »

very intuitive! worked perfect on first try.
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Assembly 2 workbench for FreeCAD v0.15

Post by yorik »

Once again, amazing work hamish! Now I am getting afraid, what will be the next workbench that you will attack ;)
hamish
Posts: 72
Joined: Wed Nov 12, 2014 7:08 am

Re: Assembly 2 workbench for FreeCAD v0.15

Post by hamish »

lol, thanks yorik. Do not think of them as attacks but rather as suggestions for the next version of FreeCAD...

Also thank jim for git the advice, but i will leave things as they are for the moment, falling quite far behind with my work ...
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Assembly 2 workbench for FreeCAD v0.15

Post by yorik »

hamish wrote:Do not think of them as attacks but rather as suggestions for the next version of FreeCAD...
Of course, only joking. But it's always cool to see someone else think over a problem in a new way and solve it in a simple manner...
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Assembly 2 workbench for FreeCAD v0.15

Post by abdullah »

I gave it a try. It is quite intuitive. I had problems though trying to align to circular faces to their corresponding axes... probably I did not dedicate enough time to it... looking forward for more!! :-)
Post Reply