ACRES/SQ. FT. LISP

Discussion in 'AutoCAD' started by Dave, Nov 4, 2004.

  1. Dave

    Dave Guest

    I have an lisp that gives me acres when I pick an internal point and places
    text inside the picked area - is there a way to have it give me the sq. ft.
    at the same time? I would like the sq. ft. to appear under the acres.

    Thanks - Dave
     
    Dave, Nov 4, 2004
    #1
  2. Dave

    Douglas Barr Guest

    T'ain't purty, but it works.
    I had to disable your 'txt2mtxt' line for it to work for me.
    -doug

    (defun C:ACRE (/ INTPT AREA ACRES)
    (setq INTPT (getpoint "\n Pick internal point"))
    (setq nextpoint (list (car intpt)(- (cadr intpt) (* 1.25 (getvar
    "textsize")))))
    (command "-boundary" INTPT "")
    (command "area" "o" "l")
    (setq AREA (getvar "area"))
    (command "erase" "l" "")
    (setq ACRES (/ AREA 43560.000))
    (setq sqft (strcat (rtos AREA 2 1)" SQ.FT."))
    (setq ACRES (rtos ACRES 2 4))
    (setq ACRES (strcat ACRES " ACRES "))
    (command "text" "m" INTPT 0 ACRES)
    (setq pretext (entlast))
    (command "text" "m" nextpoint 0 sqft)
    (COMMAND "txt2mtxt" pretext (entlast) "")
    (prompt "\nProgram complete.")
    (princ)
    )
     
    Douglas Barr, Nov 4, 2004
    #2
  3. Dave

    BillZ Guest

    This would be a quick way to do it but I see that only the last piece of text gets converted to mtext.

    Code:
    ;;expects the current text style to have a fixed height
    (defun C:ACRE  (/ INTPT AREA ACRES)
    (setq INTPT (getpoint "\n Pick internal point"))
    (command "-boundary" INTPT "")
    (command "area" "o" "l")
    (setq Ar1 (getvar "area"))
    (command "erase" "l" "")
    (setq ACRES (/ Ar1 43560.000))
    (setq ACRES (rtos ACRES 2 4))
    (setq ACRES (strcat ACRES " ACRES "))
    (setq Ar1 (strcat (rtos ar1 2 4) " Sq.Ft."))
    (command "text" "m" INTPT 0 ACRES "text" "" Ar1)
    (COMMAND "txt2mtxt" "L" "")
    (prompt "\nProgram complete.")
    (princ))
    

    Bill
     
    BillZ, Nov 4, 2004
    #3
  4. Dave

    Dave Guest

    COOL - EITHER WORKS FOR WHAT I'M DOING - THANKS A LOT!!!! :)
     
    Dave, Nov 4, 2004
    #4
  5. Dave

    Dave Guest

    One more quick question - is there a way to repeat the lsp so that I can
    just click away (left mouse button) all the parcels that i want without
    having to do one then right mouse click to repeat the command? Make sense?

    I know - I'm being lazy - sorry. : )

    thanks again - dave
     
    Dave, Nov 4, 2004
    #5
  6. Dave

    Douglas Barr Guest

    (defun C:ACRE (/ INTPT AREA ACRES)
    (while
    (setq INTPT (getpoint "\n Pick internal point"))
    (setq nextpoint (list (car intpt)(- (cadr intpt) (* 1.25 (getvar "textsize")))))
    (command "-boundary" INTPT "")
    (command "area" "o" "l")
    (setq AREA (getvar "area"))
    (command "erase" "l" "")
    (setq ACRES (/ AREA 43560.000))
    (setq sqft (strcat (rtos AREA 2 1)" SQ.FT."))
    (setq ACRES (rtos ACRES 2 4))
    (setq ACRES (strcat ACRES " ACRES "))
    (command "text" "m" INTPT 0 ACRES)
    (setq pretext (entlast))
    (command "text" "m" nextpoint 0 sqft)
    (COMMAND "txt2mtxt" pretext (entlast) "")
    )
    (prompt "\nProgram complete.")
    (princ)
    )
     
    Douglas Barr, Nov 4, 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.