Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/30/2025 in Posts

  1. As far as I can tell, you can't identify the file containing the LISP directly. LISP is loaded into CAD and it is used from memory rather than CAD referring to the .lsp file, you could copy and paste the LISP into the command line and it will work just the same for example, likewise load from a file and modify or delete the .lsp file, what was loaded will still run OK. If the .lsp file is saved in a known location you can search these locations and read the files till you find the LISP function you want, and from that you can return the location and file name it contains. For example the Trusted locations are known, so you can search through them. For myself I have a small file, "Location.lsp" that contains the locations for my .lsp files, manually updated one file, all the others refer to this as necessary and this file is in the start-up suit. You can get a LISP to append to this file if you want, even so far as delete the file (you know it's location) and recreating it which can be handy if you have an install LISP: have locations.lps saved in trusted locations, get the user to specify a folder to 'install' .lsp files into, and then append to locations.lsp this new location
    2 points
  2. Did you try with Auto Number function from Express Tools in Autocad? Try with this Auto Numbering Text.
    1 point
  3. I think the @GLAVCVS, @Steven P and @SLW210 gave you a good point what you need to do.
    1 point
  4. I actually use this LISP more now, needs Express Tools. ;;; Load all LISPs in selected folder ;;; ;;; By SLW210 (a.k.a. Steve Wilson) ;;; (defun c:LoadLISP ( / mylispfolder mylispfiles) (setq mylispfolder (acet-ui-pickdir)) ; Select a folder (if (and mylispfolder (vl-file-directory-p mylispfolder)) ; Check if a valid (progn (setq mylispfiles (vl-directory-files mylispfolder "*.lsp" nil)) (if mylispfiles (progn (foreach file mylispfiles (setq fullpath (strcat mylispfolder "\\" file)) ; The path (princ (strcat "\nLoading: " fullpath)) ; Print the path (load fullpath) ; Load LISP file(s) ) (princ (strcat "\nLoaded " (itoa (length mylispfiles)) " LISP files.")) ) (princ "\nNo LISP files found in the selected folder.") ) ) (princ "\nInvalid folder selected.") ) (princ) ) May not be what the OP wants.
    1 point
  5. If I understand your requirement... You could use this LISP and load it with acaddoc.lsp or your preferred method. Just put the relevant path to the folder with the LISPs to be loaded. ;;; Load all LISPs in folder ;;; ;;; By SLW210 (a.k.a. Steve Wilson) ;;; (defun c:LoadAll ( / mylispfolder mylispfiles acount) (setq mylispfolder "C:\\Path\\To\\Your\\LISP\\Folder\\") ; Change this to the folder path (setq mylispfiles (vl-directory-files mylispfolder "*.lsp" nil)) (foreach file mylispfiles (load (strcat mylispfolder file)) ) (princ) ) Maybe something in here ---> Retrieve list of applications with path? - AutoLISP, Visual LISP & DCL - AutoCAD Forums I prefer the bundle method or an exe for deployments to other users, as mentioned by BIGAL in that thread. There is a recent thread about making a deployment... I found it...
    1 point
  6. Hi Fidelojo, here's an option to automatically add it to a supported file path. (setq f (vla-get-files (vla-get-preferences (vlax-get-acad-object))) s (vla-get-supportpath f) ) (vlax-put f 'supportpath (strcat s ";" "<desired folder location>")); edit folder location here
    1 point
  7. Do you want to number them in ascending and consecutive order?
    1 point
  8. Hi This is an interesting point: how do you make the file able to identify itself and where it's located? Why? For example: if you want to create a small *.lsp that works as an installer for other files (lsp, dcl, imgs, etc.) that accompany it in the same directory or in other subdirectories included within it... how do you do it? One way would be to copy the files to a known directory, but the most reliable way would be to make the file able to locate itself, regardless of where it's located. To this day, I still haven't found a good solution for this.
    1 point
  9. @Fidelojo I don't know how you would get the "current script name". If the Lisp file you refer to is in your support paths, would the following work? (findfile "somescript.lsp").
    1 point
  10. Like you @Steven P I was going to add a check is it a Uxx block name and if so ask for new name. Found one problem when using explode it stops on explode a Spline will have a think about that. Got so so close, One Uxx left behind. I removed the two shrubs as they are made up of splines, realised that when exploded the objects are not Uxx blocks so no need to change unless objects name is Uxx. On attempt 4 now, as usual twists and turns in supplied dwgs. So 2 tests check name and check after explode. I have it stopping at the named Uxx blocks, displaying the block so you cam see what it looks like, then input correct name.
    1 point
  11. Made in the Universe, for the Universe = UNIVERSAL (defun c:Df2Column (/ col1 col2 n1 n2 p1 p2 p3 basept dy txt1 txt2 i ent1 ent2 l1 l2 ordena op opt sg r) (defun ordena (cj1 cj2 / e l n m c) (foreach cj (list cj1 cj2) (setq l (cons (vl-sort (while (setq e (ssname cj (setq n (if n (1+ n) 0 ) ) ) ) (setq c (cons (list (caddr (assoc 10 (entget e))) e) c)) ) '(lambda (a b) (> (car a) (car b))) ) l ) c nil n nil ) ) (setq l1 (cadr l) l2 (car l) ) ) (princ "\nSelect the texts of the first column: ") (setq col1 (ssget '((0 . "TEXT,MTEXT")))) (if (not col1) (progn (princ "\nThe objects of the first column are not selected.") (exit) ) ) (princ "\nSelect the texts of the second column: ") (setq col2 (ssget '((0 . "TEXT,MTEXT")))) (if (not col2) (progn (princ "\nThe objects of the second column are not selected." ) (exit) ) ) (if (/= (sslength col1) (sslength col2)) (progn (princ "\nThe number of objects in the columns does not match." ) (exit) ) ) (ordena col1 col2) (while (not (member (setq op (strcase (getstring (strcat "\nWhat operation do you want? { +|-|*|/ } <" (if *op* *op* "+") ">: ")))) '("" "+" "-" "*" "/"))) (princ "\n** Invalid option ** Try again...") ) (if (= op "") (if *op* (setq op (eval (read *op*))) (setq *op* "+" op +) ) (setq *op* op op (eval (read op))) ) (while (not (member (setq opt (strcase (getstring "\nMeaning positive numbers? No/<Yes>: "))) '("" "Y" "N"))) (princ "\n** Invalid option ** Try again...") ) (if (/= opt "N") (setq sg T) (setq sg nil)) (setq basept (getpoint "\nSpecify the insertion point of the third column: ")) ;; Defining the step by Y between the elements of the second column (setq i 0) (repeat (length l1);(sslength col1) (setq ent1 (cadr (nth i l1))) (setq ent2 (cadr (nth i l2))) (setq txt1 (cdr (assoc 1 (entget ent1)))) (setq txt2 (cdr (assoc 1 (entget ent2)))) (setq n1 (atof txt1)) (setq n2 (atof txt2)) (if (and n1 n2) (progn (setq p3 (list (car basept) (car (nth i l2)) 0.0)) ;(+ (cadr basept) (* i dy)) 0.0)) (entmakex (list (cons 0 "TEXT") (cons 8 (cdr (assoc 8 (entget ent2)))) (cons 10 p3) (cons 40 (cdr (assoc 40 (entget ent2)))) (cons 1 (if (> (setq r (op n1 n2)) 0) (strcat (if sg "+" "") (rtos r 2 (if (= r (fix r)) 0 3))) (rtos r 2 (if (= r (fix r)) 0 3)) ) ) ) ) ) ) (setq i (1+ i)) ) (princ) )
    1 point
×
×
  • Create New...