EasyAlias macro

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
TheMarkster
Veteran
Posts: 5513
Joined: Thu Apr 05, 2018 1:53 am

EasyAlias macro

Post by TheMarkster »

Here is a macro to help ease the pain of creating spreadsheet aliases.

Usually when I setup a spreadsheet it looks something like this:
EasyAlias-scr1.png
EasyAlias-scr1.png (15.43 KiB) Viewed 6155 times
I'll have my labels in Column A and my values and aliases in Column B. The label in Column A is completely irrelevant to FreeCAD; all it cares about is the alias and content in Column B because I'll set my constraint in a sketch (or some property of an object) to something like Spreadsheet.radius (where radius is one of the Column B aliases). This works fine, but the only issue is it can be somewhat tedious and time-consuming (not to mention cumbersome, awkward, and aggravating) to setup the aliases. It occurred to me the string I use for my Column A label will almost always make a suitable alias for the cell in Column B, so why not automate the process to use that label for the alias? Why not, indeed.

Here is a screencast:
easy-alias.gif
easy-alias.gif (766.72 KiB) Viewed 6155 times
Attachments
EasyAlias.FCMacro.py
(4 KiB) Downloaded 647 times
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: EasyAlias macro

Post by DeepSOIC »

sounds similar to this: Macro_Alias_Manager
TheMarkster
Veteran
Posts: 5513
Joined: Thu Apr 05, 2018 1:53 am

Re: EasyAlias macro

Post by TheMarkster »

DeepSOIC wrote: Mon Aug 20, 2018 2:22 pm sounds similar to this: Macro_Alias_Manager
Thanks for the link. Yes, that macro is similar to this one. But...

While there are similarities between the two macros I think the developers' goals are different. I can't read minds, but I know what my goals were for making Easy Alias -- to streamline the workflow required for setting aliases. Based on my examination of Alias Manager, I believe the developers' goals were different -- to make a comprehensive alias management tool, with which the user can set aliases, clear aliases, move aliases, etc. AM's advantages include a graphical user interface and a more comprehensive feature list. EA's advantages include a more streamlined workflow, and, it's also a little bit more robust in the types of labels from which it can successfully generate aliases (those labels containing spaces). I believe it would be reasonable to install and use both macros, depending on the needs at the time. For example, if you have aliases you wish to clear or move to another column, Alias Manager would be the tool for that job, but if you just want to quickly generate aliases, Easy Alias is the tool to use.
chrisb
Veteran
Posts: 54176
Joined: Tue Mar 17, 2015 9:14 am

Re: EasyAlias macro

Post by chrisb »

TheMarkster wrote: Mon Aug 20, 2018 6:41 pm I believe it would be reasonable to install and use both macros, depending on the needs at the time.
Who wants to have two macros for maintaining aliases? I would appreciate it if you contact the authors and if you create a single macro with the best of both :D .
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Jamers
Posts: 1
Joined: Fri Oct 23, 2020 12:55 pm

Re: EasyAlias macro

Post by Jamers »

Thank you for this macro. Works great and does what I needed. Coming from F360 I use parameters all the time so this really accelerates the process of creating variables.
v0.19
User avatar
ChristophS
Posts: 8
Joined: Tue Apr 20, 2021 8:42 pm
Location: Aachen

Re: EasyAlias macro

Post by ChristophS »

Thank you! A very useful macro! :D
run_the_race
Posts: 161
Joined: Mon Feb 01, 2021 7:22 pm

Re: EasyAlias macro

Post by run_the_race »

Great macro! I think it should be a built in tool, called something like ("Cell contents to cell on the right alias"). Everyone deals with this issue.
drmacro
Veteran
Posts: 8979
Joined: Sun Mar 02, 2014 4:35 pm

Re: EasyAlias macro

Post by drmacro »

I use the column to the left as a description. For this to be useful for me I'd have to type a second column with the alias anyhow.

But I like macros...that's the point of user extensible software. :mrgreen:

So, great job!
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
xsuper9988
Posts: 223
Joined: Sat Oct 24, 2020 4:20 am

Re: EasyAlias macro

Post by xsuper9988 »

TheMarkster wrote: Sun Aug 19, 2018 11:42 pm Here is a macro to help ease the pain of creating spreadsheet aliases.

Usually when I setup a spreadsheet it looks something like this:

EasyAlias-scr1.png

I'll have my labels in Column A and my values and aliases in Column B. The label in Column A is completely irrelevant to FreeCAD; all it cares about is the alias and content in Column B because I'll set my constraint in a sketch (or some property of an object) to something like Spreadsheet.radius (where radius is one of the Column B aliases). This works fine, but the only issue is it can be somewhat tedious and time-consuming (not to mention cumbersome, awkward, and aggravating) to setup the aliases. It occurred to me the string I use for my Column A label will almost always make a suitable alias for the cell in Column B, so why not automate the process to use that label for the alias? Why not, indeed.

Here is a screencast:

easy-alias.gif
Sorry can you add one more
Row to the next row
Because with Row it is possible to comment
Thank you very much
Attachments
alias.png
alias.png (99.44 KiB) Viewed 4457 times
User avatar
xsuper9988
Posts: 223
Joined: Sat Oct 24, 2020 4:20 am

Re: EasyAlias macro

Post by xsuper9988 »

TheMarkster wrote: Sun Aug 19, 2018 11:42 pm Here is a macro to help ease the pain of creating spreadsheet aliases.

Usually when I setup a spreadsheet it looks something like this:

EasyAlias-scr1.png

I'll have my labels in Column A and my values and aliases in Column B. The label in Column A is completely irrelevant to FreeCAD; all it cares about is the alias and content in Column B because I'll set my constraint in a sketch (or some property of an object) to something like Spreadsheet.radius (where radius is one of the Column B aliases). This works fine, but the only issue is it can be somewhat tedious and time-consuming (not to mention cumbersome, awkward, and aggravating) to setup the aliases. It occurred to me the string I use for my Column A label will almost always make a suitable alias for the cell in Column B, so why not automate the process to use that label for the alias? Why not, indeed.

Here is a screencast:

easy-alias.gif
Very sorry
because I'm in a hurry to use
I added a new version myself
If there is any inappropriate
telling me to delete
or release a new version
tell me to download
thank you very much
Attachments
EasyAliasColRow.gif
EasyAliasColRow.gif (697.42 KiB) Viewed 4426 times
Easy-alias-Col-icon.png
Easy-alias-Col-icon.png (977 Bytes) Viewed 4426 times
Easy-alias-Row-icon.png
Easy-alias-Row-icon.png (983 Bytes) Viewed 4426 times
Macro_EasyAliasCol.FCMacro
(5.13 KiB) Downloaded 93 times
Macro_EasyAliasRow.FCMacro
(5.13 KiB) Downloaded 80 times
Post Reply