Author Topic: Loading custom menus  (Read 1409 times)

0 Members and 1 Guest are viewing this topic.

like_citrus

  • Newt
  • Posts: 114
Loading custom menus
« on: January 28, 2021, 02:30:57 AM »
I have 3 custom menus which I'm trying to load into AutoCAD.

The script below was taken from a textbook and it was for AutoCAD 2000 (type SCRIPT to load file). It still sort of worked when I had 2 custom menus but the response from AutoCAD was inconsistent. Sometimes you could call up each script file and then both menus would load. Sometimes you'd load one, then the next one wouldn't load. Sometimes both would disappear from view. After a few trials, you'd eventually see 2 menu files.

I can't load 3 menu files though.
Having tried MENULOAD, each menu does load but I have an issue with the menu actions. The action is that a structural section is inserted. But with MENULOAD, it doesn't work.
Is there a way to resolve?
 
"BlockInsert" is set to is a LISP routine set to autoload.
To test, place in C drive in folder "POP103 Structural Steel".

SCRIPT
Code: [Select]
(if (and (not (findfile "STRUCTURAL_STEEL.mnu"))
(findfile "C:\\POP103 Structural Steel\\STRUCTURAL_STEEL.mnu")
)
(setenv "ACAD" (strcat (getenv "ACAD") "C:\\POP103 Structural Steel"))
)
(command "._MENULOAD" "STRUCTURAL_STEEL.mnu")
(menucmd "P103=+STRUCTURAL_STEEL.CTOPopSTRUCTURAL_STEEL")

MENU FILE
Code: [Select]
***MENUGROUP=STRUCTURAL_STEEL
***POP103
**CTOPopSTRUCTURAL_STEEL

[Structural Steel]

[->UB]
   [530UB82]^C^C(BlockInsert "UniversalBeams_530UB82.0");scale;1;
   [<-530UB92]^C^C(BlockInsert "UniversalBeams_530UB92.4");scale;1;

"BlockInsert"
Code: [Select]
(defun BlockInsert (blkname)
    (command "_.-insert" (substr (strcat blkname "-" (menucmd "m=$(edtime,0,yymoddhhmmss)") "=" blkname) (+ (vl-string-position (ascii "_") blkname 1) 2)) pause 1 "" 0)
)

kpblc

  • Bull Frog
  • Posts: 396
Re: Loading custom menus
« Reply #1 on: January 28, 2021, 04:57:57 AM »
Where is BlockInsert function definition? Does it loaded?
Sorry for my English.

like_citrus

  • Newt
  • Posts: 114
Re: Loading custom menus
« Reply #2 on: January 28, 2021, 04:59:50 AM »
The BlockInsert code is in a LISP file which is on auto-load.
This is via command APPLOAD, in the Startup Suite, select the LISP file.

d2010

  • Bull Frog
  • Posts: 326
Re: Loading custom menus
« Reply #3 on: January 28, 2021, 06:06:15 AM »
Sorry. :sick:
I try in old-times file.MNU and .MNL,
But this solution is not suitable for future-income,
You must emulate the file.mnu+lisp.mnl with file*dcl+*.lisp.
Here you view parse-of-mnu.
« Last Edit: January 28, 2021, 06:26:41 AM by d2010 »

kpblc

  • Bull Frog
  • Posts: 396
Re: Loading custom menus
« Reply #4 on: January 28, 2021, 01:30:07 PM »
The BlockInsert code is in a LISP file which is on auto-load.
This is via command APPLOAD, in the Startup Suite, select the LISP file.
At some versions StartupSuite doesn't work correctly. Use <MenuName>.mnl file to load your lisps.
Sorry for my English.

like_citrus

  • Newt
  • Posts: 114
Re: Loading custom menus
« Reply #5 on: January 28, 2021, 08:17:30 PM »
kpblc, I don't have any issues with the autoload but will keep that in mind.

like_citrus

  • Newt
  • Posts: 114
Re: Loading custom menus
« Reply #6 on: February 07, 2021, 05:25:44 AM »
Bumping up.