lua_with_simple_polar_co-ordinates

Example of LUA code for using FEMM with polar co-ordinates:

function rz (R1,Z1,R2,Z2,arcangle,arcseg) -- R=radius, Z=angle 
	if R2==nil then R2=0 end
	if Z2==nil then Z2=0 end
	return R1*cos(rad(Z1)),R1*sin(rad(Z1)), R2*cos(rad(Z2)), R2*sin(rad(Z2)), arcangle, arcseg
end
 
-- use the rz() function to convert
mi_addnode(rz(1,45))
mi_addnode(rz(2,-45))
mi_addarc(rz(2,-45, 1,45,180,1))  
mi_addsegment(rz(1,45,2,-45))
mi_zoom(rz(2,-90,2,45))
 
-- for other functions reuse the 5th parameter, e.g.
mi_selectrectangle(x1,y1,x2,y2,editmode) -- set arcangle=editmode
lua_with_simple_polar_co-ordinates.txt · Last modified: 2023/06/09 23:13 by stanzurek