Can someone plz help with a very weird illustrator script issue? /crying

Made a script for illustrator with ai help… go figure… in short generates vector lines over a gradient on an object… created second boundary box at the gradients angle, make secondary bounding box contain original bounding box, make a perpendicular vector to the gradient with origin the respective edge of the new bounding box closest to the beginning of the gradient… masked/hid, rounded up the vectors length in the new bounding box by the width of the var stroke width, divided rounded up length by sroke width, made a simple linear interpolation to generate perpendicular lines perpendicular to the vector to approximate a gradient (with two control vars, distance where transition takes place from the center of the vector, and “gradience” for the amount of transition that takes place within that distance… and defined the generated lines length by their respective parallel side of the new bounding box in an effort to fill the whole bounding box which would then be masked(trimmed)… and I messed up and the length of the generated “gradient” lines is taking its value from the wrong side of the bounding box… for the life of me I can’t figure out how to fix this and have the length be taken from another edge!! there are only two dimensions that define the bounding box, and I’ve managed to get the length from the wrong one, as well as not being able to figure out how to change it… I suck at coding… and ai help was good but at some point I got lost… at least the ai comments a lot… Anyone wants to take a look? I’m making this script to convert gradient vectors into specific width stroke controlled approximations to basically make paths for pen plotters :stuck_out_tongue: /cry… (I suck)

You did not post your code.

it is kind of long… but here is a pastebin link: illustrator script - Thanks for wanting to take a look :slight_smile: cheers

Maybe learn how to code instead of using ai.

yes yes… that is a dream /cry… the one regret…

Can you explain what parts (functions) work and which ones do not and for the ones that do not work, explain (using an example), what the function should return vs. what gets returned.

everything works, the generation works too, the lines within the generation are based on the perpendicular side of the “new bounding box” rather than the parallel, resulting in lines that either do not fill the bounding box or extend away from it, since they are being masked though it only matters when the perpendicular side of the new bounding box is shorter than the parallel side to the generation lines, since then the generated lines are too short and don’t fill the bounding box… the issue is that their length is based on a perpendicular side of the bounding box rather than a parallel one… just that… besides that everything works…