function placeOriginToPlate(part,machine,isForBottomFace,offsetToolpath,job) local w = part.width local h = part.height local t = currentPlateThickness local machineX = machine.size.x if (w >= h) and (machineX > w) and (isForBottomFace == false) then returnValue = placeWestSouth(w,h,t) elseif not(w >= h) and (machineX > h) and (isForBottomFace == false) then returnValue = placeEastSouth(w,h,t) elseif (w >= h) and (isForBottomFace == false) then returnValue = placeEastSouth(w,h,t) elseif not(w >= h) and (isForBottomFace == false) then returnValue = placeWestSouth(w,h,t) elseif (w >= h) and (isForBottomFace == true) then returnValue = placeWestSouthBottom(w,h,t) elseif not(w >= h) and (isForBottomFace == true) then returnValue = placeEastSouthBottom(w,h,t) end return returnValue end function setCurrentPlateWidthHeight(plate,isBottomFace) local orj = placeOriginToPlate(plate.nestedPlate ,currentMachine,isBottomFace,nil,nil) local bbPlate = ABox3d() local v1 = orj:inverse() * Vec3(0,0,0) local v2 = orj:inverse() * Vec3( plate.nestedPlate.width , plate.nestedPlate.height , 0) bbPlate:extend(v1) bbPlate:extend(v2) currentPlateWidth = bbPlate:sizes().x currentPlateHeight = bbPlate:sizes().y end