Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/31/2024 in all areas

  1. Suppose that there are discrete texts in different places of the layout, for example, apple, orange, banana, lemon. I need a lisp that after typing the command, I do the first right click on the apple, and by doing the rest of the right clicks on other fruits, they turn into apples. Lisp will replace any number of selected texts with "apple" (for example)... First, select the replacement texts, and then specify the sample text. replace.lsp
    1 point
  2. It is a simple task to replace a new string in an existing string, the issue here is Mtext can have multiple lines of text, is your mtext only 1 line ? Also it can have various controls in the text font style, color, bold and so on. Please confirm or post a sample dwg may be best use wblock to make a small dwg if necessary. This is for just single text no mtext controls. (defun c:test ( / obj ent txt) (setq obj (vlax-ename->vla-object (car (entsel "\nSelect a text object ")))) (setq txt (vlax-get obj 'textstring)) (while (setq ent (car (entsel "\nPick text to change Enter to exit "))) (vlax-put (vlax-ename->vla-object ent) 'textstring txt) ) (princ) )
    1 point
  3. Try this mate: (defun c:BlockOut (/ *error* lst2str FILE IATT IBLK INFO OFILE SS) (vl-load-com) (defun *error* (msg) (and ofile (close ofile)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ)) (defun lst2str (lst del) (if (cdr lst) (strcat (car lst) del (lst2str (cdr lst) del)) (car lst))) (if (and (ssget '((0 . "INSERT"))) (setq file (getfiled "Output File" "" "csv" 1))) (progn (vlax-for obj (setq ss (vla-get-ActiveSelectionSet (vla-get-ActiveDocument (vlax-get-acad-object)))) (setq iBlk (list (if (vlax-property-available-p obj 'EffectiveName) (vla-get-EffectiveName obj) (vla-get-Name obj)) (vla-get-Handle obj))) (if (eq :vlax-true (vla-get-HasAttributes obj)) (foreach att (vlax-invoke obj 'GetAttributes) (setq iAtt (cons (list (vla-get-TagString att) (vla-get-Handle att) (vla-get-TextString att)) iAtt)))) (setq Info (cons (cons iBlk iAtt) Info) iBlk nil iAtt nil)) (vla-delete ss) (setq ofile (open file "w")) (foreach b Info (write-line (lst2str (car b) ",") ofile) (foreach a (cdr b) (write-line (lst2str a ",") ofile)) (write-line "" ofile)) (setq ofile (close ofile)))) (princ))
    1 point
×
×
  • Create New...