Author Topic: match text and LAYER  (Read 3733 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
match text and LAYER
« on: March 25, 2004, 08:25:09 AM »
hey guys i have this code which works good but the only thing i wanna add is for it to match the layer as well as the text string. how would i go about incorporating that into here?

Code: [Select]
(DEFUN C:QC (/ ETHING 1THING 2THING)

  (setq ETHING (entget (car (entsel "\nReplace this text: "))))
  (setq 1THING (entget (car (entsel "\nwith this text: ")))
        2THING (CDR (assoc 1 1THING))
  )

  (SETQ ETHING
         (SUBST (CONS 1 2THING)
                (ASSOC 1 ETHING)
                ETHING
         )
  )
;;;
  (SETQ ETHING
         (SUBST ;; place on current layer:
                ;; (cons 8 (getvar "CLAYER"))
                ;; .. or on 1THING's layer:
                (CONS 8 (cdr (assoc 8 1THING)))
                (ASSOC 8 ETHING)
                ETHING
         )
  )

;;;
  (ENTMOD ETHING)
  (PRINC)

) ;_ END

daron

  • Guest
match text and LAYER
« Reply #1 on: March 25, 2004, 08:33:37 AM »
You would need to add a whole new program to it. I have one that I believe I posted here. Maybe do a search for c:cdt in show your stuff. The thread is called Christmas present.

ELOQUINTET

  • Guest
match text and LAYER
« Reply #2 on: March 25, 2004, 09:13:21 AM »
thanks daron but i get this error when i run it. what could be out of whack. thanks man merry christmas  :lol:

ELOQUINTET

  • Guest
match text and LAYER
« Reply #3 on: March 25, 2004, 09:13:56 AM »
o sheesh i forgot the message  :oops:

Command: CDT
; error: no function definition: VL-UNDOBEGIN

SMadsen

  • Guest
match text and LAYER
« Reply #4 on: March 25, 2004, 09:25:55 AM »
Don't know about the error .. it comes from another routine than you posted.

As for the code you posted, C:QC, I believe it came up on another forum and was answered (coincidently by me). Here's what became of it:

Code: [Select]
(defun C:QC (/ ething 1thing entl nlay ntxt)
  (initget "Type")
  (cond
    ((setq ething (entsel "\nSelect text object to match or [Type]: "))
     (cond
       ((= ething "Type") (setq ntxt (getstring T "\nNew text: ")))
       ((and (vl-consp ething)
             (member (cdr (assoc 0 (setq entl (entget (car ething)))))
                     '("TEXT" "MTEXT")
             )
        )
        (setq ntxt (cdr (assoc 1 entl))
              nlay (cdr (assoc 8 entl))
        )
       )
     )
    )
  )
  (and
    ntxt
    (> (strlen ntxt) 0)
    (while (setq 1thing (entsel "\nSelect text to change: "))
      (setq entl (entget (car 1thing)))
      (cond ((assoc 3 entl)
             (princ
               "\nThis version only supports max. 250 character MTEXTs"
             )
            )
            ((setq entl (subst (cons 1 ntxt) (assoc 1 entl) entl))
             (if nlay
               (setq entl (subst (cons 8 nlay) (assoc 8 entl) entl))
             )
             (entmod entl)
            )
      )
    )
  )
  (princ)
)

daron

  • Guest
match text and LAYER
« Reply #5 on: March 25, 2004, 09:30:35 AM »
Did you happen to download the needed files? Look here.
Notice in the cdt code that there are three comments ; that say ;for this... this... and this...

ELOQUINTET

  • Guest
match text and LAYER
« Reply #6 on: March 25, 2004, 09:35:40 AM »
hey madsen tried out yours and it does match the text layers but is there a way to make the leader line be changed as well or then be able to select the leader. i use different layers for different scales and freeze them in viewports so this is a problem. thanks

SMadsen

  • Guest
match text and LAYER
« Reply #7 on: March 25, 2004, 10:07:21 AM »
Yes, and there is a way to make it support MTEXT with more than 250 characters, too. It can be tweaked to do anything you want but I'm not gonna write it.
When you write the changes, you're welcome to post the questions that might pop up in the process.