Quick English-Metric Conversion

Discussion in 'AutoCAD' started by Matthew Kuehl, Nov 9, 2004.

  1. Hi.
    I need to convert a bunch of spot elevations in a survey from english to metric. Does anybody have a quick lisp routine or other command that might do this?
    Thanks,
    Matthew Kuehl
     
    Matthew Kuehl, Nov 9, 2004
    #1
  2. Wow! Check out what I found...

    ********TeXt Math********
    (defun c:txm ( / texts func xx n text textentget textent oldtext textreal result
    newtext)
    (princ "\nSelect texts you want to operate mathematically upon:")
    (setq texts (ssget))
    (princ "\nWhat function do you wish to
    apply<Add,Subtract,Multiply,Divide,sQuare,Root>?")
    (setq func (strcase (getstring)))
    (cond
    ((= func "A")
    (princ "\nAdd what number:")
    (setq xx (getreal))
    )
    ((= func "S")
    (princ "\nSubtract what number:")
    (setq xx (getreal))
    )
    ((= func "M")
    (princ "\nMultiply by what number:")
    (setq xx (getreal))
    )
    ((= func "D")
    (princ "\nDivide by what number:")
    (setq xx (getreal))
    )
    )
    (setq n 0)
    (while
    (setq text (ssname texts n))
    (setq textentget (entget text))
    (setq textent (assoc 1 textentget))
    (setq oldtext (cdr textent))
    (setq textreal (atof oldtext))
    (cond
    ((= func "A")
    (setq result (+ textreal xx))
    )
    ((= func "S")
    (setq result (- textreal xx))
    )
    ((= func "M")
    (setq result (* textreal xx))
    )
    ((= func "D")
    (setq result (/ textreal xx))
    )
    ((= func "Q")
    (setq result (* textreal textreal))
    )
    ((= func "R")
    (setq result (sqrt textreal))
    )
    )
    (setq newtext (rtos result 2 3))
    (setq textentget (subst (cons 1 newtext) textent textentget))
    (entmod textentget)
    (setq n (1+ n))
    )
    (princ)
    )
    ;********TeXt Math********

    Enjoy!
    Matthew Kuehl
     
    Matthew Kuehl, Nov 9, 2004
    #2
  3. Matthew Kuehl

    Jerry Guest

    What does that have to do with metric conversion?
     
    Jerry, Nov 10, 2004
    #3
  4. Matthew Kuehl

    Huw Guest

    The elevations are probably in whole feet, so it's a simple mathematical conversion for him.
     
    Huw, Nov 10, 2004
    #4
  5. Actually, it turns out that one doesn't work so well. Any other ideas? Thanks,
    Matt
     
    Matthew Kuehl, Nov 10, 2004
    #5
  6. Matthew Kuehl

    Brad Yarger Guest

    What format are your spot elevations in? Is it a 2D CAD file? Are they
    survey points in a txt or CSV format? If they are in 3D CAD, all you would
    have to do is scale them.

    If you have Land Desktop, export your points. Bring them into Excel, insert
    columns between the northings, eastings and elevations. Multiply the
    northings, eastings and elevations by the conversion factor in the new
    columns, and then save them back as a txt or csv. Close the file and then
    reopen so that you are working with the saved txt or csv. Delete the
    English value columns. Save again as a txt or csv file. Erase all the
    points you have modified from your original Land Desktop file. Import the
    updated points.

    --
    Brad Yarger

    metric. Does anybody have a quick lisp routine or other command that might
    do this?
     
    Brad Yarger, Nov 11, 2004
    #6
  7. Matthew Kuehl

    lsaapedd Guest

    Search the help for cvunit. It may help.
     
    lsaapedd, Nov 11, 2004
    #7
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.