• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
blog.draftsperson.net

blog.draftsperson.net

the art of technical drawing

blog.draftsperson.net

FIELDMATH LISP: Build a Live Calculation From Drawing Text

August 3, 2026

FIELDMATH builds a live calculation from numbers already on the drawing. Pick a piece of text holding a number, choose an operator, pick another, and keep going. The result is a field that recalculates itself whenever any of the numbers it references changes.

What FieldMath does

The obvious use is a schedule total that must never fall out of step with the figures above it — or a rate multiplied by a quantity, where both live elsewhere on the sheet and either might be revised.

What can be picked: Text, MText, attributes, multileaders and dimensions — anything holding a number. A dimension contributes its measurement, so the calculation follows the geometry rather than any typed override. The Constant option lets you type a number in directly, for a rate or a factor that is not written anywhere on the drawing.

Add, Subtract, Multiply and Divide. Undo removes the last term; Result finishes and places the field. The running expression is echoed at the command line as you build it, so you can see what you have so far.

Where the result goes: pick a point for new MText, click a table cell, or choose Object to write into existing text, an attribute, a block or a multileader.

How to use it

  1. Load the routine with APPLOAD, or put it on your support file search path.
  2. Type FIELDMATH.
  3. Pick the first number, or choose Constant and type one.
  4. Choose an operator, then pick the next number. Repeat as needed — the expression is echoed as you go.
  5. Use Undo to drop the last term if you mis-pick.
  6. Choose Result, then pick a point, a table cell, or an existing object to write into.

How it works

Nested fields are handled deliberately, and it matters more than it looks. If you pick a piece of text that is itself a field, the default is to reference that field’s underlying expression directly rather than its displayed text.

The reason is rounding. Displayed text is formatted: a value of 12.3456 shown to two decimals reads 12.35. Calculating from the rounded figure rather than the real one compounds the error at every step, so a total built from six such values can be visibly wrong while every figure on the sheet looks right.

Set FieldMath:UseNested to nil if you genuinely want to reference the displayed text instead — there are cases where the rounded figure is the one that should be added, and the choice is left to you.

A dimension contributes its measurement rather than its text for the same reason: the calculation should follow the geometry, not what somebody typed over it.

Notes and limits

  • Dimensions contribute their measurement, not any override. That is a feature — see DIMTATTLE for why overridden dimension text should not be trusted.
  • Nested fields reference the real value by default. Change FieldMath:UseNested only if you specifically want the rounded, displayed figure.
  • Deleting a referenced object breaks the field, which then displays ####.
  • Fields update on regeneration, governed by FIELDEVAL and FIELDDISPLAY.

Download and details

NameFieldMath — build a live calculation from numbers already in the drawing
DownloadFieldMath.lsp — 31.0 KB, plain AutoLISP source. Downloads directly; no zip to unpack.
TypeAutoCAD AutoLISP routine
CommandFIELDMATH
Requiresthe ActiveX layer (loaded automatically by the routine with vl-load-com); nothing extra — the dialog is written to a temporary file at run time and deleted again, so there is no .dcl to install.
Source size31.0 KB, 726 lines
Error handlingYes — a *error* handler restores every system variable it changed, on cancel as well as on error.
UndoThe whole operation is wrapped in a single undo group, so one U reverses all of it.
CompatibilityAutoCAD (any release with AutoLISP), BricsCAD, ZWCAD, GstarCAD, ProgeCAD and other IntelliCAD-based platforms. AutoCAD LT needs a LISP enabler. No .NET, no ObjectARX, no installer.
AuthorYZ, August 2026
LicenceFree to use, supplied “as is” with no warranty.

References

  • FIELDGRAFT LISP — copy the finished field onto other objects
  • AREASUM LISP — a live field totalling areas rather than text values
  • DIMTATTLE LISP — find the overridden dimensions this routine ignores
  • More free AutoLISP routines on this site
  • Wisey’s Steel Shapes — free structural steel section drawing program

Filed Under: AutoLISP Routines

Primary Sidebar

Subscribe to our Youtube Channel

Post CAD drafting jobs on Freelancer.com. and get some free money to do this.

Categories

  • American Steel Industry (4)
  • AutoCAD Articles & Reference (30)
  • AutoCAD Bugs & Problems (19)
  • AutoCAD Tips (29)
  • AutoCAD Tutorials (54)
  • AutoLISP Routines (328)
  • AutoLISP Tutorials (15)
  • CAD Standards (7)
  • Civil 3D (7)
  • Civil Drafting (4)
  • Dimensions (2)
  • Drafting Funnies (71)
  • Drafting History (9)
  • Drafting Standards (84)
  • Electrical Drafting (2)
  • General IT reference (7)
  • Geometry (15)
  • GIS (2)
  • Hatch Patterns (12)
  • Office Life Hacks (3)
  • PT (1)
  • Revit Tutorials (54)
  • Steel Detailing (14)
  • Structural Drafting (26)
  • Technical Dictionary (61)
  • Useful Website Links (19)

Footer

Free downloads

  • Free AutoLISP routines
  • Free hatch patterns
  • SHX fonts & text styles
  • Numbering LISP collection
  • ISO 3098B font

Reference charts

  • AWS weld symbols chart
  • Steel detailing chart
  • Hole & slot sizes
  • Bolt edge distance
  • ANSI & ARCH paper sizes
  • How to fold an A1 drawing

Useful links

  • CAD blocks (DWG)
  • Revit families
  • structuraldrafter.com
  • cad-corner.com
  • About
  • Privacy policy

Provided for free with no warranty · Log in