Solved

Autocad: Entering text using script

Posted on 2004-09-06
13
6,056 Views
Last Modified: 2008-02-20
I am trying to enter a number of texts in autocad by generating a script file in Excel. The problem is that the first text command works fine but it does not exit to the command line. As a result all the subsequent command lines are printed instead of just the intended text.

e.g.

the script file is

text 5,5 2 90 abc
text 5,15 2 90 def
text 5,25 2 90 ghi
text 5,35 2 90 jkl

it is supposed to show as

jkl
ghi
def
abc

on the screen but is shows

abc
text 5,15 2 90 def
text 5,25 2 90 ghi
text 5,35 2 90 jkl

because after printing abc it does not return to the command line but instead asks for further text which is passed to autocad in the form of the entire command line.

I hope I have made myself clear. I want to know how to come back to the command line. One way would be to insert an extra line between each of the command lines but this is not very convenient in excel.

Saqib
0
Comment
Question by:Saqib Husain, Syed
  • 6
  • 4
  • 3
13 Comments
 
LVL 10

Expert Comment

by:norrin_radd
ID: 11990018
I'm not really sure I understand how you are making the script file. Are you creating it excel then changing the extension to .scr or are you doing this with vba or something. And what version of acad are you using?

 I copied your script to notepad, saved with the .scr extention, ran it in acad 2002 and it worked.

If you are doing it some other way you may want to try adding a semi-colon ';' or a space after each line, I know that makes hard returns in diesel expressions/macros ran on the command line.


0
 
LVL 43

Author Comment

by:Saqib Husain, Syed
ID: 11990331
I have tried it on 2004. The control does not return to the command line for the next command.

I am not saving it to a file. I am copying from excel and pasting to autocad command line.

Saqib
0
 
LVL 10

Accepted Solution

by:
norrin_radd earned 125 total points
ID: 11991404
if thats the way you are doing it I think that using a script file or trying to get it through vba would be the better solution. sorry I cant help anymore im going to be out of town the rest of week.
0
 
LVL 43

Author Comment

by:Saqib Husain, Syed
ID: 11991728
Thanks anyway. I would try the file method when I get back to work tomorrow.

Saqib
0
 
LVL 10

Expert Comment

by:norrin_radd
ID: 11996391
hey, i got limited access to a pc at this conference Im at. I've been thinking of your problem. If you have to create this script in excel a quick work around may be to create a script file in notepad (with .scr extension) and copy/paste your code into that scr file, save the scr file, you dont even have to close it, then run the script using the script command in acad. You cold automate that more by creating a toolbutton to run the script, something like this:
_script;yourdrive/yourfile;

I wrote that macro from memory, so it may need a little tweeking, might refer to the help files if it doesnt work right. I know there is a simpler/better solution to this I just cant get to were I can sit down to figure it out, stuff like that bugs me. Maybe somebody else will jump in.
0
 
LVL 43

Author Comment

by:Saqib Husain, Syed
ID: 12006480
You are very right. Once upon a time i used to create script files and then run them. But now that cutting and pasting works in autocad I had left behind the file method. It seems I would have to revert to that method for some commands.

Thanks for the reminder.

Saqib
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 10

Expert Comment

by:norrin_radd
ID: 12007055
yeah the copy/paste thing was a cool addition, just not ideal for everything. glad to jog your memory ;)
0
 
LVL 2

Expert Comment

by:hgj1357
ID: 12309381
I have done this in the past (Acad V12 +14). I will review and get back to you because the potential was huge. You could insert data collection data with different blocks on different layers etc.
0
 
LVL 2

Expert Comment

by:hgj1357
ID: 12312170

Here's a way to make it work. You leave a blank row between entries in excel, column H contains this formula

=B7  & " " & C7 & "," & D7 & " " & E7 & " " & F7 & " " & G7

A      B      C      D      E      F      G      H
1            X      Y      Height      Rotation            Copy Me!
2      text      5      5      2      90      jkl      text 5,5 2 90 jkl
3                                          
4      text      5      15      2      90      ghi      text 5,15 2 90 ghi
5                                          
6      text      5      25      2      90      def      text 5,25 2 90 def
7                                          
8      text      5      35      2      90      abc      text 5,35 2 90 abc
9                                          


Copy G2:G9 and paste in ACAD ~ viola


You can even have a little fun with it:

Column H contains:   =B18  & " " & C18 & "," & D18 & " " & E18 & "," & F18

A      B      C      D      E      F      G      H
18      line      0      0      0      100            line 0,0 0,100
19                                          
20      line      5      0      0      95            line 5,0 0,95
21                                          
22      line      10      0      0      90            line 10,0 0,90
23                                          
24      line      15      0      0      85            line 15,0 0,85
25                                          
26      line      20      0      0      80            line 20,0 0,80
27                                          
28      line      25      0      0      75            line 25,0 0,75
29                                          
30      line      30      0      0      70            line 30,0 0,70
31                                          
32      line      35      0      0      65            line 35,0 0,65
33                                          
34      line      40      0      0      60            line 40,0 0,60
35                                          
36      line      45      0      0      55            line 45,0 0,55
37                                          
38      line      50      0      0      50            line 50,0 0,50
39                                          
40      line      55      0      0      45            line 55,0 0,45
41                                          
42      line      60      0      0      40            line 60,0 0,40
43                                          
44      line      65      0      0      35            line 65,0 0,35
45                                          
46      line      70      0      0      30            line 70,0 0,30
47                                          
48      line      75      0      0      25            line 75,0 0,25
49                                          
50      line      80      0      0      20            line 80,0 0,20
51                                          
52      line      85      0      0      15            line 85,0 0,15
53                                          
54      line      90      0      0      10            line 90,0 0,10
55                                          
56      line      95      0      0      5            line 95,0 0,5
57                                          
58      line      100      0      0      0            line 100,0 0,0
59                                          

copy H18:H59 and paste into a cad command line

Howard
0
 
LVL 10

Expert Comment

by:norrin_radd
ID: 12312392
I would have never thought of doing it that way, interesting.
Just out of curiosity, what is the benifit of getting input to autocad like this?
0
 
LVL 2

Expert Comment

by:hgj1357
ID: 12312629
If you have field data in spreadsheet format, you could enter using insert, blockname, x,y,z etc. Land desktop far exceeds this capability now, but it may be useful if you have many blocks with diffrerent attribute values (especially if attribute value is based on a formula using your data, Zone1, 2 or 3 based on XY coords perhaps,). I have used it to draw stations from field data, but, in reality, unless you have ~500 points or more it is not worth the effort.

0
 
LVL 10

Expert Comment

by:norrin_radd
ID: 12312889
Yeah, I see what you mean now. I just never saw the copy/paste approach as a way to get input on a regular basis before ssaqibh
 asked the question here. I could see how it might be usefull, learn something new everyday I guess ;)
0
 
LVL 43

Author Comment

by:Saqib Husain, Syed
ID: 12331799
Thanks for the comments, Howard. Actually I was aware of that method as I had mentioned at the end of my question. But I do not find it convenient to readjust the spreadsheet accordingly because in many instances a given line is dependent on the previous line and the formulae would have to be adjusted accordingly. Too many of such adjustments is a potential source of error. So in the end I think that I would prefer to go back to the file method.

Saqib
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

If, like me, you find yourself repeatedly and tediously joining many segments (lines, arcs) in other people's drawings back into polylines that can be used more effectively in Computer Aided Machining and Laser Cutting, then this article is for you!…
In this article, we will see the basic design consideration while designing a Multi-tenant web application in a simple manner. Though, many frameworks are available in the market to develop a multi - tenant application, but do they provide data, cod…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now