Update AUTOCAD Drawing Using EXCEL formulas - Part 2

 

Excel_ing CAD - TEXT/MTEXT

We can add text in AutoCAD drawing in a predefined way using Excel. 
  1. NORMAL TEXT IN THE SELECTED LAYER
  2. TEXT AS PER CONDITIONAL COLORS
  3. TEXT ON SPECIFIED LAYERS
  4. TEXT AT A PARTICULAR DISTANCE
Prerequisite to apply our formula in the specified drawing :

  • Get the Coordinates where we want to define the values as text/object. (Explained in Part-1)
  • Set the style of text as per requirement. (COMMAND: "ST")
NORMAL TEXT IN THE SELECTED LAYER

Fx ="-TEXT "&[@[X-COORDINATE]]&","&[@[Y-COORDINATE]]&" "&[@ROTATION]&" "&[@TEXT]

RESULT = -TEXT 2717612.8821,-1817752.3676 0 MH-1







"COPY ALL THE "TEXT-CAD" CELLS AND PASTE THEM INTO THE COMMAND LINE OF AUTOCAD"

TEXT AS PER CONDITIONAL COLORS

Fx ="-color "&[@COLOR]&" "&"-TEXT "&[@[X-COORDINATE]]&","&[@[Y-COORDINATE]]&" "&[@ROTATION]&" "&[@TEXT]

RESULT = -color bylayer -TEXT 2717612.8821,-1817752.3676 0 MH-1




"We can make colour-changing conditions in excel with the "IF" or other functions."



"COPY ALL THE "TEXT-CAD" CELLS AND PASTE THEM INTO THE COMMAND LINE OF AUTOCAD"


TEXT ON SPECIFIED LAYERS

Here we can add 3 additional cells above the text column. Remember, the layer works vertically, so the layer formula will be applied before the text.

-LA Set
_AKS_ELE_LAYER-5

-color bylayer -TEXT 2717612.8821,-1817752.3676 0 MH-1
-color 1 -TEXT 2718158.4431,-1817555.9639 20 MH-2
-color 2 -TEXT 2718689.3365,-1817813.9279 30 MH-3
and so on .....






TEXT AT A PARTICULAR DISTANCE

It is the same function, only need to add an additional value in x or y coordinates.

Fx ="-color "&[@COLOR]&" "&"-TEXT "&[@[X-COORDINATE]]+200&","&[@[Y-COORDINATE]]&" "&[@ROTATION]&" "&[@[C-NAME]]

RESULT = -color bylayer -TEXT 2717812.8821,-1817752.3676 0 By Layer

Or, We can add an extra spacing just before the text, to get the desired location of new text in the drawing. This means using the same coordinate as a reference for new texts.

Fx ="-color "&[@COLOR]&" "&"-TEXT "&[@[X-COORDINATE]]&","&[@[Y-COORDINATE]]&" "&[@ROTATION]&" "&"    "&[@[C-NAME]]

RESULT = -color bylayer -TEXT 2717612.8821,-1817752.3676 0     By Layer







"In this way, we can modify these formulas to tweak the texts/object in Autocad"

This method is very useful when a person is dealing with huge data sets. Because, we can analyse, verify, automate and test our data in excel with more ease and then reflect the data in CAD using this practical method.

SAMPLE FILE: TEXT_MTEXT

Comments