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!
dan-miel
Posts: 391
Joined: Thu Sep 13, 2018 12:29 am
Location: Spokane WA. USA

Re: Another approach to assembly solver (A2plus)

Post by dan-miel »

Smiling_user wrote: Tue Aug 18, 2020 6:18 pm And maybe the more required option would be to disable popup: set multiple constraints without having the "Set / solve " constraint popup.
Smiling_user wrote: Tue Aug 18, 2020 7:57 am Hi, could you allow multiselect for adding some rules? eg. "add a plane coincident constraint"
A direct use case is following: dragchains.png
Smiling_user wrote: Wed Aug 19, 2020 6:06 am In the properties editor it is possible to add new property (or via python scripting)
Smiling_user wrote: Wed Aug 19, 2020 6:06 am And also a very needed tool is: Apply <fixedPosition = true> to constrain-positioned parts.
Hi Smiling_User:
The questions above are the questions I was trying to answer and the answer is still write your own.
Smiling_user wrote: Wed Aug 19, 2020 6:06 am And also a very needed tool is: Apply <fixedPosition = true> to constrain-positioned parts.
This workbench is simply four different programs the I wrote, no flow. It started with the Full Auto program because I have Parkinson’s and sometimes it takes both of my hands to control the mouse let alone holding down the control key. Then the update program because I became tired of having to redo Constraints every time I made a change to a part. The other programs are just time wasters that I thought might be handy.
Smiling_user wrote: Sat Aug 22, 2020 6:59 am And else, could you, please, provide a dependency graph of the project files?

I’m not a programmer as you can tell from the code so I looked up dependency graph. Looks like a good tool if I ever learn to make one.
Smiling_user wrote: Sat Aug 22, 2020 6:59 am And to get it working I had to copy some files from A2P folder.
I modified the dirinfo.py file so you can hard code you a2plus path if needed The directions are in the help file 003. I hope it works.
I added the code so you can change the Fix property from the form. The directions are in the pdf.
I’m not quite sure where you’re going with the files you sent they kind of look like the beginning of a SolidWorks assembly file. I have a feeling that the information you’re trying to put into the assembly is getting lost when the file is made into as a2plus file. If you want to kick it around send a bit more info.
Thanks for sending the results of your testing the workbench.
Dan
Attachments
Full auto directions003.pdf
(91.98 KiB) Downloaded 69 times
A2plusmore ver003.zip
(234.91 KiB) Downloaded 100 times
Smiling_user
Posts: 196
Joined: Tue Jul 28, 2020 7:31 am

Re: Another approach to assembly solver (A2plus)

Post by Smiling_user »

You're right, I made some repetitive text.
Now will try to get clear:
1. the efficiency of tool is defined by it's usability inside a workflow. So the beginning of implementation is to plan a general work-flow.
2. The most simple way to get parts positioned: make guidelines -> constrain to guidelines.

In complex cases constraining to details is easier and more obvious, then constraining to guidelines.
But practice showed, that constraining to guidelines can replace constraining to parts, not the opposite.
Why? Because in the FC the most sophisticated solver and parametrisation is inside the Sketcher, so it is easier to make a sketch with constraints, than to calculate positions / interposition in Draft.

The efficient tool complex in this case would look like:
>>DynamicData (<-Set values)
>>Sketcher -> Constraints (<-DynamicData)
->>guidelines -> constrain to guidelines with A2P / A2Pmore

But here arises the problem: A2P(a2PMore) does not consider guidelines "Placement == Fixed" on calculation - it makes changes to position of Sketch and even altered some sketches.

So the key-solution for this case would be - to set a Sketch as the base of solving, aka Sketch{fixedPosition == true}
Then sketches would become one of possible the assembling bases. This resembles SW? Well - that's not so bad.


Other step-to-usability would be, if the A2P/A2PMore could constrain parts/bodies, containers inside the master-file.
Then it would be very easy to "copy-paste-position" similar parts. The last version of A2P showed ability to constrain parts inside the file itself (without import). But also the first part must have the fixedPosition=true, and so must be imported.

Also the real work-flow sometimes goes different:
-- sometimes it is easier to work in A2PMore manner, sometimes I turned off [auto-solve] and first applied constraints, then pressed [solve].

So at this moment as a workbench - the best seems to be the combination of A2P/A2PMore tools in a single workbench.
So I did: Tools -> Customize -> Toolbars -> A2P -> new toolbar -> import all new tools from A2PMore

But still the very case-to-solve is to set fixed position to sketches.
Maybe drafts are not movable by A2P, and it is possible to convert sketches to Drafts, but this would remove parametrization.

// Besides: to the head-developers: how difficult would it be to make the "parts-library" macro - the internal part of FC?
I would use such a work-flow:
1. Select detail (Part, body, simple link-group, sketch, draft)
2. click - [save to LocalPartsLibrary] - [Ask user input: SaveAs "FileName".FCStd]
-> the detail is saved to the DirPojectFolder\\parts\\"FileName".FCStd
3. When needed - RClick ->ImportPartFromLocalLibrary

It is similar to importing in an assembly, but is able to utilize all tools of FC( sketches, drafts, parts.....)
Especially, that direct copy-paste replication of details is not complete in the GUI if FC.

///////
Just tried to see the A2P Code - maybe the clue is located around a2p_importpart.py Lines 430..450 ?
dan-miel
Posts: 391
Joined: Thu Sep 13, 2018 12:29 am
Location: Spokane WA. USA

Re: Another approach to assembly solver (A2plus)

Post by dan-miel »

dan-miel wrote: Sun Aug 23, 2020 3:49 am I’m not quite sure where you’re going with the files you sent they kind of look like the beginning of a SolidWorks assembly file.
I meant to put SolidWorks Weldment file, not assembly file.

Here is the latest a2plusmore files. The instruction pdf is in the zip file. It seems to be stable and I don't think I Can do much more without any input.
Smiling_user wrote: Sun Aug 23, 2020 4:08 pm the best seems to be the combination of A2P/A2PMore tools in a single workbench.
So I did: Tools -> Customize -> Toolbars -> A2P -> new toolbar -> import all new tools from A2PMore
That is the way I use this workbench. I don't have the skills to modify the A2plus workbench and if I did I don't have a clue about the math that is being used so I wrote these work arounds. This lets me add constraints by selecting 2 features and I don't need to mess with all the yes/no dialogs which is handy when tremors are bothersome.

I can follow some of what what you wrote but I was not able to add a sketch to the A2plus assembly file like you did so I wasn't able to explorer very much. How did you do that?

Where Is kbwbe, he hasn't responded to anything for months? It would be interesting to hear his input.

Sorry I can't offer more input until I play some more with your idea.
Dan Miel
Attachments
A2plusmore rev004.zip
(331.35 KiB) Downloaded 67 times
Smiling_user
Posts: 196
Joined: Tue Jul 28, 2020 7:31 am

Re: Another approach to assembly solver (A2plus)

Post by Smiling_user »

Putting a sketch inside - easy: just draw it with Sketcher.

Another option, mentioned by kbwbe in this thread, is to make a master file with all sketches, and synchronized, and import them to the assembly file on-by-one.
I tried, it works. A2P contains [partial import tool] - it allows to import Bodies, sketches, Parts.
Draft, Arch, BIM - are under question for now.

A Body may contain a system of sketches, all imported at once.
dan-miel
Posts: 391
Joined: Thu Sep 13, 2018 12:29 am
Location: Spokane WA. USA

Re: Another approach to assembly solver (A2plus)

Post by dan-miel »

Update for A2plus.
I came home and found an error when I tried to fix a floating part. So I fixed it.

And I forgot to mention that I added my a2p_solversystem.py file to the the a2plusmore folder. When you solve an assembly there are no popups for the unmoved files, instead it prints a list of the parts to the Report view at the end of the run. I believe other errors are reported as usual.

The direction pdf is in the zip file
Dan
Attachments
A2plusmore vers 005.zip
(331.42 KiB) Downloaded 95 times
Smiling_user
Posts: 196
Joined: Tue Jul 28, 2020 7:31 am

Re: Another approach to assembly solver (A2plus)

Post by Smiling_user »

Dan-miel,
I have recently used A2PlusMore under windows.
Video is nice, it just will take some time to learn all features.
But: today tried to install under ubuntu - it does not work: FC does not see any "new" plugin.

To KWBWE ( or to whom it may concern) :
is there an option to exclude from solving the constraints between two details with fixedPosition==true?
Worked with sketches imported into an assembly.
1. solving the whole assembly repetitively - takes a lot of time is not acceptable and not needed for details with position fixed.
2. after changes to the master sketch - all constraints broke, and needed resolving. But for the reason of some conflict somewhere in the previous constraints - solving is not possible, so I got to manually apply about 30 constraints again.

At the writing moment, I see that I should have made all the guidelines inside the master-SketchFile.

But such an option to select constraints for current (partial)solving - is greatly needed. (Maybe it exists, but did not notice).
dan-miel
Posts: 391
Joined: Thu Sep 13, 2018 12:29 am
Location: Spokane WA. USA

Re: Another approach to assembly solver (A2plus)

Post by dan-miel »

My apologies to kbwbe for chopping up his work. I still don’t understand his work, his mind works on a higher level than mine.
Smiling_user wrote: Sun Aug 30, 2020 6:10 pm solving the whole assembly repetitively - takes a lot of time is not acceptable and not needed for details with position fixed.
Smiling:
This is probably too late to help you but the latest version of the a2plusmore allows you to run just the last few constraints of a file. It is amazing how fast it is. I did this by modifying kbwbe’s solver so on the first run it solves the constraints and collects the parts with zero DOF, it then lets you attach parts to the Zero DOF parts. I added a option dialog so I can chose to run the original solver or my hacked up versions and how many constraints to run. Kbwbe’s solver is always available.
My hack also eliminates most of the popups except for the critical errors that stop the program.

It seems to work on Windows 10 but might choke on linux. The FreeCAD undo button doesn’t record what the program does so the undo’s don’t work. . If anyone wants to see the speed difference the files and direction are in the Zip and here are a few videos. Most are a minute long, the subassembly one is 1min 45 sec.
Dan

Edited: I sometimes worry about me. I had one whopper of a mistake in version 7. I changed too many things after I tested. I haven't tested everything in this version but I believe you can make the constraints with it. I need to do better testing and put up a better version in a few days. I also need to put this on Github.
Dan


Create constraints:https://youtu.be/fRmYsYxumhM
Find the last created constraint:https://youtu.be/LmiKEwOSbzY
How to view constraints using full auto:https://youtu.be/qG7JwF8dzTM
How to check for fixed parts in the assembly:https://youtu.be/pHvLkGp4Y1c
How to constraint multiple part to a common feature:https://youtu.be/SmrMTddMLEs
Making a small sub outside of main assm:https://youtu.be/_1Q_2MDx3FM
Attachments
a2plus wb and FullAuto vers 008.zip
(394.71 KiB) Downloaded 52 times
Smiling_user
Posts: 196
Joined: Tue Jul 28, 2020 7:31 am

Re: Another approach to assembly solver (A2plus)

Post by Smiling_user »

Well.
Have put the <A2plusmore> folder to Kubuntu -> /home/worker/.FreeCAD/Mod/
Then started the FC:
On the next restart of FC - found A2P_More at the end of list.
It works Fine !
Objectives:
-- What already found: in A2P possible to press "Make Duplicate" several times and then Click-click-click- distribute about 6-8 duplicates in the 3D view.
Clicking the same button on the on the A2P_More panel - allows only 1 duplicate to make.
-- After using the A2Plus_More... the model stopped importing new parts.... After removal of A2Plus_More - importing an duplicating returned...
Last edited by Smiling_user on Mon Sep 07, 2020 5:45 pm, edited 1 time in total.
chrisb
Veteran
Posts: 53953
Joined: Tue Mar 17, 2015 9:14 am

Re: Another approach to assembly solver (A2plus)

Post by chrisb »

The yellow color is illegible on default FreeCAD forum style:
Attachments
Bildschirmfoto 2020-09-07 um 18.42.48.png
Bildschirmfoto 2020-09-07 um 18.42.48.png (11.04 KiB) Viewed 2569 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
dan-miel
Posts: 391
Joined: Thu Sep 13, 2018 12:29 am
Location: Spokane WA. USA

Re: Another approach to assembly solver (A2plus)

Post by dan-miel »

Smiling_user wrote: Mon Sep 07, 2020 4:01 pm -- What already found: in A2P possible to press "Make Duplicate" several times and then Click-click-click- distribute about 6-8 duplicates in the 3D view.
Clicking the same button on the on the A2P_More panel - allows only 1 duplicate to make.
smiling. Try using the Make Duplicate button on the lower left of the Auto dialog. The import, Move and Make Duplicate buttons turns the auto select off while you're working on those functions and turns it back on when you are done . If you don't use those buttons you need to press the "Make constraints' button so the auto select is off and when you're done you need to press it again to turn the auto select back on.
Dan
Post Reply