Author Topic: Remove a toolbar  (Read 1881 times)

0 Members and 1 Guest are viewing this topic.

GDF

  • Water Moccasin
  • Posts: 2081
Remove a toolbar
« on: February 22, 2020, 02:19:37 PM »
How would I remove a toolbar without using a command:
(command "toolbar" "ARCH.Arch2Program©" "hide")

I want it to work thru a reactor...


Code - Auto/Visual Lisp: [Select]
  1. (defun C:RARCH ()
  2.   (princ "\n*** ---- Resetting ARCH Menu Pulldown ---- ***")
  3.   (cond
  4.     ((or (= (nth 0 (ARCH:Split (getvar "dwgprefix") "\\")) "Z:")(= (substr (getvar 'dwgname) 1 (- (strlen (getvar 'dwgname)) 5)) "Drawing"))
  5.       (ARCH:NotInDirectory))
  6.     ((or (/= (nth 0 (ARCH:Split (getvar "dwgprefix") "\\")) "Z:")(/= (substr (getvar 'dwgname) 1 (- (strlen (getvar 'dwgname)) 5)) "Drawing"))
  7.       (ARCH:InDirectory)))
  8.   [b];;(command "toolbar" "ARCH.Arch2Program©" "hide")[/b]
  9.   (princ))  
  10. ;;;
  11. (defun rarchit (calling-reactor commandinfo) (C:RARCH) (princ))
  12. (vlr-docmanager-reactor () '((:vlr-documentBecameCurrent . rarchit)))

EDIT (John): Added code tags.
« Last Edit: February 22, 2020, 03:01:19 PM by John Kaul (Se7en) »
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

GDF

  • Water Moccasin
  • Posts: 2081
Re: Remove a toolbar
« Reply #1 on: February 22, 2020, 02:57:16 PM »
Code - Auto/Visual Lisp: [Select]
  1. (defun ax:Toggle (mGroup tBarName / tbar)
  2.   (if (= (vla-get-visible tbar) :vlax-true)
  3.     (vla-put-visible tbar :vlax-false)
  4.     (vla-put-visible tbar :vlax-true)
  5.   )
  6.   (princ))
  7.  
  8.  
  9. (ax:Toggle "ARCH" "Arch2Program©")

EDIT (John): Added code tags.
« Last Edit: February 22, 2020, 03:01:36 PM by John Kaul (Se7en) »
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

GDF

  • Water Moccasin
  • Posts: 2081
Re: Remove a toolbar
« Reply #2 on: February 22, 2020, 03:22:03 PM »
I got this to work:

(defun ax:Toggle-off (mGroup tBarName / tbar)
  (setq tbar (vla-item (vla-get-toolbars (vla-item (vla-get-menugroups (vlax-get-acad-object)) mGroup)) tBarName))
  (if (= (vla-get-visible tbar) :vlax-true) (vla-put-visible tbar :vlax-false))
  (princ))
(defun ax:Toggle-on (mGroup tBarName / tbar)
  (setq tbar (vla-item (vla-get-toolbars (vla-item (vla-get-menugroups (vlax-get-acad-object)) mGroup)) tBarName))
  (if (= (vla-get-visible tbar) :vlax-false) (vla-put-visible tbar :vlax-true))
  (princ))
;;;
(defun C:RARCH ()
  (princ "\n*** ---- Resetting ARCH Menu Pulldown ---- ***")
  (ARCH:GDFstandard)
  (cond
    ((or (= (nth 0 (ARCH:Split (getvar "dwgprefix") "\\")) "Z:")(= (substr (getvar 'dwgname) 1 (- (strlen (getvar 'dwgname)) 5)) "Drawing"))
      (progn (ax:Toggle-off "ARCH" "Arch2Program©")(ARCH:NotInDirectory)))
    ((or (/= (nth 0 (ARCH:Split (getvar "dwgprefix") "\\")) "Z:")(/= (substr (getvar 'dwgname) 1 (- (strlen (getvar 'dwgname)) 5)) "Drawing"))
      (progn (ax:Toggle-on "ARCH" "Arch2Program©")(ARCH:InDirectory))))   
  (princ)) 
;;;
(defun rarchit (calling-reactor commandinfo) (C:RARCH) (princ))
(vlr-docmanager-reactor () '((:vlr-documentBecameCurrent . rarchit)))
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

GDF

  • Water Moccasin
  • Posts: 2081
Re: Remove a toolbar
« Reply #3 on: February 22, 2020, 03:25:30 PM »
Well it works in BricsCAD but not AutoCAD.
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

GDF

  • Water Moccasin
  • Posts: 2081
Re: Remove a toolbar
« Reply #4 on: February 22, 2020, 09:37:59 PM »
I found the error, a toolbar command call; which AutoCAD does not allow within a reactor.
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64