char limit for entmake text?

Discussion in 'AutoCAD' started by cwitt, Jan 17, 2005.

  1. cwitt

    cwitt Guest

    I have an existing mtext with 2077 char's.. but EVERY time i try to
    edit it with lisp, and re-create it with entmake.. it is deleted.

    If i split it into 2 parts, then it works fine, but it refuses to work
    "as is".

    so i'm left assuming that there is a char limit to entmake for text (or
    rather mtext).

    Am I wrong?
     
    cwitt, Jan 17, 2005
    #1
  2. cwitt

    Jürg Menzi Guest

    Hi cwitt

    Check DXF-Help for MTEXT...
    Group Code 1:
    Text string. If the text string is less than 250 characters, all characters
    appear in group 1. If the text string is greater than 250 characters, the
    string is divided into 250 character chunks, which appear in one or more
    group 3 codes. If group 3 codes are used, the last group is a group 1 and
    has fewer than 250 characters

    Group Code 3:
    Additional text (always in 250 character chunks) (optional)

    Cheers
     
    Jürg Menzi, Jan 17, 2005
    #2
  3. cwitt

    cwitt Guest

    yes, I am aware of that....

    When creating mtext you can put the whole text string into code 1 (no
    matter how long).. and cad will separate it into groups 3 and 1 as required.

    Regardless that wasn't my question.. (but thanks for replying anyway).
     
    cwitt, Jan 17, 2005
    #3
  4. cwitt

    Jeff Mishler Guest

    Evidently you CAN"T put the whole string into group 1. Maybe there is a
    glitch that allows you to do so up to a certain length, but Jurg's advice is
    correct. And since it is NOT documented that you can do as you are, you
    really shouldn't expect any one to know the answer. To be safe, follow what
    the docs tell you. Better yet, use ActiveX and you will never need to worry
    about it.

    Here's how I used to do this prior to converting to ActiveX:

    (setq test (car (entsel "\nSelect Text: ")))
    (setq txtstr "");initialize variable
    (setq ent (entget test))
    (foreach x ent ;put together all of the group 3 values
    (if (= 3 (car x))
    (setq txtstr (strcat txtstr (cdr x)))
    )
    )
    (setq txtstr (strcat txtstr (cdr (assoc 1 ent))));add the group 1 value
    (setq ent (vl-remove-if '(lambda (x)
    (= 3 (car x))
    )
    ent));strip out the group 3 lists
    ;(setq txtstr "modify your textstring with a lot of characters.....")
    ;;now add the rest of the text back.....
    (setq newent nil)
    (while (> (strlen txtstr) 250);;split into small chunks for group 3 values
    (setq newent (cons (cons 3 (substr txtstr 1 250)) newent))
    (setq txtstr (substr txtstr 251))
    )
    (setq newent (cons (cons 1 txtstr) newent));;append the last chunk as a
    group 1
    (setq newent (reverse newent));;flip it around
    (setq ent (vl-remove-if '(lambda (x)
    (= 1 (car x))
    )
    ent));remove the old group 1
    (setq ent (append ent newent));add thge new list to the entity
    (entmod ent);modify it
     
    Jeff Mishler, Jan 17, 2005
    #4
  5. The limit seems to happen at 2048 characters.
    I can entmake a piece of mtext (using group
    code 1 for the string) up to 2047 characters
    without problem.

    Using 2005 here, don't have a previous version
    to test with.
     
    Jason Piercey, Jan 17, 2005
    #5
  6. cwitt

    cwitt Guest

    Thank you.

    I'll have to work around that.
     
    cwitt, Jan 17, 2005
    #6
  7. You're welcome. You can use activeX methods
    (as Jeff suggested) without this problem.

    Example of adding text to modelspace.

    (vlax-invoke
    (vla-get-modelspace
    (vla-get-activedocument
    (vlax-get-acad-object)))
    'addmtext
    '(0.0 0.0 0.0)
    1.0
    "YourTextHere"
    )
     
    Jason Piercey, Jan 17, 2005
    #7
  8. cwitt

    cwitt Guest

    Very nice lisp.. that should come in handy.

    thank you.
     
    cwitt, Jan 17, 2005
    #8
  9. cwitt

    cwitt Guest

    ... how do you control all the other mtext options?

    masks, height, color, layers.. etc.
     
    cwitt, Jan 17, 2005
    #9
  10. (setq
    object
    (vlax-invoke
    (vla-get-modelspace
    (vla-get-activedocument
    (vlax-get-acad-object)))
    'addmtext
    '(0.0 0.0 0.0)
    1.0
    "YourTextHere"
    )
    )

    (vla-put-backgroundfill object :vlax-true)
    (vla-put-height object 1.0)
    (vla-put-color object 6)
    (vla-put-layer object "0")

    etc....
     
    Jason Piercey, Jan 17, 2005
    #10
  11. cwitt

    cwitt Guest

    were can I get a list of all the vla-put-? variables?.. and know what
    ones apply to what type of objects?.. (the cad help is no help)

    One of the many reasons for asking this is .. "masks" have a few
    variables that need to be set.. etc.
     
    cwitt, Jan 17, 2005
    #11
  12. Help -> Developer Help -> ActiveX and VBA Reference.

    Or

    You can use the Apropos button within VLIDE window,
    it looks like this (A), type in vla- and press OK.
     
    Jason Piercey, Jan 17, 2005
    #12
  13. cwitt

    cwitt Guest

    "You can use the Apropos button within VLIDE window, it looks like this
    (A), type in vla- and press OK."

    NICE!! Thank you.
     
    cwitt, Jan 17, 2005
    #13
  14. cwitt

    cwitt Guest

    one last question..

    do you know if it is possible to alter the mask settings with this
    method? (All I can find, suggests you can only turn it on/off).
     
    cwitt, Jan 17, 2005
    #14
  15. You're welcome.
     
    Jason Piercey, Jan 17, 2005
    #15
  16. I'm uncertain. I think the other properties are accessed
    via xdata, but haven't examined it in any depth. I've seen
    some other (vanilla) code posted in these forums that deal
    with the background mask but I am also uncertain how
    detailed that is.

    PS: Try the following link for that vanilla code

    http://hyperpics.com/customization/autolisp/autolisp_downloads.htm
     
    Jason Piercey, Jan 17, 2005
    #16
  17. cwitt

    cwitt Guest

    Thanks,

    But the lisp I have for dealing with it works as-is. I was just hoping
    that vla would have a way of doing it so I could do a 100% switch rather
    than part vla and part lisp.

    Thanks again.
     
    cwitt, Jan 17, 2005
    #17
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.