Tuesday, October 30, 2007

Customize AreaText.LSP for AutoCAD

In the earlier post about AreaText.LSP the result was in SQ. FT. Several users have asked how to get it in other formats like m², cm², etc.

Here is what you do. Draw a polyline. Run the FIELD command and select the Objects Field category>the Object Field name>Area Property and select the polyline. Make changes as you want to the Format, Precision and Additional Format.

FIELD

Notice the result in Field expression.

Copy the text for example it can look like this:

%<\AcObjProp.16.2 Object(%<\_ObjId 2130314088>%).Area \f "%lu2%pr1%ps[,m²]%ct8[0.001]">%

What is maked bold green is what is the important part.

Now look at the code for AreaText.LSP. Change this row below in the code.

">%).Area \\f \"%pr2%lu2%ct4%qf1 SQ. FT.\">%"

Now pick the correct piece of the field expression so the code look like this instead using one decimal as precision, the conversion factor of .001 and the suffix m².

">%).Area \\f \"%lu2%pr1%ps[,m²]%ct8[0.001]\">%"

11 comments:

  1. I've been having problems with getting the AreaText.lsp to work with AutoCAD 2010. Is anyone else experiencing the same problem? If so is there a fix?

    ReplyDelete
  2. It should work with AutoCAD 2010. What is the problem?

    ReplyDelete
  3. i don't know why - but it gives a wrong number... for example - instead of 190 sqm. --> 1.34 sqm.
    how come?

    ReplyDelete
  4. It is probably because the factor is incorrect or because of different settings for units in the drawing. Try to run FIELDS manually and figure out what settings you need to use.

    ReplyDelete
  5. The AreaText lisp I use allows me to select the pline and place the text, but then only displays 4 pound signs (####). Any ideas what lisp modification may fix this glitch? I'm using MEP 2009...

    ReplyDelete
  6. What happens if you use the FIELDS command, select the polyline and then try to get the area of it? You may also check the code at the bottom of the FIELDS dialog box and take note of what it says and if needed make adjustment to the lsp code.

    ReplyDelete
  7. Can anyone help fix this error?
    Command: at
    Select object: Select point: #

    ReplyDelete
  8. Not sure what this error could be. I would need to know more like AutoCAD version, if you used the code exactly as it is or if you modified it.

    ReplyDelete
  9. Scott NewcombeSeptember 07, 2012

    This works really well for me. I have tried modifying to return the perimeter of the area but I get the error shown below. Any ideas?
    "Select object: Select point: ; error: bad argument type: stringp nil"
    Thanks
    Scott

    ReplyDelete
  10. Scott, What code change did you do?

    ReplyDelete

Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner