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

build polyline series from excel data

  • Thread starter Thread starter wallace&gromit
  • Start date Start date

wallace&gromit

Guest
hello to everyone, I am new to the forum and rather inexperienced by autocad.
I have an excel file in which I calculated the coordinates of a series of lines (packaging thousands), each consisting of 3 points. Now I would like to represent everything in autocad, I imagine with a macro of excel (in those I cable enough). I saw something on the forum, but only for the passage of one polylinea.
 
You can use a script. in the forum there is an excel file that automatically creates it. merge excel features to automate everything
 
Yes, the idea could be this. But to leave I would need some extra information on what autocad commands to insert. In the examples, prints and saves are carried out, I need to trace polylines.
 
In the examples, prints and saves are carried out, I need to trace polylines.
are more common examples to show how the script generator works. that basically means you have to bring back the commands that you launch in autocad to do the operations you need

then basic the commands should be polylinea followed by the coordinates of three points and the option close then departed with the new polylinea
 
Forgive me, but I said I'm a autocad goat.
So, I wanted to make a simple polylinear insertion test. in autocad I must insert the commands "_pline"; "16,23";"17,24";"ch" and creates a segment between these two points.
I tried to generate the script starting from excel and inserting on 4 different lines these commands. then I generated the script file
by autocad I typed "script", chosen the file just created and launched the script. But nothing happens!
 
coordinates must be inserted in the same line. the decimals must be written with the point.
therefore the coordination of the pint will be 10.54,17.63.
before writing the code you should do the command on autocad by writing on a sheet the commands and keeping in mind that the line jump of the script corresponds to sending in autocad
 
other important thing
in the excel in the file column must be present of the text. no matter if it is recalled in the code, you can also write x, but it serves to create the code otherwise the script file is empty (just open it with note block to verify it)
 
I haven't solved yet! when in autocad I have to finish a polyline without closing it premo enter. I thought I could do the same by leaving a blank line in the excel script, but it doesn't work. How do I do that?
 
I found: I have to insert a space on the same line as the last point of polylinea.
then head to write again _pline.
for now it seems fine, thanks again of the support!
 
to those who should come across my own problems also mark another curiosity: excel in some cases did not allow me to save the digit format, cipher: 4500,1200 was automatically transformed into 45001200.
to circumvent this problem I found a loophole that illuminates below. I also add the simplified code that I use to launch the script (see that I don't need other functions than simply to fill out what I find in the av column).
...
range("av" & urout + 1) = "_pline"
range("at" & urout + 2) = progprec
range("at" & urout + 3) = progm
range("at" & urout + 4) = progsucc
range("au" & urout + 2) = zprec
range("au" & urout + 3) = zm
range("au" & urout + 4) = zsucc
range("av" & urout + 2).formulalocal = range("at" & urout + 2) & "," & range("au" & urout + 2)
range("av" & urout + 3).formulalocal = range("at" & urout + 3) & "," & range("au" & urout + 3)
range("av" & urout + 4).formulalocal = range("at" & urout + 4) & "," & range("au" & urout + 4) & " "

next i

call creation

end sub

sub-creascript()
scriptname = application.getsavesfilename("", filefilter:="file di testo (*.scr), *.scr")
on local error resume next
kill scriptname
on error goto 0

open scriptname for output as 1
i = 2
do until range("av" & i) = ""
print #1, range("av" & i).text
i = i + 1
loop
closed 1
range("av2").select

end sub
 
among other things the strange thing is that the same operation done with formulas does not give problems, only with the macros and with a second number greater than the thousand (this because I suppose excel interprets the comma as a separator of the thousands)
 

Forum statistics

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

Members online

No members online now.
Back
Top