Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/07/2025 in all areas

  1. To add to this, if you had pasted the code into the VLIDE, the color coding is an easy indicator of the missing " since all the code at the end is color coded as a string.
    1 point
  2. Had some time just then, not sure if this is really what you want. E-mail this to the users, they can drag and drop the file into the command line. It should autorun. First part grabs that users support path, searching for support path folders with 'support' and not 'ENU' in the path (you can adjust this to suit), taking the first path it finds. Asks user to select a folder for their LISPs, this can be removed and for example hard coded to your company LISP library Creates and saves a LISP file "Appreload" into the support path which will load all the LISP files in the above Lisp Folder when it runs. You can adjust this to run on demand or a (BigAl) menu system. Dinner time now... only thing to add is function to autorun the LISP 'appreload' (defun Installer ( / f s n SP SupportLisp LP) ;; Sub functions (defun LM:str->lst ( str del / pos ) ;;Lee Mac (if (setq pos (vl-string-search del str)) (cons (substr str 1 pos) (LM:str->lst (substr str (+ pos 1 (strlen del))) del)) (list str) ) ) (defun LM:lst->str ( lst del ) (if (cdr lst) (strcat (car lst) del (LM:lst->str (cdr lst) del)) (car lst) ) ) (defun LM:browseforfolder ( msg dir bit / err fld pth shl slf ) (setq err (vl-catch-all-apply (function (lambda ( / app hwd ) (if (setq app (vlax-get-acad-object) shl (vla-getinterfaceobject app "shell.application") hwd (vl-catch-all-apply 'vla-get-hwnd (list app)) fld (vlax-invoke-method shl 'browseforfolder (if (vl-catch-all-error-p hwd) 0 hwd) msg bit dir) ) (setq slf (vlax-get-property fld 'self) pth (vlax-get-property slf 'path) pth (vl-string-right-trim "\\" (vl-string-translate "/" "\\" pth)) ) ) ) ) ) ) (if slf (vlax-release-object slf)) (if fld (vlax-release-object fld)) (if shl (vlax-release-object shl)) (if (vl-catch-all-error-p err) (prompt (vl-catch-all-error-message err)) pth ) ) (defun GetDesktop ( / script spFolders desktop) (cond ( (setq script (vlax-create-object "WScript.Shell")) (setq spFolders (vlax-get-property script "SpecialFolders") desktop (vlax-invoke-method spFolders 'Item "Desktop") ) (vlax-release-object spFolders) (vlax-release-object script) ) ) desktop ) ;; End subfunctions (setq f (vla-get-files (vla-get-preferences (vlax-get-acad-object))) ) ; Files (setq s (vla-get-supportpath f)) ; Support Path (setq s (LM:str->lst s ";")) ; First in list since it will always be in the list (foreach n s (if (and (wcmatch n "*\\support") ; find support path folder with 'support' in the path (not (wcmatch n "*\\enu\\*") ) ; add exceptions as you find them ) (setq SP (cons n SP)) ;; SP: Support Path eg ...\\Program files\\autodesk\\autocad 2022\\support ) ; end if ) ; end foreach (setq SP (car (reverse SP))) ;; return the first folder with 'support' in its name, excluding exceptions above ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;LP: Asks users to select 'Lisp Path' folder location. Hard code this if required, remember double '\\' (setq LP (LM:browseforfolder "Select LISP directory" (getdesktop) 0)) ;;adjust '(getdesktop)' filepath as required. Hard code a file path here if you want for the LISP library. (setq LP (LM:str->lst LP "\\")) (setq LP (LM:lst->str LP "\\\\")) ;; doubles '\\' in the selected file path. Not needed if LP hard coded instead of (browseforfolder.... ) ;;;;;;;;;;;;;;;;;;;;;;;; ;; For testing, support path is Desktop. ;; (setq SP (getdesktop)) ;; Delete this to add to support path identified ;;;;;;;;;;;;;;;;;;;;;;;; ;; Create a LISP file in Support Path (setq SupportLisp (strcat SP "\\\\LISPFilePaths.lsp")) (if (setq SL (open SupportLisp "w")) (progn (write-line "(vl-load-com)" SL) (write-line ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" SL) (write-line "(defun c:appreload ( / lspname myfiles acount mylistlength Failedtoload)" SL) (write-line (strcat "(setq myfiles (vl-directory-files \"" LP "\" \"*.lsp\" nil))") SL) (write-line "(setq mylistlength (length myfiles))" SL) (write-line "(setq acount -1)" SL) (write-line "(repeat mylistlength" SL) (write-line "(setq acount (1+ acount))" SL) (write-line "(setq FailedtoLoad (strcat (nth acount myfiles) \" failed to load\"))" SL) (write-line "(load (strcat mylispfolder (nth acount myfiles)) FailedtoLoad)" SL) (write-line ")" SL) (write-line "(princ \"\\n\")" SL) (write-line "(princ mylistlength)" SL) (write-line "(princ \" lsp files loaded from \")" SL) (write-line "(princ mylispfolder)" SL) (write-line "(princ)" SL) (write-line ")" SL) (write-line ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" SL) (close SL) ;; Close file descriptor ) ;; end PROGN (princ "\nUnable to create Support LISP file.") ;; Else the text file could not be created ) ;; end IF (princ) ) (Installer); Autorun
    1 point
  3. Thank You very much for this help @Emmanuel Delay thank you .
    1 point
  4. Hi Lines/polylines OB0, OB1, OB2 and OB3 intersect several different lines/polylines. What is the criterion for determining which ones are important? Or... Are they all important?
    1 point
  5. change this : ("*EN-LITE-CIRC . 160) to this ("*EN-LITE-CIRC" . 160) and if you want to keep this line ERROR WTF MAYBE MAKE NEW SCRIPT ----------------------------------------------- LAYCOL add a ;; before the line as bigal pointed out ;;ERROR WTF MAYBE MAKE NEW SCRIPT ;;----------------------------------------------- ;;LAYCOL
    1 point
  6. To determine the current value use: ;; allow-explode-p ;; returns 1 or 0 (Yes or No) ;; (defun allow-explode-p () (vl-registry-read (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\Profiles\\" (vla-get-activeprofile (vla-get-profiles (vla-get-preferences (vlax-get-acad-object)) ) ) "\\Dialogs\\block_definition_dialog" ) "Explode" ) ) ;; ;; ;; wiz_04DEC09 To set it to 'allow exploding' use: ;; allow-explode ;; ;; (defun allow-explode () (vl-registry-write (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\Profiles\\" (vla-get-activeprofile (vla-get-profiles (vla-get-preferences (vlax-get-acad-object)) ) ) "\\Dialogs\\block_definition_dialog" ) "Explode" 1 ) ) ;; (allow-explode) ;; ;; ;; wiz_04DEC09
    1 point
×
×
  • Create New...