creating and saving toolbar

Started by potencjalek, December 20, 2013, 05:35:55 AM

Previous topic - Next topic

potencjalek

Hi Guys
i have two function first one creates manu group and it works fine
Code (autolisp) Select
(defun createToolbarGroup (tgname toolbarlist / fn flag) ;(createToolbarGroup "DanielJaros" '("Narzędzia" "Aplikacje"))
(setq flag nil)
(if (not (findfile (strcat tgname ".mns")))
(progn
  (setq fn (open (strcat main_cad_folder tgname ".mns") "w"))
  (close fn)
)
)
(vlax-for n (vla-get-menuGroups (vlax-get-acad-object))
(if (= (vla-get-name n) tgname)
  (setq flag T)
)
(terpri)
(princ (vla-get-name n))
)
(if (null flag)
(vla-load (vla-get-menuGroups (vlax-get-acad-object)) (strcat tgname ".mns"))
)
(foreach tb toolbarlist
(vla-add (vla-get-toolbars (vla-item (vla-get-menuGroups (vlax-get-acad-object)) tgname)) tb)
)
)

and second adds toolbars and buttons
Code (autolisp) Select
(defun AddButtons (tgname button_lst / Toolbar newToolbarButton) ; tgname - toolbar group name button_lst - list of buttons
(setq Toolbar nil)
(vlax-for n (vla-get-toolbars (vla-item (vla-get-menuGroups (vlax-get-acad-object)) tgname))
(if (= (vla-get-name n) (car button_lst))
(setq Toolbar n)
)
)
(if (not Toolbar)(setq Toolbar (vla-add (vla-get-toolbars (vla-item (vla-get-menuGroups (vlax-get-acad-object)) tgname)) (car button_lst)))) ; tworzy nowy toolbar
(foreach button (nth 1 button_lst)
(progn
(print (nth 0 button))
(setq newToolbarButton
(vla-addToolbarButton
Toolbar
(1+ (vla-get-count Toolbar))
(nth 0 button) (nth 0 button) (nth 1 button) ; name and command
)
)
(setq SmallBitmapName (nth 2 button)) ; path to icon
(setq LargeBitmapName (nth 2 button)) 
(vla-setBitmaps newToolbarButton SmallBitmapName LargeBitmapName)
(vla-put-helpString newToolbarButton (nth 3 button)) ; help
)
)
)

which also works fine, the problem is that after restart bricscad i cant see created toolbars anymore
should I save it somehow?

owenwengerd

Please limit your questions here to OpenDCL questions. There are much better forums for general programming and lisp questions.
Owen Wengerd (Outside The Box) / ManuSoft

potencjalek

ok, sorry
i will use it only for odcl