Length.lsp

Length.lsp

Anonymous
Not applicable
3,773 Views
7 Replies
Message 1 of 8

Length.lsp

Anonymous
Not applicable

For years, my company has been using a lisp app to add dimensions to Plines, in a way that automatically adjusts for take-outs of threaded pipe. We've had a ton of issues over the years keeping it working consistently, but generally the desired outcome is to type "len" into the command line, and it starts up the length.lsp command. This generally involves change the shortcut for lengthen to "long" so the two commands don't trip up over each other.

 

Yesterday, I installed the newest version of AUtoCAD MEP 2021 to a brand new laptop. I have installed the lsp file into the support directory, but all pathways that I've taken previously to get the .lsp file to run have been unsuccessful.

 

I've used the Vlide command to load the app and test, and I can't get it to work there either. Normally I've have to create an acaddoc.lsp file to auto load the length.lsp, and I generally will set ACADLSPASDOC to 1 so that it looks for and loads that lisp. I think I've gathered that Autodesk changed how this works, and it now creates a ACAD2021DOC.lsp file in the language folder, but even if I add the load commands to that document, when I type "len" in the command line, it comes back as an UNKNOWN command. 

 

I've attached the .lsp file I'm trying to use. Could someone help me get this to load in the current version of ACAD? It is a huge time savor for us, so whatever steps I need to make this happen would be acceptable.

 

Thanks

0 Likes
3,774 Views
7 Replies
Replies (7)
Message 2 of 8

JoeVernice
Advocate
Advocate

@Anonymous,

 

The attached file has a reference to a missing sub-routine (unit), is trying to load another file (load "round") and has no function which can be called from the command line (defun c:len...). Basically, additional files need to be loaded for this command to work.

 

JMV

Message 3 of 8

Anonymous
Not applicable

I found and moved over the ROUND.lsp file to the new laptop. I tried to look in it for any other app hooks, and it appears to be in Chinese. The forums will not let me post that file because "content type (application/octet-stream) does not match its file extension and has been removed."

 

I'm unfamiliar with sub-routines, so I'm unsure how to look for reference.

 

There is a defun command in the length.lsp file, but its referring to a roundit function, which I can't find:

(defun f_roundit (len) (* (fix (+ (/ len 0.5) 0.49)) 0.5))

 

Do you have any recommendations on what I can do to try and fix this? I still have the old computers, so I can find any of the files referenced, I just need to know what files I'm looking for. My suspicion is that a lot of these .lsp files were included in AutoCAD in previous versions, but might have been removed in the newer installs. 

 

 

0 Likes
Message 4 of 8

ВeekeeCZ
Consultant
Consultant

Since sub-routines are defined by: 

(defun name () ...

 

you need to find a file that will contain these words next to each other:

defun unit

defun f_setlyr

defun diground

 

Also, how did you run it on your old pc?

0 Likes
Message 5 of 8

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

....

There is a defun command in the length.lsp file, but its referring to a roundit function, which I can't find:

(defun f_roundit (len) (* (fix (+ (/ len 0.5) 0.49)) 0.5))

 

.... I still have the old computers, so I can find any of the files referenced, I just need to know what files I'm looking for. .... 


That (defun) isn't referring to a roundit function, but defining one, and it's self-contained -- you don't need to look for any separate file about that.  But you do need to find a file called "round.lsp" or maybe "round.fas" that the (load) function is looking for.  That should be easy to find, by its file name.

 

And you need to find some file that contains somewhere within it

  (defun c:len

[in some case combination], which is what defines the LEN command name.  [I assume that's not the "round.xxx" file, but you never know....]  That can be harder, depending on how many possible files there are.  You could open each .lsp file in Notepad and use Ctrl+F to look for C:LEN.  Or you could copy all such files to some separate folder, change the filetype endings on all the copies to .txt, and then in Windows Explorer you can Search for something containing C:LEN [its Search function can "see inside" .txt files, but not .lsp files].

 

Kent Cooper, AIA
0 Likes
Message 6 of 8

ronjonp
Advisor
Advisor

@Kent1Cooper 

You can also set your windows indexing to 'Plain Text Filter' for *.lsp files. Then search will look within 🍺

image.png

0 Likes
Message 7 of 8

john.uhden
Mentor
Mentor

@Kent1Cooper

That's a great tip (of which I wasn't aware), but I prefer to use ZTree where you can set a file spec and search multiple drives for any string of text you want.  And then you can pick one and view the contents without opening the file and just hit the spacebar to consecutively highlight each occurrence.  Plus you can Gather lines of text to the clipboard or simply hit "O" to open it with whatever app is associated with the file extension (in my case TextPad of course for .LSP files).

John F. Uhden

0 Likes
Message 8 of 8

Sea-Haven
Mentor
Mentor

I dont have Mep but I have always kept my lisp load away from acaddoc etc I just use Appload and add the program I want loaded to the Startup Suite. Same Bricscad. The lisp loaded has multiple functions so only load like 3 programs.

 

 

0 Likes