First basic implementation

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: First basic implementation

Post by ickby »

I see your point. I changed it to the proposed way of working, removed the windows compile and runtime errors (should actually work now) and added more constraints.

You can use every constraint with all the entitys which it makes sense for. For example coincident can be used with point/point, point/line, line/plane, point/cylinder, cylinder/cylinder and so on... If you hit a unsupported combination a assert (debug only) will accour, I'm gonna change that later.

I'm not a grand master of usability, so if anyone has a better idea to integrate the constraints than the current toolbar+dialog approach I'm glad to implement it. Maybe the SolidWorks approach is considerd more user friendly: one single mate tool and a task dialog with all options?

Icons are needed, I currently copied some sketch constraint icons.

Greeting,
Stefan
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: First basic implementation

Post by jriegel »

Sounds good! I will take a look.

For the user interface;
we can offer both ways to do constraints. I like seperate commands more, cause i can trigger them with shortcuts. So it goes click-click-key and your done very fast :) But thats as always a matter of taste...
Stop whining - start coding!
maidenone
Posts: 13
Joined: Wed May 30, 2012 6:31 am

Re: First basic implementation

Post by maidenone »

I would like to help if its possible, I actually begun work on my own assembly module last Friday (in python) but i can code c/c++ aswell. My assembly module consists of a workbench and a toolbar with a "mate" icon, The mate function took two selected faces and rotated the objects to which the faces belonged to so that the normals of the two selected faces faced the same direction. During the day i work as an embedded engineer consultant and are playing around with CNC machines and 3d printers in my sparetime. I can work on whatever i want when i am not on a assignment, so now and then i get quite some time on my hands. I have waited for the assembly module scince ~2011, so now when i have the time and ability i feel its better to contribute to the project then waiting for some one else to do the work.
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: First basic implementation

Post by ickby »

Hello maidenone,

it's always a good idea to start contributing, and help is appreciated. I will list some points that come to my mind, however, I myself work only on a small part of the assembly system, namly the solver. So it would be a good idea to talk to jriegel, I'm quite sure he has a lot of unfinished work to share too :)

First about the solver: It can do most of the needed assembly constraints already and supports cyclic constraint systems (thats why it's already a huge codebase and most likly the big diffrence to your approach) If you want to help with the implementation you can look at this repository: https://github.com/ickby/openDCM. To write code you would need some experiance in template metaprogramming. I myself spend currently the most time with documentation and extending the test suit. Boring but neccessary stuff, I would love some help with that :) But we would also find some needed features, if you are more interessted in such things.

Second: The solver integration. That has actually to do with writing FreeCAD specific code. The commands, which are used to interface the workbench with the assembly solver, are very basic. I'm not a big fan of UI design and programing, so I didn't spent too much time with it and hoped someone would take care of it. Give the user a intuitive way of using the solver would be a good task, maybe introducing a mate TaskPanel wich allows setting constraints dependend on selection. Also some senseful actions on constraint double-click would be nice to have a alternative way to change constraint values apart from the property editor. That would all need some FreeCAD internal knowledge, but thats learned fast.

I'm also often in the FreeCAD IRC channel, so feel free to contact me.
maidenone
Posts: 13
Joined: Wed May 30, 2012 6:31 am

Re: First basic implementation

Post by maidenone »

I can start working on the user interface for the solver once i have figured out how the solver works ;) have checked out your and jriegels assembly branch, which is best to use? I am currently reading through the source code and trying to understand how things work and interact. Had my first glance on the code last friday and continued that work now, so i have some lerning to do. Will have the rest of this week and next week before i leave for vacation. I will hopefully be able to continue working on the project in august when i am back at work.
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: First basic implementation

Post by ickby »

Use jriegels branch, it also has the new part design structure and it makes therefore sense to work with it.
maidenone
Posts: 13
Joined: Wed May 30, 2012 6:31 am

Re: First basic implementation

Post by maidenone »

I have played around a bit with the Assembly module and browsed the code. Now i would like some feedback for some ideas.
Its good to have a place where all the constrants can be seen as it is right now (in ComboView), But when you have lots of constrants it is good to get some references to what constrants affects what parts/faces. Examples for "highlighting" below:

Select a constraint in the constrantGroup and then paste this code to the Python console

Code: Select all

# Select Constrained Faces
#A is a selected Constraint from the ConstraintGroup in ComboView->Model
A = Gui.Selection.getSelection()[0]
Gui.Selection.addSelection(A.First[0].Model.Model[0],A.First[1][0])
Gui.Selection.addSelection(A.Second[0].Model.Model[0],A.Second[1][0])
or

Code: Select all

# Select constraned Objects
#A is a selected Constraint from the ConstraintGroup in ComboView->Model
A = Gui.Selection.getSelection()[0]
Gui.Selection.addSelection(A.First[0].Model.Model[0])
Gui.Selection.addSelection(A.Second[0].Model.Model[0])
Another idea is to have references/copies of the constraints in a "local" constrantgroup for each part (as an extra to the "global" constrant group)
The resulting comboView->Model would look something like this:
Product
##Part1
####Body1
####LocalConstraintGroup
##Part2
#####Body2
#####LocalConstraintGroup
##Constraintgroup

Also, i think the constraint "Align->Parallell,Offset=0" feature should have its own button because this is one of the most used features.
Currently the assembly do not recalculate when a part is transformed, i think this ought to be enabled by default but that the user ought to be able to disable it.
A import feature for freecad files would be nice (automatic open fcstd,save as step,close fcstd, open stepfile)
Can the solver handle circles? I would like to create a "co-centric" constraint so you can "mate" two metalsheets with holes with a balt/pin. (center point?)
Some constraints have several solutions (a bolt can enter a hole from two directions ) Is it possible for the solver to search for next solution after the first solution is found? (in solidworks you can check "switch direction")

Is there any issue-tracker for the Assembly branch? i have found some "unintended features" ;)
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: First basic implementation

Post by ickby »

The basic idea for showing the user which parts/faces are involved by a certain constraint is good. A thing to consider: It should in all cases show whats involved, otherwise the user will be confused. That means it has to work even if geometrys are constraint in such a way that they are both not visible anymore. So only highlighting is not enough, you would need to implement some additional markers.

I don't have a strong opinion to the local group, maybe nice to have.

Align->Parallell,Offset=0 is the coincident constraint, so it already has its extra button. Also the switch direction works simple: just select 'equal' or 'opposite' instead of parallel. Thats why the dialog for the coincident constraint is needed, to allow the user that specification. And thats why I initialy mentioned the task dialog for constraints, it would allow a less interfering way of specifying such raerly used things. (and you could combine such a task panel with your highlithing: double click a constraint opens the task dialog and gives options for highlighting the parts/faces involved, that would be awesome)

co-centric is supported by coincident constraints, however, currently only with cylinder faces. circles will follow some time, they are however mathmaticly way harder to treat than cylinders (for non co-centric constraints, co-centric would be simple too)

To the multiple solutions: there is no way to get to the next one, however, directions can be specified (equal or opposide) when the parallel option didn't choose as you wanted (actually parallel just uses one of the both dependend whats nearer to a soltion at the begining)
maidenone
Posts: 13
Joined: Wed May 30, 2012 6:31 am

Re: First basic implementation

Post by maidenone »

Omg, Nice! I do not yet have a good insight of how the code works, but i follow the basic structure. Do i only have to build the Assembly module or do i have to recompile the entire freecad if i make changes to the assembly C++ code? I have not yet found anything that could not be done from python and would prefere to keep to pyton for fast code/test itterations.

I think i will make a small study of how the assembly interrface works (icons,functions,workflow etc.) on SolidWorks,ProE,NX,Catia. I have access to all of them here on the office and a friend who is a mechanical engineer will help out a bit. I think i can have a report done by early next week.
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: First basic implementation

Post by ickby »

you recompile only the files that you have changed. or all dependend files, if you change a header. Just execute make, it will do the selecting for you. An overview would be good to have, maybe you're able to combine the best of all programs and new ideas to something inovative. I myself only worked with solid works and therefore have very limited knowledge.
Post Reply