Modify Block attributes values from a csv file

Dear All,

Does anyone can help me to write a lisp code to update blocks attributes values from a csv file ?

-My csv file will be like :

BlockName;Layer;KeyAtt;KeyattValue;Att1;Att1Value; Att2;Att2Value; Att3;Att3Value; Att4;Att4Value; Att5;Att5Value; Att6;Att6Value

Block1;Layer1;Att0;XXX;Att1;A1; Att2;A2; Att3;A3; Att4;A4;Att5; A5;Att6;A6

Block2;Layer1; Att0;YYY;Att1;B1; Att2;B2; Att3;B3; Att4;B4;Att5; B5;Att6;B6

Block2;Layer2; Att0;ZZZ;Att1;C1; Att2;C2; Att3;C3; Att4;C4;Att5;;Att6;C6

Block3;Layer2; Att0;GGG;Att1;D1; Att2;D2; Att3;D3

- Lsp code Bricscad v22

-The window to select the CSV file will be displayed and positioned from the path of the DWG file.

-All lines must read from line 2 of the csv file

-Some attributes values may be equal to 0.

-Blocks contain variables attributes (quantity and names)

-The lsp code should not be interrupted by any prompt (even if the block itself contain attributes with prompt)

-The code will only apply to blocks from model tab (no modification on layouts)

-Case 1 : If several blocks meet these three criteria (BlockName;Layer;KeyAttValue): display a warning message and continue to the next line of the CSV file.

-Case 2 : If no blocks meet these three criteria (BlockName;Layer;KeyAttValue): display a warning message and continue to the next line of the CSV file.

-Case 3 : If a single blocks meet these three criteria (BlockName;Layer;KeyAttValue): Modify attributes values of

-A log will mentioned all ignored lined (Case 1 and 2) and the quantity of updated lines (Case 3)

TY for your help

.

Comments

  • Can be done direct from Excel no need for a csv.

    Need a dwg and Excel for testing, code posted many times.


    I can not do till Tuesday..