Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Lisp to import custom ribbon and tool bar if they dent exist.

7 REPLIES 7
Reply
Message 1 of 8
anieves228
290 Views, 7 Replies

Lisp to import custom ribbon and tool bar if they dent exist.

Hi All,

 

Is there a way to use lisp to import a custom ribbon on a machine if it doesn't exist?

 

I see mixed thoughts. one says use .NET framework and I see one for menues but not what I'm looking for and I have ZERO experience with .NET framework. 

 

Thank in advance!

7 REPLIES 7
Message 2 of 8
pendean
in reply to: anieves228

What is your goal: for example, are you trying to add a custom ribbon to a few hundred AutoCAD seats?

Or is this a "ribbon" that is constantly changing over and over again?

 

Or something else?

Message 3 of 8
Sea-Haven
in reply to: anieves228

Have a look at this it will unload a menu if it exists or just load a new one. 

 

(setq Menu_Path "C:\\yourpath\\") ; Path to Menu file
(setq Menu_Name "yourmenuname") ; pop menu to load
(setq Group_Name "YourMENU") ; groupname assigned in .mnu or .mns file

(if (menugroup menu_Name)
(command "_MENUUNLOAD" menu_Name)
)
(setq cnt (vla-get-count(vla-get-menuGroups (vlax-get-acad-object))))
(if  (> (vl-string-search  "BricsCAD" (getvar 'acadver)) 0)
(progn
(command "MENULOAD" (strcat Menu_Path Menu_Name ".CUI"))
(menucmd (strcat "P" (rtos (+ cnt 1) 2 0) "=+" menu_Name ".POP1"))
)
(progn
(command "MENULOAD" (strcat Menu_Path Menu_Name ".cuix"))
(menucmd (strcat "P" (rtos (+ cnt 1) 2 0) "=+" menu_Name ".POP1"))
)
)

 

 

Message 4 of 8
anieves228
in reply to: pendean

Yes. It will be sent to +50 machines and it will be updated as needed, but it will be frequently updated when first implemented.

Message 5 of 8
pendean
in reply to: anieves228


@anieves228 wrote:

Yes. It will be sent to +50 machines and it will be updated as needed, but it will be frequently updated when first implemented.


Good lisp above for your use.

 

BUT... have you all considered implementing an ENTERPRISE menu instead? it's built into the program an works well for situations like yours

https://help.autodesk.com/view/ACD/2024/ENU/?guid=GUID-B3F0CB28-99D6-48B5-99C7-3E58249BB18C#:~:text=...

Message 6 of 8
anieves228
in reply to: Sea-Haven

Question. 

 

path to file menu file would be the .cuix file location correct?

 

Then the Ribbon name would be the Menu_name?

 

Now I don't have a .mnu or .mns file. I have a .mnr file that is generated. Which I think is causing me an issue. 

 

I comment out the first (progn) since mine is a .cuix not an .cui. 

 

So I'm not sure where to go from here. 

 

(setq Menu_Path "x:\\zCAD\\Tools\\cui\\") ; Path to Menu file
(setq Menu_Name "Company Custom") ; pop menu to load
(setq Group_Name "Company Custom") ; groupname assigned in .mnu or .mns file

(if 
  (menugroup menu_Name)
  (command "_MENUUNLOAD" menu_Name)
)

(setq cnt 
  (vla-get-count
    (vla-get-menuGroups
      (vlax-get-acad-object)
    )
  )
)

(if  
  (> 
    (vl-string-search  "BricsCAD"
      (getvar 'acadver)
    ) 0
  )
  
  ; (progn
  ;   (command "MENULOAD" (strcat Menu_Path Menu_Name ".CUI"))
  ;   (menucmd (strcat "P" (rtos (+ cnt 1) 2 0) "=+" menu_Name ".POP1"))
  ; )
  
  (progn
    (command "MENULOAD" (strcat Menu_Path Menu_Name ".cuix"))
    (menucmd (strcat "P" (rtos (+ cnt 1) 2 0) "=+" menu_Name ".POP1"))
  )
)

 

Message 7 of 8
anieves228
in reply to: Sea-Haven

Also. it still stops and asks for the customization file

error.png

Message 8 of 8
Sea-Haven
in reply to: anieves228

(setq Menu_Name "name of your mnu file")

 

Need to look at 1st few lines of a mnu file,  **MENUGROUP=this is name of menu group

(setq Group_Name "this is name of menu group")

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report