View Full Version : Script & Block Attributes
3D Jack
2005-08-03, 12:34 AM
Thanks to an early post in AUGI, I am attempting to use a script file created from Excel data. The problem that I have is how to enter data to go into an attribute. I can output a line of text as follows: "-insert MarkerNameNorthEastDepth_Small 515978.9,6036545.8 15,6036545.8,515978.9,-3.8" With a comma delimited file I can search and replace comma's globally by placing something unique in the original file such as z, The script as I have it here will insert the block at the 3 point coordinate that has the , between them just like AutoCAD likes. Then I have 4 spaces for the X,Y and rotate prompts. After that is the values for the attributes in the line which are 15,6036545.8,515978.9,-3.8 I have replaced the comma with a semicolon ; and I have used a plain space to try and get the carriage return the script needs. I tried placing each one in quote marks and a space between quotes. NO luck. I have turned attdia on and off but nothing works. Does anybody know how to make a script file text string work as data for block attributes. I have attached a small testing script file and the block I am using if anyone wants to tackle this. Changed the file extension on script from .scr to .txt so system didn't think it was a virus. ALL help is highly appreciated. If we can whip this I will post again a couple of the tricks I was able to due with the XLS sheet to get to this point. Thanks a bunch, Jack Foster.
Mike.Perry
2005-08-03, 12:51 AM
Hi Jack
Please note I have *moved* this thread from the AutoCAD Tips & Tricks (http://forums.augi.com/forumdisplay.php?f=180) Forum to this one as I feel this particular Forum is a more appropriate place for such a topic.
Thanks, Mike
Forum Moderator
jaberwok
2005-08-03, 06:53 AM
This does what I think you want - i.e. the later blocks are placed like the earlier ones.
All I've done is reproduce the format of the earlier lines in the later ones.
Is this too simple?
Mike.Perry
2005-08-03, 07:03 AM
Hi
Please find attached my effort (similar to John's).
Please note within the script file I changed Block name "MarkerNameNorthEastDepth_Small" to "MarkerNameNorthEastDepth" (as per the example drawing file you posted in your original post. I realise I could have renamed the drawing file instead).
Have a good one, Mike
3D Jack
2005-08-05, 01:19 AM
Thanks for the replies but what I am looking for is a program to read each line of an excel sheet and then spit it out into a script file with the appropriate line feeds. I have kind of since given up on that. The real problem is that there are 1133 times that I wanted to insert the block with attributes and manually editing the file would have been a lot of work. I finally had a wild hair idea. I will try and describe for future use. In the spreadsheet I added columns between each of the columns that I wanted to export. In these columns I placed different unique characters such as ** in one column and *** in another column. I saved the file as a CSV comma file first. Then the file looked something like this. ,***, as it used comma's to separate each column. Now comes the part that saved the day. Somehow or other I was able to open that file as a Word doc file. Then I could use the super duper find/replace feature and search for ,***, and replace it with a "special" character which was the line break. When I did this it would do the automatic line feed for me and the script file looked just like the examples you all replied with. I am not sure if a program could be written, at least easily, to break the attribute values into separate lines. The key to this is getting the file into Word for the special replace feature. I jokingly called this the Poorboy's Excel to AutoCAD script maker. Probably struggled for half a day to come up with this but when I did the script put all 1133 insertions into the drawing in 10 seconds. Manually would have taken days. Thanks for the replies and if you want me to elaborate on what I did I can try. Thanks again, Jack Foster. PS: Here is an example of what a partial row of data would look like when opened in Word. ,**,15,***,60483983,***,153685,***,-4.5 Replacing the ,***, with manual line break did the trick.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.