wannabe Posted December 1, 2008 Posted December 1, 2008 I have some blocks in a drawing that all have attributes, with each having a unique identification code. My current requirement is to amend the coordinates for each of the blocks; so I just want to know if it's possible to edit the coordinates in excel, or even in the table I created using EATTEXT, that will then automatically amend the coordinates of the corresponding block. cheers. Quote
dbroada Posted December 1, 2008 Posted December 1, 2008 are you saing that you want the blocks moved or just figures in them updated? Either way it should be possible with LISP or VBA but I don't know how to do it. Quote
wannabe Posted December 1, 2008 Author Posted December 1, 2008 I just want to make all of their locations change by typed input. In this case I had to redefine and merge blocks, so I started from scratch, manually moving them to the required location. Quote
dbroada Posted December 1, 2008 Posted December 1, 2008 rather than manually moving them you can retype their coordinate in the properties palette. Quote
wannabe Posted December 1, 2008 Author Posted December 1, 2008 rather than manually moving them you can retype their coordinate in the properties palette. Sorry, thats what I meant. When I said manual I just meant I did it within CAD, sorry. Cheers. Quote
dbroada Posted December 1, 2008 Posted December 1, 2008 I though you might have done - but I could also see you moving your blocks around on the end of a cursor. Back to your problem, yes this should be easy using a programming language but I think it is outside the scope of plain AutoCAD. If nobody comes along with furhter suggestions either pm a mod and ask for this to be moved or ask again in the LISP part of the forum. Quote
wannabe Posted December 1, 2008 Author Posted December 1, 2008 I though you might have done - but I could also see you moving your blocks around on the end of a cursor. Back to your problem, yes this should be easy using a programming language but I think it is outside the scope of plain AutoCAD. If nobody comes along with furhter suggestions either pm a mod and ask for this to be moved or ask again in the LISP part of the forum. I'm thinking of a comprehensive, form-driven block coordinate modification and multiple instance creation command, that I can create using C# .NET. Dont expect it this side of christmas, but it will be a good challenege and I will post it up once complete. Quote
BIGAL Posted December 2, 2008 Posted December 2, 2008 Just following on you can definately look within autocad and find one!! individual block so long as it has a unique attribute does not matter where it is paperspace or model space. BUT !!!! must be only once with individual id. If you have a txt file or use excel to create blockid x y pit1 123.456 789.567 pit2 546.789 123.567 etc Then search for all occurences of block called pits it has an attribute called blockid You should be able to find the block with id and then change its insertion point and update. I have not had the need to move a block. Search here for atttribute and vba many people have posted code examples including a recent one by me that almost does what you want. Someone will be able to add the move VBA code. Quote
wannabe Posted December 2, 2008 Author Posted December 2, 2008 BIGAL, I kind of get the jist of what you're saying. Firstly how do you get the coordinates from the .dwg into excel? Is there some kind of export available? Secondly, if I amend the coordinates in excel, how would I then import it and allow the blocks to automatically update their location? I am using AutoCAD 2007. Cheers. Quote
BIGAL Posted December 3, 2008 Posted December 3, 2008 Answer first Two ways to get to excel use "attext" this will write a file that exports out all your block details to a cdf file (comma delimited) which can be read by excel. Or use a vba or lisp program to write directly what you want to excel. Answer two Use a lisp or vba program to read either a cdf file or excel direct and update your blocks. Basicly what I am saying is search here and look in the Autocad tutorials there are lots of examples of how to link to excel both ways. I was looking at one yesterday on this forum forget where, use search. Once you can read the excel data then add the code to modify the insertion point. It may be easier to write the code to read a txt file first then add the excel link after taht way at least you can use it straight away. So 1 use 1 block hard code blockid X Y move block 2 Repeat and read txt file move blocks 3 Add excel link if required The reading of excel works on a row, column system which is pretty easy to understand eg A1 = 1,1 so you would just read each line 1,1 1,2 1,3 etc pitid X Y. Quote
wannabe Posted December 3, 2008 Author Posted December 3, 2008 Cheers for the advice. I'll work on my own group of commands in .NET and post it up in the new year for you guys to play with and find faults. Also, there is a function in Microstation that can do this. So there is my short term solution. Quote
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.