hi
can anybody help me on this....
is there any lisp program like a find & replace option
i want to replace blocks in place of text.
thanks.
|
|
|
hi
can anybody help me on this....
is there any lisp program like a find & replace option
i want to replace blocks in place of text.
thanks.
"How we think determines what we do, and what we do determines what we get."
Sincpac C3D ~ Autodesk Exchange Apps
Computer Specs:
Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000
If you have a technical question, please find the appropriate forum and ask it there.
You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
jUSt
"How we think determines what we do, and what we do determines what we get."
Sincpac C3D ~ Autodesk Exchange Apps
Computer Specs:
Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000
Thanks blackbox for "BLOCKREPLACE"
But I didn’t get my answer. I checked “blockreplace” command is working for blocked object only. I need the program for text format to block object. Because In my drawing I have numbers like a 48, 65, 113.... in text format on different locations. I want to replace those numbers with some blocks.
"How we think determines what we do, and what we do determines what we get."
Sincpac C3D ~ Autodesk Exchange Apps
Computer Specs:
Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000
Last edited by BlackBox; 2013-07-23 at 08:16 PM.
Try this ...
Code:(defun c:Test (/ b ss i e) ;;; Tharwat 27. 07. 2013 ;;; (if (and (setq b (getstring t "\n Specify Block name :")) (if (not (tblsearch "BLOCK" b)) (progn (alert "Block name is not found in drawing !!") nil ) t ) (progn (princ "\n Select texts to replace with a Block :") (setq ss (ssget "_:L" '((0 . "*TEXT")))) ) ) (repeat (setq i (sslength ss)) (setq e (ssname ss (setq i (1- i)))) (if (entmake (list '(0 . "INSERT") (cons 2 b) (assoc 8 (entget e)) (assoc 10 (entget e)) '(41 . 1.) '(42 . 1.) '(43 . 1.) ) ) (entdel e) ) ) ) (princ) )
Thank you very much…
I checked with this lisp the problem is I need to select the text then it will replace with the block.
But I don’t want select the text one by one. I need if I give a number it should find from selected area or (from the same .dwg file) then replace those numbers with block according to text alignment.
Or at least update the program for me. The text should be replace with block according to text align.
Please help me on this........
Thanks.
This routine prompts the user for text to search for, supports WCMATCH (i.e., ""*Text To Find*"), and is case sensitive... If a valid selection is made on the current tab, the user is then prompted to either select the desired block, or enter a valid block name, which is then inserted, rotated, and placed on the same layer as the source text entity (RText not included)... This routine also supports UNDO:
Code:(vl-load-com) (defun c:FOO (/ *error* match block acDoc oSpace) (defun *error* (msg) (if acDoc (vla-endundomark acDoc)) (cond ((not msg)) ; Normal exit ((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit) ((princ (strcat "\n** Error: " msg " ** "))) ; Fatal error, display it ) (princ) ) (if (and (princ "\n** Search supports \"WCMATCH\", and is case sensitive ** ") (setq match (getstring T "\nEnter text to find and replace with block: " ) ) (ssget "_x" (list '(0 . "MTEXT,TEXT") (cons 1 match) (cons 410 (getvar 'ctab)) ) ) (or (and (setq block (car (entsel "\nSelect block to replace text, <Enter> for name: " ) ) ) (= "INSERT" (cdr (assoc 0 (entget block)))) (setq block (vla-get-effectivename (vlax-ename->vla-object block))) ) (and (setq block (getstring T "\nEnter name of block to replace text: " ) ) (tblsearch "block" block) ) ) ) (progn (vla-startundomark (setq acDoc (vla-get-activedocument (vlax-get-acad-object))) ) (setq oSpace (vlax-get acDoc (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace ) ) ) (vlax-for x (vla-get-activeselectionset acDoc) (vla-put-layer (vla-insertblock oSpace (vla-get-insertionpoint x) block 1. 1. 1. (vla-get-rotation x) ) (vla-get-layer x) ) (vla-delete x) ) ) (cond (block (prompt "\n** Invalid block ** ")) (match (prompt "\n** No matching text found ** ")) ) ) (*error* nil) )
"How we think determines what we do, and what we do determines what we get."
Sincpac C3D ~ Autodesk Exchange Apps
Computer Specs:
Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000