Community
AutoCAD LT Forum
Welcome to Autodesk’s AutoCAD LT Forums. Share your knowledge, ask questions, and explore popular AutoCAD LT topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Insert block based on an Excel sheet

27 REPLIES 27
SOLVED
Reply
Message 1 of 28
Anonymous
15509 Views, 27 Replies

Insert block based on an Excel sheet

Hi,

In a drawing I have made a handfull of blocks with the names block1, block2 etc. each with one attribute.

 

I have an Excel document and for each line I want to insert a block, based on the block name(column A), fill in the attribute info(column B), and place it based on column C.

 

Can it be achieved in LT through scripts or do I have to use LISP for such things?

 

sleenshatt.PNG

 

27 REPLIES 27
Message 21 of 28
steven-g
in reply to: Anonymous

Can you explain exactly how you are running the commands from excel into Autocad. And post a copy of your command history (F2) from that process.

Attached is what I get, the left part of the drawing is what happens when I copy and paste directly from Excel into the command line. and on the right is the result of creating a script file from the Excel list, and then running the script.

Next to each group of 3 blocks (I only get 3) is a copy of the command history showing how it goes wrong, there is a slight difference in how AutoCAD treats a macro and a script when it comes to the x and y scales.

 

There is a chance that system variable differences are at play but I would need to see your command history to see what AutoCAD is doing during the macro/script.

Message 22 of 28
cadffm
in reply to: Anonymous

_-INSERT space or linebreak as Enter

Blockname linebreak as enter

coordinates space or linebreak as Enter

1 for XYZ-scaling and space or linebreak as Enter

0 for rotation and space or linebreak as Enter

attval1 linebreak as Enter

attval2 linebreak as Enter

attval3 linebreak as Enter

 

See my quick AND DIRTY correction attached.

 

My sample: Copy the BLUE range and paste it to the command line.

This way it isn't a script, it is just like type in by hand.

As Script you have to edit the content because Scripts are using another INSERT command version.

 

Sebastian

EESignature

Message 23 of 28
Anonymous
in reply to: steven-g

I copied the excel output from the attached XLS

and clicked the command line in Cad and pressed Control-V

the attached CAD file is the output of my last test with the F2 results pasted in.

 

Thank you very much for your help.

 

regarding the SysVar  any Ideas on which might be messing me up

Message 24 of 28
sthompson1021
in reply to: Anonymous

Here is a spreadsheet that works. You almost had it on the last try but you should have left the first attribute where it was.

Message 25 of 28
steven-g
in reply to: Anonymous

If you look at your command history that you show, the rotate angle "0" isn't used for the angle it shows up as an 'unknown' command.

That is because in your Excel file you actually have two spaces in between the numbers in column D, it's only a small thing but difficult to trace unless you read the command history and see where it is going wrong.

 

Message 26 of 28
Anonymous
in reply to: steven-g

All is working, thanks 

 

 

Message 27 of 28
Anonymous
in reply to: steven-g

this is all working, thanks you
Message 28 of 28
shiva.b2008
in reply to: Anonymous

Sri,

I want Insert the block, how to write in script in excel 

Please suggest 

siva 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Technology Administrators