Combining Fields in Mtext

Discussion in 'AutoCAD' started by RKLindner, Oct 13, 2004.

  1. RKLindner

    RKLindner Guest

    I've been trying to merge the contents of fields together to make it behave and show Sq. Ft. when selecting a polyline object in a drawing. What I can not seem to be able to do is get the contents to show the Sq. Ft. information but limiting the characters to 0 places, aka as shown in other posts by using the code of \f "%.0f" to force this setting. If I try this by itself and create the variable lin1 with this code in place of the other formatting in quotes, it works fine by keeping it to no place precision, but I get an echo of the square inch value, rather than Sq. Ft. (of course since I've stripped out that formatting). Is it possible to merge together the coding to keep 0 place precision AND Sq. Ft. output??

    Appreciate any pointers.. All you need is a polyline in a drawing and run the test lisp routine below

    (defun c:testfield ()
    (setq ar1 (entsel "\nSelect Area Boundary: "))
    (setq ar2 (car ar1))
    (setq tab (vlax-ename->vla-object ar2))
    (setq oba (vla-get-objectid tab))
    (setq tpt (getpoint "\nSelect Area Text Point: "))

    (setq lin1 (strcat "%<\\AcObjProp Object(%<\\_ObjId "
    (rtos oba 2 0)
    ">%).Area \\f \"%lu2%ct4%qf1 SQ. FT.\nClosed pline -\">%"))
    ;;; somehow merge the \f "%.0f" in here??

    (setq lin2 (strcat lin1 "%<\\AcObjProp Object(%<\\_ObjId "
    (rtos oba 2 0)
    ">%).Closed \\f \"%bl2 \">%"))

    (command "mtext" tpt "w" "0" lin2 "")
    )
     
    RKLindner, Oct 13, 2004
    #1
  2. AFAIK, no.

    --
    R. Robert Bell


    I've been trying to merge the contents of fields together to make it behave
    and show Sq. Ft. when selecting a polyline object in a drawing. What I can
    not seem to be able to do is get the contents to show the Sq. Ft.
    information but limiting the characters to 0 places, aka as shown in other
    posts by using the code of \f "%.0f" to force this setting. If I try this
    by itself and create the variable lin1 with this code in place of the other
    formatting in quotes, it works fine by keeping it to no place precision, but
    I get an echo of the square inch value, rather than Sq. Ft. (of course since
    I've stripped out that formatting). Is it possible to merge together the
    coding to keep 0 place precision AND Sq. Ft. output??

    Appreciate any pointers.. All you need is a polyline in a drawing and run
    the test lisp routine below

    (defun c:testfield ()
    (setq ar1 (entsel "\nSelect Area Boundary: "))
    (setq ar2 (car ar1))
    (setq tab (vlax-ename->vla-object ar2))
    (setq oba (vla-get-objectid tab))
    (setq tpt (getpoint "\nSelect Area Text Point: "))

    (setq lin1 (strcat "%<\\AcObjProp Object(%<\\_ObjId "
    (rtos oba 2 0)
    ">%).Area \\f \"%lu2%ct4%qf1 SQ. FT.\nClosed pline -\">%"))
    ;;; somehow merge the \f "%.0f" in here??

    (setq lin2 (strcat lin1 "%<\\AcObjProp Object(%<\\_ObjId "
    (rtos oba 2 0)
    ">%).Closed \\f \"%bl2 \">%"))

    (command "mtext" tpt "w" "0" lin2 "")
    )
     
    R. Robert Bell, Oct 13, 2004
    #2
  3. RKLindner

    RKLindner Guest

    Thank you for the reply. Wish it was a tad different <s>

    Do you know if there is a listing somewhere of the formatting of Fields and the codes that are represented? I searched but didn't see anything.
     
    RKLindner, Oct 14, 2004
    #3
  4. There was a post today by Jenna in the thread "Customization of Fields".

    --
    R. Robert Bell


    Thank you for the reply. Wish it was a tad different <s>

    Do you know if there is a listing somewhere of the formatting of Fields and
    the codes that are represented? I searched but didn't see anything.
     
    R. Robert Bell, Oct 14, 2004
    #4
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.