Skip to main content
runninghead_design
Inspiring
December 26, 2016
Question

Script to convert all diagonals to 45 degrees?

  • December 26, 2016
  • 1 reply
  • 1050 views

I'm getting in to Illustrator scripts in a big way at the moment.

Some amazing and USEFUL scripts out there by the likes of Wundes and Sato Hiroyuki!

In an ill-advised attempt to compile a single master script (to rule them all!!) I'm looking for a script that will convert all selected diagonal path segments in to either:

a) perfect 45 degree segments or

b) in to a nice faux-iso angle, such as might be good for iso vector artwork (as used in phone games, etc).

Doing this manually is not an option (too many paths).

Any leads?

This topic has been closed for replies.

1 reply

JETalmage
Inspiring
December 26, 2016

Try to think like the script. If you were the script and I instructed you to "convert all selected segments into perfect 45 degree segments," what would you take that to mean?

Scripts cannot perform ambiguous instructions.

For example, consider a single closed path which was drawn with the Polygon Tool, and has 5 equal length segments (i.e., a pentagon). What would "make all segments into 45 degree segments" mean?

Rotate each segment about its center such that it is literally angled at what Illustrator's coordinate system considers 45 degrees (the angle 45 degrees counter-clockwise from horizontal)? All segments would end up at the same angle, and the result would look like a single 45 degree line.

Rotate each segment such that it makes a 45 degree angle with its adjacent segment? That leads to "but what if" questions requiring decisions which have to lead to geometrically possible answers.

Are the segments to remain connected as a single, closed path? If so, how do you reconcile that five 45 degree angles total only 225 degrees, not 360 degrees? An equilateral polygon consisting of only 45 degree angles is an octagon. How and where is the script supposed to add the three missing segments?

See what I mean? When writing a script, you have to be able to explain what you want to occur in explicit statements which covers all possible circumstances and what to do in each circumstance. That's  what is meant by "pseudo-code." Try to write out in normal language what specific steps the script should perform. Test the logic of those instructions by thinking them through in any given situation and see if you can mentally perform them without running into ambiguities or impossibilities.

JET

runninghead_design
Inspiring
December 26, 2016

Thanks Jet, so you don't know of a script that already exists?

I'll consider you input seriously though while I await any other responses.

Cheers.

JETalmage
Inspiring
December 26, 2016

...so you don't know of a script that already exists?

What I'm saying is, your description of what you want the script to do is too ambiguous to write a script based on that description. You also mention "iso". Assuming that is a reference to isometric drawing, I'm at a loss as to what 45 degrees has to do with that.

You need to describe the problem more fully. Post a screenshot of an example of a drawing you would run the script on and another of what you would expect as result.

JET