Jump to content

Recommended Posts

Posted

hello friends,
what is wrong with my code?

(defun c:zaz ()
  (if (tblsearch "DRAW")
    (command "-toolbar" "draw" "hide")
    (command "-toolbar" "draw" "show")
  )
  (princ)
)

 

Posted
5 minutes ago, rlx said:

tblsearch what, block, layer?

i want to know  about toolbar (draw)

Posted (edited)
(vlax-for mnu (vla-get-menugroups (vlax-get-acad-object))
   (vlax-for tlb (vla-get-toolbars mnu)
      (if (= (vla-get-visible tlb) :vlax-true)
         (setq tlb_lst (cons (vla-get-name tlb) tlb_lst))
      )
   )
)

 

with this you can built list of visible toolbars. If draw is member of list tlb_lst its visible , if not a member its hidden...

Edited by rlx
Posted
31 minutes ago, rlx said:
(vlax-for mnu (vla-get-menugroups (vlax-get-acad-object))
   (vlax-for tlb (vla-get-toolbars mnu)
      (if (= (vla-get-visible tlb) :vlax-true)
         (setq tlb_lst (cons (vla-get-name tlb) tlb_lst))
      )
   )
)

 

with this you can built list of visible toolbars. If draw is member of list tlb_lst its visible , if not a member its hidden...

actually my goal is to control toolbar "draw"
if draw is active, inactive that
if the draw is inactive, active it !!!
i dont know how to use ur code ?

Posted
;;; toggle draw toolbar
(defun c:tdtb ( / lst )
  (vlax-for mnu (vla-get-menugroups (vlax-get-acad-object))
    (vlax-for tlb (vla-get-toolbars mnu)
      (if (= (vla-get-visible tlb) :vlax-true) (setq lst (cons (vla-get-name tlb) lst)))))
  (if (member "Draw" lst)
    (command "-toolbar" "Draw" "Hide")
    (command "-toolbar" "Draw" "Show")
  )
)

 

  • Like 3

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...