How to know real text width, reading from a dxf file ?

Discussion in 'AutoCAD' started by JoseMaria, Feb 5, 2006.

  1. JoseMaria

    JoseMaria Guest

    I am developing software that reads from dxf files and processes the
    results. I need to know the real height and width of text elements.

    With height there is no problem since I can retrieve it. It appears
    with code 40 in the dxf file.

    The problem is width. I find no means to know the real text width. I
    can read from the dxf file the "width / height ratio" ( code 41 ) ,
    multiply this ratio by the the height and the number of characters, but
    I have been disappointed to see that this is not exact. I have seen for
    instance text elements with a "width / height ratio" of 1 with digits
    which have a height much greater than width. I usually handle text
    elements which display numbers, and their digits are usually drawn
    taller than wider, even if they show a width/height ratio of 1 or
    similar.

    Any help would be appreciated, since I need to know what area these
    elements cover.

    Thanks
     
    JoseMaria, Feb 5, 2006
    #1
  2. JoseMaria

    bojar Guest

     
    bojar, Feb 5, 2006
    #2
  3. JoseMaria

    bojar Guest

    Hi Jose,
    you can measure the length of any string using dxf codes 10 and 11
    Good Luck.
     
    bojar, Feb 5, 2006
    #3
  4. JoseMaria

    JoseMaria Guest

    Thanks for your post.
    10 is reliable as the origin X coordinate.
    11 should be the end X coordinate but is not reliable, sometimes it is
    set to 0, even if obviously this not the case.
     
    JoseMaria, Feb 6, 2006
    #4
  5. JoseMaria

    bojar Guest

    Hi Jose,
    Code 72 must be non zero. Maybe you can play with that. Also check out
    the 'textbox' function in lisp.Good luck with that, you'll have to
    write a subroutine which does this. If you are still having a hard
    time, I can send you an example routine which inserts a block with
    attributes, and than draws a 3d face above each attribute (whatever the
    length), to "wipe-out" whatever is under the text. You can e-mail me
    directly, if you like. Bojar
     
    bojar, Feb 6, 2006
    #5
  6. JoseMaria

    JoseMaria Guest

    Hi Jose,
    Ok this helps, If I see 72 is non zero I can trust the 11 code, and
    this is the case in most drawings, but the problem persists in those
    cases in which code 72 is 0

    I can't decide if 72 is informed or no, since I only process dxf files,
    I can't decide what is in those files.

    For the same reason I don't think lisp helps me. What I want to do is
    to be able to process a dxf file, and get the information (such as real
    text dimensions on the drawing) from this file, the user may not even
    have autocad ( And I think autocad is necessary for executing your lisp
    routine )

    Thank you very much for your help
     
    JoseMaria, Feb 7, 2006
    #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.