Jump to content

Specify a path to create toolbar(*.mnu)


liuhaixin88

Recommended Posts

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)   

Link to comment
Share on other sites

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 ^.^

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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")

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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...