All Activity
- Past hour
-
UnFormat.lsp does not work in Autocad 2021
Steven P replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Try this, taking away the text modification part: It should put the original text + format codes one one command line, and the next unformatted, see if it gets that far. It won't change any of the drawing. (defun c:UNFORMAT ( / ss ssl cnt en xxobj otyp txr ntx MyText) ;;;;;;;;;;;;; mAssoc;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun mAssoc ( key lst / result ) ;; Lee Mac (foreach x lst (if (= key (car x)) (setq result (cons (cdr x) result)) ) ) (reverse result) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; UnFormat MText, MLeader, Table - strip formatting contol codes from texts ; ; based on Lee Mac's UnFormat string - www.lee-mac.com/unformatstring.html ; CAD Studio, 2018, www.cadstudio.cz www.cadforum.cz ; ; (vl-load-com) ;;-------------------=={ UnFormat String }==------------------;; ;; ;; ;; Returns a string with all MText formatting codes removed. ;; ;;------------------------------------------------------------;; ;; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; str - String to Process ;; ;; mtx - MText Flag (T if string is for use in MText) ;; ;;------------------------------------------------------------;; ;; Returns: String with formatting codes removed ;; ;;------------------------------------------------------------;; ;;SP ASSUMING LEE MAC PART WORKS. IT USUALLY DOES. (defun LM:UnFormat ( str mtx / _replace rx ) (defun _replace ( new old str ) (vlax-put-property rx 'pattern old) (vlax-invoke rx 'replace str new) ) (if (setq rx (vlax-get-or-create-object "VBScript.RegExp")) (progn (setq str (vl-catch-all-apply (function (lambda ( ) (vlax-put-property rx 'global actrue) (vlax-put-property rx 'multiline actrue) (vlax-put-property rx 'ignorecase acfalse) (foreach pair '( ("\032" . "\\\\\\\\") (" " . "\\\\P|\\n|\\t") ("$1" . "\\\\(\\\\[ACcFfHLlOopQTW])|\\\\[ACcFfHLlOopQTW][^\\\\;]*;|\\\\[ACcFfHLlOopQTW]") ("$1$2/$3" . "([^\\\\])\\\\S([^;]*)[/#\\^]([^;]*);") ("$1$2" . "\\\\(\\\\S)|[\\\\](})|}") ("$1" . "[\\\\]({)|{") ) (setq str (_replace (car pair) (cdr pair) str)) ) (if mtx (_replace "\\\\" "\032" (_replace "\\$1$2$3" "(\\\\[ACcFfHLlOoPpQSTW])|({)|(})" str)) (_replace "\\" "\032" str) ) ) ) ) ) (vlax-release-object rx) (if (null (vl-catch-all-error-p str)) str ) ) ) ) ;; End LM:Unformat ;----------------- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun doUnformatTable (table / rowCounter colCounter) (setq rowCounter (vla-Get-Rows table)) (repeat rowCounter (setq rowCounter (1- rowCounter)) (setq colCounter (vla-Get-Columns table)) (repeat colCounter (setq colCounter (1- colCounter)) (setq cellType (vla-GetCellType table rowCounter colCounter)) (if (= cellType acTextCell)(progn (setq cellText (vla-GetText table rowCounter colCounter)) (if (/= cellText "") (vla-SetText table rowCounter colCounter (LM:UnFormat cellText T))) )) ; end if, end if ) ; rep ) ; rep ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; End Sub routines (princ "\nSelect MTEXTs/DIMENSIONs/MLEADERs/TABLEs: ") (setq ss (ssget '((0 . "MTEXT,DIMENSION,MULTILEADER,ACAD_TABLE")))) (if ss (progn (setq acount 0) (while (< acount (sslength ss)) (setq ed (ssname ss acount)) (if (or (equal (assoc 0 (entget ed)) '(0 . "MTEXT")) (equal (assoc 0 (entget ed)) '(0 . "DIMENSION")) (equal (assoc 0 (entget ed)) '(0 . "MULTILEADER")) ) ; endor (progn (setq Mytexts (mAssoc 1 (entget ed))) (foreach n Mytexts ;; (entmod (subst (cons 1 (lm:Unformat n T)) (cons 1 n) (entget ed)) ) (princ "\n")(princ "\n")(princ n)(princ "\n")(princ (lm:Unformat n T)) ) ;; (setq Mytexts (mAssoc 3 (entget ed))) ;; extend mtexts ;; (foreach n Mytexts ;; (entmod (subst (cons 3 (lm:Unformat n T)) (cons 3 n) (entget ed)) ) ;; ) ) ; end progn mtext (progn ; tables ((= otyp "ACAD_TABLE")(doUnformatTable (vlax-ename->vla-object ed))) ; AcDbTable ) ) (setq acount (+ acount 1)) ) ; end while ) ; end progn, ss ) ; end if ss ) -
UnFormat.lsp does not work in Autocad 2021
Nikon replied to Nikon's topic in AutoLISP, Visual LISP & DCL
There is no problem with fonts. I can't understand why this UNFORMAT.lsp works for me in Autocad 2019, but not in Autocad 2021. I have another code that works in Autocad 2021, but it has slightly fewer functions. ;; UNFORMAT.LSP (c)2003, John F. Uhden, Cadlantic/CADvantage ;; v1.0 (04-01-03) ;; Removes MTEXT formatting with option to retain the "\\P" LineFeeds ;; ;; Rev. (05-09-05) (defun C:UNFORMAT_W ( / vars vals ss i e ans KeepLF) ;; v2.0 (3-15-2023) added MLeaders to qualified objects (gc) (vl-load-com) (prompt "\nUNFORMAT.LSP v2.0 (c)2005-23, John F. Uhden") (or *acad* (setq *acad* (vlax-get-acad-object))) (or *doc* (setq *doc* (vla-get-ActiveDocument *acad*))) (defun *error* (error) (mapcar 'setvar vals vars) (vla-endundomark *doc*) (cond ((not error)) ((wcmatch (strcase error) "*QUIT*,*CANCEL*")) (1 (princ (strcat "\nERROR: " error)) ) ) (princ) ) ;;-------------------------------------------- ;; Intitialize drawing and program variables: ;; (setq vars '("cmdecho")) (setq vals (mapcar 'getvar vars)) (mapcar 'setvar vars '(0)) (vla-startundomark *doc*) (command ".expert" (getvar "expert")) ;; dummy command (defun @UnFormat (Mtext KeepLF / -Old -New -Tmp -Str) (cond ((= (type Mtext) 'VLA-Object)) ((= (type Mtext) 'Ename) (setq Mtext (vlax-ename->vla-object Mtext)) ) (1 (setq Mtext nil)) ) (if (= KeepLF 0)(setq KeepLF nil)) (and Mtext (or (= (vlax-get Mtext 'ObjectName) "AcDbMText") (= (vlax-get Mtext 'ObjectName) "AcDbMLeader") ) (setq Old (vlax-get Mtext 'TextString)) (setq Tmp Old) (setq New "") (while (/= Tmp "") (cond ((wcmatch (strcase (setq Str (substr Tmp 1 2))) "\\[\\{}`~]") (setq Tmp (substr Tmp 3) New (strcat New Str) ) ) ((wcmatch (substr Tmp 1 1) "[{}]") (setq Tmp (substr Tmp 2)) ) ((and KeepLF (wcmatch (strcase (substr Tmp 1 2)) "\\P")) (setq New (strcat New (substr Tmp 1 2)) Tmp (substr Tmp 3) ) ) ;; added "\n" (03-03-08) ((and KeepLF (wcmatch (strcase (substr Tmp 1 1)) "\N")) (setq New (strcat New (substr Tmp 1 1)) Tmp (substr Tmp 2) ) ) ((wcmatch (strcase (substr Tmp 1 2)) "\\[LOP]") (setq Tmp (substr Tmp 3)) ) ((wcmatch (strcase (substr Tmp 1 2)) "\\[ACFHQSTW]") (setq Tmp (substr Tmp (+ 2 (vl-string-search ";" Tmp)))) ) (1 (setq New (strcat New (substr Tmp 1 1)) Tmp (substr Tmp 2) ) ) ) ) (/= Old New) (not (vl-catch-all-error-p (vl-catch-all-apply 'vlax-put (list Mtext 'TextString New) ) ) ) ) ) ;; Begin the action: (and (setq ss (ssget '((0 . "MTEXT,MULTILEADER")))) (or (initget "Yes No") 1) (or (setq ans (getkword "\nRetain line feeds? <Yes>/No: ")) (setq ans "Yes") ) (setq KeepLF (if (/= ans "Yes") 0 1)) (repeat (setq i (sslength ss)) (setq e (ssname ss (setq i (1- i)))) (@unformat e KeepLF) ) ) (*error* nil) ) (defun C:UF_W ()(C:UNFORMAT_W)) -
UnFormat.lsp does not work in Autocad 2021
GLAVCVS replied to Nikon's topic in AutoLISP, Visual LISP & DCL
This is an interesting topic. I edited my code to recursively search any file loaded with 'load' at all nesting levels. Try it. However, reviewing your explanation of the problem, I checked the MTEXT entity lists and saw that it forces the font to change to ISOCTEUR or SIMPLEX. I don't think these fonts support Cyrillic. Perhaps for this reason, when trying to replace the codes, it returns an empty string, which AutoCAD interprets as deleting the MTEXT. - Today
-
UnFormat.lsp does not work in Autocad 2021
Nikon replied to Nikon's topic in AutoLISP, Visual LISP & DCL
@Steven P thanks. I ran your code, but unfortunately the mtexts were deleted again. - Yesterday
-
AutoCad 2007 finally bit the dust?
BIGAL replied to Berzerker's topic in AutoCAD Bugs, Error Messages & Quirks
"Amazon has 2022 for $250 for a lifetime single user license but can this be installed on more than one computer?" Sounds like a scam a pirate copy. Autodesk don't allow generally sale of old copies. Can happen only under sale of a company. If you want cheap perpetual look at Bricscad. -
UnFormat.lsp does not work in Autocad 2021
Steven P replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Edited: See if this works. I have put the other routines as sub routines (LM:Unformat and DoUnformatTable). Changed the text modifying about so it uses entmod instead of vla (personal preference) Try it and see if it works - if it does then the unformat part (Lee Macs) is working as expected (it usually does) and there is something you'll be wanting to look at in the code you added. (defun c:UNFORMAT ( / ss ssl cnt en xxobj otyp txr ntx MyText) ;;;;;;;;;;;;; mAssoc;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun mAssoc ( key lst / result ) ;; Lee Mac (foreach x lst (if (= key (car x)) (setq result (cons (cdr x) result)) ) ) (reverse result) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; UnFormat MText, MLeader, Table - strip formatting contol codes from texts ; ; based on Lee Mac's UnFormat string - www.lee-mac.com/unformatstring.html ; CAD Studio, 2018, www.cadstudio.cz www.cadforum.cz ; ; (vl-load-com) ;;-------------------=={ UnFormat String }==------------------;; ;; ;; ;; Returns a string with all MText formatting codes removed. ;; ;;------------------------------------------------------------;; ;; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; str - String to Process ;; ;; mtx - MText Flag (T if string is for use in MText) ;; ;;------------------------------------------------------------;; ;; Returns: String with formatting codes removed ;; ;;------------------------------------------------------------;; ;;SP ASSUMING LEE MAC PART WORKS. IT USUALLY DOES. (defun LM:UnFormat ( str mtx / _replace rx ) (defun _replace ( new old str ) (vlax-put-property rx 'pattern old) (vlax-invoke rx 'replace str new) ) (if (setq rx (vlax-get-or-create-object "VBScript.RegExp")) (progn (setq str (vl-catch-all-apply (function (lambda ( ) (vlax-put-property rx 'global actrue) (vlax-put-property rx 'multiline actrue) (vlax-put-property rx 'ignorecase acfalse) (foreach pair '( ("\032" . "\\\\\\\\") (" " . "\\\\P|\\n|\\t") ("$1" . "\\\\(\\\\[ACcFfHLlOopQTW])|\\\\[ACcFfHLlOopQTW][^\\\\;]*;|\\\\[ACcFfHLlOopQTW]") ("$1$2/$3" . "([^\\\\])\\\\S([^;]*)[/#\\^]([^;]*);") ("$1$2" . "\\\\(\\\\S)|[\\\\](})|}") ("$1" . "[\\\\]({)|{") ) (setq str (_replace (car pair) (cdr pair) str)) ) (if mtx (_replace "\\\\" "\032" (_replace "\\$1$2$3" "(\\\\[ACcFfHLlOoPpQSTW])|({)|(})" str)) (_replace "\\" "\032" str) ) ) ) ) ) (vlax-release-object rx) (if (null (vl-catch-all-error-p str)) str ) ) ) ) ;; End LM:Unformat ;----------------- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun doUnformatTable (table / rowCounter colCounter) (setq rowCounter (vla-Get-Rows table)) (repeat rowCounter (setq rowCounter (1- rowCounter)) (setq colCounter (vla-Get-Columns table)) (repeat colCounter (setq colCounter (1- colCounter)) (setq cellType (vla-GetCellType table rowCounter colCounter)) (if (= cellType acTextCell)(progn (setq cellText (vla-GetText table rowCounter colCounter)) (if (/= cellText "") (vla-SetText table rowCounter colCounter (LM:UnFormat cellText T))) )) ; end if, end if ) ; rep ) ; rep ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; End Sub routines (princ "\nSelect MTEXTs/DIMENSIONs/MLEADERs/TABLEs: ") (setq ss (ssget '((0 . "MTEXT,DIMENSION,MULTILEADER,ACAD_TABLE")))) (if ss (progn (setq acount 0) (while (< acount (sslength ss)) (setq ed (ssname ss acount)) (if (or (equal (assoc 0 (entget ed)) '(0 . "MTEXT")) (equal (assoc 0 (entget ed)) '(0 . "DIMENSION")) (equal (assoc 0 (entget ed)) '(0 . "MULTILEADER")) ) ; endor (progn (setq Mytexts (mAssoc 1 (entget ed))) (foreach n Mytexts (entmod (subst (cons 1 (lm:Unformat n T)) (cons 1 n) (entget ed)) ) ) (setq Mytexts (mAssoc 3 (entget ed))) ;; extend mtexts (foreach n Mytexts (entmod (subst (cons 3 (lm:Unformat n T)) (cons 3 n) (entget ed)) ) ) ) ; end progn mtext (progn ; tables ((= otyp "ACAD_TABLE")(doUnformatTable (vlax-ename->vla-object ed))) ; AcDbTable ) ) (setq acount (+ acount 1)) ) ; end while ) ; end progn, ss ) ; end if ss ) -
AutoCad 2007 finally bit the dust?
Berzerker replied to Berzerker's topic in AutoCAD Bugs, Error Messages & Quirks
OK, the cui transfer in 2007 is broken. simply copy the whole support directory to the new machine and it works. -
Berzerker started following AutoCad 2007 finally bit the dust?
-
AutoCad 2007 finally bit the dust?
Berzerker posted a topic in AutoCAD Bugs, Error Messages & Quirks
I recently bought a new computer with win 11 on it and went to install my old trusty AutoCad 2007. And when it loads no toolbars. I read all the suggestions online and even came here but to no avail. I even tried to save the cui setting from my old computer and load them, but it just keeps saying it can't or won't load them. been at it for two whole days. The best I got was to load the workspace sample cui and some toolbars load but not all. Won't allow editing in no way. No workspaces under workspace, all commands say control. So, I don't know what to do. Amazon has 2022 for $250 for a lifetime single user license but can this be installed on more than one computer? - Last week
-
UnFormat.lsp does not work in Autocad 2021
Nikon replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Thanks for the help! I think the problem isn't due to overlapping code. I will check the system variables and all the reactors. -
UnFormat.lsp does not work in Autocad 2021
GLAVCVS replied to Nikon's topic in AutoLISP, Visual LISP & DCL
I've modified the code so that it also analyzes the files loaded from the profile. ;******************* p o r d e s í a r g o ******************** ;************************ G L A V C V S ************************* ;************************** F E C I T *************************** (defun c:buscaDefunsRepets (/ lstLsps arch nmarch linea lst as nbref separa<->palabras lstDefuns lstRepets tit i dale path escrutArch) (defun separa<->palabras (tx lstCtrs / c p l) (foreach c (vl-string->list tx) (if (member (setq c (chr c)) lstCtrs) (if p (setq l (cons (strcase p T) l) p nil)) (setq p (if p (strcat p c) c)) ) ) (reverse (if p (cons (strcase p T) l) l)) ) (defun escrutArch (nmarch / arch linea lst as nbref dale mirExtens) (defun mirExtens (nmarch) (if (not (wcmatch nmarch "*[.]@@@")) (strcat nmarch ".lsp") nmarch ) ) (if (and (setq nmarch (findfile (mirExtens nmarch))) (setq arch (open nmarch "r"))) (while (setq linea (read-line arch)) (cond ((and (wcmatch linea "*(defun *") (not (wcmatch linea "*\"(defun *,*\"*(defun [*] *,*\"*(defun [*]\"*"))) (setq lst (separa<->palabras linea '(" " "(" "\"")) pos (vl-position "defun" lst) nbref (nth (1+ pos) lst) ) (if lstDefuns (if (not (vl-some ; comprobamos cada defun acumulada '(lambda (v) (if (and (= (car v) nbref) (/= nbref "defun")); si la defun recien leída coincide con alguna de las encontradas anteriormente (if (setq lr (assoc nbref lstRepets)) (setq lstRepets (subst (append lr (list nmarch)) lr lstRepets)) (setq lstRepets (append lstRepets (list (append v (list nmarch))))) ) ) ) lstDefuns ) ) (setq lstDefuns (append lstDefuns (list (list nbref nmarch)))) ) (setq lstDefuns (append lstDefuns (list (list nbref nmarch)))) ) ) ((wcmatch linea "*(load *\")*") (setq lst (separa<->palabras linea '(" " "(" "\""))) (foreach v lst (if dale (setq dale (if (and (not (member (strcase v T) (list "acad2021.lsp" "acad2021doc.lsp"))) (or (= (length (setq lst1 (separa<->palabras v '(".")))) 1) (member (strcase (cadr lst1) T) extens) ) ) (escrutArch v) ) dale nil ) (if (= (strcase v T) "load") (setq dale T) ) ) ) ) ) ) ) (if arch (close arch)) ) (setq lstLsps (list "acad2021.lsp" "acad2021doc.lsp" "acadddd.lsp") extens '("lsp")) (foreach lsp lstLsps (if (and (findfile lsp) (setq arch (open (setq nmarch (findfile lsp)) "r"))) (escrutArch nmarch) ) ) (if arch (close arch)) (setq i 0) (while (setq nmarch (vl-registry-read (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\Profiles\\" (getvar "CPROFILE") "\\Dialogs\\Appload\\Startup") (strcat (itoa (setq i (1+ i))) "StartUp"))) (escrutArch nmarch) ) (if lstRepets (if (setq arch (open (setq nmarch (strcat (VL-REGISTRY-READ "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" "Personal") "\\informe.txt")) "w")) (foreach lr lstRepets (princ (strcat (if (not tit) (setq tit "FUNCTIONS DEFINED MULTIPLE TIMES:\n") "") "\n Function NAME \'" (car lr) "\' in:\n") arch) (foreach path (cdr lr) (princ (strcat "\t" path "\n") arch) ) ) ) ) (if arch (progn (close arch) (startapp "notepad" nmarch))) (princ) ) If after trying this nothing different comes out, then the problem isn't due to overlapping code. In that case, I would look at the system variables and any reactors your LISPs generate when loading. -
UnFormat.lsp does not work in Autocad 2021
Nikon replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Yes! I checked the code in Autocad 2019, it works great! -
UnFormat.lsp does not work in Autocad 2021
GLAVCVS replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Those functions have nothing to do with your problem. Your code doesn't work in any drawing? -
UnFormat.lsp does not work in Autocad 2021
Nikon replied to Nikon's topic in AutoLISP, Visual LISP & DCL
@GLAVCVS thank you very much! I run the command buscaDefunsRepets and I get this message: FUNCTIONS DEFINED MULTIPLE TIMES: Function NAME '*merr*' in: C:\Users\Nikon\AppData\Roaming\Autodesk\AutoCAD 2021\R24.0\rus\support\acad2021doc.lsp C:\Users\Nikon\AppData\Roaming\Autodesk\AutoCAD 2021\R24.0\rus\support\acad2021doc.lsp Function NAME '*merrmsg*' in: C:\Users\Nikon\AppData\Roaming\Autodesk\AutoCAD 2021\R24.0\rus\support\acad2021doc.lsp C:\Users\artem\Nikon\AppData\Roaming\Autodesk\AutoCAD 2021\R24.0\rus\support\acad2021doc.lsp What do I need to do next? acad2021doc.lsp ........... (defun *merr* (msg) (setq *error* m:err m:err nil) (princ) ) (defun *merrmsg* (msg) (princ msg) (setq *error* m:err m:err nil) (princ) ) ................... -
UnFormat.lsp does not work in Autocad 2021
GLAVCVS replied to Nikon's topic in AutoLISP, Visual LISP & DCL
PS: The command will analyze the code in the files in the 'lstLsps' list and any files loaded from them. However, it will not analyze any files loaded from the latter. That is, it will not analyze code loaded beyond the second level of nesting. But I think that should be enough. -
UnFormat.lsp does not work in Autocad 2021
GLAVCVS replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Yes This, for Eixample ;******************* p o r d e s í a r g o ******************** ;************************ G L A V C V S ************************* ;************************** F E C I T *************************** (defun c:buscaDefunsRepets (/ lstLsps arch nmarch linea lst as nbref separa<->palabras lstDefuns lstRepets tit dale path escrutArch) (defun separa<->palabras (tx lstCtrs / c p l) (foreach c (vl-string->list tx) (if (member (setq c (chr c)) lstCtrs) (if p (setq l (cons p l) p nil)) (setq p (if p (strcat p c) c)) ) ) (reverse (if p (cons p l) l)) ) (defun escrutArch (nmarch / arch linea lst as nbref) (if (and (setq nmarch (findfile nmarch)) (setq arch (open nmarch "r"))) (while (setq linea (read-line arch)) (cond ((wcmatch linea "*(defun *") (setq lst (separa<->palabras linea ;'(" " "(")) '(" " "(" "\"")) as (assoc (setq nbref (cadr lst)) lstDefuns) ) (if lstDefuns (if (not (vl-some ; comprobamos cada defun acumulada '(lambda (v) (if (and (= (car v) nbref) (/= nbref "defun")); si la defun recien leída coincide con alguna de las encontradas anteriormente (if (setq lr (assoc nbref lstRepets)) (setq lstRepets (subst (append lr (list nmarch)) lr lstRepets)) (setq lstRepets (append lstRepets (list (append v (list nmarch))))) ) ) ) lstDefuns ) ) (setq lstDefuns (append lstDefuns (list (list nbref nmarch)))) ) (setq lstDefuns (append lstDefuns (list (list nbref nmarch)))) ) ) ) ) ) (if arch (close arch)) ) (setq lstLsps (list "acad2021.lsp" "acad2021doc.lsp") extens '("lsp")) (foreach lsp lstLsps (if (and (findfile lsp) (setq arch (open (setq nmarch (findfile lsp)) "r"))) (progn (while (setq linea (read-line arch)) (cond ((wcmatch linea "*(defun *") (setq lst (separa<->palabras linea '(" " "(")) as (assoc (setq nbref (cadr lst)) lstDefuns) ) (if lstDefuns (if (not (vl-some ; comprobamos cada defun acumulada '(lambda (v) (if (and (= (car v) nbref) (/= nbref "defun")); si la defun recien leída coincide con alguna de las encontradas anteriormente (if (setq lr (assoc nbref lstRepets)) (setq lstRepets (subst (append lr (list nmarch)) lr lstRepets)) (setq lstRepets (append lstRepets (list (append v (list nmarch))))) ) ) ) lstDefuns ) ) (setq lstDefuns (append lstDefuns (list (list nbref nmarch)))) ) (setq lstDefuns (append lstDefuns (list (list nbref nmarch)))) ) ) ((wcmatch linea "*(load *\")*") (setq lst (separa<->palabras linea '(" " "(" "\""));'(" " "(")) as (assoc (setq nbref (cadr lst)) lstDefuns) ) (foreach v lst (if dale (setq dale (if (and (not (member (strcase v T) (list "acad2021.lsp" "acad2021doc.lsp"))) (or (= (length (setq lst1 (separa<->palabras v '(".")))) 1) (member (strcase (cadr lst1) T) extens) ) ) (escrutArch v) ) dale nil ) (if (= (strcase v T) "load") (setq dale T) ) ) (if nmArch1 (escrutArch nmArch1)) ) ) ) ) ) ) ) (if arch (close arch)) (if lstRepets (if (setq arch (open (setq nmarch (strcat (VL-REGISTRY-READ "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" "Personal") "\\informe.txt")) "w")) (foreach lr lstRepets (princ (strcat (if (not tit) (setq tit "FUNCTIONS DEFINED MULTIPLE TIMES:\n") "") "\n Function NAME \'" (car lr) "\' in:\n") arch) (foreach path (cdr lr) (princ (strcat "\t" path "\n") arch) ) ) ) ) (if arch (progn (close arch) (startapp "notepad" nmarch))) (princ) ) Try it -
UnFormat.lsp does not work in Autocad 2021
Steven P replied to Nikon's topic in AutoLISP, Visual LISP & DCL
You'll need to apply some thought there, use the filename and location of where you have saved the LSP file containing the unformat lisps you posted above. -
UnFormat.lsp does not work in Autocad 2021
Nikon replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Thank you all for your advice. I've tried all the options. It doesn't work… There is no file UNFORMAT in the startup, I open a new file, download lisp UNFORMAT and nothing changes... Mysticism?!? -
UnFormat.lsp does not work in Autocad 2021
Steven P replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Try this as an experiment: (Defun C:LMUnF ( / ) (Load " -NIKON LISP FILEPATH- \\LM-Unformat.lsp") (c:UNFORMAT)(princ) ) Where -Nikon Lisp Filepath is where the file is saved, LM-Unformat.lsp is the file name. It should load this file when you run 'LMUnf' - and since it is the latest loaded will take precedence over anything loaded previously, Second option is to modify the text using entmod perhaps -
UnFormat.lsp does not work in Autocad 2021
Nikon replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Is there a way to find this intervention? I have two more codes with this function that don't work... -
UnFormat.lsp does not work in Autocad 2021
GLAVCVS replied to Nikon's topic in AutoLISP, Visual LISP & DCL
I agree with StevenP. I've tested Lee Mac's code in the 2021 version, and it works fine in your drawing. It's probably some interference between your loaded Lisp code. -
Danielm103 started following How to correctly extract nested objects from blocks with scaling/mirroring)
-
How to correctly extract nested objects from blocks with scaling/mirroring)
Danielm103 replied to p7q's topic in AutoLISP, Visual LISP & DCL
ARX would use AcDbBlockReference::blockTransform() to get the matrix, then call transformBy on the entity in one operation. You should be able to construct a vlax-tmatrix from the reference, then call vla-transformby on the objects you wish to transform. -
How to stop flip action reversing offsets in dynamic block
jamami replied to jamami's topic in AutoCAD Drawing Management & Output
Thank you , I will test out when back in the office Monday . doni need to download the LM function you are calling ? -
Lee Mac started following How to correctly extract nested objects from blocks with scaling/mirroring)
-
How to correctly extract nested objects from blocks with scaling/mirroring)
Lee Mac replied to p7q's topic in AutoLISP, Visual LISP & DCL
You can obtain the transformation matrix directly from an nentsel/nentselp call. -
Keep Only the Longest Overlapping Line/Polyline
SLW210 replied to p7q's topic in AutoLISP, Visual LISP & DCL
If you would run through -OVERKILL you can see current settings and the options in the command line, just add what you need to the line in the LISP, just getting the selection and ENTER twice is going to default to last used settings. Command: -OVERKILL Select objects: all 1935 found 426 were not in current space. Select objects: Current settings: Tolerance=1.000000, Ignore=All, Optimize polylines=Yes, Combine partial overlap=Yes, Combine end-to-end=Yes Enter an option to change [Done/Ignore/tOlerance/optimize Plines/combine parTial overlap/combine Endtoend/Associativity] <done>: *Cancel* The Uppercase letters are the shortcut, i.e. for Tolerance use O (value), optimize Plines use P, etc. You might find something on this thread... I need overkill and ncopy !please help me! - AutoLISP, Visual LISP & DCL - AutoCAD Forums -
Help : Analytic calculation area of polygons.
mhy3sx replied to mhy3sx's topic in AutoLISP, Visual LISP & DCL
Thanks you all, Problem solved