Help modifying this Please

Discussion in 'AutoCAD' started by cadman_meg, Mar 5, 2004.

  1. cadman_meg

    cadman_meg Guest

    I have a routine that will automatically set the text style and layer upon clicking on a peice of desired text. It looks like this:

    ;CODING STARTS HERE
    ; to make a texstyle and a layer current by selecting a single text
    ;; THS - THis Style
    (defun c:ths ( / ennn )
    (if
    ( = "TEXT" (cdr (assoc 0 (setq ennn (entget (car (entsel "\Select a
    text")))))))
    (progn
    (setvar "clayer" (cdr (assoc 8 ennn)))
    (command "_style"
    (cdr (assoc 7 ennn)) ""
    (cdr (assoc 40 ennn))
    (cdr (assoc 41 ennn))
    ( * (cdr (assoc 51 ennn)) ( / 360 ( * 2 PI )))
    "N" "N" "N"
    )
    (setvar "textsize" (cdr (assoc 40 ennn)))
    ) ;; end progn
    (alert "This is not a single text")
    ) ;; end if
    ) ;; end defun
    (prompt "\nUse \"ths\" to make a style current") (princ)
    ;CODING ENDS HERE

    I have taken it as far as I can and was hoping someone could help me edit it by adding it being able to use mtext as a selection and also removing it setting the text height in the style dialog box. I like to keep that at zero at all times. Hope to hear from someone soon. Thanks.
     
    cadman_meg, Mar 5, 2004
    #1
  2. cadman_meg

    Rudy Tovar Guest

    (defun c:me (/ e d l y)
    (setq e (entsel "\nSelect Text: "))
    (if e
    (progn
    (setq d (entget (car e))
    l (cdr (assoc 8 d))
    y (cdr (assoc 0 d))
    )
    (if (or (= y "TEXT")
    (= y "MTEXT")
    )
    (progn
    (setvar "clayer" l)
    (setvar "textstyle" (cdr (assoc 7 d)))
    )
    )
    )
    )
    (princ)
    )

    --

    AUTODESK
    Authorized Developer
    www.Cadentity.com
    MASi


    clicking on a peice of desired text. It looks like this:
    it by adding it being able to use mtext as a selection and also removing it
    setting the text height in the style dialog box. I like to keep that at zero
    at all times. Hope to hear from someone soon. Thanks.
     
    Rudy Tovar, Mar 5, 2004
    #2
  3. cadman_meg

    Rudy Tovar Guest

    Sorry, simply set the height via activeX


     
    Rudy Tovar, Mar 5, 2004
    #3
  4. (member (cdr (assoc 0 (setq ennn (entget (car (entsel "\Select a
    text")))))) '("TEXT" "MTEXT"))

    Also, since mtext does not have a dxf code 51 you will need to use
    and if statement to set that value.

    (if (assoc 51 ennn)
    ( * (cdr (assoc 51 ennn)) ( / 360 ( * 2 PI )))
    0
    )
    --
    Ken Alexander
    Acad2004
    Windows2000 Prof.

    "We can't solve problems by using the same kind
    of thinking we used when we created them."
    --Albert Einstein

    layer upon clicking on a peice of desired text. It looks like this:
    me edit it by adding it being able to use mtext as a selection and
    also removing it setting the text height in the style dialog box. I
    like to keep that at zero at all times. Hope to hear from someone
    soon. Thanks.
     
    Ken Alexander, Mar 5, 2004
    #4
  5. One more thing. You should never use entget inline with entsel. If
    you miss a pick then your routine will puke.

    (if (setq ent (entsel))
    (setq entdata (entget (car ent)))
    )

    --
    Ken Alexander
    Acad2004
    Windows2000 Prof.

    "We can't solve problems by using the same kind
    of thinking we used when we created them."
    --Albert Einstein
     
    Ken Alexander, Mar 5, 2004
    #5
  6. cadman_meg

    Rudy Tovar Guest

    ME is one.

    All you have to do is call the dimstyle and return that 'name' and set the
    value of height to zero.

    vla-get-activetextstyle - acadobject - vla-put-height.

    Simple steps.

    I understand this is over your head, but take a stab at it and we'll direct
    you.

    It's really not that hard, just a little confusing for some, don't worry
    we've all been there.

    --

    AUTODESK
    Authorized Developer
    www.Cadentity.com
    MASi

    it further, but you guys are taking it beyond my knowledge, can one of you
    piece it together and explain what you are doing? Don't know much of Active
    X. Am trying to learn though. In regards to adding the additional routine,
    "me", I want it all to be one. Thanks.
     
    Rudy Tovar, Mar 5, 2004
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.