Hello,
I'm using AutoCAD Electrical 2014 and trying to customize some parts of it. I have the folowing question:
Is there a way to run just the Select Component dialog and then get the component name that the user selected? I know you can run c:insym_go2menu but that would also add the component to the drawing - I only want to have the user select a component and then get the selection in my code.
Thank you.
Solved! Go to Solution.
Solved by PatMurnen_Adsk. Go to Solution.
I could not find an official API that does what you want. I did find an unofficial call that you can try using. Unofficial means that it can change from one release to the next and has not been tested for using as a separate call.
The call is AEICONMENU. It brings up the current schematic icon menu and returns what was picked. This can include a simple block name, information that AutoCAD Electrical uses to insert multi-pole symbols and other things like cable markers, etc. that do more than insert the symbol.
Regards,
Pat Murnen
Hello Pat,
Thank you for looking into this.
How do I call the command? You can see below AutoCAD Electrical does not recognise it. (I'm using AutoCAD Electrical 2014)
Command: (c:AEICONMENU) ; error: no function definition: C:AEICONMENU Command: AEICONMENU Unknown command "AEICONMENU". Press F1 for help.
Thank you.
try _AEICONMENU (with _) as usual this are the international commands, especially if you are using a different version than english...
It looks like this was added in AutoCAD Electrical 2015. I will look further to see if there is anything that might do what you want in AutoCAD Electrical 2014.
Regards,
Pat
I think I found an internal call you can try. By an internal call I mean a function inside the AutoCAD Electrical code. It can be changed at any release, service pack, or hotfix. So it is really use at your own risk. The call is
(wd_wdmenu_1 menuname nil)
If your icon menu .dat file is in the expected path you don't need to supply that. So the lisp call would be something like this -
(setq rtrn (wd_wdmenu_1 "ACE_IEC-60617_MENU.DAT" nil))
I cannot tell what the 2nd argument is for but using nil seems to be ok. It might have something to do with whether it is a schematic or panel menu which might not matter since you just want the return anyway.
Here is how I found it in case you want to use this trick when there isn't an API and you want to risk using an internal call.
First, I use the Command Trace which displays a bunch of information on the command line. It is intended to be used to track down an issue but can be helpful in other ways. To turn the Command Trace on you can type AEONLISPDEBUG (it is also on the Troubleshooting panel of the Project ribbon tab).
Once the command trace is on, pick the Icon Menu command and then Cancel out of it. There will be a bunch of stuff on the command line. What I was looking for was something to do with the menu. This is really hit and miss and mostly a guessing game but sometimes you can tell what a function might be by its name. Here is some of what I saw on the command line -
IN:wd_wdmenu_1
wd_1a_gn_getenv WD_USER=C:/Users/murnenp/AppData/Roaming/Autodesk/AutoCAD Electrical 2015/R20.0/enu/Support/user/
wd_1a_gn_getenv WD_USERCKTDIR=nil
IN:wd_fio_does_file_exist (ACE_IEC-60617_MENU.DAT)
IN:wd_fio_chk_exist_usr_prj=ACE_IEC-60617_MENU.DAT
wd_1a_gn_getenv WD_ACADPATHFIRST=nil
OUT:wd_fio_chk_exist_usr_prj
OUT:wd_fio_does_file_exist=C:\Users\murnenp\AppData\Roaming\Autodesk\AutoCAD Electrical 2015\R20.0\enu\Support\ACE_IEC-60617_MENU.DAT
wd_1a_gn_getenv WD_USER=C:/Users/murnenp/AppData/Roaming/Autodesk/AutoCAD Electrical 2015/R20.0/enu/Support/user/
wd_1a_gn_getenv WD_USERCKTDIR=nil
OUT:wd_wdmenu_1 sym=nil
IN:wd_sym_do_menu_select
OUT:wd_sym_do_menu_select
OUT:wd_insym_dlg
So my guess was wd_wdmenu_1 because the stuff in between IN:wd_wdmenu_1 and OUT:wd_wdmenu_1 had to do with finding the menu path, the menu name and my guess was that the sym=nil was the return and was nil because I didn't pick anything on the menu. After some hit and miss on the arguments it was expecting, I determined it needed 2 arguments, the first being the menu name and the second still unknown.
So, if you want to use this it looks like it works but as I said, it is use at your own risk as it is an internal call and not really intended for this kind of use.
Regards,
Pat
Pat,
Again thank you for your help, I ran the function and it works on 2014. Do you happen to know if it works on AutoCAD Electrical 2015 also? (I don't have one I can test with)
Thank you.
Yes, it appears to work on 2015.
-Pat