Place Objects with X Y and Rotation Values from Excel to Autocad

Place Objects with X Y and Rotation Values from Excel to Autocad

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

Place Objects with X Y and Rotation Values from Excel to Autocad

Anonymous
Not applicable

I have an excel spreadsheet with X, Y, and Rotation values (see example). I want to place the base point of a defined block at each point and rotated. My spreed sheet contains ~1000 X,Y, rotation values, so I need a LISP or Scipt that does this automatically. 

 

I have tried finding and running codes I have found online but with no luck. What is the best/easiest way to do this? I am a novice at understanding/running LISP, so the simplier the better. Any help will be greatly appreciated.

 

Thanks,

Danny

Accepted solutions (1)
9,868 Views
10 Replies
Replies (10)
Message 2 of 11

Alfred.NESWADBA
Consultant
Consultant
Accepted solution

Hi,

 

you can use excel formulas to create a script like list of commands and then just do a copy & paste.

 

Please find the attached XLSX (basically yours + formulas and:

  • Start AutoCAD with a new drawing
  • Make sure to set ATTREQ to 0 in case your block has attributes (or modify the XLS to fill the requested attributes)
  • In XLS select K2 to Q12
  • right mouse click ==> copy
  • change to AutoCAD
  • make sure your mouse selected the command line
  • right mouse click ==> paste

ready.

 

Within the XLS I have prepared:

  • in E2 ... type in your block name
  • in column G to H ... converted decimal seperator from comma to point (in case your Windows is set to use comma as decimal seperator
  • in column K to Q ... a lisp command to insert a block with your blockname at the coodinates/scaling 1/your rotation

What you need when you have other data:

  • copy your new X/Y/Rotation data to columns A to C, starting with row 2
  • select the range K2 to Q2 ==> right-click ==> copy
  • select range K3 to Q<rows depending on the number of rows your new data has> ==> right-click ==> paste

 

HTH, - alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
Message 3 of 11

Anonymous
Not applicable

First off, I want to thank you for your help on this project. I really apprciate it!

 

So I have a few problems when trying to get this to work. First off, I had to delete column "O" from your example, giving only 1 scale instead of 2. Otherwise, this would not work. (I have attached new excel showing).

 

The main problem I am having is somtimes the block are inserted at the wrong coordinates. I can delete all the blocks I just inserted in autocad then and paste the same script, and it will give me a slightly different layout. Only occasionally (maybe 1 in 10 tries)  will it insert all the blocks at the correct coordinates. There could not find a pattern to this madness either!

 

It is so close to working perfectly! Do you know what I could be doing wrong? I have set attreq to 0 and tried following you directions as closly as posssible.

 

Best Regards,

Danny

Message 4 of 11

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> First off, I had to delete column "O" from your example, giving only 1 scale instead of 2

Then your block is set to "scale uniform only".

 

>> somtimes the block are inserted at the wrong coordinates

Turn OFF object snap before starting the script

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 5 of 11

Anonymous
Not applicable

Alfred, thank you very much. This works perfectly now! You are a smart man.

0 Likes
Message 6 of 11

tim.garrison8XZPQ
Explorer
Explorer

It took me a second to get what the excel sheet was doing.  Brilliant - thanks so much.

0 Likes
Message 7 of 11

hootan2003
Community Visitor
Community Visitor

Hi,

Does anybody know how I can insert Blocks in a specific layer based on my excel data? 

I have an Excel file that contains Block names, X, Y, Rotation, and layer data. I used your method for inserting my Blocks, but all of them are in the 0 layer. I want each of them to be in their own layer based on their excel data.

Thank you for your help.

0 Likes
Message 8 of 11

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> I used your method for inserting my Blocks, but all of

>> them are in the 0 layer

Your Excel-file does not show your script content, so I can't see where you tried to set the layer and so I can't tell you where/why your trial failed.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 9 of 11

chrisjune1994
Explorer
Explorer

Hi, hope someones still here to help !

Awesome work this. However, is there a way to have a column in excel which contains the attribute required for each symbol then when you paste into Autocad, the symbols will be automatically populated with the relevant atrribute? Hope this makes sense.

 

Thanks !!

0 Likes
Message 10 of 11

kitwing_kai
Community Visitor
Community Visitor

Why some block need X, Y scale but some don't need?
insert.png

0 Likes
Message 11 of 11

cadffm
Consultant
Consultant

Hi,

 

if you create a Block(definition), there is an option "Scale uniformly".

 

For Automation with AutoCAD Commands,

Use the INSERT option SCALE !

Insert

Blockname

SCALE

.. and so on.

This way the workflow is the same for all blocks - forced to uniformly scaled  or not.

 

 

 

 

 

Sebastian

0 Likes