Results 1 to 5 of 5

Thread: Script & Block Attributes

  1. #1
    100 Club
    Join Date
    2000-11
    Posts
    140
    Login to Give a bone
    0

    Default Script & Block Attributes

    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.
    Attached Files Attached Files

  2. #2
    The Silent Type Mike.Perry's Avatar
    Join Date
    2000-11
    Posts
    13,656
    Login to Give a bone
    0

    Default Re: Script & Block Attributes

    Hi Jack

    Please note I have *moved* this thread from the AutoCAD Tips & Tricks Forum to this one as I feel this particular Forum is a more appropriate place for such a topic.

    Thanks, Mike

    Forum Moderator

  3. #3
    Certified AUGI Addict jaberwok's Avatar
    Join Date
    2000-12
    Location
    0,0,0 The Origin
    Posts
    8,570
    Login to Give a bone
    0

    Default Re: Script & Block Attributes

    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?

  4. #4
    The Silent Type Mike.Perry's Avatar
    Join Date
    2000-11
    Posts
    13,656
    Login to Give a bone
    0

    Default Re: Script & Block Attributes

    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
    Attached Files Attached Files

  5. #5
    100 Club
    Join Date
    2000-11
    Posts
    140
    Login to Give a bone
    0

    Default Re: Script & Block Attributes

    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.
    Last edited by jack.foster; 2005-08-05 at 01:26 AM.

Similar Threads

  1. Replies: 1
    Last Post: 2014-06-16, 07:54 PM
  2. Replies: 2
    Last Post: 2012-06-06, 12:28 PM
  3. 2011: LISP, script or action recorder to copy-and-paste text into attributes?
    By simon.bannister in forum AutoCAD General
    Replies: 3
    Last Post: 2011-03-23, 11:55 AM
  4. Replies: 21
    Last Post: 2007-03-20, 02:03 PM
  5. Extract Dynamic Block Attributes, values change as Block changes
    By dave.buckberry in forum Dynamic Blocks - Technical
    Replies: 11
    Last Post: 2006-09-05, 04:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •