I have added a quick access button to autocad to run the following line:
^C^C_shell "C:/Users/myuser/test.bat";
This line is needed on multiple computers, and I would like to create a "setup" file so people can just double click on it and the button will be installed in their autodesk installation. Is this possible?
I have added a quick access button to autocad to run the following line:
^C^C_shell "C:/Users/myuser/test.bat";
This line is needed on multiple computers, and I would like to create a "setup" file so people can just double click on it and the button will be installed in their autodesk installation. Is this possible?
It seems overly complex to need +200 lines of #C code to add a simple button autocad?
I believe I should be able to add a button just by editing the CUIX files?
This is as far as I've come. I've created a custom button as shown here:
looking into the acad.cuix I'm able to find that item here:
<?xml version="1.0"?>
<!--
Warning! Do not edit the contents of this file.
If you attempt to edit this file using an XML editor, you could lose
customization and migration functionality. If you need to change
information in the customization file, use the Customize User Interface
dialog in the product.
To access the Customize User Interface dialog, click the Tools menu,
Customization panel, User Interface button, or enter CUI on the command line.
-->
<QuickAccessToolbarRoot xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<QuickAccessToolbar UID="QAT_TOOLBAR1">
<ModifiedRev MajorVersion="24" MinorVersion="3" UserVersion="1" />
<Name xlate="true" UID="XLS_QAT_Name">Quick Access Toolbar 1</Name>
<QuickAccessToolbarStandardItem UID="ID_QAT_New" Id="AcQATNew">
<ModifiedRev MajorVersion="18" MinorVersion="0" UserVersion="0" />
</QuickAccessToolbarStandardItem>
<QuickAccessToolbarStandardItem UID="ID_QAT_Open" Id="AcQATOpen">
<ModifiedRev MajorVersion="18" MinorVersion="0" UserVersion="0" />
</QuickAccessToolbarStandardItem>
<QuickAccessToolbarStandardItem UID="ID_QAT_Save" Id="AcQATSave">
<ModifiedRev MajorVersion="18" MinorVersion="0" UserVersion="0" />
</QuickAccessToolbarStandardItem>
<QuickAccessToolbarStandardItem UID="ID_QAT_SaveAs" Id="AcQATSaveAs">
<ModifiedRev MajorVersion="18" MinorVersion="1" UserVersion="0" />
</QuickAccessToolbarStandardItem>
<QuickAccessToolbarStandardItem UID="ID_QAT_OpenFromWebMob" Id="AcQATOpenFromWebMob">
<ModifiedRev MajorVersion="23" MinorVersion="0" UserVersion="0" />
</QuickAccessToolbarStandardItem>
<QuickAccessToolbarStandardItem UID="ID_QAT_SaveToWebMob" Id="AcQATSaveToWebMob">
<ModifiedRev MajorVersion="23" MinorVersion="0" UserVersion="0" />
</QuickAccessToolbarStandardItem>
<QuickAccessToolbarStandardItem UID="ID_QAT_Plot" Id="AcQATPlot">
<ModifiedRev MajorVersion="18" MinorVersion="0" UserVersion="0" />
</QuickAccessToolbarStandardItem>
<QuickAccessToolbarStandardItem UID="ID_QAT_Undo" Id="AcQATUndo">
<ModifiedRev MajorVersion="18" MinorVersion="0" UserVersion="0" />
</QuickAccessToolbarStandardItem>
<QuickAccessToolbarStandardItem UID="ID_QAT_Redo" Id="AcQATRedo">
<ModifiedRev MajorVersion="18" MinorVersion="0" UserVersion="0" />
</QuickAccessToolbarStandardItem>
<RibbonCommandButton UID="ID_RBN__243_602B8" Id="AcRibbonCommandButton" Text="mycommand" ButtonStyle="SmallWithoutText" MenuMacroID="MMU_243_C51F6">
<ModifiedRev MajorVersion="24" MinorVersion="3" UserVersion="1" />
</RibbonCommandButton>
</QuickAccessToolbar>
</QuickAccessToolbarRoot>
This only places the "dead button" though. I need to find where the Macro element is located in order to create something that can add it automatically.
It seems overly complex to need +200 lines of #C code to add a simple button autocad?
I believe I should be able to add a button just by editing the CUIX files?
This is as far as I've come. I've created a custom button as shown here:
looking into the acad.cuix I'm able to find that item here:
<?xml version="1.0"?>
<!--
Warning! Do not edit the contents of this file.
If you attempt to edit this file using an XML editor, you could lose
customization and migration functionality. If you need to change
information in the customization file, use the Customize User Interface
dialog in the product.
To access the Customize User Interface dialog, click the Tools menu,
Customization panel, User Interface button, or enter CUI on the command line.
-->
<QuickAccessToolbarRoot xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<QuickAccessToolbar UID="QAT_TOOLBAR1">
<ModifiedRev MajorVersion="24" MinorVersion="3" UserVersion="1" />
<Name xlate="true" UID="XLS_QAT_Name">Quick Access Toolbar 1</Name>
<QuickAccessToolbarStandardItem UID="ID_QAT_New" Id="AcQATNew">
<ModifiedRev MajorVersion="18" MinorVersion="0" UserVersion="0" />
</QuickAccessToolbarStandardItem>
<QuickAccessToolbarStandardItem UID="ID_QAT_Open" Id="AcQATOpen">
<ModifiedRev MajorVersion="18" MinorVersion="0" UserVersion="0" />
</QuickAccessToolbarStandardItem>
<QuickAccessToolbarStandardItem UID="ID_QAT_Save" Id="AcQATSave">
<ModifiedRev MajorVersion="18" MinorVersion="0" UserVersion="0" />
</QuickAccessToolbarStandardItem>
<QuickAccessToolbarStandardItem UID="ID_QAT_SaveAs" Id="AcQATSaveAs">
<ModifiedRev MajorVersion="18" MinorVersion="1" UserVersion="0" />
</QuickAccessToolbarStandardItem>
<QuickAccessToolbarStandardItem UID="ID_QAT_OpenFromWebMob" Id="AcQATOpenFromWebMob">
<ModifiedRev MajorVersion="23" MinorVersion="0" UserVersion="0" />
</QuickAccessToolbarStandardItem>
<QuickAccessToolbarStandardItem UID="ID_QAT_SaveToWebMob" Id="AcQATSaveToWebMob">
<ModifiedRev MajorVersion="23" MinorVersion="0" UserVersion="0" />
</QuickAccessToolbarStandardItem>
<QuickAccessToolbarStandardItem UID="ID_QAT_Plot" Id="AcQATPlot">
<ModifiedRev MajorVersion="18" MinorVersion="0" UserVersion="0" />
</QuickAccessToolbarStandardItem>
<QuickAccessToolbarStandardItem UID="ID_QAT_Undo" Id="AcQATUndo">
<ModifiedRev MajorVersion="18" MinorVersion="0" UserVersion="0" />
</QuickAccessToolbarStandardItem>
<QuickAccessToolbarStandardItem UID="ID_QAT_Redo" Id="AcQATRedo">
<ModifiedRev MajorVersion="18" MinorVersion="0" UserVersion="0" />
</QuickAccessToolbarStandardItem>
<RibbonCommandButton UID="ID_RBN__243_602B8" Id="AcRibbonCommandButton" Text="mycommand" ButtonStyle="SmallWithoutText" MenuMacroID="MMU_243_C51F6">
<ModifiedRev MajorVersion="24" MinorVersion="3" UserVersion="1" />
</RibbonCommandButton>
</QuickAccessToolbar>
</QuickAccessToolbarRoot>
This only places the "dead button" though. I need to find where the Macro element is located in order to create something that can add it automatically.
Hi,
if you want to go this way... please let me know, how it ended up.
Look at the MenuGroup.cui ! (multiple places/parts inside)
Sebastian
Hi,
if you want to go this way... please let me know, how it ended up.
Look at the MenuGroup.cui ! (multiple places/parts inside)
Sebastian
I don't necessarily want to go that way. If there's an easier option I'm all ears!
I just wouldn't have imagined that creating a script that will add a button to the menu would be so difficult that one would have to write 200+ lines of C code or modifying nested CUI files.
I'm very much interested in the simplest possible solution.
I don't necessarily want to go that way. If there's an easier option I'm all ears!
I just wouldn't have imagined that creating a script that will add a button to the menu would be so difficult that one would have to write 200+ lines of C code or modifying nested CUI files.
I'm very much interested in the simplest possible solution.
Hi,
200 or 2000 doesn't matter if already present - the best way you have.
The way you are talking is much more crazy in my ears 😆
Editing nested and compressed files with unknown content, because you have to know
all users on each workstation
*
each profile (with unknown content)
*
each used main .cuix (add the button)
*
each workspace (add the button)
Sebastian
Hi,
200 or 2000 doesn't matter if already present - the best way you have.
The way you are talking is much more crazy in my ears 😆
Editing nested and compressed files with unknown content, because you have to know
all users on each workstation
*
each profile (with unknown content)
*
each used main .cuix (add the button)
*
each workspace (add the button)
Sebastian
@MRCH94D9W wrote:.... and the button will be installed in their autodesk installation....
...will add a button to the menu ... or modifying nested CUI files.
...I'm very much interested in the simplest possible solution....
Looks like your company is ready to adopt ENTERPRISE CUI, how Autodesk wants you do do it.
Enjoy the switch.
@MRCH94D9W wrote:.... and the button will be installed in their autodesk installation....
...will add a button to the menu ... or modifying nested CUI files.
...I'm very much interested in the simplest possible solution....
Looks like your company is ready to adopt ENTERPRISE CUI, how Autodesk wants you do do it.
Enjoy the switch.
What is the button actually installing? I assume installing the button is a way to allow the user to then further install something.
could you bypass the need for the use to setup the install by running a lisp at startup that puts what ever setting you need in place?
https://help.autodesk.com/view/OARX/2022/ENU/?guid=GUID-FDB4038D-1620-4A56-8824-D37729D42520
CADnoob
What is the button actually installing? I assume installing the button is a way to allow the user to then further install something.
could you bypass the need for the use to setup the install by running a lisp at startup that puts what ever setting you need in place?
https://help.autodesk.com/view/OARX/2022/ENU/?guid=GUID-FDB4038D-1620-4A56-8824-D37729D42520
CADnoob
That could be a solution.
The button doesn't install anything, it simply runs a python script which exports data from a database file which is in turn generated through Sofistiks Autocad plugin (Sofiplus).
I've found the following autolisp script which as far as I can tell, should add a button when run. But when I run it, it simply states "AddButton.lsp successfully loaded", but no button appears.
(defun c:AddBasicButton ()
(vl-load-com)
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; Macro for the command
(setq cmdMacro "^C^C_shell "C:/Users/myuser/test.bat";")
;; Get the Quick Access Toolbar
(setq menus (vla-get-MenuGroups acadObj))
(setq customToolbar (vla-Item (vla-get-Toolbars (vla-Item menus 0)) 0))
;; Add the button to the Quick Access Toolbar
(setq button (vla-AddToolbarButton customToolbar "RunMacroButton" "Run Macro" cmdMacro))
;; Ensure the toolbar is visible (typically QAT is always visible)
(vlax-put-property customToolbar 'Visible :vlax-true)
;; Debug message
(princ "\nBasic button added to Quick Access Toolbar.")
(princ)
)
(c:AddBasicButton)
That could be a solution.
The button doesn't install anything, it simply runs a python script which exports data from a database file which is in turn generated through Sofistiks Autocad plugin (Sofiplus).
I've found the following autolisp script which as far as I can tell, should add a button when run. But when I run it, it simply states "AddButton.lsp successfully loaded", but no button appears.
(defun c:AddBasicButton ()
(vl-load-com)
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; Macro for the command
(setq cmdMacro "^C^C_shell "C:/Users/myuser/test.bat";")
;; Get the Quick Access Toolbar
(setq menus (vla-get-MenuGroups acadObj))
(setq customToolbar (vla-Item (vla-get-Toolbars (vla-Item menus 0)) 0))
;; Add the button to the Quick Access Toolbar
(setq button (vla-AddToolbarButton customToolbar "RunMacroButton" "Run Macro" cmdMacro))
;; Ensure the toolbar is visible (typically QAT is always visible)
(vlax-put-property customToolbar 'Visible :vlax-true)
;; Debug message
(princ "\nBasic button added to Quick Access Toolbar.")
(princ)
)
(c:AddBasicButton)
Im not sure the lisp code does what you are trying to do. Where did you get it?
I had to add a parameter to vla-AddToolbarButton to get it to work and I also had to move the visibility part prior to the add button part.
After that it was loading the button to the mesh toolbar
Here is a link to someone adding a button to QAT but they used .net (edit: its the same link @paullimapa posted)
CADnoob
Im not sure the lisp code does what you are trying to do. Where did you get it?
I had to add a parameter to vla-AddToolbarButton to get it to work and I also had to move the visibility part prior to the add button part.
After that it was loading the button to the mesh toolbar
Here is a link to someone adding a button to QAT but they used .net (edit: its the same link @paullimapa posted)
CADnoob
It's an old piece of code I found in the company drawers. Unfortunately the author is not around anymore.
Any chance you can share your modifications to the code?
I have also seen the link previously posted. I just struggle to understand why adding a simple button should be that hard. The code also needs to be compiled, which I have no means of doing.
It's an old piece of code I found in the company drawers. Unfortunately the author is not around anymore.
Any chance you can share your modifications to the code?
I have also seen the link previously posted. I just struggle to understand why adding a simple button should be that hard. The code also needs to be compiled, which I have no means of doing.
@MRCH94D9W wrote:
....
Any chance you can share your modifications to the code?
....
Here is what I changed it to. It should be noted that all i did was make it so that it would show up on the tool bar that it was placing it on. I still think the lisp isnt working as intended though.
(defun c:AddBasicButton ()
(vl-load-com)
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; Macro for the command
(setq cmdMacro "^C^C_shell "C:/Users/myuser/test.bat";")
;; Get the Quick Access Toolbar
(setq menus (vla-get-MenuGroups acadObj))
(setq customToolbar (vla-Item (vla-get-Toolbars (vla-Item menus 0)) 0))
;; Ensure the toolbar is visible (typically QAT is always visible)
(vlax-put-property customToolbar 'Visible :vlax-true)
;; Add the button to the Quick Access Toolbar
(setq button (vla-AddToolbarButton customToolbar "RunMacroButton" "Run Macro" cmdMacro "true"))
;; Debug message
(princ "\nBasic button added to Quick Access Toolbar.")
(princ)
)
(c:AddBasicButton)
I have also seen the link previously posted. I just struggle to understand why adding a simple button should be that hard. The code also needs to be compiled, which I have no means of doing.
Its actually relatively easy to add things to the QAT for some things, but i think your parameters are making it a little more difficult. the QAT is also not a traditional toolbar which may be causing some confusion. I personally would just add the command to the start up and users could access it via the command line. We also tend to use Pallets for our custom built tools.
There are lots of things out there about managing company standards through customizing the interface. Id go check out some of the classes they have had at AU https://www.autodesk.com/autodesk-university/class/CAD-Managers-Guide-Using-Tool-Palettes-Manage-Sta...
CADnoob
@MRCH94D9W wrote:
....
Any chance you can share your modifications to the code?
....
Here is what I changed it to. It should be noted that all i did was make it so that it would show up on the tool bar that it was placing it on. I still think the lisp isnt working as intended though.
(defun c:AddBasicButton ()
(vl-load-com)
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; Macro for the command
(setq cmdMacro "^C^C_shell "C:/Users/myuser/test.bat";")
;; Get the Quick Access Toolbar
(setq menus (vla-get-MenuGroups acadObj))
(setq customToolbar (vla-Item (vla-get-Toolbars (vla-Item menus 0)) 0))
;; Ensure the toolbar is visible (typically QAT is always visible)
(vlax-put-property customToolbar 'Visible :vlax-true)
;; Add the button to the Quick Access Toolbar
(setq button (vla-AddToolbarButton customToolbar "RunMacroButton" "Run Macro" cmdMacro "true"))
;; Debug message
(princ "\nBasic button added to Quick Access Toolbar.")
(princ)
)
(c:AddBasicButton)
I have also seen the link previously posted. I just struggle to understand why adding a simple button should be that hard. The code also needs to be compiled, which I have no means of doing.
Its actually relatively easy to add things to the QAT for some things, but i think your parameters are making it a little more difficult. the QAT is also not a traditional toolbar which may be causing some confusion. I personally would just add the command to the start up and users could access it via the command line. We also tend to use Pallets for our custom built tools.
There are lots of things out there about managing company standards through customizing the interface. Id go check out some of the classes they have had at AU https://www.autodesk.com/autodesk-university/class/CAD-Managers-Guide-Using-Tool-Palettes-Manage-Sta...
CADnoob
Can't find what you're looking for? Ask the community or share your knowledge.