Author Topic: LM:EditBox von Lee Mac  (Read 4594 times)

0 Members and 1 Guest are viewing this topic.

Hugo

  • Bull Frog
  • Posts: 433
LM:EditBox von Lee Mac
« on: September 21, 2011, 07:55:59 AM »
I need help why does not the mtext and the DIMENSION to change.
Thank you

Brauche Hilfe warum funktioniert der MTEXT und die DIMENSION nicht zum ändern.
Danke

Code: [Select]
(defun c:qe ( / en st )
  (if
    (and
      (setq en (car (nentsel)))
      (wcmatch (cdr (assoc 0 (setq en (entget en)))) "TEXT,ATTRIB,MTEXT,DIMENSION")
      (setq st (LM:EditBox (cdr (assoc 1 en))))
    )
    (entupd (cdr (assoc -1 (entmod (list (assoc -1 en) (cons 1 st))))))
  )
  (princ)
)



;;----------------------=={ Edit Box }==----------------------;;
;;                                                            ;;
;;  Displays a DCL Edit Box to obtain a string from the user  ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2011 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  string - initial value to display ("" for none)           ;;
;;------------------------------------------------------------;;
;;  Returns: Edit box contents if user pressed OK, else nil   ;;
;;------------------------------------------------------------;;

(defun LM:EditBox ( string / id )
  (and
    (< 0 (setq id (load_dialog "ACAD")))
    (new_dialog "acad_txtedit" id)
    (set_tile    "text_edit"  string)
    (action_tile "text_edit" "(setq string $value)")
    (if (zerop (start_dialog)) (setq string nil))
  )
  (if (< 0 id) (unload_dialog id))
  string
)




Lee Mac

  • Seagull
  • Posts: 12924
  • London, England
Re: LM:EditBox von Lee Mac
« Reply #1 on: September 21, 2011, 08:10:38 AM »
Use instead:

Code: [Select]
(defun c:qe ( / en st )
  (if
    (and
      (setq en (car (nentsel)))
      (wcmatch (cdr (assoc 0 (setq en (entget en)))) "TEXT,ATTRIB,MTEXT")
      (setq st (LM:EditBox (cdr (assoc 1 en))))
    )
    (entupd (cdr (assoc -1 (entmod (subst (cons 1 st) (assoc 1 en) en)))))
  )
  (princ)
)

But this function was not meant for MText or Dimensions, since formatting codes will be displayed in the Edit Box. Also, you will need to use 'entsel' for Dimensions, but this will consequently prevent selection of attribs.

Hugo

  • Bull Frog
  • Posts: 433
Re: LM:EditBox von Lee Mac
« Reply #2 on: September 21, 2011, 09:03:53 AM »

Thank you Lee for the quick response and change for mtext.

Too bad that you can not dim change a thing would be Great.   :-)

Danke Lee für die schnelle Antwort und änderung für Mtext.

Schade das man Dim nicht ändern kann wäre eine Tolle sache.

Lee Mac

  • Seagull
  • Posts: 12924
  • London, England
Re: LM:EditBox von Lee Mac
« Reply #3 on: September 21, 2011, 09:17:02 AM »
Thank you Lee for the quick response and change for mtext.

Too bad that you can not dim change a thing would be Great.   :-)

You can include Dimensions by changing 'nentsel' to 'entsel' (and adding *DIMENSION to the wildcard pattern), but by changing 'nentsel' to 'entsel' you will no longer be able to select Attributes.

Also, have a read of this regarding posting code. ;)

Hugo

  • Bull Frog
  • Posts: 433
Re: LM:EditBox von Lee Mac
« Reply #4 on: September 21, 2011, 09:42:08 AM »
Quote
You can include Dimensions by changing 'nentsel' to 'entsel' (and adding *DIMENSION to the wildcard pattern), but by changing 'nentsel' to 'entsel' you will no longer be able to select Attributes.



Thanks for the info.
I want to change the attributes also can.

Danke für die Info.
Ich will die Attribute auch ändern können.
« Last Edit: September 21, 2011, 10:08:53 AM by Hugo »

Lee Mac

  • Seagull
  • Posts: 12924
  • London, England
Re: LM:EditBox von Lee Mac
« Reply #5 on: September 21, 2011, 09:48:26 AM »
Quote
You can include Dimensions by changing 'nentsel' to 'entsel' (and adding *DIMENSION to the wildcard pattern), but by changing 'nentsel' to 'entsel' you will no longer be able to select Attributes.


Thanks for the info but I will also be able to change the ATT.

Danke für die Info ich will aber die ATT auch ändern können.

 :?  :?

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: LM:EditBox von Lee Mac
« Reply #6 on: September 21, 2011, 06:47:40 PM »
May I suggest checking out my CopyText routine (posted at http://www.theswamp.org/index.php?topic=37154.msg447629#msg447629 )

You could see how I select dimensions, text, attributes, tables (individual cells and crossing windows), mleaders with mtext AND mleaders with Blocks and perhaps integrate it into your routine.

Hugo

  • Bull Frog
  • Posts: 433
Re: LM:EditBox von Lee Mac
« Reply #7 on: September 22, 2011, 06:54:36 AM »
Thank you for cmwade77 Info

Unfortunately can not change them as well to the Lisp.


Danke cmwade77 für Info

Kann leider nicht so gut Lisp um das zu ändern.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: LM:EditBox von Lee Mac
« Reply #8 on: September 23, 2011, 12:23:14 PM »
How odd, it works here quite well, I use it all the time. I am wondering what error(s) are you getting?

Hugo

  • Bull Frog
  • Posts: 433
Re: LM:EditBox von Lee Mac
« Reply #9 on: September 23, 2011, 02:38:43 PM »
It all goes great, it is the only way I always have to change very many texts Atributte and Bem.
And everything should go easily and quickly.

It's been great for Marc because unfortunately I can not change dimension.

Es geht alles super, es ist nur so ich muss immer sehr viele Texte, Atributte und Bem ändern.
Und das sollte alles einfach und schnell gehn.

Das von Marc ist schon super leider kann ich da keinen Bemassung ändern. 

thuphong

  • Guest
Re: LM:EditBox von Lee Mac
« Reply #10 on: September 24, 2011, 05:29:01 AM »
You use a try:
(defun c:qe ( / en st )
  (if
   (progn
      (setq en (car (entsel)))
      (wcmatch (cdr (assoc 0 (setq en (entget en)))) "TEXT,MTEXT,DIMENSION,INSERT")
      (if (= (cdr (assoc 0 en)) "INSERT")
         (setq en (entget (car (nentsel "\nSelect 1 Attext for edit:  "))))
      )
      (setq st (LM:EditBox (cdr (assoc 1 en))))
   )
    (entupd (cdr (assoc -1 (entmod (subst (cons 1 st) (assoc 1 en) en)))))
  )
  (princ)
)
   

Hugo

  • Bull Frog
  • Posts: 433
Re: LM:EditBox von Lee Mac
« Reply #11 on: September 24, 2011, 07:23:59 AM »
@ thuphong

Hey thanks exactly what I wanted   :-D :-D

Super Danke genau das wollte ich

Lee Mac

  • Seagull
  • Posts: 12924
  • London, England
Re: LM:EditBox von Lee Mac
« Reply #12 on: September 24, 2011, 11:38:15 AM »
Try this instead:

Code: [Select]
(defun c:qe ( / en st )
    (if
        (and
            (setq en (nentsel))
            (wcmatch (cdr (assoc 0 (entget (car en)))) "ATTRIB,TEXT,MTEXT")
            (or
                (= 2 (length en))
                (eq "ATTRIB" (cdr (assoc 0 (entget (car en)))))
                (and
                    (wcmatch (cdr (assoc 0 (entget (car (last en))))) "*DIMENSION")
                    (setq en (last en))
                )
            )
            (setq st (LM:EditBox (cdr (assoc 1 (setq en (entget (car en)))))))
            (entmod (subst (cons 1 st) (assoc 1 en) en))
        )
        (entupd (cdr (assoc -1 en)))
    )
    (princ)
)

Hugo

  • Bull Frog
  • Posts: 433
Re: LM:EditBox von Lee Mac
« Reply #13 on: September 24, 2011, 01:27:29 PM »
Thank you Lee
Great as always  :-) :-) :-)

Danke Lee
Super wie immer

thuphong

  • Guest
Re: LM:EditBox von Lee Mac
« Reply #14 on: September 24, 2011, 10:08:30 PM »
Thank you very much, Lee. very good. :-D :-D

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: LM:EditBox von Lee Mac
« Reply #15 on: September 24, 2011, 11:09:24 PM »

I haven't run the code Lee, but I expect the textbox will display an empty string if the user selects an associative dimension.

I have some code posted somewhere here for handling associative dimensions .... beware that it won't be adequate to just use the 'measurement' property because the dimensiontext may be overwritten ...

Regards
Kerry
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Lee Mac

  • Seagull
  • Posts: 12924
  • London, England
Re: LM:EditBox von Lee Mac
« Reply #16 on: September 25, 2011, 08:00:29 AM »
Thank you Lee
Great as always  :-) :-) :-)

Thank you very much, Lee. very good. :-D :-D

Cheers guys  8-)

I haven't run the code Lee, but I expect the textbox will display an empty string if the user selects an associative dimension.

I have some code posted somewhere here for handling associative dimensions .... beware that it won't be adequate to just use the 'measurement' property because the dimensiontext may be overwritten ...

Hi Kerry,

I think I know what you are referring to as I have seen your thread detailing how to retrieve the correct text displayed by a dimension; however,  this program should only be modifying the TextOverride of the Dimension and so to my knowledge, shouldn't be affected.