Simple Autolips but I consistently get an error.

Simple Autolips but I consistently get an error.

SnickerinTurtles
Enthusiast Enthusiast
2,006 Views
21 Replies
Message 1 of 22

Simple Autolips but I consistently get an error.

SnickerinTurtles
Enthusiast
Enthusiast

Hi all, 

 

I wanted a simple AutoLisp command that will Delete reg apps, purge, and then audit at the end. 

Maybe call it CUD (Clean Up Drawing). Which seems simple enough. However, when I run my lisp it works fine, but when I go to open a new dwg or another dwg file I get this error.

Capture1.JPG

Or this exact message but the "c:bb" will be replaced with something else.

This will continue as long as I have the CUD.lsp function loaded. I noticed anytime I do not have CUD.lisp loaded I never get the error when open new or other dwgs. 

 

Here is the code for CUD (Clean Up Drawing)

 

(defun CUD()

(command "-pu" "r" "*" "n") ;deletes reg apps

(command "-pu" "a" "*" "n") ;purges drawing

(command "audit" "y") ;audits drawing

(princ)

)

 

Did I miss something here?

0 Likes
2,007 Views
21 Replies
Replies (21)
Message 2 of 22

martti.halminen
Collaborator
Collaborator

Keep VLIDE open and run your program to the error. When it asks Enter break loop?, answer yes, then see the call stack in VLIDE.

 

This looks like your environment has the symbol CUD in some other use, so loading CUD.lisp overwrites that causing some other program to misbehave.

0 Likes
Message 3 of 22

SnickerinTurtles
Enthusiast
Enthusiast

If I did what you asked me correctly it says CUD=nil, once I hit yes

Capture.JPG

0 Likes
Message 4 of 22

SnickerinTurtles
Enthusiast
Enthusiast

I also tried renaming the function DPA, TEST1, and others. It still gave me the same result. 

 

0 Likes
Message 5 of 22

Sea-Haven
Mentor
Mentor

It looks as suggested that your loading 2 programs at startup and they are conflicting, you will have to look at each one and find the C:BB as a start. Remove all of them and load 1 at a time till crash.

0 Likes
Message 6 of 22

martti.halminen
Collaborator
Collaborator

So, when you are in the debugger in VLIDE (showing the _1_$ prompt), what do you get with View>Trace stack ?

 

-- 

0 Likes
Message 7 of 22

SnickerinTurtles
Enthusiast
Enthusiast

Hopefully I got the info needed. Thanks again for your help.

SnickerinTurtles_0-1620401548566.png

 

0 Likes
Message 8 of 22

ronjonp
Mentor
Mentor

If you want to make this a command you need to add C: like so:
(defun CUD() to (defun C:CUD()

0 Likes
Message 9 of 22

SnickerinTurtles
Enthusiast
Enthusiast

Opps.. My mistake I believe this is what you were looking for.

SnickerinTurtles_0-1620406537054.png

 

0 Likes
Message 10 of 22

SnickerinTurtles
Enthusiast
Enthusiast

Thank you for that correction. 

0 Likes
Message 11 of 22

SnickerinTurtles
Enthusiast
Enthusiast

Here is that screenshot. I also inspected the C:bb symbol

SnickerinTurtles_0-1620406718225.png

 

0 Likes
Message 12 of 22

ronjonp
Mentor
Mentor

So what does your 'bb' code look like ?

 

0 Likes
Message 13 of 22

SnickerinTurtles
Enthusiast
Enthusiast

I have no clue. I did not create any code for that and I am not sure where it comes from. Is it part of AutoCAD itself? 

0 Likes
Message 14 of 22

SnickerinTurtles
Enthusiast
Enthusiast
Actually, I think I may have found it. It isn't anything I wrote. I just found this line of code and not sure what it does.

(defun c:bb () ^c^c(setvar "blipmode" 1) (prompt "\nBlipmode is set to ON - Rest Sys. Var. to turn back OFF ") (princ))
0 Likes
Message 15 of 22

ronjonp
Mentor
Mentor

The ' ^c^c' should not be in that code, but I don't think that's what causing your error. Maybe open the VLIDE and set break on error to trace errors:

ronjonp_0-1620419858059.png

 

 

0 Likes
Message 16 of 22

SnickerinTurtles
Enthusiast
Enthusiast

So correct me if I am wrong so far this is what I understand. We 2 separate functions unrelated to one another. Functions CUD and BB. Separately, they work fine but when combined CAD freaks out.  

 

This is my CUD function. (I wrote)

(defun C:CUD()

(command "-pu" "r" "*" "n") ;deletes reg apps

(command "-pu" "a" "*" "n") ;purges drawing

(command "audit" "y") ;audits drawing

(princ)

)

 

And then there is this separate function "BB" (something that has been loading into CAD since before I showed up)
(defun c:bb () ^c^c(setvar "blipmode" 1) (prompt "\nBlipmode is set to ON - Rest Sys. Var. to turn back OFF ") (princ))

 

Now, I do not know what this function "BB" is for, but it has been loading in our AutoCAD for a while and hasn't been an issue.  I can open new drawings and old drawings with no pop-ups asking if we want to break the loop.

However when I load the CUD.lsp then C:BB break loop pops-up. From what I understand these aren't related, yet they somehow don't like each other? Is this right so far?

0 Likes
Message 17 of 22

SnickerinTurtles
Enthusiast
Enthusiast

So I removed the '^c^c' stuff from the BB function. Well now this is interesting my CUD command freaks out. Here is a screen shot. Apparently -PU is not a known command??????

 

SnickerinTurtles_0-1620426775930.png

 

 

0 Likes
Message 18 of 22

SnickerinTurtles
Enthusiast
Enthusiast

so added back the "^c^c" to BB function. and instead of "-pu" i put "-purge" and now the function works like it did before and I also no longer get the C:BB error or any other error for that matter.

 

Can anyone explain what happened?

0 Likes
Message 19 of 22

ronjonp
Mentor
Mentor

@SnickerinTurtles wrote:

so added back the "^c^c" to BB function. and instead of "-pu" i put "-purge" and now the function works like it did before and I also no longer get the C:BB error or any other error for that matter.

 

Can anyone explain what happened?


You have some strangeness going on .. I cannot explain it 🙂 Try removing the ^c^c from the bb lisp again and see what happens.

0 Likes
Message 20 of 22

SnickerinTurtles
Enthusiast
Enthusiast
So I tried that out and everything worked out again. So I hope that helps in explaining what happened, but I do not understand why -pu and -purge would make a difference?
0 Likes