Oberoten
May 16th, 2008, 07:51
Very quick Script :
To put the measurements to one grid-square = 1 meter AND get areas instead of sides of area effects with the results rounded to 1 decimal do the following :
In imagewindow_image.lua
Replace the whole
function onMeasureVector(token, vector)
.....
end
with
function onMeasureVector(token, vector)
if hasGrid() then
local diagonals = 0;
local straights = 0;
local gridsize = getGridSize();
for i = 1, #vector do
local gx = math.abs(math.floor(vector[i].x / gridsize));
local gy = math.abs(math.floor(vector[i].y / gridsize));
if gx > gy then
diagonals = diagonals + gy;
straights = straights + gx - gy;
else
diagonals = diagonals + gx;
straights = straights + gy - gx;
end
end
local squares = diagonals * 1.5 + straights;
local feet = squares * 1;
return math.floor( (feet * 10^1) + 0.5) / (10^1) .. "\ Meters";
else
return "";
end
end
Also replace :
function onMeasurePointer(length)
.....
end
with
function onMeasurePointer(length)
if hasGrid() then
return math.floor( ((((length / getGridSize() * 1) * 10^1) + 0.5) / (10^1))^2) .. "\ Meter(s)";
else
return "";
end
end
If you wish to change the number of decimals just change the blue numbers to the number of decimals desired.
To put the measurements to one grid-square = 1 meter AND get areas instead of sides of area effects with the results rounded to 1 decimal do the following :
In imagewindow_image.lua
Replace the whole
function onMeasureVector(token, vector)
.....
end
with
function onMeasureVector(token, vector)
if hasGrid() then
local diagonals = 0;
local straights = 0;
local gridsize = getGridSize();
for i = 1, #vector do
local gx = math.abs(math.floor(vector[i].x / gridsize));
local gy = math.abs(math.floor(vector[i].y / gridsize));
if gx > gy then
diagonals = diagonals + gy;
straights = straights + gx - gy;
else
diagonals = diagonals + gx;
straights = straights + gy - gx;
end
end
local squares = diagonals * 1.5 + straights;
local feet = squares * 1;
return math.floor( (feet * 10^1) + 0.5) / (10^1) .. "\ Meters";
else
return "";
end
end
Also replace :
function onMeasurePointer(length)
.....
end
with
function onMeasurePointer(length)
if hasGrid() then
return math.floor( ((((length / getGridSize() * 1) * 10^1) + 0.5) / (10^1))^2) .. "\ Meter(s)";
else
return "";
end
end
If you wish to change the number of decimals just change the blue numbers to the number of decimals desired.