MisterJingles Posted October 7, 2009 Posted October 7, 2009 Hi guys I received reams of co ordinates in .txt format with which I have to plot cable routes. Is there any way I can import those co ordinates and use them to place blocks at each co ordinate as quick as possible? I will use a simple X as a block and need to place them at each co ord but cant bear the thought of doing them one by one. Do I have a choice? Regards Rob Quote
Tiger Posted October 7, 2009 Posted October 7, 2009 Dang it, you are in LT all kinds of lisps are availible to and fro Excel-docs...but other than that, I have no idea... If you want just a shown X, not an actual X, I would use Points, the command is POINT and with the variables PDMODE and PDSIZE you can change the appearance of the point, PDMODE = 24 or =25 I think is an X. And then just get typing... put on some music and just zone out.. Quote
ReMark Posted October 7, 2009 Posted October 7, 2009 Given the nature of your work and the requests you have made over the last few months wouldn't it seem like a good time to consider the possibility of upgrading to a full version of AutoCAD? Quote
NBC Posted October 7, 2009 Posted October 7, 2009 you could write a script file along the lines of: osmode 0 Multiple -insert "insert the path and name of the block you wish to insert" [color=red]0,0,0[/color] [color=seagreen]1[/color] [color=blue]0[/color] [color=red]10,10,10[/color] [color=seagreen]1[/color] [color=blue]0[/color] [color=red]20,20,20[/color] [color=seagreen]1 [/color][color=blue]0[/color] whereby the red text are your co-ordinates, the green number is the scale of the block, and the blue number is the rotation of the block Quote
MisterJingles Posted October 7, 2009 Author Posted October 7, 2009 ReMark - If only it were up to me. Honestly, I do have access to full Autocad, just not at the office. So I work around that as much as possible but in situations like this I may need to saddle up next to a full version. NBC - Ill look at that, thanks. Quote
MisterJingles Posted October 7, 2009 Author Posted October 7, 2009 NBC - Do I simply put that into Notepad, modify it and then run it in the command line? Ive done it as follows... osmode 0 Multiple -insert C:\Documents and Settings\SANDILE1\Application Data\Autodesk\AutoCAD LT 2010\R15\enu\Blocks\LP.dwg 18067.067,-3271588.884,0 1 0 18093.764,3271573.726,0 1 0 18119.774,3271561.862,0 1 0 I get an error, before explaining the errors can you see anything blatantly wrong with the syntax? Please forgive my ignorance, Ive not used scripts before. Once I have a handle on this I I wont ask again Quote
NBC Posted October 7, 2009 Posted October 7, 2009 You would put all that into Notepad; then save the Notepad to to a filename of your choice; however, ensure the file extension it is saved to is .scr. Then close notepad, navigate to where you saved the file to, and drag it into AutoCAD. The only 'error' I can see from the code you posted above is that the filepath and name of the block are not enclosed within quotation marks " " Quote
MisterJingles Posted October 8, 2009 Author Posted October 8, 2009 Morning Im battling to get this working. It seems the syntax needs tweaking. I drag the above .scr into the drawing and get the following... Quote
fuccaro Posted October 8, 2009 Posted October 8, 2009 AutoCAd can't find the block. Insert it by hand prior to run the script, than delete your insert. AutoCAd will keep the block definition. Or maybe there is a bug in the script file? When AutoCAD expects the block name, it gets C:\Documents Quote
dbroada Posted October 8, 2009 Posted October 8, 2009 I can't see your image (not allowed by net-nanny) but stepping through (as suggested by fuccaro) shows me that it also expects a Y scale factor but is reading the 0 - not allowed. You may need to modify it to.. osmode 0 Multiple -insert drawingName.dwg 18067.067,-3271588.884,0 1 [color=red]1[/color] 0 Quote
jammie Posted October 8, 2009 Posted October 8, 2009 Maybe [color="DarkGreen"];ADD A Semi colon TO COMMENT. LINES WHICH START WITH A SEMI ;COLON ARE IGNORED WHEN RUNNING A SCRIPT[/color] osmode 0 Multiple -insert [color="darkgreen"];PATH ENCLOSED WITH A STARTING AND ENDING COMMAS[/color] "C:\Documents and Settings\SANDILE1\Application Data\Autodesk\AutoCAD LT 2010\R15\enu\Blocks\LP.dwg" 18067.067,-3271588.884,0 [color="darkgreen"];X SCALE[/color] 1 [color="darkgreen"];Y SCALE[/color] 1 [color="darkgreen"];ROTATION[/color] 0 [color="DarkGreen"];block name[/color] "LP" 18067.067,-3271588.884,0 1 1 0 Quote
NBC Posted October 8, 2009 Posted October 8, 2009 I can't see your image (not allowed by net-nanny) but stepping through (as suggested by fuccaro) shows me that it also expects a Y scale factor but is reading the 0 - not allowed. You may need to modify it to.. osmode 0 Multiple -insert drawingName.dwg 18067.067,-3271588.884,0 1 [color=red]1[/color] 0 Ahar, I can see now how come I didn't put in a Y scale; as I make all my blocks to scale uniformly so the Y scale is redundant Quote
MisterJingles Posted October 8, 2009 Author Posted October 8, 2009 Ok Dave that worked. I only ran a single co ordinate as a test but it placed it correctly. The only problem is it asked me to specify rotation. How can I get around doing that? Off to try multiple insertions... Quote
dbroada Posted October 8, 2009 Posted October 8, 2009 The only problem is it asked me to specify rotation. the 0 after the 1s should be the rotation. It is possible you missed a final linefeed so the 0 wasn't being read. Quote
dbroada Posted October 8, 2009 Posted October 8, 2009 Ahar, I can see now how come I didn't put in a Y scale; as I make all my blocks to scale uniformly so the Y scale is redundantthis is the touble with scripts, one unexpected question and they go all out of sync. I always forget that if you insert a block exploded you only need to give 1 scale factor. The other thing that can trip you up is the default changing between typed and scripted commands. I have a batch plot script which ends... step through command line (AutoCAD) - do you want to save changes? from script (AutoCAD) - do you want to discard changes? It took me AGES to work out why our files were being saved when I didn't want them saved! Quote
MisterJingles Posted October 8, 2009 Author Posted October 8, 2009 Ok it worked perfectly. Thanks Dave. Still takes ages to put in the co ords though because they come to me in a .txt and contain a few other categories of info so I have to edit each line. Such an ache. I would have had the same problem had I used LISP wouldnt I? Quote
dbroada Posted October 8, 2009 Posted October 8, 2009 depending on how the information is presented you may be able to open the text file in excel. If you can get the information in columns you can then strip out the bits you don't want before saving it again as raw text. You need to be imaginative at times on how you find & replace but you would be surprised at what can be done. And no, I'm not going to do it for you! Quote
MisterJingles Posted October 8, 2009 Author Posted October 8, 2009 Damn! I did try that but couldnt come right. Simply because I dont work much with Excel and when adjusting column widths didnt work I threw in the towel and spent 3 hours doing it the long way round. Quote
dbroada Posted October 8, 2009 Posted October 8, 2009 yes, I threw the teddy from the pram many times 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.