liuhaixin88 Posted April 21, 2014 Share Posted April 21, 2014 This code can automatically create the toolbar(*.mnu) But creating at " my documents ",Can I choose the path? For example: E:\Program Files\AutoCAD 2010\Support ;;Automatically create the toolbar (defun create_toolbar (/ file lst x) (setvar "cmdecho" 0) (vl-load-com) (if (not (menugroup "TEMPTOOLBAR")) (progn (alert "\nCreating\"TEMPTOOLBAR\"toolbar,Please wait!") (setq file (open "TEMPTOOLBAR.mnu" "W")) (foreach x '("***MENUGROUP=TEMPTOOLBAR\n\n***TOOLBARS\n**TEMPTOOLBAR" "ID_ZCT001 [_Toolbar(\"Block tools\", _Floating, _Hide, 10, 340, 1)]" "ID_ZCT011 [_Button(\"Building block\", \"RCDATA_16_OSNEND\", \"RCDATA_16_OSNEND\")]^C^Czline" "ID_ZCT012 [_Button(\"Delete block\", \"RCDATA_16_DIMOBL\", \"RCDATA_16_DIMOBL\")]^C^Czdim" "ID_ZCT013 [_Button(\"Preview block\", \"RCDATA_16_TEXEDI\", \"RCDATA_16_TEXEDI\")]^C^Cztext" "ID_ZCT014 [_Button(\"Rotating block\", \"RCDATA_16_DIMOVE\", \"RCDATA_16_DIMOVE\")]^C^Czch" ) (princ (strcat x "\n") file) ) (close file) (command "menuload" "TEMPTOOLBAR.mnu") ) ) (command "TOOLBAR" "Block tools" "S") (princ) ) (create_toolbar) Quote Link to comment Share on other sites More sharing options...
Bhull1985 Posted April 21, 2014 Share Posted April 21, 2014 This code can automatically create the toolbar(*.mnu)But creating at " my documents ",Can I choose the path? For example: E:\Program Files\AutoCAD 2010\Support ;;Automatically create the toolbar (defun create_toolbar (/ file lst x) (setvar "cmdecho" 0) (vl-load-com) (if (not (menugroup "TEMPTOOLBAR")) (progn (alert "\nCreating\"TEMPTOOLBAR\"toolbar,Please wait!") (setq file (open[b] [color=red][u]"TEMPTOOLBAR.mnu"[/u][/color][/b] "W")) ... Try adding the full path there instead of just the filename. Something like...replace this line with.. (setq file (open[b] [color=red][u]"[/u][/color][/b]E:\\Program Files\\AutoCAD 2010\\Support\\[b][u][color=#ff0000]TEMPTOOLBAR.mnu"[/color][/u][/b] "W")) and make sure you move the file from my documents to that support folder first ^.^ Quote Link to comment Share on other sites More sharing options...
liuhaixin88 Posted April 22, 2014 Author Share Posted April 22, 2014 Try adding the full path there instead of just the filename.Something like...replace this line with.. (setq file (open[b] [color=red][u]"[/u][/color][/b]E:\\Program Files\\AutoCAD 2010\\Support\\[b][u][color=#ff0000]TEMPTOOLBAR.mnu"[/color][/u][/b] "W")) and make sure you move the file from my documents to that support folder first ^.^ OK! Thank you !Brandon. Quote Link to comment Share on other sites More sharing options...
pBe Posted April 22, 2014 Share Posted April 22, 2014 This code can automatically create the toolbar(*.mnu)But creating at " my documents ",Can I choose the path? For example: E:\Program Files\AutoCAD 2010\Support look into (strcat (getvar 'ROAMABLEROOTPREFIX) "Support\\TEMPTOOLBAR.mnu") or even (strcat (vl-filename-directory (findfile "acad.lin")) "\\TEMPTOOLBAR.mnu") Quote Link to comment Share on other sites More sharing options...
liuhaixin88 Posted April 22, 2014 Author Share Posted April 22, 2014 look into (strcat (getvar 'ROAMABLEROOTPREFIX) "Support\\TEMPTOOLBAR.mnu") or even (strcat (vl-filename-directory (findfile "acad.lin")) "\\TEMPTOOLBAR.mnu") Thank you ,pbe, nice! Automatically determine the CAD installation path. Quote Link to comment Share on other sites More sharing options...
Bhull1985 Posted April 22, 2014 Share Posted April 22, 2014 You are very welcome, did these replies take care of the issue for you? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.