Jump to content

All Activity

This stream auto-updates

  1. Today
  2. Yes! I checked the code in Autocad 2019, it works great!
  3. Those functions have nothing to do with your problem. Your code doesn't work in any drawing?
  4. @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) ) ...................
  5. 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.
  6. 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
  7. 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.
  8. 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?!?
  9. 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
  10. Is there a way to find this intervention? I have two more codes with this function that don't work...
  11. 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.
  12. 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.
  13. Yesterday
  14. Thank you , I will test out when back in the office Monday . doni need to download the LM function you are calling ?
  15. You can obtain the transformation matrix directly from an nentsel/nentselp call.
  16. 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
  17. Thanks you all, Problem solved
  18. @SLW210 you are right. When I run the OVERKILL dialog with the options shown in the screenshot (tolerance 0.000001, all “Ignore object property” boxes checked, Optimize segments within polylines, Ignore polyline segment widths, Do not break polylines, Combine co-linear objects that partially overlap, Combine co-linear objects when aligned end to end, Maintain associative objects), I get exactly the result I want. I’d like to run this silently from LISP—no dialog—so that the same settings are always used. Calling it like this: (command "_.-OVERKILL" ss "" "") seems to use whatever options were last chosen in the dialog, not the fixed set I want. I tried to “force” the settings by editing the registry here: HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R24.3\ACAD-0001:409\Profiles\<<Unnamed Profile>>\Dialogs\Overkill but AutoCAD didn’t pick up the changes (no effect on command behavior). Questions: Is there a documented way to pass all of these options via the command-line version of OVERKILL in a single LISP call (i.e., set tolerance, ignore list, and all Yes/No toggles explicitly), so it doesn’t rely on the last-used dialog state? If not, is there another supported method (sysvars, .NET/ObjectARX API, etc.) to set OVERKILL options programmatically? Why don’t edits under the …\Dialogs\Overkill registry key take effect—am I writing to the wrong location, or are these values cached elsewhere/per-drawing? AutoCAD version: R24.3 (profile ACAD-0001:409). Goal: run OVERKILL on selected LINE and PLINE objects with the exact dialog settings above, without showing the dialog and without depending on last-used options. Thanks!
  19. i had some time so put together something, once I finished I realised could have been made simpler by just inserting the single blocks rather than using the dynamic block. Any way have a look at this. ; https://www.cadtutor.net/forum/topic/98637-how-to-stop-flip-action-reversing-offsets-in-dynamic-block/ ; See below (defun c:dyntruss ( / x truss num) (if (not LM:setdynpropvalue)(load "Dynamic block get-put Lee-mac")) ;; Set Dynamic Block Property Value - Lee Mac ;; Modifies the value of a Dynamic Block property (if present) ;; blk - [vla] VLA Dynamic Block Reference object ;; prp - [str] Dynamic Block property name (case-insensitive) ;; val - [any] New value for property ;; Returns: [any] New value if successful, else nil (defun LM:setdynpropvalue ( blk prp val ) (setq prp (strcase prp)) (vl-some '(lambda ( x ) (if (= prp (strcase (vla-get-propertyname x))) (progn (vla-put-value x (vlax-make-variant val (vlax-variant-type (vla-get-value x)))) (cond (val) (t)) ) ) ) (vlax-invoke blk 'getdynamicblockproperties) ) ) ; (LM:setdynpropvalue obj "Flip state1" flip) ; (LM:setdynpropvalue obj "Length" val1) ; (LM:SetVisibilityState obj "3+4+6") (defun trussdcl ( / fo ) (setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w")) (write-line " dyntruss : dialog { " fo) (write-line " label = \"Enter Values\" ; " fo) (write-line " : column { " fo) (write-line " width =25; " fo) (write-line " spacer_1 ; " fo) (write-line " : edit_box { " fo) (write-line " key = \"key1\" ; " fo) (write-line " label = \"Length \" ; " fo) (write-line " edit_width = 5; " fo) (write-line " edit_limit = 4; " fo) (write-line " is_enabled = true ; " fo) (write-line " allow_accept=true ; " fo) (write-line " } " fo) (write-line " spacer_1 ; " fo) (write-line " : edit_box { " fo) (write-line " key = \"key2\" ; " fo) (write-line " label = \"Angle \" ; " fo) (write-line " edit_width = 5; " fo) (write-line " edit_limit = 4; " fo) (write-line " is_enabled = true ; " fo) (write-line " allow_accept=true ; " fo) (write-line " } " fo) (write-line " spacer_1 ; " fo) (write-line " : radio_row { " fo) (write-line " : radio_button { " fo) (write-line " key = \"Rb1\" ; " fo) (write-line " label = \"Flipped\" ; " fo) (write-line " } " fo) (write-line " spacer_1 ; " fo) (write-line " : radio_button { " fo) (write-line " key = \"Rb2\" ; " fo) (write-line " label = \"No Flip\" ; " fo) (write-line " } " fo) (write-line " spacer_1 ; " fo) (write-line " } " fo) (write-line " spacer_1 ; " fo) (write-line " ok_cancel ; " fo) (write-line " } " fo) (write-line " } " fo) (close fo) (setq dcl_id (load_dialog fname)) (if (not (new_dialog "dyntruss" dcl_id) ) (exit) ) (set_tile "key1" "10") (set_tile "key2" "0") (set_tile "Rb2" "1") (action_tile "accept" "(setq val1 (atof (get_tile \"key1\")))(setq val2 (atof (get_tile \"key2\")))(setq val3 (atoi (get_tile \"Rb1\")))(done_dialog)") (action_tile "cancel" "(setq cancel \"yes\")(done_dialog)") (start_dialog) (unload_dialog dcl_id) (vl-file-delete fname) (princ) ) ;;;;;;;;;;;; starts here ;;;;;;;;;;;;;;; (setq oldsnap (getvar 'Osmode)) (setvar 'osmode 0) (trussdcl) (setq truss-size (list '(51 8 0 0 1 0) '(50 8 0 0 0 1) '(49 7 1 0 0 1) '(48 8 0 0 0 0) '(47 7 1 0 0 0) '(46 7 0 1 0 0) '(45 7 0 0 1 0) '(44 7 0 0 0 1) '(43 6 1 0 0 1) '(42 7 0 0 0 0) '(41 6 1 0 0 0) '(40 6 0 1 0 0) '(39 6 0 0 1 0) '(38 6 0 0 0 1) '(37 5 1 0 0 1) '(36 6 0 0 0 0) '(35 5 1 0 0 0) '(34 5 0 1 0 0) '(33 5 0 0 1 0) '(32 5 0 0 0 1) '(31 4 1 0 0 1) '(30 5 0 0 0 0) '(29 4 1 0 0 0) '(28 4 0 1 0 0) '(27 4 0 0 1 0) '(26 4 0 0 0 1) '(25 3 1 0 0 1) '(24 4 0 0 0 0) '(23 3 1 0 0 0) '(22 3 0 1 0 0) '(21 3 0 0 1 0) '(20 3 0 0 0 1) '(19 2 1 0 0 1) '(18 3 0 0 0 0) '(17 2 1 0 0 0) '(16 2 0 1 0 0) '(15 2 0 0 1 0) '(14 2 0 0 0 1) '(13 1 1 0 0 1) '(12 2 0 0 0 0) '(11 1 1 0 0 0) '(10 1 0 1 0 0) '(9 1 0 0 1 0) '(8 1 0 0 0 1) '(7 0 1 0 0 1) '(6 1 0 0 0 0) '(5 0 1 0 0 0) '(4 0 0 1 0 0) '(3 0 0 0 1 0) '(2 0 0 0 0 1)) ) (setq ss nil) (setq ss (ssadd)) (setq ang (* pi (/ val2 180.0))) (foreach val truss-size (if (= (car val) val1) (setq sizes val) ) ) (setq pt (getpoint "\nPick point for truss ")) (setq basept pt) (if (= val3 0) (setq flip "Not flipped") (setq flip "Flipped") ) (setq k 0 truss 7) (repeat 5 (setq k (1+ k) truss (1- truss)) (setq num (nth k sizes)) (if (= num 0) (princ (strcat "\nNo " (rtos truss 2 0) "m ")) (progn (repeat num (command "-insert" "d-d78" "s" 1 pt 0) (setq obj (vlax-ename->vla-object (entlast))) (LM:setdynpropvalue obj "Beam viz" (rtos truss 2 0)) (LM:setdynpropvalue obj "Angle1" ang) (setq ss (ssadd (entlast))) (setq pt (polar pt ang (* truss 1000.0))) ) ) ) ) (setvar 'osmode oldsnap) (princ) ) (c:dyntruss) https://www.lee-mac.com/ssget.html
  20. Best CAD Tips

    A Sneak Peek at “CAD for Grads!”

    Here’s a tiny glimpse from one of the lessons in my upcoming online course, CAD for Grads — designed to give recent graduates the essential AutoCAD® skills they need to hit the ground running in Design, Construction, Architecture, and Engineering. In this clip, you’ll see an unscripted race between two contestants trying to finish the […] The post A Sneak Peek at “CAD for Grads!” appeared first on Best CAD Tips. View the full article
  21. Last week
  22. harimaddddy

    Text content sync

    Hi sir, Thanks for the reply. With my basic knowledge in coding and use some AI help I have ended with below mentioned code. Works fine but if I reopen the drawing the link between text disappeared. I hope it have solutions and thanks in advance . (vl-load-com) ;; Global storage for set/view links (setq *set-view-links* nil) ;; Function to save set-view links to drawing dictionary (defun SaveSetViewLinks () (if *set-view-links* (progn (vl-propagate '*set-view-links*) (dictremove (namedobjdict) "SET_VIEW_LINKS") ; Remove old entry to avoid duplication (dictadd (namedobjdict) "SET_VIEW_LINKS" (vl-prin1-to-string *set-view-links*) ) ) ) (princ) ) ;; Function to load set-view links from drawing dictionary (defun LoadSetViewLinks () (if (setq dict (dictsearch (namedobjdict) "SET_VIEW_LINKS")) (progn (setq *set-view-links* (read (cdr (assoc 1 dict)))) ;; Validate loaded links to remove invalid handles (setq *set-view-links* (vl-remove-if '(lambda (link) (not (and (handent (car link)) ; Check if set exists (vl-every 'handent (cadr link))))) ; Check if all views exist *set-view-links*)) (if *set-view-links* (SaveSetViewLinks)) ; Save cleaned links ) ) (princ) ) (defun c:LINKTEXT (/ set views set-handle v-handles ent) (prompt "\nSelect the SET TEXT or MTEXT: ") (setq set (entsel)) ; Get full entsel output (if (and set (setq set (car set)) ; Extract entity name (wcmatch (cdr (assoc 0 (entget set))) "TEXT,MTEXT")) (progn ;; Change set text color to red for identification (entmod (subst (cons 62 1) (assoc 62 (entget set)) (entget set))) (entupd set) (setq set-handle (cdr (assoc 5 (entget set)))) ;; Select views (prompt "\nSelect VIEW TEXT or MTEXT entities: ") (setq views (ssget '((0 . "TEXT,MTEXT")))) (if views (progn (setq v-handles '()) (repeat (sslength views) (setq ent (ssname views 0)) (ssdel ent views) ;; Immediately match text (vla-put-TextString (vlax-ename->vla-object ent) (cdr (assoc 1 (entget set))) ) (setq v-handles (cons (cdr (assoc 5 (entget ent))) v-handles)) ) ;; Store link pair in global var (setq *set-view-links* (cons (list set-handle v-handles) *set-view-links*)) ;; Save links to dictionary (SaveSetViewLinks) (prompt "\nSet linked to views.") ) (prompt "\nNo view text selected.") ) ) (prompt "\nInvalid set entity.") ) (princ) ) (defun c:SYNCSET (/ link s-ent v-handles s-text v-obj) (if *set-view-links* (progn (foreach link *set-view-links* (setq s-ent (handent (car link))) (if s-ent (progn (setq s-text (cdr (assoc 1 (entget s-ent)))) (foreach v-handle (cadr link) (setq v-obj (handent v-handle)) (if v-obj (vla-put-TextString (vlax-ename->vla-object v-obj) s-text) ) ) ) ) ) (prompt "\nAll view texts updated from their sets.") ) (prompt "\nNo set-view links found.") ) (princ) ) (defun c:SELECTLINKED (/ pick handle result) (prompt "\nPick any linked text (set or view): ") (setq pick (entsel)) (if pick (progn (setq handle (cdr (assoc 5 (entget (car pick))))) (setq result (ssadd)) (foreach link *set-view-links* (cond ;; If picked is set ((equal (car link) handle) (if (handent (car link)) (ssadd (handent (car link)) result)) (foreach v-h (cadr link) (if (handent v-h) (ssadd (handent v-h) result)) ) ) ;; If picked is view ((member handle (cadr link)) (if (handent (car link)) (ssadd (handent (car link)) result)) (foreach v-h (cadr link) (if (handent v-h) (ssadd (handent v-h) result)) ) ) ) ) (if (> (sslength result) 0) (progn (sssetfirst nil result) (princ (strcat "\nSelected " (itoa (sslength result)) " linked texts.")) ) (prompt "\nNo linked texts found.") ) ) (prompt "\nNothing selected.") ) (princ) ) (defun c:UNLINKVIEW (/ set views set-handle new-views) (prompt "\nSelect SET TEXT: ") (setq set (entsel)) (if (and set (setq set (car set)) (wcmatch (cdr (assoc 0 (entget set))) "TEXT,MTEXT")) (progn (setq set-handle (cdr (assoc 5 (entget set)))) (prompt "\nSelect VIEWS to unlink: ") (setq views (ssget '((0 . "TEXT,MTEXT")))) (if views (progn (foreach link *set-view-links* (if (equal (car link) set-handle) (progn (setq new-views (vl-remove-if '(lambda (h) (ssmemb (handent h) views)) (cadr link))) (setq *set-view-links* (subst (list set-handle new-views) link *set-view-links*)) ) ) ) ;; Remove empty links (setq *set-view-links* (vl-remove-if '(lambda (link) (null (cadr link))) *set-view-links*)) ;; Save updated links to dictionary (SaveSetViewLinks) (prompt "\nViews unlinked.") ) (prompt "\nNo views selected.") ) ) (prompt "\nInvalid set.") ) (princ) ) (defun WarnIfDeletingSet (/ e) (if (and e (member (cdr (assoc 5 (entget e))) (mapcar 'car *set-view-links*))) (alert "WARNING: You are deleting a SET text linked to other texts!") ) ) ;; Add reactor for delete warning (vlr-command-reactor nil '((:vlr-commandWillStart . (lambda (reactor cmd) (if (wcmatch (strcase cmd) "ERASE") (progn (setq ss (ssget "_I")) (if ss (repeat (sslength ss) (WarnIfDeletingSet (ssname ss (setq idx (1- (sslength ss))))) ) ) ) ) ) ) ) ) ;; Load set-view links when LISP is loaded (LoadSetViewLinks) (prompt "\nCommands: LINKTEXT, SYNCSET, SELECTLINKED, UNLINKVIEW") (princ)
  23. David Devitt

    Table Building Mode - AutoCAD 2007/2008

    Thanks BIGAL!
  24. BIGAL

    Table Building Mode - AutoCAD 2007/2008

    Where I used to work we made a script for each user as they wanted different toolbars. Toolbar layer show Viewport show and so on I have a install lsp that does all the work like adding menu's support paths etc. I save the final workspace as the user name. If you go to options after setting everything up you can Export a profile, this makes a ARG file save it somewhere, you can also import a ARG file.
  25. BIGAL

    Text content sync

    A couple of suggestions. ; (prompt “\nSelect the SET TEXT or MTEXT: “) (setq set (car (entsel “\nSelect the SET TEXT or MTEXT: “))) If you want to force a selection of a certain type use SSGET as you have done in your code further down. (setq set (ssname (ssget ‘((0 . “TEXT,MTEXT”))) 0)) Better still have a look at this link. https://www.lee-mac.com/ssget.html Don't use "set", it is a reserved word and is used in lisp to do just that "set a value" rather than setq. Will try to make some time to look at your code.
  26. Compare d1 and d2 when it is trapezoid. If they are equal, then it is an parallelogram. For a quick solution, just replace the trapezoid formula, somewhere around line 160 in your original code (if (equal d1 d2 1e-4) (strcat label (itoa (setq count (1+ count))) " = " (rtos d1 2 2) " x " (rtos h 2 2) " = " (rtos surf 2 2) " t.µ.\\P" ) (strcat label (itoa (setq count (1+ count))) " = 1/2 x (" (rtos d1 2 2) " + " (rtos d2 2 2) ") x " (rtos h 2 2) " = " (rtos surf 2 2) " t.µ.\\P" ) )
  27. David Devitt

    Table Building Mode - AutoCAD 2007/2008

    Looks very promising; I'll check it out - thanks!
  28. SLW210

    Table Building Mode - AutoCAD 2007/2008

    Windows rollback might work. First see this... https://forums.augi.com/showthread.php?63018-AutoCAD-LT-2008-missing-toolbars&s=c8de2eac9c2dc8adda3ce7d928c84c57&p=724183&viewfull=1#post724183
  1. Load more activity
×
×
  • Create New...