I have a certain function which takes inputs as milling parameters and then generates a surface . Within this function I have a for loop which stores the co-ordinates of the center point of my tool. I wanted to know how can i store the X and Y coordinates of my center point CP in an array so that i can use these values for further manipulations? for further manipulation i need to access each value of X-Coordinate of my CP variable using a for loop , multiply the value of X coordinate with some factor and then make this as my new CP x-coordinates for the next iteration of loop. How do i do this?
def Milling(xdim, ydim, resolution, feed, infeed, radius ):
"""
Die Funktion gibt eine Punktwolke zurück (x1 y1 z1)
xdim, ydim: gemessenes Feld [mm] \n
resolution: Messpunktauflösung [1/mm] \n
feed: Bahnabstand [mm] \n
infeed: vertikale Zustellung [mm] \n
"""
tstart = time.time()
surface = np.zeros((xdim*resolution+1, ydim*resolution+1)) #inititalisation of the array
i = 0 # Run index for the milling paths
phi = np.arccos(1-infeed/radius) # angle between ball cutter center point and extreme trimming edge on the path
print("np.zeros(): ", (time.time()-tstart)*1000)
for i in range(0,int((xdim+radius)//feed)): #Here is a post-checked-loop, a milling operation is always executed
cp = [feed*i,-infeed+radius] # Center point location of the spherical cutter
if radius*np.sin(phi) > i*feed:
x0 = 0 # Milling path has a wide range of x0 to x1.
else:
x0 = cp[0]-radius*np.sin(phi) #if X0 is outside surface set it 0 , i.e at staarting point of workpiece
if cp[0]+radius*np.sin(phi) > xdim:
x1 = xdim #if x1 exeeds XDIM set it as last point of workpeice
else:
x1 = cp[0]+radius*np.sin(phi)
for x in range(int(np.round(x0*resolution)),int(np.round(x1*resolution))): # Ball Mill# represents the discretized points on between X0 &x1..remember res is 1/res**
phi_ = np.arcsin((cp[0]-x/resolution)/radius)
z = cp[1] - radius * np.cos(phi_) #this y should be actually a temperory value along Z...
if surface[x,0] > z:
surface[x,0] = z
So I just wanted to know how can i store and print out the values of my variable cp?