🔊 - Whats your thoughts on AutoLISP in AutoCAD LT 2024?

🔊 - Whats your thoughts on AutoLISP in AutoCAD LT 2024?

handjonathan
Autodesk Autodesk
44,958 Views
146 Replies
Message 1 of 147

🔊 - Whats your thoughts on AutoLISP in AutoCAD LT 2024?

handjonathan
Autodesk
Autodesk

Hello, AutoCAD community,

 

The AutoCAD team wants to hear your impressions of AutoLISP, specifically around its availability in the 2024 release of AutoCAD LT.

 

Which routines are you most excited to use? Let us know in the comments below!



Jonathan Hand


Technical Marketing Manager | Construction

0 Likes
44,959 Views
146 Replies
Replies (146)
Message 101 of 147

HE-MJJ
Advocate
Advocate

Looking for replacement of Dos_Serial. This worked for me under AutoCAD full but not under LT. Any other suggestions?

 

; (dos-serialno "C:") (dos-serialno "H:")
(defun dos-serialno ( hdd / wmi srv drv ser did vsn prp)
(vl-catch-all-apply
(function
(lambda ( )
(if
(setq wmi (vlax-create-object "WbemScripting.SWbemLocator")
srv (vlax-invoke wmi 'connectserver nil nil nil nil nil nil nil nil)
drv (vlax-invoke srv 'execquery "Select VolumeSerialNumber from Win32_LogicalDisk")
)
(vlax-for item drv
(vlax-for prop (vlax-get item 'Properties_)
(setq prp (strcase (vlax-get prop 'name)))
(cond
( (eq "DEVICEID" prp) (setq did (vlax-get prop 'value)) )
( (eq "VOLUMESERIALNUMBER" prp) (setq vsn (vlax-get prop 'value)) )
)
); (print prp) (princ " ") (prin1 did) (princ " ") (prin1 vsn)
(and did vsn (setq ser (cons (cons did vsn) ser)))
)
)
)
)
)
(foreach obj (list drv srv wmi) (and obj (vlax-release-object obj)))
(cdr (assoc hdd ser))
)

0 Likes
Message 102 of 147

Sea-Haven
Mentor
Mentor

Maybe this will help a couple of different ways.

(setq ser (vla-get-Serialnumber (vlax-invoke (vlax-create-object "Scripting.FileSystemObject") 'getdrive "c:")))


; drive type 1 is a usb 2 hard disk
(defun UsbDriveSerialNumber ( / fso dr)
  (setq fso (vlax-create-object "Scripting.FileSystemObject"))
  (vlax-for d (vlax-get fso 'Drives)
    (if
	  (= (Vlax-get  d 'DriveType) 2)
      (setq dr (cons (list (vla-get-path d) (vla-get-SerialNumber d)) dr)
      )
    )
  )
  (vlax-release-object fso)
  (reverse dr)
)
(UsbDriveSerialNumber)


(vlax-for d (vlax-get fso 'Drives)
	  (princ (Vlax-get  d 'DriveType) )
)

M

 

0 Likes
Message 103 of 147

HE-MJJ
Advocate
Advocate

Thanks for you're reply.

 

I tried that, but is gives me a different value instead of the actual serial number of my HDD.

-1170006533 instead of "Volume Serial Number is BA43-1DFB" which is shown with the Dir command.

Where does this value come from? Is it derived from BA43-1DFB?

Maybe I can use that anyway as a unique value for my local HDD, and the HDD's  and on the Server?

Also: (UsbDriveSerialNumber) doesn't return serials of the HDD's in the server.

0 Likes
Message 104 of 147

Sea-Haven
Mentor
Mentor

Mine returned similar a number, for C D E.

 

If you have multiple lisp files write a little check serial lisp, from CMD you can copy 2 files into 1 new one so can add the check serial to say start of every program, then compile to fas etc. I use (exit) which does just that exits a lisp program an internal function.

 

Copy check.lsp+lispprog1.lsp c:\compile\lispprog1.lsp

Copy check.lsp+lispprog2.lsp c:\compile\lispprog2.lsp

just write a simple bat file with all the file names.

0 Likes
Message 105 of 147

HE-MJJ
Advocate
Advocate

I don't see how this helps me.

0 Likes
Message 106 of 147

Sea-Haven
Mentor
Mentor

One suite of programs has 100 lisps each has a single or multiple function/task so to put the serial check into each lsp before convert to a fas would take forever, it is done in a few seconds using the copy 2 files into 1. Could also be added to the lisp for making Fas files.

 

Re protection, any number that is fixed is useful, you can also get say network card IP address. I have it somewhere just google. You can get Usernames as per say PC login. If your in a controlled enviroment the user name is removed from access when they leave. (getenv "username") What does (getvar '_pkser) return, its the cad serial number.

0 Likes
Message 107 of 147

HE-MJJ
Advocate
Advocate

Command: (getvar '_pkser) returns "xxx-xxxxxxxx" I have now disabled the two routines with dos_serialno in it under AutoCAD LT. So I'm going skip this one for now. Thanks.

0 Likes
Message 108 of 147

HE-MJJ
Advocate
Advocate

I'm now looking to replace (dos_filedate "H:\\0000\\0000\\Tekeningen\\BT\\0000_BT-TI-001.dwg") which for example returns (("0000_BT-TI-001.dwg" . 2.01903e+07))

0 Likes
Message 109 of 147

Sea-Haven
Mentor
Mentor

Not sure if this helps (VL-FILE-SYSTIME filename)

Message 110 of 147

HE-MJJ
Advocate
Advocate

_$ (VL-FILE-SYSTIME fnm) results in (2019 3 3 13 11 11 49 0)


_$ (dos_filedate fnm) results in (("0000_BT-TI-001.dwg" . 2.01903e+07))

dos_filedate returns a list containing filenames and AutoCAD calendar dates.

 

It would be nice if there would be some code that gives me the same result.


_$

0 Likes
Message 111 of 147

Sea-Haven
Mentor
Mentor

Just join the two in a strcat. gwgname ?

Message 112 of 147

JamesMaeding
Advisor
Advisor

This thread is hilarious.

OP wanted to know what we thought of lisp in LT and it degraded to details of various lisp functions.

I don't think it was a good idea.

A better idea would be to give LT customers a year of full acad license so they could get addicted to using what is out there without all the special cases of lisp in LT.

The fact is, the autolisp API is intermingled with .net now and always was with ARX so its not really giving them full lisp.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Message 113 of 147

JamesMaeding
Advisor
Advisor

@Sea-Haven 

You need to re-read:

"I can say the VLIDE for acad is much different than the lisp IDE for bcad. I do large projects in list with 50 or so code files and the bcad IDE does not handle that well. It loads them slow because it analyzes them.

I need to revisit that but currently debug with acad VLIDE."

 

We are talking the IDE in acad vs bcad, not regular day to day use.

Those 50 lisps get compiled to one .vlx or .des depending on acad/bcad.

When debugging though, you load the uncompiled lisps and set break points and so on, and bcad is real slow at loading those as it does tons more than the VLIDE does.

Let me know if you want info on the VLIDE compiling to vlx, its super slick IMO.

I just recalled LT does not have the VLIDE, that is a shame. They offer a taste of the drug so why not go for full addiction?


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Message 114 of 147

Sea-Haven
Mentor
Mentor

Been using Autocad since V1.4 thats like 1980's having spent 40 years writing lisp I use Vlide and Blade like once every 3 months I really have to get stuck before using either to find the bug. I admit used today to just find any missing local variable names as got out to about 40. Used word then excel and sort column then paste back into lisp now a nice alphabet list of local variables.

 

Last time I looked 3500+ lisps. Latest client 34 lsp. Another is like 130 for drawing houses. 

 

"A better idea would be to give LT customers" Its called Bricscad !!

0 Likes
Message 115 of 147

JamesMaeding
Advisor
Advisor

@Sea-Haven 

Cool, so you know the various ways to load lisps and so on.

I am still amazed at people  using LT rather than bcad, as bcad has advantages over acad in some areas to boot.

Every company should have 1 network seat of bcad IMO, as plan B when drawings go corrupt or you are dealing with point clouds or dgn's.

 

I wanted to mention these days my typical menu entry or key-in assignments will load the lisp every time, like:

(DEFUN C:XIL () (PRINC "\nIsolate Xref Layers")(LOAD "IsolateXrefs.lsp")(c:IsolateXrefs)(princ))

Seems crazy, but its so fast there is essentially no delay.

I could do:

(DEFUN C:XIL () (PRINC "\nIsolate Xref Layers")(IF (NOT c:IsolateXrefs)(LOAD "IsolateXrefs.lsp"))(c:IsolateXrefs)(princ))

but reloading each time deals with some old junky lisps that have common function names with other lisps that I have not cleaned up. Really, I just like the shorter code statement.

 

I could  use autoload but never startup suite.

Ver 1.4 must have been fun. I started on 10 for DOS in college. We had tablets and the pen with pushy end tip for picking. I loved it. I know now its all about unloading the mouse hand from commands, typing is way less stress on tendons, faster too. RIBBONCLOSE is still my favorite command, lol.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Message 116 of 147

Sea-Haven
Mentor
Mentor

If you want Acad <--> Excel then LT is no good as does not support "application", who knows why Autodesk left that out, Bricscad supports it. I dont read csv any more read Excel direct.

0 Likes
Message 117 of 147

gstein
Participant
Participant

I will take half a lisp in LT over what I had to do with Script files to make my drafting faster in LT before. Now I can make decisions in code instead of just running a keyboard Script file.

0 Likes
Message 118 of 147

JamesMaeding
Advisor
Advisor

@gstein 

May I ask, why are you using LT instead of full acad or bcad?

Is that forced on you by company or your own decision?

I get that software is very expensive for people that don't bill $150/hr fulll time.

thx


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Message 119 of 147

gstein
Participant
Participant

I am a one-man drafting service, my own company. I needed 2D drafting and AutoCAD compatibility so I chose LT. My clients are usually contractors or subcontractors. I actually own a seat of Progecad but it had some trouble matching AutoCAD's dims and mtext entities. I trade the .DWG files back and forth between my clients so I needed something that would not break their drawings.

0 Likes
Message 120 of 147

JamesMaeding
Advisor
Advisor

@gstein 

Got it. I can say Bricscad Pro has the compatibility and full lisp/other support for same price as LT.

There is a learning curve to Bcad, but mainly the options dialog, and maybe its layer/xref dialogs that are more powerful but a bit less clean IMO.

If you ever want to get going on it, I have helped several small firms get adapted and typically add in my free tools (purgeids) so they can keep their drawings clean. This is all free help, not advertising for services.

There is a lower bcad version, too that is like LT but cheaper, and its dwg compatibility is top notch.

Thx for answering my question.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties