Issue I422 [81,enhancement,largelyresolved] Manipulating PAs from Lua inside SIMION NOTE: This is currently an 8.1 feature that is only available in the 8.1 "early access" mode. See Issue I421 for details. There are new functions for manipulating potential arrays from Lua inside SIMION. This is similar to the SL Libraries, but the functions are accessed in Lua and operate directly on the PAs loaded inside SIMION. Examples: local pa = simion.pas[1] -- Get first SIMION PA in memory. v = pa:potential(10,20,0) -- get potential pa:potential(10,20,0, v) -- set potential b = pa:electrode(10,20,0) -- is point an electrode point pa:electrode(10,20,0, b) -- set whether is an electrode point There are numerous other functions and properties. The API is documented fully in the electronic documentation (Help|Browse documentation) by selecting "Libraries API Reference" and then "simion.pas" (it is the file "docs\lua_simion.pas.html"). It is strongly recommended that you download the latest version of the electronic documentation ("simion8-docs*.zip" from "Check for Updates") since this API is changing frequently. CHANGES: Largely implemented in 8.0.3-TEST4 provided "early access" mode is enabled. 8.0.3-TEST21 - updated/expanded + documented in supplementary docs. 8.0.3-TEST22 - new pa:fast_adjust{...} function. 8.0.5-TEST13 - pa:clear() sets all points to 0V nonelectrodes. pa:potential_add(xi,yi,zi, val) adds potential val to potential at point (xi,yi,zi). pa:copy(pasrc) copies all points from pasrc to pa assuming array size identical. 8.0.5-TEST17 - pa:potentials_scale(a, b) Scales all potentials v(x,y,z) in array pa by the formula vnew(x,y,z) = a + b*v(x,y,z), where a and b are constant numbers. vmin,vmax = pa:potentials_minmax() Returns the minimum and maximum potentials in the array pa. 8.0.5-TEST18 - v = pa(x,y,z) -- Applying the call operator to the array is identical to pa:potential_vc. pa.symmetry values changed to "2dcylindrical", "2dcylindrical[x]", "2dplanar", "2dplanar[x]", "2dplanar[y]", "2dplanar[xy]", "3dplanar", "3dplanar[x]", "3dplanar[y]", "3dplanar[xy]", "3dplanar[z]", "3dplanar[xz]", "3dplanar[yz]", "3dplanar[xyz]" 8.0.5-TEST20 pa:potential_vc and pa:field_vc now take an optional table parameter to specify fast adjust electrode potentials (similar to the fast_adjust segment): potential = pa:potential_vc(10,0,0, {[1]=100, [2]=-100}) ex,ey,ez = pa:field_vc(10,0,0, {[1]=100, [2]=-100}) New pa.electrode_numbers field is an array of fast adjustable electrode numbers. 8.0.5-TEST21 New methods: instance:pa_to_wb_coords and wb_to_pa_coords instance:pa_to_wb_orient, instance:wb_to_pa_orient, instance:pa_to_array_coords 8.0.5-TEST27 simion.pas:open now returns nothing on success and raises on error. pa:load now raises on error. 8.0.5-TEST29 pa:close now raises on error. pa.filename now contains long filename Issue I422. 8.0.5-TEST30 simion.pas:clear renamed simion.pas:close. 8.0.6-TEST6 pa:rescale added (e.g. double/halve array) pa:refine convergence objective maximum limit no longer imposed. pa:field_vc corrected for magnetic arrays (magnetic field was not properly scaled by ng) 8.0.6-TEST13 In pa:potential_vc(x,y,z, t) and pa:field_vc(x,y,z, t), the table t now accepts an additional "exclusive=true" field which causes all electrodes not mentioned in the table to be set to 0 V. These electrode solution arrays are not are not loaded into memory. Also, solution arrays for electrode numbers not mentioned in t are no longer automatically unloaded. Sub-issues: Issue I422.1 - Fixed array corruption when doing simion.pas[n]:fast_adjust{...}, particuarly inside View screen. Issue I422.2 - pa:refine if long running now updates screen and responds to abort requests. See also Issue I496 - Manipulating workbenches from Lua inside SIMION