Insert Text information from excel file to AutoCad using X,Y coordinates

Insert Text information from excel file to AutoCad using X,Y coordinates

Anonymous
Not applicable
11,746 Views
9 Replies
Message 1 of 10

Insert Text information from excel file to AutoCad using X,Y coordinates

Anonymous
Not applicable

Hello All,

 

I'm wanting to find a way to take a large list of part numbers and part names and be able to have this data inserted into AutoCad through the command line.  I'm drawing various sized rectangles to represent the size of containers in a top down view layout I am drawing but don't want to spending the time consuming process of manually entering in all the part number and part name data.

 

I've figured out how to draw the various size rectanles just using the simple command: Rectangle x1,x2 y1,y2 but I would like to have a way so that once this rectangle is drawn I can also have the mtext inserted as well.  Does anyone know how I can do this?

 

I'm using AutoCAD2015 (but could get it down to 2013 if needed).

 

Thanks!!

0 Likes
Accepted solutions (1)
11,747 Views
9 Replies
Replies (9)
Message 2 of 10

john.vellek
Alumni
Alumni

Hi @Anonymous,

 

I see that you are visiting as a new member to the AutoCAD forum. Welcome to the Autodesk Community!

 

I think you should investigate DBCONNECT as it sounds much better suited to what you are trying to do.

 

Here is a YouTube video that shows how this might work for you.

 

If you really want to stick with Excel, consider using Dtext instead of Mtext. You could put the values in Excel and then use the Concatenate function to build lines for a script file that could place the text into your drawing.

 

Please select the Accept as Solution button if my post solves your issue or answers your question.


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
0 Likes
Message 3 of 10

Anonymous
Not applicable

Thank you for the quick reply!  I'll need to keep using excel since I hope to be able to share this with others and I'm trying to make it as easy to transfer as possible.

 

What would the lines look like using DText?  For example where would I put the text information?

 

Right now I just have the string: Rectangle X1,Y1 X2,Y2 and that builds the rectangle like I want, I can get it to position the text input box where I want using the same type of string (just replacing the rectangle command with mtext), but not sure where I put the two bits of text information that I want to go into that text box in the CAD file.

 

Thanks!

0 Likes
Message 4 of 10

john.vellek
Alumni
Alumni

Hi @Anonymous,

 

(COMMAND) dtext (LOCATION) x,y (HEIGHT) height (ROTATION) rotation (TEXT STRING) value (PARAGRAPH) return (COMPLETE COMMAND) return

 

dtext x,y height rotation valued return return

 

Please let me know if this helps.

 

 

Please select the Accept as Solution button if my post solves your issue or answers your question.


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
0 Likes
Message 5 of 10

Anonymous
Not applicable

John,

 

I'm still getting just the blinking cursor when I paste the string into the command bar.

 

Here is what I'm trying to copy and paste into the command bar from excel (the spaces are different cells going left to right)

 

dtext 2,40 0 0 80872-ZX01A

 

Basically I'm just wanting it to be able to take the 10 digit part number and put it at 2,40 using the text formatting that I already have in the AutoCAD file.  Maybe I'm missing something here, not sure.  I have well over 1000 that I'll have to manually key in and I'd really like to find a way to make this data input a lot more efficient.  If there's a way to have a second line under the 10 digit number that has a part name description that would be even better.

 

Thanks again for all of your help!

0 Likes
Message 6 of 10

Ranjit_Singh
Advisor
Advisor
Accepted solution

Maybe use -mtext instead of mtext.. See below. Very crude but you get the idea. Good luck.mtext_through_script.gif

 

0 Likes
Message 7 of 10

Anonymous
Not applicable

It worked!!!  Thank you!!

0 Likes
Message 8 of 10

Anonymous
Not applicable

Hi! Longtime reader, first time poster. Thanks for getting me this far.

 

I have been able to get my string of text to correctly place if I paste it in individually, as is shown in your GIF. However, is there any way to paste in multiple lines of text and have all of the commands execute correctly?


The problem I can't seem to figure out is how to exit the -MTEXT command once I'm in it, other than by hitting return on my keyboard. Is there a way to use excel to communicate "enter" to autocad? While in the -MTEXT command, CAD just understands a space as a space in the text, not as a return.

 

I am trying to input data for thousands of trees, so copying and pasting them in one at at time isn't going to do the trick.

 

Here's what I'm getting right now:

 

Test command entered:

-MTEXT 11169954.7289,1750062.0007 11170242.7289,1749834.0007 COTTONWOOD, EASTERN Multi: 4.1, 4.2; steep codominant base with included bark; heavy vines
-MTEXT 11170388.9129,1750105.3687 11170676.9129,1749877.3687 TREE OF HEAVEN partly uprooted; bayonet butt; low LCR; poor twig extension

 

Result:

mtext from excel.PNG

Message 9 of 10

mongeziD7RGH
Community Visitor
Community Visitor

Also having the same problem, I will wait with you

mongeziD7RGH_0-1739802395308.png

 

 

0 Likes
Message 10 of 10

RFreund
Advocate
Advocate

See here for "getting out of MText":
Solved: MTEXT command line exit - Autodesk Community

0 Likes