Error with LISP routine - "Macro not found"?

Error with LISP routine - "Macro not found"?

Anonymous
Not applicable
1,966 Views
7 Replies
Message 1 of 8

Error with LISP routine - "Macro not found"?

Anonymous
Not applicable

I'm hoping this is something simple that I am missing.  Hopefully someone can help me out.   I am trying to edit and run a lisp routine that I used at a previous employer in 2012ish.  While I was at that job I needed to change the layer colors from our standards to another seperate companies set of layer color standards and this lisp worked great there.  Now I am at a different employer and I am trying to edit and tweak the lisp so that it will work with the projects I with now.  (One set being our "layout" standards and the other set being our "rough-in" standards.)

 

The lisp routine has the text file and two excel files that it references.  (One excel file for the original layers and one exel file for the "new" layers). The problem is when I run the lisp - it starts to work by first purging all the unused layers in the drawing, but then when it comes time for it to reference the excel file and add the "new" layers it gives me the error "Macro not found".  I feel I know a decient amount about CAD, but I know less about Lisp routines and hardly anything about Macros.  I'm working on 2015 AutoCAD Architecture.  The coding for the lisp is below - any help would be much appreciated. 

 

(defun C:LRIColors ()

;;; Determine which company's colors to use. ;;;
;;
;;

(setq $QCOMPANY
(if $QCOMPANY
$QCOMPANY
""
)
)
(setq PRMPT
"\nEnter which layer colors to use [Layout/Roughin]:"
)
(if $QCOMPANY
(setq PRMPT (strcat PRMPT " <" $QCOMPANY ">: "))
)
(initget
"Layout Roughin"
)
(setq ANS (getkword PRMPT))
(setq $QCOMPANY
(if (> ANS "")
ANS
$QCOMPANY
)
)
(princ)

(prompt $QCOMPANY)
(prompt " was selected. ")
(princ)

;;
;;
;;; Determine which Layer colors to use. ;;;

;;; Replace current colors with selected company's colors. ;;;
;;
;;

(command "undo" "begin")
(setvar "cmdecho" 0)
(setq QSSGET (ssget "_X"))
(command "_copybase" "0,0" QSSGET "")
(command "erase" QSSGET "")
(command "purge" "Layers" "*" "no")

(cond ; Begin Cond
(
(= $QCOMPANY "Roughin")
(command "vbarun"
"MasterLay.dvb!modMain.Create_Layers"
"Roughin_Layers.xls"
)
)
(
(= $QCOMPANY "Layout")
(command "vbarun"
"MasterLay.dvb!modMain.Create_Layers"
"Layout_Layers.xls"
)
)
(t NIL)
) ; End Cond

(command "_pasteblock" "0,0")
(command "explode" (entlast))
(command "purge" "Layers" "*" "no")
(setvar "cmdecho" 1)
(command "undo" "end")
(princ)

;;
;;
;;; Replace current colors with selected layer colors. ;;;

)

0 Likes
1,967 Views
7 Replies
Replies (7)
Message 2 of 8

ВeekeeCZ
Consultant
Consultant
0 Likes
Message 3 of 8

Balaji_Ram
Alumni
Alumni

Also, do you have the MasterLay.dvb that your Lisp routines depends on already loaded in AutoCAD ?

You can manually try using -vbarun and invoke the macros to see if they work.

 

Regards,

Balaji

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 4 of 8

Anonymous
Not applicable

I did install the VBA link previously...   I tried the -vbarun command and when it asked for the macro name I typed in the "masterlay.dvb" and it came back with "Execution Error".   Did I do that wrong?  I'm not sure what that means?    

0 Likes
Message 5 of 8

Balaji_Ram
Alumni
Alumni

Sorry, there is too little information to say what could be causing it.

 

You may need to debug your code in VBA IDE and get the macro working when invoked from VBARUN.

 

Regards,

Balaji



Balaji
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 6 of 8

Anonymous
Not applicable

I'm not sure what more information I can give you.  If you tell me what you need to know I'll be happy to tell you what I have.

 

I appologize, I know basic coding for Lisp routines, but I know hardly know anything about Marcos and VBA stuff.  Can you give me some guidence on how to work with the "VBA IDE" and VBARUN?   Give me something to try? or maybe just point me in the right direction for me to research and learn on my own?  

0 Likes
Message 7 of 8

paullimapa
Mentor
Mentor

The Lisp code you posted contains calls to a vba code that's saved outside of the Lisp file called:MasterLay.dvb

(= $QCOMPANY "Roughin")
(command "vbarun"
"MasterLay.dvb!modMain.Create_Layers"
"Roughin_Layers.xls"
)
)
(
(= $QCOMPANY "Layout")
(command "vbarun"
"MasterLay.dvb!modMain.Create_Layers"
"Layout_Layers.xls"
)

 

Unless you have the MasterLay.dvb file, the Lisp function will fail.  This is the file you need to have for this Lisp to run correctly.

 

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales |Exchange App Store

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 8 of 8

Balaji_Ram
Alumni
Alumni

These steps may help narrow down the issue :

 

1. run VBALOAD command and load the .dvb

2. run VBAIDE and the VBA code should appear in the VBA IDE.

3. Place breakpoints in the routine that your Lisp code is using.  use F9 to toggle breakpoints

4. Switch to AutoCAD and run "VBARUN" command

5. Select the routine that your Lisp code was invoking and click Run.

6. Break point should get hit and step through the VBA code using F8.

 

This ebook should help in getting to know the VBA IDE.

Introduction to VBA for AutoCAD - HyperPics

 

If you can please share a non-confidential sample code (VBA and Lisp) to reproduce the error message, I will look into it.

 

Regards,

Balaji



Balaji
Developer Technical Services
Autodesk Developer Network

0 Likes