HOME‎ > ‎

ALTEXT

Replace texts, change multiple numbers by adding or multiplying, add texts as prefix, suffix or in the middle of the string and get sum of figures in selected Texts, Mtexts, Block Attributes, MultiLeaders, and attribute in MultiLeader blocks.
 
 
INTRODUCTION
With ALTEXT, you can complete the following time-consuming tasks in just 2 seconds.
  • Add a certain amount to figures embedded in numerous Mtexts;
  • Convert the unit of numbers by multiplying them with a same factor;
  • Add a prefix or suffix to the grid numbers;
  • Replace different notes with a new content;
  • Update title blocks in different layouts;
  • Insert a new grid number and update all others;
  • Update all car parking space numbers after inserting a new one;
  • Change inserted block attributes to a number sequence, such as 1, 2, 3, 4, ...;
  • Sort selected text from left to right in a row, then next row... or sort them along a few pline paths;
  • Copy existing civil levels as new levels and raise all new levels by a certain height above the existing ones;
  • Filter out attribute value by a matching rule and apply changes only to these attributes;
  • Find out the sum of numbers;
  • Insert characters to separate numbers, eg. change "1234567890" to "123-456-7890";
  • Add leading zeros to numbers;
  • Round numbers in text;
  • Use formula to calculate new value based existing block attribute values; 
    and much more ....
It can intellectually find the numbers in selected texts and change them accordingly.
Command: ALTEXT
Select objects:
You can select Texts, Mtexts, Blocks with Attribute(s), and MultiLeaders
If there are blocks in the selection, and some of the blocks have more than one attribute, it prompts:
Which attribute to be changed: Attribute No.<1>:
The attribute number refer to the sequence of the editable attributes in the block definition. No.1 is the first row of attribute appears in the ATTEDIT dialogue box. Constant attributes are not editable.
If the number of editable attribute in any block is less than the input attribute number, this block is skipped and no changes is made to it.
If none of the objects has the selected attribute No., it prompts as following and exits:
Selected attribute No. exceeds total editable attribute number.
Otherwise, a "Change text content" dialogue box appears as below:
 
 
Options:
  • Sort selection
    ALTEXT provides 4 modes to sort selected texts when changing numbers in a sequence with the "Relative" option.
    - As selected
    It uses the same order as the texts are selected. Use this mode if the texts are selected one by one in a sequence.
    - Reversed
    It reverses the selection, ie. the last selected text becomes the first in the selection set.
    - Left-Right/Up-Down
    It sorts the texts in rows. Rows are sorted from top to bottom and texts in the same row are sorted from left to right, just like reading a book.
    This wonderful sorting tool is very unique that it does not depend on the text insert points as the sorting function in many other routines do. Texts objects are sorted to rows as they visually shown on the computer screen, as long as they "look like" in a row. It allows texts moving up and down a fair bit in the same row. Also see Tip 8 below.
    - Along paths
    Selected texts are sorted along paths.
    See "USAGE OF ALONG PATHS" below for more details about using "Along paths" sorting method.
  • Replace with
    - Modified
    - New
    You can choose one of these two options to replace selected contents with modified content individually or with a brand-new content globally.
  • Change to
    - String
    - Number
    You can select one option to define whether to change the whole text string or only the number inside the text string.
    if "String" is selected, the new text will be added to the whole string as a prefix, suffix, or in any middle positions;
    if "Number" is selected, the new text is only added to the number part in selected strings. The number is affected by Option "Search from".
    When "Number" option is selected, changes are only made to texts with numbers inside. No changes will be made to texts without any numbers.
    This option is disabled if there is no numbers in any of selected objects.
  • Count from
    - Left
    - Right
    This option is enabled when the "Insert at" slider below points to "(Middle)".
    Use this option to define whether the insert position of new text is counted from left-hand side or right-hand side of selected text / number.
    Examples:
    1. When count from left, position 1 in text "ABCDE" is "A", new text will be inserted to the right side of this position. So with new text dash symbol "-" inserted, the result will be "A-BCDE".
    2. When count from right, position 1 in text "ABCDE" is "E", new text will be inserted to the left side of this position. So with new text dash symbol "-" inserted, the result will be "ABCD-E".
  • Insert at
    - Prefix
    - Middle
    - Suffix
    Move the indicator of the slider to switch among these three options. It defines the location of the inserted new text in selected text string.
    When the indicator points to "(Middle)", the "Position" option below and "Count from" option above are available.
  • Position
    This option is enabled when "Insert at" slider points to "(Middle)". Input positions where you want to insert new text in the text string / number.
    Position could be 0 and any integers. It accepts multiple position inputs to insert same new text in different positions.
    Separate positions with space or comma, eg. "0 1 2 5 10", or "2,4, 7, 9" are all valid position inputs.
    Repeated positions are ignored. eg. "1, 2, 2, 5, 5," equals "1, 2, 5".
    When "Change to Number" is selected, the positon is counted based on the whole text string.
    Any position beyond the last position of the text string will be ignored. eg. position "6" is ignored in text "ABCD" because its last position is 4.
    When "Count from Left" is selected, position 0 equals insert prefix to the text string.
    When "Count from Right" is selected, position 0 equals insert suffix to the text string.
    Examples:
    1. "Count from Left" and insert "-" to position "0, 3, 8" of text string "LEVEL12345A", "Change to String" will get "-LEV-EL123-45A", while "Change to Number" will get "LEVEL-123-45A"
    Examples:
    2. "Count from Right" and insert "-" to position "0, 3, 8" of text string "LEVEL12345A", "Change to String" will get "LEV-EL123-45A-", while "Change to Number" will get "LEV-EL12-345-A"
  • New text
    This option has different meanings bechantween "Replace with Modified" and "Replace with New". 
    When the option "Replace with Modified" is selected, new text will be inserted to certain positions of selected text strings. 
    When the option "Replace with New" is selected, new text will replace selected contents entirely.
  • Only apply to
    This option enable user to filter out certain texts which matches a search pattern and only apply changes to them, skipping other texts.
    Leave the input box blank or set it to * if no filter needed and apply changes to all texts.
    Enter text search pattern with wildcard characters. The usage of wildcard is same as in AutoCAD FIND command.  
    Search pattern is capital sensitive.
    Example:
    Enter "PB*" here to set up a search pattern so changes only apply to texts start with "PB", all other texts in the selection remain unchanged. 
    Also see Note 13 below.
When "Replace with modified" and "Change to number" are selected, if there is any number included in selected texts, all the options in "Number" column are enabled.  
  • Search from
    - Left
    - Right
    These two options define from which side should ALTEXT search number from in each text.
    For instance, if the text string is "A 3 level building 9.3m high", select "Left" gets number 3, select "Right" gets number
    9.3
  • Changes
    - Absolut
    - Relative
    These two options define the increment is applied universally or only relative to the last changed figure.
    For instance, when Relative is selected, selected 5 copies of text 1A, and set the increment as 1, the result will be 1A, 2A, 3A, 4A, and 5A.
    The first number is going to remain.
    When Absolute is selected in such case, the result will be 5 copies of 2A.
    The picking order is important to the result if "Relative" is used to generate a number sequence.
  • Operator
    - + Plus
    - x Multiply
    Select one of these options to apply addition/substraction or multiply/division to figures with the Increment.
    If you want to do subtraction, put negative symbol in front of the Increment value;
    If you want to do division, convert denominator to its reciprocal, put it in the Increment, then select "x Multiply".
    "+ Plus" is the default option and is selected automatically when you select "Relative", and
    "Absolute" is selected
    automatically when you select "x Multiply"
  • Increment
    It can be a positive or negative real or fraction such as "-11.4/3.08". The default is 0.0.
    Input leading zeros here and select "Use Increment precision" below can add leading zeros to number. For example, input "00000" here and select "Use Increment precision" can add leading zeros to numbers to make a 5-digit format, such as "01234" and "00008". Refer to "Use Increment precision" below for more details.
  • Start from
    Only numbers equal or greater than the figure definied in "Start from" will be affected. It can be a positive or negative real. The default value is the smallest number contained in all selected texts and found by the "Search from" option.
    It is not avaiable when "Relative" is selected.
    This option is also avaiable when "Replace with new" and "Change to number" are selected.
  • End at
    Only numbers equal or smaller than the figure definied in "End at" will be affected. It can be a positive or negative real. The default value is the greatest number contained in all selected texts and found by the "Search from" option.

    Default "Start from" and "End at" will be changed automatically when different options selected among "Left", "Right", and "Dash as negative symbol".
    It is not avaiable when "Relative" is selected.
    This option is also avaiable when "Replace with new" and "Change to number" are selected.
  • Dash "-" as negative symbol
    If selected, the character dash "-"
     will be recognized as a negative symbol.
    For instance, if the text string is "Level -5 Car Park P-3a", when this option is selected and search from left, it will get number -5; deselect this opton will get number 5.
  • Dot "." as decimal point
    If selected, the character dot "." will be recognized as the decimal point.
    Otherwise, it will not be recoginzed as a part of figure.
    For instance, if the text string is "DOOR1.23", when this option is selected, it will find the figure 1.23, otherwise two figures 1 and 23 will be find separately when searching from Left and Right.
  • Sum of selected numbers
    A brief summary of the sum of all figures in selected objects, it might changes according to different settings of "Search from", "Dash as negative symbol" and "Dot as decimal point". The result will be shown in the command line as well so you can copy it from there for further use.
  • Use Increment precision
    By default, this option is not selected and the change to numbers will use the precision of the original number.
    If this option is selected, the precision of the result will use the precision of the number input in "Increment" eidt box.
    This option is only avaiable when "Modified" and "Number" are selected.
    This option has no effect on the result if "Increment" is a fraction.
    This option can also be used to add leading zeros to numbers. For example, to change 1, 2, 3, ... to 0001, 0002, 0003, ...etc, just select this option and input "0000" in "Increment" above.
    When adding leading zeros, keep in mind the precision of Increment (the decimal part) also affect precision of the result.
    For example, Input "0000.000" in "Increment" will change number 1 to 0001.000, 23.3 to 0023.300. 
    Input "0000" in "Increment" without decimal part will remove all decimal parts in selected number. For instance, 23.3 will be 0023 instead of 0023.3.
  • Use formula
    With additional formula, ALTEXT has nearly unlimited potential ability to handel text strings or numbers. 
    If selected, it prompts users to select an lisp file which will be used as a formula. The filename of the lisp file and path is recorded and used as the default in next time.
    When this option is selected, "Replace mode" is set to "New" and "Change to" is set to "String" automatically. "Sort selection" is still valid. All other options are disabled.
    Refer to the theme "Usage of Formula" below for more details.
  • Help button
    Bring you to this webpage.
Inputs in "Increment", "Start from" and "End at" must be valid numbers, otherwise an alarm box will appears when you press OK button:
If input in "Increment" is a fraction and then "Use Increment precision" is selected, a similar alarm box will appears to remind "Use Increment precision" will have no effect on the result and it will de-select "Use Increment precision" automatically.
 
TIPS
1. Selected all texts you want to add up to get the sum of them.
2. You can created a series of numbers by toggle on "Relative" option and select texts in order.
3. To change texts with different content to a new number sequence, you can select them in order and change them to a same content first (eg. 00), then use ALTEXT again, select "p"(previous selection), use "Relavtive" and "Number" option and assign an "Increment".
4. You can remove certain characters in a certain position of selected texts.
For example, if you want to remove the second dash "-" in texts in a format of "(02)-12-34-5678", it is impossible with the standard FIND command in AutoCAD. But by using ALTEXT, you can insert a special character (eg. "*") at position 8 in all text strings first to change it to "(02)-12-*34-5678". Then use FIND command to replace "-*" with nothing to remove "-*" from all text strings.
The final result will be "(02)-1234-5678".
5. To change precision of selected numbers to a certain decimal digits or round up to a integer, please input 0 with extra 0 as the decimal part in the "Increment" box to define how many digits you prefer. For example, to format numbers 4, 5.6, and 7.898 to 2 digits precision, you can input "0.00" in "Increment" box, then select "Use Increment precision", the result will be 4.00, 5.60, and 7.90.
6. To reverse number sequence, for instance, reverse 1, 2, 3, ... 100 to 100, 99, 98, ... 1, simply multiple them by -1, then add 101 to all of them (remember to tick "Dash as negative symbol" option).
7. To find and replace a same number, just set "Start from" and "End at" to the same value.
8. For texts not in Left-Right/Up-Down order, you can mirror them and make them in correct order before using TEXT2CSV, then mirror them back.
9. To update title blocks in different layouts, you can select these blocks with command FILTER first, then use ALTEXT to replace the value of certain attribute such as revision in one go.
  
NOTES
1. The original text format is remained in selected Mtext and MultiLeader objects, except for any format changes inside the target numbers.
    Example: Add Prefix A, Suffix s, Increment -8.3 to Mtext PPLE3.64b will get APPLE-4.66bs
2. Changed number match the original number precision individually unless "Use Increment precision" is selected, see Tip 5.
    Example: Add 2.34567 to texts E3.65, F4.3756893a, M3s will get E5.00, F6.7213593a, M5s
3. The leading 0 in the positive integer part will be remained to keep the same number digits.
    Example: Add 1 to text eX001, eX002, eX009, eX09, will get eX002, eX003, eX010, eX10
4. Zero will be added to end of the decimal part to keep the original decimal digits, unless "Use Increment precision" is selected.
    Example: Add 1.12 to text D6.000 will get D7.120
5. The maximum decimal precision is 10 digits after the decimal point, redundant digits will be changed to 0.
    Example: Add 1.1 to text Ps0.345678901234567ud wil get Ps1.445678901200000ud.
6. Stacked text in Mtext is recognized as a character, not a figure. All figures in stacked text are not going to be changed.
7. It doesn't support table objects.
8. If the number in the text string is changed and new string is inserted to it in the same operation,
    the new string will be inserted to the changed figures, not the original figures.
    Example: Add 1000 to number 234 in text AB234CD and also insert dash "-" to position "0, 2" counting from left will get result AB-12-34CD
9. Nothing changes if Increment = 0, no matter "+ Plus" or "x Multiply" is selected, unless "Use Increment precision" is selected.
10. Numbers in locked entities are valid to be added up, but cannot be modified. It prompts "Some Texts/Attributes are on a locked/freez/off layer and haven't been changed." if there are entities on a locked/turned-off layer.
11. MLeaders with "None" as Content or with "Block" as Content but without any editable attributes are not valid for modification.
12. There is a known bug in AutoCAD, when trying to change the layer status of an annotative attribute in MLeader block, AutoCAD crushes.
     So please avoid using such MLeader styles in your drawing. When AutoCAD crushes in this case, it has nothing to do with ALTEXT.
13. The sum of numbers doesn't affected by "Only apply to" setting.
 
USAGE OF ALONG PATHS
"Along paths" is one of options in "Sort selection" menu.  
Before using ALTEXT, you need define the paths. Paths include lines and plines. Valid pline can only contain line segments, without arcs, without Fit or Spline justification, without overlapped segments or nodes. Plines can be closed and/or self-intersected (like a number "8").
Paths do not necessarily need touch the texts. ALTEXT projects the texts to the paths and sorts the projection points along every path from its start point to its end point.
Because a text is projected to the nearest segment/node, sometimes the position of the path segment/node is critical as it affects the sorting result. In the following example, the top line of a closed pline is in different positions thus the text in red is projected to different segment and the final results are different.
 Altext Sample 1 Figure 1  Altext Example 1 Figure 2  Altext Example 1 Figure 3
A circle of text number 1.
The top-left number is close to the last segment of the path which is on the left. It becomes the last in the sequence. The top-left number is close to the first segment of the path which is on the top. It becomes the first in the sequence.

A Comprehensive text sorting rule about "Along paths" option is available upon request.
Options "Number", "Relative", and "Increment" are selected automatically when any option in sort selection menu is selected other than the default "As selected". 
After the settings dialogue box is closed by pressing OK button, it prompts user to select paths:
Select lines / plines as paths:
If no path selected, it prompts:
No paths selected. Entities are sorted as selected.
When a line or a valid pline is selected, ALTEXT highlights the path and shows a red arrow on the path indicating its direction and prompts with 3 options:
1 path selected, [Reverse/Next/eXit] <Next>:
- Reverse
Select this option to reverse the path, the red arrow is reversed as well to indicate the new direction. When reversed, the start point of a line or an open pline becomes the end point, but the start point is remained in a closed pline, only its direction is reversed.
This prompt is repeated when Reverse option is selected again until Next or eXit option is selected.
- Next
Select this option to select the next path, it repeats previous prompt:
Select lines / plines as paths:
If nothing selected or Enter is pressed at the prompt, the path selection procedure ends and the texts are modified. It equals to selecting option eXit.
- eXit
This option ends the path selection procedure and shows the final result.
See Example 1 below regarding the usage of different sort selection options.
See Example 2 below regarding the usage of sort selection option - Along path.
 
Example 1
Usage of different sort selection options
The following illustratoins show the results from different sort selection options. Other settings are the same as below:
Text- Change to = Number
Number- Changes = Relative
Number- Imcrement = 1
4x4 array of text number 1.
Created with command ARRAY from bottom-left to top-right. 
Sort selection: As selected  Sort selection: Reversed 
 
Sort selection: Left-right/Up-down  Sort selection: Along paths  Sort selection: Along paths, reversed. 
 
Example 2
Usage of sort selection option - Along paths (Please click the image to enlarge it)
A floor plan with door number blocks inserted which have the same initial number 1.  A red pline is drawn and selected as the path used in ALTEXT "Along paths" option. ALTEXT shows the pline direction and then changes the block attributes in a sequence along the path and adds prefix "D" at the same time.   
 
USAGE OF FORMULA
Formula provides great flexibility in handling datas especially attribute in blocks.
Requirements of the formula lisp file:
- The main function name defined in the lisp file must be "ALTEXT_FORMULA"; For example, (defun ALTEXT_FORMULA () .....)
- There are some predefined variables which you can use in the lisp file as below:
   "ALTEXT_STR_ORG" presents the original text string in selected texts/attribute;
   "ALTEXT_ATT_n" presents the value of the block attributes, indicates the sequence number of attribute in the block definition. 
   "ALTEXT_BLK_ENT" presents the definition data of selected block itself, same format as the result by using entget.
    For example, ALTEXT_ATT_1 means the first attribute in the block, ALTEXT_ATT_2 means the second,... etc.
- If the formula lisp returns nil, then no change is made to the original text string.
- When ALTEXT prompts "Which attribute to be changed: Attribute No.<1>:", enter the order number of the attribute you need to change.
 
Example 1
This example uses condition statements to change attribute value. It is impossible use condition statements in field objects, but with ALTEXT formula, it becomes practical.
The block we are going to change has two attributes. Attribute No.1 represents number of fixture units, can be any value from 0.5 to 10000, which is inside a pair of brackets; Attribute No.2 is the size of the pipe, in a sequence of ½, ¾, 1, 1¼, ...
What we need to do is automatically assign relative pipe size to Attribute No.2 base on the number of fixture units in Attribute No.1.
The relationship between Attribute No.1 and Attribute No.2 is as below:

 Number of fixture units (Attribute No.1)

 Pipe Size
(Attribute No.2)

 (0.5)~(1) ½
 (1.5)~(7) ¾
 (7.5)~(17) 1
 (17.3)~(36) 1¼
 ... ...
The formula lisp file is as below:
;;; This is an example formula for ALTEXT.vlx
(defun ALTEXT_FORMULA (/ nb1 cd_pair)
  (if Altext_att_1
    (progn
      (setq nb1 (atof (vl-string-right-trim ")" (vl-string-left-trim "(" Altext_att_1))))
      (cond
        ((<= nb1 1) "\U+00BD")
        ((<= nb1 7) "\U+00BE")
        ((<= nb1 17) "1")
        ((<= nb1 36) "1\U+00BC")
        (T nil)
       )
      )
    )
  )
Save the content above as a lisp file, and select it as the formula used in ALTEXT.
 
Example 2
This example is similar as Example 1, refer to Autodesk Discussion Group post "Simple if or condition code".
The block we are going to change has two attributes. Attribute No.1 represents types, includes 50x50, 100x100, & 150x150; Attribute No.2 is a number ranging from 0-750.
What we need to do is automatically assign relative type to Attribute No.1 base on the number of Attribute No.2.
The relationship between Attribute No.1 and Attribute No.2 is as below:

 Type
(Attribute No.1)

 Number range
(Attribute No.2)

 50x500-200
 100x100201-500
 150x150501-750
 ... ...
The formula lisp file is as below:
;;; This is an example formula for ALTEXT.vlx
(defun ALTEXT_FORMULA (/ nb1)
  (if Altext_att_2
    (progn
      (setq nb1 (atof Altext_att_2))
      (cond
        ((<= nb1 200) "50x50")
        ((<= nb1 500) "100x100")
        ((<= nb1 750) "150x150")
        (T nil)
       )
      )
    )
  )
Save the content above as a lisp file, and select it as the formula used in ALTEXT.

Example 3
This example shows how to set the attribute as the Z value of the block insertion point.
;;; This is an example formula for ALTEXT.vlx
(defun ALTEXT_FORMULA ()
  (if ALTEXT_BLK_ENT
    (rtos (cadddr (assoc 10 ALTEXT_BLK_ENT)) 2 3) ;Refer to rtos usage to change unit mode & precision.
  )
)

Example 4
This example multiplies a certain factor to an attribute.
;;; This is an example formula for ALTEXT.vlx
;;; It multiplies "factor" to selected attribute.
;;; It uses current system units and precision for the result.
;;; Change factor, units, and precision to suit your usage.
;;; Change Altext_att_2 to Altext_att_n if the attribute to be updated is No. n attribute in the block.
(defun ALTEXT_FORMULA (/ C_lunits C_luprec factor)
  (setq factor 1.5)
  (setq C_lunits (getvar "lunits"))
  (setq C_luprec (getvar "luprec"))
  (rtos  (* (atof Altext_att_2) factor) C_lunits C_luprec)
  )

Example 5
This example rounds up selected numbers to next nearest round number
For instance, change number 456, 789, 2000, & 2234 to next nearest 500. The result will be 500, 1000, 2000, & 2500.
;;; This is an example formula for ALTEXT.vlx
;;; Round up selected numbers to nearest markers.
;;; Change value of RoundUp to suit
(defun ALTEXT_FORMULA (/ RoundUp f1 f2)
  (setq RoundUp 500
 f1 (/ (atof ALTEXT_STR_ORG) RoundUp)
 f2 (fix f1)
 )
  (itoa (if (= f1 f2)
   (* f2 RoundUp)
   (* (1+ f2) RoundUp)
   )
 )
  )
 
Example 6
There are 2 types of blocks in this example. Block Type A is a series of blocks to be inserted. Block Type B is a block with some attributes and the third attribute represents the block name of Block Type A. The formula zooms to every Block Type B and select line objects on left-hand side of it, then find out the center point of these line objects, then get the name of Block Type A from the third attribute, and then insert Block Type A with this name at the center point.
 
 Block Type A
 
 Block Type B and line objects
 
 Result

;;; This is an example formula for ALTEXT.vlx
;;; Zoom to the attribute block, select lines on its left, find out their centre point.
;;; Get the content of the third attribut as a block name, and insert this block at centre point.
(defun ALTEXT_FORMULA (/ fc1 i1 ins Lx Ly MinPoint MaxPoint old-osnaps1 sc1 vc1 vh2 vs1 vw2 vx1 vy1 vobj)
  (setq old-osnap (getvar "OSMODE"))
  (setvar "OSMODE" 0)
  (setq vobj (vlax-ename->vla-object (cdar ALTEXT_BLK_ENT)))
  (vla-getboundingbox vobj 'MinPoint 'MaxPoint)
  (setq
    MinPoint (trans (vlax-safearray->list MinPoint) 0 1)
    MaxPoint (trans (vlax-safearray->list MaxPoint) 0 1)
    )
  (vl-cmdf "._zoom" MinPoint MaxPoint)
  (setq vc1 (getvar "viewctr")
 vx1 (car vc1)
 vy1 (cadr vc1)
 vs1 (getvar "viewsize")
 sc1 (getvar "screensize")
 fc1 (/ (car sc1)(cadr sc1))
 vh2 (/ vs1 2.0)
 vw2 (* vh2 fc1)
   )
  (setq s1 (ssget "W" (list (- vx1 vw2) (- vy1 vh2)) (list vx1 (+ vy1 vh2)) '((0 . "LINE")(8 . "S-_COLN----_E"))))
  (if s1
    (progn
      (repeat (setq i1 (sslength s1))
 (setq i1 (1- i1))
 (setq Lx
        (cons (cadr (assoc 11 (entget (ssname s1 i1))))
       (cons (cadr (assoc 10 (entget (ssname s1 i1)))) Lx)
       )
       )
 (setq Ly
        (cons (caddr (assoc 11 (entget (ssname s1 i1))))
       (cons (caddr (assoc 10 (entget (ssname s1 i1)))) Ly)
       )
       )
 )
      (setq Lx (vl-sort Lx '<))
      (setq Ly (vl-sort Ly '<))
      (setq ins (list (/ (+ (car Lx) (last Lx)) 2.0) (/ (+ (car Ly) (last Ly)) 2.0)))
      (vl-cmdf "._insert" ALTEXT_ATT_3 ins 1.0 1.0 0.0)
      (setvar "OSMODE" old-osnap)
      )
    )
  nil
  )
 

Please contact 3wood.CADKITS@gmail.com if you have any questions or need other fomula lisp files to perform other type of tasks.
 
DISCUSSIONS
TRIAL VERSION LIMITS
Trial Version is limited to 5 objects only. After registration, all restrictions and registration dialogue boxes dispear.
Please contact 3wood.CADKITS@gmail.com to get the FREE Registration Code.
 
UPDATES
28 Sep 2018, Added Formula Example 6.
14 Oct 2016, Compatible with ZWCAD.
20 Feb 2016, Able to use a search pattern to filter out certain texts in the selection to apply the changes.
05 Dec 2014, Variable ALTEXT_BLK_ENT added.
10 Feb 2014, Allow edit attribute on Layer 0 even if Layer 0 is turned off, frozen, or locked.
                    Allow select objects before using ALTEXT
02 Aug 2013, Fixed a problem when using Along Path function
10 Jan 2013, New option - Able to use lisp file as formula
                   Able to format the result to match the number of leading zero in Increment when "Use Increment precision" is selected.
15 Mar 2012, Filter out MLeaders with None Content or with Block Content which doesn't has attributes from the selection.
                   Constant attributes are excluded from editable attributes.
21 Feb 2012, Fixed a bug in option "Along paths".
20 Feb 2012, Sort selection added 1 option - "Along paths";
                   "Left-Right/Up-Down" uses UCS instead of WCS;
                   Resolve an issue when changing multilined Mtext with numbers only.
                       No changes to the first number when "Relative" option is selected. 
08 Feb 2012, Sort selection added 3 options - "As selected", "Reverse selection", and "Left-Right/Up-Down"
22 Nov 2011, Resolve an issue in AutoCAD 2008 and lower version when editing MLeaders with an attribute block.
                   If some selected entities are on locked layers, it still shows the sum of numbers but won't make changes to them.
26 Jul 2011, Partially true-colored Mtext number such as "123456" now is recognized as one number
09 Jul 2011, Able to change attribute of block content in MLeaders; 
                  Resolve an issue when attribute is on a locked layer.
                  Now it prompts: "Some Attributes are on a locked/freez/off layer and haven't been changed."
01 Jul 2011, Allow fraction in Increment, Option "Use Increment precision" added.
10 Jun 2011,  Bugs fixed with multiply operation; Fixed a bug which removes trailing zeros in decimal part.
28 Apr 2011, Operator option added.
23 Dec 2010, Updated
01 Dec 2010, Updated
01 Oct 2010, Updated
11 Jun 2009, Updated