I have this little piece of code:
g = open("spheretop1.stl", "r")
m = open("morelinestop1.gcode", "w")
searchlines = g.readlines()
file = ""
for i, line in enumerate(searchlines):if X1 in line and Y1 in line:m.write("start" + "\n")
with X1 = '206.9799' and Y1 = '0.1218346'
the line this file refers to looks like this:
facet normal 4.650354e-002 -9.989174e-001 -1.217645e-003outer loopvertex 2.069799e+002 1.218346e-001 2.000000e+002vertex 2.069756e+002 1.218346e-001 1.997564e+002vertex 2.139428e+002 4.871899e-001 1.995131e+002endloopendfacet
I basically only want the file to write "start" + "\n" when the X1 and Y1 are in the same line AND are the first two variables in that line, as in the 3rd line above. So what I want to do is find X1 in the line at position x (17 spaces from left) and Y1 in the line at position y (31 spaces from left). Hope that its clear :)