LISP file does not work on 2024/2025 AutoCAD LT

LISP file does not work on 2024/2025 AutoCAD LT

tpottebaum
Contributor Contributor
4,733 Views
26 Replies
Message 1 of 27

LISP file does not work on 2024/2025 AutoCAD LT

tpottebaum
Contributor
Contributor

Hello, I have been trying to develop a simple LISP code to run on AutoCAD LT 2025. I originally went to chat GPT to get a solid starting point as I haven't practiced coding in a while. Since then I have been modifying the code (I thought unsuccessfully).

 

To give some insight on the code, it's essential function is to fill a selected rectangular outline with 4'x'8 rectangles. The outline I've been using for this is a 10'x34' rectangle. In this code, it would start in the bottom left corner and use a while loop to create vertical 4x8 rectangles, then fill in the remaining length with a skinnier 8' tall rectangle (a 2'x8' in my case). The code then essentially repeated the process for the remaining area above, except with horizontal rectangles, then finally filled in the top right hand corner. 

 

The first part of the code was working great, but whenever it got to the remaining area on the right, it would place a 2'x10'. I could not for the life of me figure out why this was happening. Eventually simplified my code down to the initial while loop, and I just hardcoded a rectangle command with the exact coordinates for that rectangle's location, and still I got a 10' tall rectangle. So I sent this code to a coworkers computer (he was using AutoCAD 2024) and it worked. I then tried my initial code to fill in the entire area and that also worked perfect. 

 

I've been working with an Autodesk Directly expert and he is also stumped. I sent him my AutoCAD file and he had the same issue I had, but when he recreated it in 2024 he did not. I tried it on my end with 2024 and I still had the issue. Attached is the test code I have been running. With this code, if I make my 10'x34' rectangle in the location such that the hardcoded rectangle will get placed in the correct spot, it will generate a rectangle in the right spot, but it's 2' taller than what is hardcoded in. If I move that outline somewhere else, the hardcoded rectangle will drop in exactly how it's hardcoded. 

 

Has anyone experienced something like this?

 

*Update to this question* 

The Autodesk Directly expert used this link to the starting file I was using. This will have the rectangle I was using. If you use this link and run the code attached, you should see the same thing I have been seeing, unless you are on 2024, then it may work?

https://autode.sk/3KQw1aG

0 Likes
Accepted solutions (1)
4,734 Views
26 Replies
Replies (26)
Message 21 of 27

Kent1Cooper
Consultant
Consultant

Just for future reference:  Any command running in an AutoLisp (command) function that involves point-location specifications is subject to running Object Snap if it's on, just as if you picked those locations with the cursor when drawing manually.  It is common practice in defining routines or commands to control for that -- typically make note of the current OSMODE setting at the beginning, shut it off or change it to a specific setting for the working of the routine, and restore the original value afterwards.  But another way to avoid the problem, when it's feasible, is to use (entmake) or (entmakex) to draw things, rather than using drawing commands in (command) functions.  That approach is not subject to the effects of running Object Snap.

Kent Cooper, AIA
0 Likes
Message 22 of 27

paullimapa
Mentor
Mentor

What’s really surprising to me is OPs statement:

I've been working with an Autodesk Directly expert and he is also stumped”


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

tpottebaum
Contributor
Contributor

That's good to know. I think (entmake) or (entmakex) would be a better option then as this code will get used be a few different people.  Would be nice for them to not have to worry about turning object snaps on/off. 

0 Likes
Message 24 of 27

paullimapa
Mentor
Mentor

I think you’re missing the point. User doesn’t have to turn running osnaps off but code needs to get that done when using commands. 


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

cwisnerUABKE
Community Visitor
Community Visitor

Wait a minute - you can use LISP in Autocad LT? since when?

0 Likes
Message 26 of 27

paullimapa
Mentor
Mentor

Since 2024LT 


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

Sea-Haven
Mentor
Mentor

As mentioned LT2024+ but it is missing a few lisp functions, the LT2026 version seems to be the same missing some lisp functions, some one will confirm. If updating there is other CAD software and they support lisp, sometimes cheaper to buy, Bricscad, Intellicad, ZWCAD, Gstar and more.

0 Likes