Page 1 of 1

Ideas for A2+ enhancement

Posted: Sun Dec 01, 2019 5:04 am
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.

Re: Ideas for A2+ enhancement

Posted: Sun Dec 01, 2019 5:44 am
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.

Re: Ideas for A2+ enhancement

Posted: Sun Dec 01, 2019 12:56 pm
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

Re: Ideas for A2+ enhancement

Posted: Fri Jan 17, 2020 5:39 pm
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?

Re: Ideas for A2+ enhancement

Posted: Sat Jan 18, 2020 7:26 pm
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

Re: Ideas for A2+ enhancement

Posted: Sat Jan 18, 2020 7:53 pm
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.

Re: Ideas for A2+ enhancement

Posted: Tue Jan 21, 2020 8:15 pm
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',

Re: Ideas for A2+ enhancement

Posted: Wed Jan 22, 2020 4:59 am
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',

Re: Ideas for A2+ enhancement

Posted: Wed Jan 22, 2020 6:21 am
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