Defining a text style with underline

Discussion in 'AutoCAD' started by John Cutler, Feb 25, 2004.

  1. John Cutler

    John Cutler Guest

    Hi, all --

    I'm working in A2K Map...

    Is there a way to:

    (a) define a text style wherein the mtext is underlined as part of the
    definition?

    or (b) a LISP routine that will, once executed, underline any mtext that is
    left-clicked (and end the routine with <Esc>)?

    thanks --

    John

    )))))))
    (o)-(o)
    -----oo0---(_)---0oo--------------------------
    | | | | | | | | | | | | | | | | | |
    | | | | | | | | | | | | | | | | | |

    John Cutler -- Mapping/GIS Director,
    Ozark Regional Land Trust
    (Ozark Bioregion - MO/AR/KS/OK)
    2435 Sweetwater Lane
    Mansfield MO 65704
    (417) 741-7363
     
    John Cutler, Feb 25, 2004
    #1
  2. John Cutler

    John Cutler Guest

    Allow me to refine this request a bit...

    BACKGROUND: someone gave me a LISP routine that allows me to click on a
    series of points and automatically write mtext Y,X coordinates next to each
    point.

    NOW: I want to click on each Y,X mtext label, consult my GPS data
    printout, and type a *new* mtext (the GPS waypoint #) to *replace* that Y,X
    label.

    EXAMPLE: the lat/long mtext (Y,X) label next to a point says:

    36.82426,
    -92.35469

    I look at my GPS data list for this value pair, which shows "094" as the GPS
    waypoint number.

    I want to type the 094 as a *replacement* mtext for the lat/long mtext
    values and have the 094 mtext be *underlined*.

    Then prompt to click on the next Y,X mtext pair...

    ======================================

    To get really fancy, and automate it..... (I'm a programmer, but not a LISP
    programmer...!)

    The waypoints data file is called something like c:\...\...\WAYGARDEN.TXT.
    There are a number of such .txt files in a given folder.

    Waygarden.txt has 3 space-delimited fields within each record (can be made
    comma-delimited, tab-delimited, or anything else you desire). The headings
    "Pt # Lat (Y) Long (X)" are not included in the text file, which looks
    like:

    Pt # Lat (Y) Long (X)
    ------------------------------
    094 36.82426 -92.35469
    095 36.82435 -92.35489
    096 36.82425 -92.35487

    ...... and so on.

    For this example, all the Y,X *points* are already plotted on a layer called
    WAYGARDEN, and the corresponding *mtext* is already on the layer WAYGARDEN
    TEXT, which is the current layer.

    I'd start the LISP routine from a custom tool bar button, and at the prompt
    -- type the appropriate path & filename of the GPS .txt file (which would
    then be opened for searching).
    -- the .txt file path always has the form
    "C:\ORLT\project\MAPS\name.TXT"
    -- "project" and "name" are the only variables -- "project" can be one or
    multiple words, such as SMITH or HAWK HILL, "name" is always a single word.

    The routine would

    -- search WAYGARDEN.TXT for the (first) pair of Y,X values on the current
    layer,
    -- automatically *substitute* the matching GPS point # for the Y,X mtext,
    -- underline the GPS #,
    -- and loop back to "-- search...", until --

    -- all Y,X mtext on the current layer has been replaced by the matching GPS
    # mtext, and the routine would terminate.

    thanks, J
     
    John Cutler, Feb 25, 2004
    #2
  3. John Cutler

    Jeff Mishler Guest

    Well, the first part is rather simple, load then type "chg_undrln" to run:

    (defun c:chg_undrln (/ ent str newstr)
    (while (setq ent (entsel))
    (setq ent (vlax-ename->vla-object (car ent)))
    (if (= (strcase (vla-get-objectname ent)) "ACDBMTEXT")
    (progn
    (setq str (vla-get-textstring ent))
    (while (wcmatch str "*\\P*")
    (setq str (vl-string-subst " " "\\P" str))
    )
    (princ (strcat "\nOld text: " str))
    (setq newstr (getstring "\nNew text: "))
    (vla-put-textstring ent (strcat "\\L" newstr))
    )
    (princ "\nNot an Mtext entity, try again....")
    )
    )
    (princ)
    )

    To completely automate it may/will take some time & thought.......

    What do you program?

    HTH,
    Jeff
     
    Jeff Mishler, Feb 26, 2004
    #3
  4. John Cutler

    Jeff Mishler Guest

    Could you post a small sample dwg & txt file?

    I think I have a working lisp, but want to check it on something more than
    my simple 3 line test file....

    Jeff
     
    Jeff Mishler, Feb 26, 2004
    #4
  5. John Cutler

    John Cutler Guest

    Jeff --

    Thinking I could avoid burden on the newsgroup, I sent a couple of response
    emails to and they bounced back as "undeliverable" -- so
    I'm resending the content via the newsgroup....

    EMAIL 1 ---

    For the last 19 years I've been designing custom database applications
    (mainly for businesses) using an application development package called
    "SmartWare".

    SmartWare was originally created in the late '70s by a group in Kansas City.
    It was "Windows" before "Windows" came along -- it contains an integrated
    relational database, spreadsheet and wordprocessor that all talk to each
    other (like Access, Excel, and Word).

    SmartWare also has its own internal programming language that reminds me of
    FORTRAN or BASIC (the languages I used in the late 60s).

    Over the years, SmartWare has gone through about a dozen upgrades from an
    original DOS version, to Windows and LINUX versions. SmartWare's literature
    claims it is comparable to Oracle.

    ---------------------------

    My commercial programming career is gradually fading out, and for the last 4
    years I've been setting up and operating a "GIS department" for a small
    non-profit organization that does land conservation work in the Ozarks (MO,
    AR, KS, OK). I've written a number of SmartWare database applications for
    the organization; I continue to upgrade these and write new apps.

    So far, my use of AutoCAD Map (simple maps, and some blueprints for
    construction) has not required any database connectivity, but SmartWare has
    its own ODBC drivers, and because I think it may have application in the
    future, I'm moving toward connecting it to AutoCAD... (SmartWare will also
    export/import directly to a dBASE format which is (as I recall) one of the
    "native" database formats recognized by AutoCAD).

    For example, just a brief skimming of Scott McFarlane's "AutoCAD Database
    Connectivity" makes me think I could accomplish the *automatic* insertion
    and labeling of GPS waypoints with a database of these point (which database
    already exists in SmartWare).

    I'd love to be a LISP programmer, and have begun (twice) to learn it, but
    it's a matter of "use it or lose it" -- I suspect that I wouldn't do enough
    programming to retain syntax, strategy, etc.

    And there's far too much "regular work" to do in my job as it is -- I *may*
    be keeping even with the work load, but I'm certainly *not gaining* on the
    backlog (there was no "GIS department" for the first 15 years of the
    organization's existence).

    I'll give your initial LISP routine "chg_undrln" a try and report back....

    EMAIL 2 ---

    FYI - I loaded and ran chg_undrln.lsp -- works very well! This will greatly
    speed up my work. Thanks...!

    Per my previous email, I will send a sample .dwg and a lat/long text file
    for testing, but if you don't want to spend the time making the "automation"
    work, we can stop with chg_undrln.lsp.

    (As a programmer, it's hard to resist the temptation to automate
    something -- when a client says "can you make it do xyz?", I generally have
    to meet the challenge!)


    --
    John

    )))))))
    (o)-(o)
    -----oo0---(_)---0oo--------------------------
    | | | | | | | | | | | | | | | | | |
    | | | | | | | | | | | | | | | | | |

    John Cutler -- Mapping/GIS Director,
    Ozark Regional Land Trust
    (Ozark Bioregion - MO/AR/KS/OK)
    2435 Sweetwater Lane
    Mansfield MO 65704
    (417) 741-7363
     
    John Cutler, Feb 27, 2004
    #5
  6. John Cutler

    Jeff Mishler Guest

    Sorry John,
    My eamil address is what is posted if you remove the USES from it.....just a
    small way to cut back on the amount of SPAM I get....

    Jeff
     
    Jeff Mishler, Feb 27, 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.