Update AUTOCAD Drawing Using EXCEL formulas - Part 3

 

Excel_ing CAD - BLOCK

We can add blocks in AutoCAD drawing in a predefined way using Excel. 
  1. BLOCK WITH DYNAMIC ATTRIBUTES IN THE TABLE
  2. BLOCK WITH DYNAMIC VALUE ON EACH ITEM
Prerequisite to apply our formula in the specified drawing :

  • Get the Coordinates where we want to define the BLOCK. (Explained in Part-1)
  • Create a user-defined BLOCK and save it for reference
BLOCK WITH DYNAMIC ATTRIBUTES IN THE TABLE

Make a Block in CAD and define the attributes as per your requirements. attributes can be skipped also if we don't need them.


Once the block is defined, it's all set to apply these in our formulas.

"ATTREQ" SET THIS TO "0"

ATTREQ (System Variable)

Controls whether INSERT uses default attribute settings during the insertion of blocks.

Type:Integer
Saved in:Registry
Initial value:1

Value

Description

0

Assumes the defaults for the values of all attributes

1

Turns on prompts or a dialogue box for attribute values, as specified by ATTDIA

BLOCK FORMULA  ="(command ""insert"" """&"BLOCK NAME"&""""&" "&[@[X,Y]]&" ""SCALE FACTOR-X"" ""SCALE FACTOR-Y"" ""ROTATION ANGLE"""&" "&""""&[@[ATTRIBUTE-1]]&""""&" "&""""&[@[ATTRIBUTE-2]]&""""&" "&""""&[@[ATTRIBUTE-3]]&""""&" "&""""&[@[ATTRIBUTE-4]]&""""&" "&""""&[@[ATTRIBUTE-5]]&""""&" "&""""&[@[ATTRIBUTE-6]]&""""&" "&""""&[@[ATTRIBUTE-7]]&""""&" "&")"


RESULT = (command "insert" "AK" "2719825.3674,-1816594.9487" "1" "1" "0" "TABLE-1" "VALUE-1" "VALUE-2" "VALUE-3" "101" "102" "103" )


"IF YOU WISH TO ADD MORE ATTRIBUTES WE CAN INSERT THEM BETWEEN THE FORMULA"

&""""&" "&""""&[@[ATTRIBUTE-4]]&""""&" "&""""&


Similarly, we can add any type of block with different dynamic attributes in a predefined way.



SAMPLE FILE: BLOCK.dwg

Comments