Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/14/2023 in all areas

  1. like Steven said explode,overkill, purge this only removes it from model/paper space but then you have to detach the reference so its "removed" from the drawing. I think it would still show up in "External refrences" like this. Here is something Tharwat made.
    2 points
  2. FWIW, You should move the vlax-3d-point into the loop so it does not error out. (defun c:pp2 (/ nr str ip) (setq nr (itoa (getint "\nEnter number: ")) str (strcat "{\\L" nr " - " nr "}") ) (while (setq ip (getpoint "\nPick Insertion Point: ")) (vla-addmtext (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))) (vlax-3d-point ip) 0 str ) ) (princ) )
    2 points
  3. @EnM4st3r Nothing came of it... @EnM4st3r You need to start writing, and then select from the drop-down list
    1 point
  4. @Nikon you can also add a while loop so you can continue the placement. Dont know if that would be useful: (defun c:pp2 (/ nr str ip) (setq nr (itoa (getint "\nEnter number: ")) str (strcat "{\\L" nr " - " nr "}") ) (while (setq ip (vlax-3d-point (getpoint "\nPick Insertion Point: "))) (vla-addmtext (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))) ip 0 str) ) (princ) )
    1 point
  5. like this? (defun c:pp2 (/ nr str ip) (setq nr (itoa (getint "\nEnter number: ")) str (strcat "{\\L" nr " - " nr "}") ip (vlax-3d-point (getpoint "\nPick Insertion Point: ")) ) (vla-addmtext (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))) ip 0 str) (princ) )
    1 point
  6. Benefit for that way is it retains any other formatting in the text string, (such as mtext colour over rides (except in the required text portion), italics, and so on) and can be used to replace the text if it is in a larger text block
    1 point
  7. That's a easy fix, ta. (defun c:test ( / MyEnt MyEntGet MyTExt MyStart OldNumber NewNumber NewText) (vl-load-com) (setq MyEnt (car (entsel "\nSelect Text"))) (while ;; while loop, checking that text was selected (and (/= (cdr (assoc 0 (entget MyEnt))) "TEXT") (/= (cdr (assoc 0 (entget MyEnt))) "MTEXT") ) (princ "\nWell, that isn't text is it now? ") (setq MyEnt (car (entsel "Please select Text"))) ) (setq MyEntGet (entget MyEnt)) ; get text entity definition (setq MyText (cdr (assoc 1 MyEntGet))) ; get text string (setq MyStart (vl-string-search "-" MyText)) ; look for first instance of "-" in text string. Error check it exists? (setq NewNumber (getstring "\nEnter New Number : " t)) ; ask for replacement number, t to allow for spaces in text (if (wcmatch MyText "*#`-#*") (setq OldNumber (substr MyText (- MyStart 0) 3))) ; for 0-0 to 9-9 (if (wcmatch MyText "*##`-##*") (setq OldNumber (substr MyText (- MyStart 1) 5))) ; for 10-10 to 99-99 (if (wcmatch MyText "*###`-###*") (setq OldNumber (substr MyText (- MyStart 2) 7))) ; for 100-100 to 999-999 (if (wcmatch MyText "*# `- #*") (setq OldNumber (substr MyText (- MyStart 1) 5))) ; for 0-0 to 9-9 (if (wcmatch MyText "*## `- ##*") (setq OldNumber (substr MyText (- MyStart 2) 7))) ; for 10-10 to 99-99 (if (wcmatch MyText "*### `- ###*") (setq OldNumber (substr MyText (- MyStart 3) 9))) ; for 100-100 to 999-999 (if (= OldNumber nil) ; if text contained a valid format, update text (princ "Text string does not contain 'xx-xx' format text. Going for a nap now.") (progn (if (wcmatch MyText "*#`-#*") (setq NewText (vl-string-subst (strcat NewNumber "-" NewNumber) OldNumber MyText)) ; substitute new text in (setq NewText (vl-string-subst (strcat NewNumber " - " NewNumber) OldNumber MyText)) ; substitute new text in ) (vla-put-TextString (vlax-ename->vla-object MyEnt) Newtext) ) ) (princ) ; exit quietly )
    1 point
  8. this should work for both (defun c:pp(/ el nr str) (setq el (entget (car (entsel "pick (m)text"))) nr (itoa (getint "enter number")) ) (cond ((wcmatch (cdr (assoc 0 el)) "MTEXT") (setq str (strcat "{\\L" nr " - " nr "}")) ) ((wcmatch (cdr (assoc 0 el)) "TEXT") (setq str (strcat "%%u" nr " - " nr)) ) (t (alert "thats no text obj") (exit) ) ) (entmod (subst (cons 1 str) (assoc 1 el) el)) )
    1 point
  9. Like this? (defun c:pp() (setq el (entget (car (entsel "pick (m)text"))) nr (itoa (getint "enter number")) el (entmod (subst (cons 1 (strcat nr " - " nr)) (assoc 1 el) el))) )
    1 point
×
×
  • Create New...