All Activity
- Past hour
-
Add several lisp files to the startup at once
Nikon replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Is it possible to use lisp to get a list of lisp files? (in the form of a text file, put the file on the desktop),which are in the startup. -
Add several lisp files to the startup at once
GLAVCVS replied to Nikon's topic in AutoLISP, Visual LISP & DCL
@BIGAL's option is a very good one. Regarding your question about writing the LISPs to load to a file, the code can be easily adapted to that. But I think it would take the same amount of time as writing it to a file: - Option 1: Write the names of the LISPs to load to a file: find the file name in the folder, write the file name, and then correct 5% of the names (statistically, I think you'd write 5% of the names with some kind of error. That will waste your time later trying to figure out what's wrong and correcting the file). ESTIMATED AVERAGE TIME (my own) FOR ALL THIS: 15 seconds per file - Option 2: Select each file to copy in Windows Explorer, Control+C, find the destination folder, Control+V, and then Windows should take about 5 seconds to complete this task. ESTIMATED TIME (my estimate) FOR ALL OF THIS: LESS THAN 10 SECONDS PER FILE. Based on this, for me, the choice is clear. But if you're sure you prefer the file option, then just open (or create, if you don't have one) the "acad. lsp" file and write a line like this for each file you want to load: (load "filename.lsp") PS In the latter case, you will need to include the location of your lisp files in the AutoCAD search paths list. - Today
-
Add several lisp files to the startup at once
BIGAL replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Why not use a pop menu a toolbar or a ribbon then all your lisps are available. This has 130 lisp's behind it. You can check if loaded already else load it. -
Add several lisp files to the startup at once
Nikon replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Do I understand correctly? The LoadFolder code opens a folder selection dialog, searches for all lisp files in the selected folder, and automatically downloads all lisp files (*.lsp) from this folder. That is, should I sort the lisp files for autoloading into a separate folder? With more than 300 files, sorting will take a long time... Therefore, I decided that it would be easier to have a list of lisp files in notepad and upload this list. Is it possible to implement this in code? -
Add several lisp files to the startup at once
Nikon replied to Nikon's topic in AutoLISP, Visual LISP & DCL
I'll explain what it's for. I had to transfer all the lisp files to a new computer, a little later, I reinstalled the Autocad version, each time I added the files to the startup one at a time, since they are used in acad.pgp. I load the rest of the lisp files using strings like: (_autoload "ObjectBreakV1-0")(c:brk) (_autoload "ObjectBreakV1-0")(c:brko) (_autoload "unformat_LM")(c:unformat_LM) .................................. The list of files (_autoload... located in the .dwg template Therefore, there was a question about uploading files as a list. -
issammesk started following field text
-
dear all i have text as PROPOSED & EXISTING WATER CROSSING AT CH 81+137.23 & CH 21+152.45 and i want to take part of Thes text as name of title CH 81+137.23 & CH 21 i think as field but i can't doit can you help me
-
Hi @PGia I'm not sure I understand your example drawing correctly. But... isn't it possible that it's incorrect on the second floor?
-
How did you achived that? Can you explain how to add sign /
-
bjxing started following Lee Mac
-
bjxing joined the community
-
Aniruddha Raste changed their profile photo
-
aishaalsamt joined the community
-
MAK Soeunchanpanha joined the community
-
Add several lisp files to the startup at once
ronjonp replied to Nikon's topic in AutoLISP, Visual LISP & DCL
@Nikon You should try what I posted. It will LOAD not AUTOLOAD all lisp files found within the folder "C:\\Program Files\\Autodesk\\AutoCAD 2021\\Support\\" -
Add several lisp files to the startup at once
GLAVCVS replied to Nikon's topic in AutoLISP, Visual LISP & DCL
PS The idea has more substance than the code itself -
Add several lisp files to the startup at once
GLAVCVS replied to Nikon's topic in AutoLISP, Visual LISP & DCL
A code as simple as this... (defun c:LoadFolder (/ sh hwd carp slf pth lstAA a) (if (setq sh (vla-getinterfaceobject (vlax-get-acad-object) "shell.application") hwd (vl-catch-all-apply 'vla-get-hwnd (list (vlax-get-acad-object))) carp (vlax-invoke-method sh 'browseforfolder (if (vl-catch-all-error-p hwd) 0 hwd) "Folder lisp to load" 0 "") ) (if (setq slf (vlax-get-property carp 'self) pth (vlax-get-property slf 'path) pth (vl-string-right-trim "\\" (vl-string-translate "/" "\\" pth)) ) (if (setq lstAA (vl-directory-files pth "*.lsp")) (foreach a lstAA (load (strcat pth "\\" a)) ) (alert "Nothing to load") ) ) ) (princ) ) -
Add several lisp files to the startup at once
GLAVCVS replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Yes I think you should learn these simple things. In any case, in situations like this, one way to avoid having to select the 50 lisp files one by one or, in the future, any group of files you need to load, is to create folders where you group and store the lisps needed for each task. For example: you can create a folder called "Print", in which you store all your lisp files that you use to prepare a drawing for printing. In this way, you would only need to create a command (for example "LoadFolder") that shows you a "dialogBox" to select the folder and load all its contents. - Yesterday
-
To avoid confusion: I've separated each resulting perimeter from the model drawing to show it in this example. In reality, each perimeter logically overlaps the others.
-
Add several lisp files to the startup at once
BIGAL replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Agree with Lee look into lisp built in functions, if you use Autoload function then its easy just need to add one lisp to the Start Up Suite. An example of the lsp file. (autoload "COPY0" '("COPY0")) (autoload "COPYCOMMAND" '("ZZZ")) (autoload "COVER" '("COVER")) (autoload "DIMFLIP" '("DIMFLIP")) (autoload "DRAWXFALL" '("DRAWXFALL")) (autoload "DRAWPIPE" '("DRAWPIPE")) ..... add more -
Efficient way to isolate duplicates on a large list
BIGAL replied to jbreard's topic in AutoLISP, Visual LISP & DCL
I asked a similar question for a task. It groups common items not sure if it is useful as no data to test on. ; Thanks to Dexus for groupby sep 2025 (defun _groupBy (fun lst0 / itm old rtn) (while lst0 (setq itm (fun (car lst0)) rtn (if (setq old (assoc itm rtn)) (subst (cons itm (cons (car lst0) (cdr old))) old rtn) (cons (cons itm (list (car lst0))) rtn) ) lst0 (cdr lst0) ) ) (mapcar 'cdr rtn) ) (setq lst (vl-sort lst '(lambda (x y) (< (car x)(car y))))) (setq lst2 (_groupBy (lambda (e) (car e)) lst)) -
Hi. A simple example. The main label is always a Roman numeral followed by a : or + to indicate, respectively, a floor plan with a particular feature or a number of volumes with another additional element above it. There are many more possible combinations, but I'll stick with a simple example. ctePns.dwg
-
Lee Mac started following Add several lisp files to the startup at once
-
Add several lisp files to the startup at once
Lee Mac replied to Nikon's topic in AutoLISP, Visual LISP & DCL
I think it's time you started to learn AutoLISP @Nikon -
LeoManu joined the community
-
Amcbayy joined the community
-
Add several lisp files to the startup at once
Nikon replied to Nikon's topic in AutoLISP, Visual LISP & DCL
I need to add 50 lisp programs to autoload... I want to be able to upload lisp files not one, but in a list. -
ronjonp started following Add several lisp files to the startup at once
-
Add several lisp files to the startup at once
ronjonp replied to Nikon's topic in AutoLISP, Visual LISP & DCL
That is because that is an AI generated function that does not exist. Rather than add them to the startup suite, just load them all using one lisp file: (defun loadlisp (path / lst pth) (if (and (setq pth (strcat (vl-string-right-trim "\\" path) "\\")) (setq lst (vl-directory-files pth "*.lsp" 1)) ) (foreach x (mapcar 'vl-filename-base lst) (vl-catch-all-apply 'load (list (strcat pth x)))) ) (princ) ) (loadlisp "C:\\Program Files\\Autodesk\\AutoCAD 2021\\Support\\") Easy to inspect in the vlide: -
Good day everyone! I want to add several lisp files to the startup at once. I have a list of lisp files in notepad, in the Support folder. The code returns an error: no function definition: VLA-GET-STARTUPSUITE (defun c:add-list-lisps-to-startup ( / file line folder fullpath app ssuite ) (vl-load-com) ;; The folder where the LISP files are located (setq folder "C:/Program Files/Autodesk/AutoCAD 2021/Support/") ;; Opening the list file (setq file (open "C:/Program Files/Autodesk/AutoCAD 2021/Support/list_startup.txt" "r")) (if file (progn ;; Getting the object Application (setq app (vlax-get-acad-object)) (setq ssuite (vla-get-StartupSuite app)) (while (setq line (read-line file)) (setq line (vl-string-trim " \t\r " line)) (if (and line (> (strlen line) 0)) (progn (setq fullpath (strcat folder line)) (if (findfile fullpath) (progn (vla-Add ssuite fullpath) (princ (strcat "Added to auto-upload: " fullpath)) ) (princ (strcat "File not found: " fullpath)) ) ) ) ) ; end while (close file) (princ "All files from the list have been processed.") ) ; end progn (princ "Couldn't open the list file.") ) ; end if (princ) ) ; end defun
-
Efficient way to isolate duplicates on a large list
Lee Mac replied to jbreard's topic in AutoLISP, Visual LISP & DCL
Here's another example - for the below function, "unq" will contain the items with unique MAT value, and "dup" will contain those for which there is more than one MAT value: (defun foo ( lst / dup key len unq ) (while (setq itm (car lst)) (setq key (car itm) len (length dup) lst (vl-remove-if (function (lambda ( x ) (if (= key (car x)) (setq dup (cons x dup))))) (cdr lst)) ) (if (< len (length dup)) (setq dup (cons itm dup)) (setq unq (cons itm unq)) ) ) (list unq dup) ) Though it's probably more efficient to use the lists directly in your code rather than the above function returning a list of lists - alternatively, output parameters may be used, e.g.: (defun foo ( lst unq-out dup-out / dup key len unq ) (while (setq itm (car lst)) (setq key (car itm) len (length dup) lst (vl-remove-if (function (lambda ( x ) (if (= key (car x)) (setq dup (cons x dup))))) (cdr lst)) ) (if (< len (length dup)) (setq dup (cons itm dup)) (setq unq (cons itm unq)) ) ) (set unq-out unq) (set dup-out dup) nil ) _$ (foo '(("abc" 1) ("def" 2) ("abc" 3) ("xyz" 4) ("abc" 5)) 'unq-sym 'dup-sym) nil _$ unq-sym (("xyz" 4) ("def" 2)) _$ dup-sym (("abc" 1) ("abc" 5) ("abc" 3)) Note that the element order is not preserved with the above. -
Lee Mac started following Efficient way to isolate duplicates on a large list
-
Efficient way to isolate duplicates on a large list
Lee Mac replied to jbreard's topic in AutoLISP, Visual LISP & DCL
I'm unsure if you're looking to group the items by the MAT value or something else (sample data and the expected result would help in this regard), but I might suggest manipulating the data into groups using the MAT value as the key, i.e. (defun foo ( lst / ass rtn ) (foreach itm lst (if (setq ass (assoc (car itm) rtn)) (setq rtn (subst (vl-list* (car ass) itm (cdr ass)) ass rtn)) (setq rtn (cons (list (car itm) itm) rtn)) ) ) ) -
pkenewell started following Efficient way to isolate duplicates on a large list
-
Efficient way to isolate duplicates on a large list
pkenewell replied to jbreard's topic in AutoLISP, Visual LISP & DCL
Try Lee Mac's "List Duplicates" functions at the following link: https://www.lee-mac.com/uniqueduplicate.html#listdupes -
jbreard started following Efficient way to isolate duplicates on a large list
-
Efficient way to isolate duplicates on a large list
jbreard posted a topic in AutoLISP, Visual LISP & DCL
Hello everyone, I'm looking for a solution to efficiently extract from a given list all duplicates. I've got a solution that works in theory but that is ineficient in practice due to the length of the list I want to analyse (approximately 25 000 elements). The list I'm working with is a list of lists. All individual lists decribe a Covadis bloc (topography software) with the format (MAT, ALT, ALTI, (X, Y, Z), ename of the bloc). MAT, ALT and ALTI are attributes value of the bloc and (X, Y, Z) is the insert coordinates. I want to isolate all the blocs that have the same MAT attribute and save them on a separate list. I have come with the solution described in the code below but it's much to slow and absolutely not opimised. ; lst = general list with bloc caracteristics ; sublst format (MAT, ALT, ALTI, (X, Y, Z), ename) (while (setq sublst (car lst)) (setq lst_same_mat (vl-remove nil (mapcar '(lambda(p) (if (equal (car p) (car sublst)) p nil)) lst))) (setq lst_same_mat_save (cons lst_same_mat lst_same_mat_save)) (setq lst (REMOVE_LST1FROM_LST2 lst_same_mat lst_same_mat_save) ) ;;;; ;lst_gen : list we want to suppress certain element from ;lst_suppr : list of elements to be suppressed in lst_gen (defun REMOVE_LST1_FROM_LST2 (lst_suppr lst_gen / ele_suppr lst_modif n) (setq n 0) (setq lst_modif lst_gen) (while (setq ele_suppr (nth n lst_suppr)) (setq lst_modif (vl-remove ele_suppr lst_modif)) (setq n (1+ n)) ) lst_modif ) Would anyone have an idea on how to speed this up for large list ? Thanks and best regards, Jacques -
I created a parcel. I gave it a number and a name. I modified the default label to include the number, a slash, and the name. Now the parcel has a label that looks like what I believe you want. If that's not correct, please elaborate.