• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

drawing circles importing data from excel

Lollosilva

Guest
hi, I would like to know if it is possible to create a design in autocad taking the data(x,y, radius) from a table of excel, I basically have to create a series of circumferences having the rays and coordinates of the center
thanks in advance.
 
So there's no chance?
I also wanted to know if you can extract from the drawing already made a table of excel or in any case a table where there are the values of the drawing, in my case x,y, radius
Thank you. .
 
tried on 2006, it does not work, despite having submitted a micro-file of excel with only 1 record.. .

:
with Italian autocad does not work, I made a small modification here:
http://www.cad3d.it/forum1/showthread.php?t=14033
So there's no chance?
I also wanted to know if you can extract from the drawing already made a table of excel or in any case a table where there are the values of the drawing, in my case x,y, radius
Thank you. .
Look, there is also a very banal solution, that of creating a script.
in excel, create a column with a formula

=concatena(a2;",";b2;";c2;"""

where a2 and b2 are the coordinates and c2 the circle radius.
just copy the column with the formula in the note block and enter the _circle command at the beginning of the text with the coordinates. then you have to save the .scr file extension and drag it to autocad. and automatically you will have all your beautiful circles.
longer to explain it than to do it.
 
with Italian autocad does not work
but in fact I tried it both on my acad in English, and in the Polish one of the colleagues, and it doesn't work in any way, but I won't.. .
There is a very banal solution, to create a script.in excel, create a column with a formula
true, unfortunately lollosilva (stamani at 9:09) asked the exact opposite: how to export the characteristics of the circles da autocad towards excel.

with the map version is a trivial operation (via shape), but with the "normal" version I don't know exactly.. .

other ideas?
 
but in fact I tried it both on my acad in English, and in the Polish one of the colleagues, and it doesn't work in any way, but I won't.. .
As soon as I have a moment, I'll try again.
..vero, unfortunately lollosilva (stamani at 9:09) asked the exact opposite: how to export the characteristics of the circles da autocad towards excel.

with the map version is a trivial operation (via shape), but with the "normal" version I don't know exactly.. .

other ideas?
You're right. I didn't read well!
We wait for him to clarify what he wants exactly.
 
Excuse me, I made you mess up.
I would need both methods, i.e. one that, given an excel table makes me the design in autocad 2011 (always giving as x,y input, ray) and one that, made the design in autocad give me a table with x,y values and radius. .
Thank you.
 
Excuse me, I made you mess up.
I would need both methods, i.e. one that, given an excel table makes me the design in autocad 2011 (always giving as x,y input, ray) and one that, made the design in autocad give me a table with x,y values and radius. .
Thank you.
then for the first request, excel verse autocad, you can use the script solution I mentioned above.
to generate the table, da autocad a excel, you can use the command estrdati. you have the option to choose items to extract, and then by selecting as geometry option you can export the items you want (area, diameter, coordinates, radius).
 
sub discerchi()

dim newlayer as acadlayer

dim ssetobj as acadselectionset
dim cerchio as acadcircle
dim layercerchi as string

dim pt(0 to 2) as double
dim r as double

dim riga as integer

dim excelsheet as object
dim strfilename as string

set excelsheet = getobject("c:\tabellacerchi.xls")

excelsheet.application.visible = true

layercerchi = "cerchi"

thisdrawing.layers.add layercerchi
set newlayer = thisdrawing.layers(layercerchi)
thisdrawing.activelayer = newlayer

riga = 3
do while excelsheet.application.cells(riga, 1) <> ""

pt(0) = excelsheet.application.cells(riga, 2)
pt(1) = excelsheet.application.cells(riga, 3)
r = excelsheet.application.cells(riga, 4)

thisdrawing.modelspace.addcircle pt(), r

riga = riga + 1

loop

end sub

scompatta il file in c:\, aprilo e vai in autocad.
avvia la macro discerchi.
i cerchi sono disegnati sul layer cerchi.

bye
 

Attachments

good rpor66, it works beautifully!

in the meantime, I managed to throw the lispino signaled by pr...
xls2acad.gif
that correctly draws the xyz coordinate circles, but unfortunately of unique diameter for all circles...

rpor66,
Maybe if you send your macro to mr.jefferypsanders, who knows, maybe you get a bottle of bourbon yankee. . .
smile.gif
 
then for the first request, excel verse autocad, you can use the script solution I mentioned above.
to generate the table, da autocad a excel, you can use the command estrdati. you have the option to choose items to extract, and then by selecting as geometry option you can export the items you want (area, diameter, coordinates, radius).
I have autocads in English, how do I insert the command "outside"?
 
Well, I didn't check the values, but they look right. Now I have to see if I can from excel table to create autocad drawing.
Thank you very much to all. :
 
sub discerchi()

dim newlayer as acadlayer

dim ssetobj as acadselectionset
dim cerchio as acadcircle
dim layercerchi as string

dim pt(0 to 2) as double
dim r as double

dim riga as integer

dim excelsheet as object
dim strfilename as string

set excelsheet = getobject("c:\tabellacerchi.xls")

excelsheet.application.visible = true

layercerchi = "cerchi"

thisdrawing.layers.add layercerchi
set newlayer = thisdrawing.layers(layercerchi)
thisdrawing.activelayer = newlayer

riga = 3
do while excelsheet.application.cells(riga, 1) <> ""

pt(0) = excelsheet.application.cells(riga, 2)
pt(1) = excelsheet.application.cells(riga, 3)
r = excelsheet.application.cells(riga, 4)

thisdrawing.modelspace.addcircle pt(), r

riga = riga + 1

loop

end sub

scompatta il file in c:\, aprilo e vai in autocad.
avvia la macro discerchi.
i cerchi sono disegnati sul layer cerchi.

bye
Sorry to bother you, but I am not very experienced yet, I downloaded your .zip file, I opened the excel file, then what do I have to do?(I have autocad in English, so the command you should give me in English) excuse again and thank you. .
 
the dvb file you had to create it attached.
from autocad through tools/load application select it and click load, then always in tools go on macro/macros, run discerchi.

bye
 

Attachments

sub discerchi()

dim newlayer as acadlayer
dim i as integer

dim ssetobj as acadselectionset
dim cerchio as acadcircle
dim layercerchi(0 to 4) as string

dim pt(0 to 2) as double
dim r as double
dim tipo as integer
dim riga as integer

dim excelsheet as object
dim strfilename as string

set excelsheet = getobject("c:\tabellacerchi.xls")

excelsheet.application.visible = true

layercerchi(0) = "cerchi1"
layercerchi(1) = "cerchi2"
layercerchi(2) = "cerchi3"
layercerchi(3) = "cerchi4"
layercerchi(4) = "cerchi5"

select case (tipo)
case 1 or 2 or 4
thisdrawing.layers.add layercerchi(0)
set newlayer = thisdrawing.layers(layercerchi(0))
thisdrawing.activelayer = newlayer
case 3 or 8 or 12 or 16 or 20 or 24 or 28
thisdrawing.layers.add layercerchi(1)
set newlayer = thisdrawing.layers(layercerchi(1))
thisdrawing.activelayer = newlayer
case 5 or 6 or 7 or 9 or 10 or 11 or 13 or 14 or 15 or 17 or 18 or 19 or 21 or 22 or 23 or 25 or 26 or 27
thisdrawing.layers.add layercerchi(2)
set newlayer = thisdrawing.layers(layercerchi(2))
thisdrawing.activelayer = newlayer
case 30 or 31
thisdrawing.layers.add layercerchi(3)
set newlayer = thisdrawing.layers(layercerchi(3))
thisdrawing.activelayer = newlayer
end select

riga = 3
do while excelsheet.application.cells(riga, 1) <> ""

pt(0) = excelsheet.application.cells(riga, 2)
pt(1) = excelsheet.application.cells(riga, 3)
r = excelsheet.application.cells(riga, 4)
tipo = excelsheet.application.cells(riga, 5)

thisdrawing.modelspace.addcircle pt(), r, tipo

riga = riga + 1

loop

end sub


ho modificato il programma, per creare 5 layer diversi(per il momento ne utilizzo solo 4) in modo da poterli colorare per distinguere le parti diverse nel disegno, per distinguere le diverse parti di disegno le ho divise con un numero che verrà letto da tabella, e poi verranno raggruppate in uno stesso layer per avere solo 4 layer e non 30.
adesso non funziona ho provato a capire come modificarlo ma non ci riesco,grazie in anticipo..
 
with Italian autocad does not work, I made a small modification here:
http://www.cad3d.it/forum1/showthread.php?t=14033Look, there is also a very banal solution, that of creating a script.
in excel, create a column with a formula

=concatena(a2;",";b2;";c2;"""

where a2 and b2 are the coordinates and c2 the circle radius.
just copy the column with the formula in the note block and enter the _circle command at the beginning of the text with the coordinates. then you have to save the .scr file extension and drag it to autocad. and automatically you will have all your beautiful circles.
longer to explain it than to do it.
Excuse me for curiosity, will you make me understand how you would write the lisp?
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top