Insert Blocks from a csv file

Dear All,

Is there any way to place several blocks from a .csv file on a Bricscad drawing from a lisp code ?

Each line of the csv file is made like this :

BlockName;x;y;z;AttributeName1;AttributeValue1;AttributeName2;AttributeValue2;AttributeName3;AttributeValue3;AttributeName4;AttributeValue4;...;AttributeNamen;AttributeValuen

Semicolons seperate values.

I wish I could insert the block named "BlockName" at the coordinate system x,y,z and then modify values of the attributes without any prompt.

Thank you for your help.

BR

Comments

  • Hello.

    An alternative to the solution from the link above could be as in the attached file.

    This approach parses the csv file line by line and inserts a block.
    Another way of working could be to first parse the entire csv file and then insert the blocks.

    For this variant to work, the blocks should be found either in the drawing or on some location on disc.
    There is no check included regarding the existence of a block name - this is something to consider.

    If the blocks are outer files, the file name should be provided, using the extension - "BlockName.dwg".
    Also, in this case, either the full path should be provided or the block files should be placed in a folder specified in the SRCHPATH system variable.

    There are two functions from Lee Mac used in the sample file, but not included.
    Here are the links.
    https://www.lee-mac.com/stringtolist.html
    https://www.lee-mac.com/attributefunctions.html

    This sample is presented only as a start point in achieving the task.
    It should be further adjusted and improved to match the specific conditions of the project where the task is required.