Code Red > AutoLISP (Vanilla / Visual)

Loading custom menus

(1/2) > >>

like_citrus:
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: ---(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")
--- End code ---

MENU FILE

--- Code: ---***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;
--- End code ---

"BlockInsert"

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

kpblc:
Where is BlockInsert function definition? Does it loaded?

like_citrus:
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:

--- Quote from: like_citrus on January 28, 2021, 04:59:50 AM ---
--- End quote ---
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.

kpblc:

--- Quote from: like_citrus 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.

--- End quote ---
At some versions StartupSuite doesn't work correctly. Use <MenuName>.mnl file to load your lisps.

Navigation

[0] Message Index

[#] Next page

Go to full version