Electric Polar Vector
Does anybody know how to recreate this electric polar vector in Ai? (It seems the Blend tool doesn't work! Cause it reshapes the lines' thickness). I think a script would do the job. Any help?

Does anybody know how to recreate this electric polar vector in Ai? (It seems the Blend tool doesn't work! Cause it reshapes the lines' thickness). I think a script would do the job. Any help?

I am aware of creating a script from a code and running it from Ai. I did it, but I changed the extension to JS instead of JSX. I thought I had to draw a shape (circle or rectangle) and then apply the script to it. Yes! I realized the script does not need any shape (just an open doc). Great script, many thanks.
I have another question. There is a problem, even if I enter a big number like 225 (15*15), the centre column and row are not an exact horizontal/vertical (0/90 degree) line.

That was indeed a poor script. Here's version 2.0.
var n = prompt("Enter square root (side):", 15, " ");
if (n > 30) n = 30;
var distance = 10;
var increment = distance / (0.5 * n);
var doc = app.activeDocument;
var x = doc.width / 2;
var y = - doc.height / 2;
var group = doc.groupItems.add();
if (n % 2) {
var start1 = start2 = 0;
} else {
var start1 = distance / 2;
var start2 = increment;
}
drawQuadrent(-1, 1);
drawQuadrent(-1, -1);
drawQuadrent( 1, 1);
drawQuadrent( 1, -1);
function drawQuadrent(horizontal, vertical/*direction*/) {
var x1 = x + (horizontal * start1);
var x2 = x1 + (horizontal * (start2 * 0.5));
for (var i = 0; i < n / 2; i++) {
var y1 = y + (vertical * start1);
var y2 = y1 + (vertical * (start2 * 0.5));
for (var j = 0; j < n / 2; j++) {
drawVector(x1, y1, x2, y2);
y1 = y1 + (vertical * distance);
y2 = y1 + (vertical * (increment * (j + 1)));
}
x1 = x1 + (horizontal * distance);
x2 = x1 + (horizontal * (increment * (i + 1)));
}
}
function drawVector(x1, y1, x2, y2) {
var path1 = doc.pathItems.add();
path1.setEntirePath([[x1, y1], [x2, y2]]);
path1.moveToEnd(group);
}

Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.