Automated Block (with attributes) Point Entry

Automated Block (with attributes) Point Entry

Anonymous
Not applicable
1,579 Views
8 Replies
Message 1 of 9

Automated Block (with attributes) Point Entry

Anonymous
Not applicable

I had originally posted a message on the LT forum and got a solution from John Vellek. The reason for posting to the LT forum was that at my workplace we have a mix of Autocad and Autocad LT users and a solution must be made for all.

The problem was to find a way to insert Blocks from an Excel table. The solution came in the form of a script file (attached) that has worked well.

I am trying to create a 'Halo Text' (see screenshot attached) using that same script file but will allow for a second attribute to be added in the same location. If you view the screenshot you will notice that there is a thick white text for the one attribute and a thinner black one. This 'Halo' allows for better visibility on drawings where an image such as an aerial or satellite photo exists (this halo text issue has been raised on the forums).

I tried appending the same cell number as the first attribute at the end of the expression but got unexpected and unwanted results.

Can someone tell me what needs to be added to the end or how the basic script needs to be modified to get that second attribute text in place?

 

0 Likes
Accepted solutions (1)
1,580 Views
8 Replies
Replies (8)
Message 2 of 9

SeeMSixty7
Advisor
Advisor

Your script file should work for the added attribute field depending on your blocks definition is how you would need the script file to work.

 

Typically it would look something like this

-insert [blockname] [insertpoint] [xyzscale] [rotation] [attvalue1] [attvalue2] [...]

thsi woudl work just fine, unless of course your background attribute (halo) is set to preset. if that is the case, AutoCAD is not prompting for the attribute value and is then assuming your next value is a command for autocad to interpret, probably causing the unexpected results.

 

To change the attribute you would need to update the block definition. Just use BEDIT and then select the "halo" attribute and make sure preset is set to no.

 

If you have more than the two attributes, you will need to make sure the order for prompts match your intended attributes as well.

 

Hope that helps

 

 

0 Likes
Message 3 of 9

Anonymous
Not applicable

Thanks for your response.

The attributes for the block are not on 'preset.

I tried entering a space and then the same field from the Excel sheet for the second attribute and it did not work.

I walked through the command from the command line and when it came time for the attributes to be entered the dialogue box pops up. Should a TAB move to the second field instead of an ENTER?

0 Likes
Message 4 of 9

SeeMSixty7
Advisor
Advisor
Accepted solution

A script file will not use the dialog box.

If you are TESTING at the command prompt you can set up the environment to run more like the script.

make sure the following variables are set

ATTREQ=1 (ON) - Shouddl be this way if you want to prompt for values scripting or not

 

ATTDIA=0(OFF) this sets the prompts to command line prompts and does not use the dialog box.

Keep in mind you don't need this setting unless you don't want the dialog box to pop up.

 

This is what your script file should have in it. The string prompt allows for spaces so the doubling up of the attributes requires an enter after each attribute.

 

-insert Borehole 571758.289,6064469.893,1182.055 1 0 A-SS18-01
A-SS18-01
-insert ....

 

Attached is a sample script file you can run to test. Notice this one only has a single block it is inserting bu there is an extra line after the last attribute to make sure enter is passed to the insert command.

 

Good luck and I hope this helps you out.

0 Likes
Message 5 of 9

Anonymous
Not applicable

That worked but it is a manual process to get the second attribute to the second line in Notepad. It's unfortunate that the Excel formula cannot generate that.

 

Thanks!

 

0 Likes
Message 6 of 9

SeeMSixty7
Advisor
Advisor

You can get that to happen in excel as well by using a  CHAR(10) in your formula to create the new line.

0 Likes
Message 7 of 9

Sea-Haven
Mentor
Mentor

Be careful with scripts as a space is used as a next command so attribute of "a B" will do a then B should though be able to stack multiple attributes on 1 line. The other is a line by line solution.

 

-insert

x,y

name

1

1

0

a

b

 

-insert

0 Likes
Message 8 of 9

Anonymous
Not applicable
I tried different iterations with the CHAR(10)inserted into the line. It did move it to the next line in Notepad for the script but it added another return or something that caused it to try to repeat some of the coordinates.
0 Likes
Message 9 of 9

SeeMSixty7
Advisor
Advisor

Upload your Excel file and I'll take a look.

0 Likes