Ideas for A2+ enhancement

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
dan-miel
Posts: 391
Joined: Thu Sep 13, 2018 12:29 am
Location: Spokane WA. USA

Ideas for A2+ enhancement

Post by dan-miel »

Ideas for A2+ enhancement

If you put the attached file, a2p_constraintDialog.py, in the A2plus folder you should be able to try some ideas I have for enhancements. After you restart FreeCAD and select A2plus open the Constraint Tool dialog, it should look like the attached picture.
In the upper left click the “Turn Auto On Off”. This has only stated observers.
In the lower right, (Idea 1)clicking the Auto Select 2 enables you to select two parts without using the control key. You then select the constraint like you normally do.
Auto Mate: (Idea 2)If you select two surfaces the program assumes you want to create a coincident mate and makes it for you. The edit dialog shows as normal so you can accept it. If that is not the mate you want, hold down the control key when you select the second part and the mate selector will show as usual.
(idea3) Auto Approve: makes a “default” mate and approves it. To start a new mate simply select the surfaces of the next mate, which will be created and continue to the next mate. The first few mates are scary but experienced CAD user may like it. (Idea 4) If you need to add an offset click the edit icon and it will open to the latest mate.
There are some mates that are picky what is selected first. The edge to surface and point on surface are two of them. If you use the Auto mode (Idea 5) the features are checked and put in the correct order, no matter which order they were selected.

The default mates are:
1. Point coincident if two points are selected:
2. Edge coincident if two edges are selected.
3. Plane coincident for two planes. CAUTION if you select a curved face. There is not a check for those so use the Ctl key and select the mate you want.
4. When you pick any other features the selection dialogs show as normal.
5.
I would like to see the first idea implemented as l have Parkinson’s and tremors sometimes makes it very hard to hold the Ctl key down.

The code the I added in the main code body should be between #dan— code and #--dan in the file.
I hope this code works for someone.
Dan Miel

Edited: Although it is fun watching this py file crash and act weirdly, :P I removed this file because the features had been copied from a macro as I was trying to add my features to the familiar dialog. The macro in the third post is a macro that is closer to what I use. The concepts are the same, the macro does not crash like this file did.
Attachments
Tools dialog.JPG
Tools dialog.JPG (32.5 KiB) Viewed 1626 times
Last edited by dan-miel on Thu Dec 12, 2019 2:28 am, edited 2 times in total.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Ideas for A2+ enhancement

Post by vocx »

dan-miel wrote: Sun Dec 01, 2019 5:04 am If you put the attached file, a2p_constraintDialog.py,...
The best way to contribute code is if you open a GitHub account, fork the A2plus repository, make a new branch with your changes, and then submit a pull request to that project. Then you can provide a link to your modified branch and pull request. In this way we can see exactly which changes are done to the source code, and we can provide review and even patches more easily.

If you don't know how to use Git, see source code management.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
dan-miel
Posts: 391
Joined: Thu Sep 13, 2018 12:29 am
Location: Spokane WA. USA

Re: Ideas for A2+ enhancement

Post by dan-miel »

vocx wrote: Sun Dec 01, 2019 5:44 am The best way to contribute code is if you open a GitHub account, fork the A2plus repository, make a new branch with your changes, and then
vocx: Thanks for the suggestion. I am not a coder and what I write should not be added to A2plus. The purpose of the file was to demonstrate what I find useful. After I posted the file I tried to use it and dialog boxes were popping up and disappearing like crazy so I am posting this macro which is closer to what I use.

The small dialog always shows and is on top so that I can flip parts and enter offsets quickly. For other changes the “Show edit Form” button brings up kbwbe’s dialog and I use his tools for further modifications.
If this is dropped in the macro folder it should find the a2plus folder. If this is your first time using a program that mates automatically you may want to uncheck the last two check boxes for the first few mates then check the next, then the last.
Please remember: Only the ideas, not the code.

Kbwbe: Thanks for the time and expertise that you have put into the A2plus program.
Dan Miel
Attachments
M1.FCMacro
(16.42 KiB) Downloaded 33 times
M1 FCMacro dialog.JPG
M1 FCMacro dialog.JPG (18.15 KiB) Viewed 1582 times
User avatar
mmiscool
Posts: 73
Joined: Sun Dec 18, 2016 9:07 pm
Location: Connecticut
Contact:

Re: Ideas for A2+ enhancement

Post by mmiscool »

Love this macro just for the ability to select multiple faces at once with out using the CTRL key.

Do you think that the functionality of just doing a multi select with out CTRL key could be paced out of this for more general use?
My main project is https://autodrop3d.com
Effort on https://github.com/mmiscool/FC-Docker FreeCAD for cloud with browser based access has been discontinued in favor of focused development on https://github.com/xibyte/jsketcher
dan-miel
Posts: 391
Joined: Thu Sep 13, 2018 12:29 am
Location: Spokane WA. USA

Re: Ideas for A2+ enhancement

Post by dan-miel »

mmiscool wrote: Fri Jan 17, 2020 5:39 pm Do you think that the functionality of just doing a multi select with out CTRL key could be paced out of this for more general use?
I believe so. What do you want to do with it? What version of FreeCAD and the A@plus are you using?
Here are some shots of the tool as it is today Finding conflictshttps://www.youtube.com/watch?v=ZUlw8_5p5FQ . Creating constraints https://www.youtube.com/watch?v=8q5UfD15K9k . Selecting a pert once to add many https://www.youtube.com/watch?v=5fAh7Tm8qYU . Suppressing constraints https://www.youtube.com/watch?v=ZUlw8_5p5FQ. That should be enough to bore you.

How much coding do you know?

Dan
User avatar
mmiscool
Posts: 73
Joined: Sun Dec 18, 2016 9:07 pm
Location: Connecticut
Contact:

Re: Ideas for A2+ enhancement

Post by mmiscool »

I am mostly interested in just being able to toggle multi select functionality in general and get away from using the CTRL key.

I feel like a really stripped down version of this macro could be really handy for that.
Don't want any kind of filter on the items that are being select. just any thing clicked.

As to programming experience. That is some thing I am moderately good with. python3 is not my primary language so there are some bumps there.
My main project is https://autodrop3d.com
Effort on https://github.com/mmiscool/FC-Docker FreeCAD for cloud with browser based access has been discontinued in favor of focused development on https://github.com/xibyte/jsketcher
dan-miel
Posts: 391
Joined: Thu Sep 13, 2018 12:29 am
Location: Spokane WA. USA

Re: Ideas for A2+ enhancement

Post by dan-miel »

dan-miel wrote: Sat Jan 18, 2020 7:26 pm Do you think that the functionality of just doing a multi select with out CTRL key could be paced out of this for more general use?
Here it is. Let me know if it doesn't work.
In the InitGui.py file that is in the FreeCAD Mod folder you need to add two lines.
Around line 67 add the line "import a2p_autokey1"
Around 100 add 'a2p_autokey1_Command', so that it looks like it does below.

Add the a2p_autokey1.py to the folder’ Restart the program and click on the black X until I find out more about icons. You should not need to use the control key when selecting features for constraints

PS edited There are some constraints that need the features to be selected in a certain order, vector and plane might be one, even when their selected out of order this should put them in the correct order. Or kbwbe may have changed that. It is in def putfeaturesinorder_addtoselection(self):
Dan


import a2p_constraintcommands
import a2p_bom # bom == bill of materials == partslist
import a2p_autokey1

if a2plib.getRecursiveUpdateEnabled():


if a2plib.SHOW_CONSTRAINTS_ON_TOOLBAR:
constraintCommands = [
'a2p_autokey1_Command',
'a2p_ConstraintDialogCommand',
'a2p_EditConstraintCommand',
Attachments
a2p_autokey1.py
(14.88 KiB) Downloaded 25 times
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Ideas for A2+ enhancement

Post by vocx »

dan-miel wrote: Tue Jan 21, 2020 8:15 pm Here it is. Let me know if it doesn't work.
Use code tags when placing code in the forum so it looks correctly.

Code: Select all

import a2p_constraintcommands
        import a2p_bom # bom == bill of materials == partslist
        import a2p_autokey1

        if a2plib.getRecursiveUpdateEnabled():

        
        if a2plib.SHOW_CONSTRAINTS_ON_TOOLBAR:
            constraintCommands = [
                'a2p_autokey1_Command',
                'a2p_ConstraintDialogCommand',
                'a2p_EditConstraintCommand',
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
dan-miel
Posts: 391
Joined: Thu Sep 13, 2018 12:29 am
Location: Spokane WA. USA

Re: Ideas for A2+ enhancement

Post by dan-miel »

vocx wrote: Wed Jan 22, 2020 4:59 am Use code tags when placing code in the forum so it looks correctly.
Thankyou. It looks better.
Dan
Post Reply