muzicman82 Posted April 23, 2018 Share Posted April 23, 2018 Hi all, So on another thread, I was pointed to a couple methods to extracting text from a drawing. Now, I want to use that CSV or Excel file as a data source, but I don't want to use an AutoCAD table. The CSV is basically one column and hundreds of rows. The application here is printing a bunch of labels. I'd like to use AutoCAD as I have paper space control over the layout. Excel isn't very good at that. The labels I am printing to are letter sheets with a 6x7 grid of labels. I'd like to set up AutoCAD so that on my model space, I can lay out field placeholders, and then the data source populates them. I will have multiple sheets. Even if the placeholder text requires me to have the column row number somewhere, I have LSPs that can help increment those. So the first label placeholder might be something like A1 (for column A, row 1). There are some where the label will have the same value repeated, and I'd just copy the placeholder. Any ideas? If I should be going about this a different way, let me know. Quote Link to comment Share on other sites More sharing options...
pendean Posted April 23, 2018 Share Posted April 23, 2018 Do you just want to do this or this https://forums.autodesk.com/t5/autocad-forum/insert-text-information-from-excel-file-to-autocad-using-x-y/td-p/7521018 and explore this LISP tip http://www.cadtutor.net/forum/showthread.php?77838-Lisp-to-read-excel-file-to-insert-text-values-at-coordinates&p=525759 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 24, 2018 Share Posted April 24, 2018 Have a look at Getexel.lsp pretty sure it uses the A1 in its code. You can also do a "what is max row" so a repeat function would know how many to do. For you grid its a simple double repeat (repeat ( + ymany 1) (repeat ( + xmany 1) .... ) ... ) Quote Link to comment Share on other sites More sharing options...
muzicman82 Posted April 24, 2018 Author Share Posted April 24, 2018 I don't exactly have coordinates for layout. I kind of need to make a template for these sheets of labels, and drop DTXT elements in properly aligned to some object so they are centered. I believe I kind of need it to replace DTXT on click or when I say go. Quote Link to comment Share on other sites More sharing options...
pendean Posted April 24, 2018 Share Posted April 24, 2018 Your basically going to have to write the equivalent of a script file in Excel, see this post's "solved" solution https://forums.autodesk.com/t5/autocad-forum/insert-text-information-from-excel-file-to-autocad-using-x-y/m-p/7521018#M905793 Excel doesn't speak "dtext" sadly. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 25, 2018 Share Posted April 25, 2018 If you have just one column in excel then it makes it easy, your trying to do labels so a page is filled in say by rows down a column then next row and so on. Have a look at this grid label example I think I posted at Theswamp but it shows you how to make a grid using a double repeat. I will see if I can find time on holidays right now and going fishing more important than work and coding. Pick a start point pick to right, pick point above you should see something. (setq pt1 (getpoint "Pick 1st point cnr")) (setq x1 (car pt1)) (setq y1 (cadr pt1)) (setq x 1) (setq y 1) (setq d1 (GETDIST PT1 "2nd point X")) (setq d2 (getdist PT1 "2ND PT y")) ;(SETQ Xmany (GETINT "How many in x direction")) ;(setq ymany (getint "How many in Y direction")) (setq ansx "A00") (setq ansy "B00") (setq ymany 7) (setq xmany 6) (repeat ( + ymany 1) (repeat ( + xmany 1) (setq pt (list x1 y1)) (command "text" pt "1" "" (strcat ansx (rtos x 2 0) ansy (rtos y 2 0))) (setq x1 (+ x1 d1)) (setq x (+ x 1)) ) (setq x 1) (setq x1(car pt1)) (setq y1 (+ y1 d2)) (setq Y (+ y 1)) ) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.