der Titel ist vll. etwas verwirrend. Es geht um Folgendes:
in meinem 3D Plot soll eine Struktur aus einem .pnt file dargestellt werden.
Diese Datei ist wie folgt aufgebaut
x y z nr
wenn die Nummer eine 3 wird der Stift auf das Blatt gedrückt, bis zur nächsten 3.
In meiner Datei sieht das z.B. so aus:
Code: Alles auswählen
26985.099609 -42896.000000 2945.500000 3
26987.599609 -42891.898438 2945.290039 2
26992.101563 -42892.964844 2945.192139 2
26990.873047 -42897.644531 2945.209473 2
26956.000000 -43014.000000 2945.760010 3
26957.000000 -43007.601563 2946.000000 2
26960.400391 -43008.500000 2945.989990 2
26960.800781 -43012.898438 2945.979980 2
26974.699219 -42954.500000 2945.050049 3
26974.199219 -42957.300781 2945.030029 2
26971.199219 -42953.500000 2945.550049 2
26971.199219 -42953.500000 2945.550049 2
26978.931641 -42926.320313 2945.371582 3
26980.183594 -42921.355469 2945.359375 2
26984.232422 -42922.933594 2945.302490 2
26982.878906 -42928.089844 2945.321289 2
26983.945313 -42906.464844 2945.322266 3
Jemand eine Idee, wie ich das Problem lösen kann?
So sieht der Code aus:
Code: Alles auswählen
struc = 'E:\\pipapo.pnt'
struc_x = []
struc_y = []
struc_z = []
option_list = []
index_list = []
with open(struc,'r') as f:
content = f.readlines()
z = len(content)
for i in range(0,z):
line = content[i]
line = line.split()
struc_x.append(float(line[0]))
struc_y.append(float(line[1]))
struc_z.append(float(line[2]))
option_list.append(line[3])
if (option_list[i] == "3"):
index_list.append(i)
.....
for i in range (0, len(index_list)-1):
x1 = struc_x[index_list[i]:index_list[i+1]]
y1 = struc_y[index_list[i]:index_list[i+1]]
z1 = struc_z[index_list[i]:index_list[i+1]]
ax1.plot(x1,y1,z1,'-k',alpha=0.3)