Is lisp programing of Auto cad in2022 different?

Is lisp programing of Auto cad in2022 different?

Anonymous
Not applicable
1,435 Views
11 Replies
Message 1 of 12

Is lisp programing of Auto cad in2022 different?

Anonymous
Not applicable

Hi sir.

The lisp When I've used well on auto cad 2006 doesn't work on 2022 ver. 

Customer service center said that lisp programing is different on auto cad 2021,2022. But I don't know how to correct it. 

Does it have any problem?

Please check out below and correct on new version.🤧

 

(defun c:vv()
(command "ucs" "w" "osnap""end,ins,cen,nod,int")
)

 

0 Likes
1,436 Views
11 Replies
Replies (11)
Message 2 of 12

pendean
Community Legend
Community Legend
Your posted LISP works just fine in R2022.1 here as is: what issue are you having exactly? Explain the problem in a lot of details. "doesn't work" does not tell us much.

0 Likes
Message 3 of 12

Anonymous
Not applicable

As the word itself.

I have 2 elaborate cases. (Basically it starts in all osnap off)

1. On autocad 2022, I input command "osnap" -> "end,ins,cen,nod,int" . Then the commands work so the 5 osnaps turn on.

 

2. I input the "vv" lisp, it doesn't work. No change and still all osnap off.

 

What's the difference of two cases? 

I don't know what the lisp's problem is ...

0 Likes
Message 4 of 12

pendean
Community Legend
Community Legend
How are you loading your lisp VV exactly? Like I wrote earlier, it works just fine here in R2022.1, when I type VV the UCS is set to WORLD and your desired osnaps are set as active.
Or are you loading the VV lisp?
0 Likes
Message 5 of 12

hak_vz
Advisor
Advisor

@Anonymous 

Your code works well and there should be no problem to use in any ACAD version. It sets world UCS and turns on specified osnap modes.

There have been some changes in newer versions regarding support of Unicode font definitions (UTF) in some lisp commands, where older versions  only worked with ASCII codes. Visual Studio Code with extension for autolisp (visual lisp) is added as a new IDE parallel to Visual Lisp Editor.

Those changes don't affect execution of code you've attached.

As @pendean  stated in his post. Check that your code is loaded. Put direct folder where lisp file is stored to list of trusted locations, and / or add to startup suite to be loaded with every new open file.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 6 of 12

Anonymous
Not applicable

When I type "vv", it commands "vv nil"

 

Also in some files, "vv" works and in others it doesn't.

 

Is it related to interfere between lisps?

 

0 Likes
Message 7 of 12

pendean
Community Legend
Community Legend
How are you loading VV.LSP exactly? You skirt around the question a lot, are you just unsure?
it would appear it is not loading "sometimes" for some reason we cannot see, so we need to understand how exactly it is loaded.
Anyone else in your office have more experience with loading LISPs that can help?

0 Likes
Message 8 of 12

hak_vz
Advisor
Advisor

Copy command definition to system console and hit <enter>

(defun c:vv()(command "_.ucs" "w" "_.osnap" "end,ins,cen,nod,int") (princ))

Type vv and run it. Does it work?

Open new drawing and type vv. If it doesn't work your lisp file is not loaded. As stated before, add that directory to list of trusted location, and add to startup suite (manus tools->load application->startup suite < Add>  select vv.lsp file or however is named)

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 9 of 12

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

When I type "vv", it commands "vv nil"

....


That is appropriate, assuming you have CMDECHO set to 0 so you don't see the commands go by at the prompt line.  The (command) function always returns nil.  But in that case it should be having the effect you want.

 

When it doesn't work, and if you have CMDECHO set to 1, do you get this?

 

Command: vv
Unknown command "VV". Press F1 for help.

 

That would indicate that it hasn't loaded [see others' messages].

Kent Cooper, AIA
0 Likes
Message 10 of 12

Anonymous
Not applicable

Thank you all. @Kent1Cooper @hak_vz @pendean  I use the ways that you guys tell me but still it doesn't work.

 

How I use the lisp

1. open my drawing file. (Asumming osnaps on)

2. use some lisps(ex. import bolts or dowel pins...)

3. suddenly osnaps turn off. (I guess it's the interfere about lisps.. maybe? IDK)

4. So I type "vv"

5. but still osnaps off. The ment is "vv nil" (only in some files, the "vv" works)

 

Or.. is it about the problem of my drawing file? 

Please check it. I attach my file !

0 Likes
Message 11 of 12

pendean
Community Legend
Community Legend

Why is your DWG file R2004 format?

 

Your LISP works just fine in your file, in my files, in any file I test. Over and over again.

 

But we don't have your setup, so somewhere between your #2 and #3 you have something else going on

pendean_0-1627303537508.png

 

R2022 found 14 errors in your DWG file here and a lot of unused removable content, see attached.

 

0 Likes
Message 12 of 12

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

....

2. use some lisps (ex. import bolts or dowel pins...)

3. suddenly osnaps turn off. (I guess it's the interfere about lisps.. maybe? IDK)

....


That would strongly suggest that something in one [or more] of those "some lisps" is turning Osnap off to do whatever it does, but not turning it back on.

Kent Cooper, AIA
0 Likes