Jump to content

Lisp prg for reading csv or text file and place the text in the each layout sequentially.


Recommended Posts


I am new to the lisp programming.

Looking for a lisp script, that will read the content of the csv file and place the text in the each layout of the file. The layout are numbered as 1,2,3,4, etc., 

Attached the list of the text file and screenshot the layout



Link to comment
Share on other sites

Post a dwg.


Is there a block in each layout that the values go into ? Only need 1 example.


The best way to read in this type of file is to make it a CSV file Comma separated variables. 


Just a guess

1,B1,SECOND FLOOR 1,Work Bench,1170 x 900 x 900
2,B1,SECOND FLOOR 2,Work Bench,(4200+3500) x 1200 x 900


You can create in Excel save as CSV, yes can read from Excel direct more advanced code.

Edited by BIGAL
Link to comment
Share on other sites

Hi, bigal.,


I attached here with a sample of final output file.

Each layout will have the mtext at the top left corner ( no block for updation) which i wish to add from the csv. the format will be sl.no,room name, table type, table dimension in width, depth and height.. it can be a single column with all values with concatenation. 

The sample file is less number of drawings.

if there are 50 layouts, i have to jump to each layout and the text for the individual layout has be added manually.Sample.dwg

i had a template  setting in the first layout say the layout name as "1". i had already defined the page set up for the layout like, paper size, printer details, view port visual style etc., with the text at the top

i want the template to be copied to the second layout and existing text has to be changed, like this process has to be repeated for the 'n' number of layouts. i have code for creating the number of the layouts, which has posted online. 


Link to comment
Share on other sites

Ok was having a go at the layouts your other post. What would be better is to put the text inside the rectang why make a file and read it. If you put say "5" in the rectang on a layer that say does not plot then that would mean layout 5 is to be used. If order does not matter even easier.


I am looking at reading the rectangs and making the layouts, 1st thing though is they should all be the same shape ie 1 size rectang it should reflect your mview in a layout, will make the layouts appear in a couple of seconds. You can get the rectang centre point and use that in the layout to pick correct view. 


This is a view with the layout mview shown, you can see the difference in shape. You just need to have one and can scale that to suit rather than random shapes adding a level of complexity not required.


Watch this space.

Edited by BIGAL
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...