Skip navigation
BluePhaze
Currently Being Moderated

Z Order based on relative position

Jul 16, 2013 11:15 PM

Tags: #illustrator #automation #z_order

Hello All,

 

Sorry if this is a simple question, I just can't seem to find a way to do this. I am using multiple objects to make larger more complex objects. As part of this I need a way to select a large group of objects and adjust their Z Order. For example, say I have a grid of 100 squares, 10 columns of 10 squares. I want to arrange them so the squares (rows) toward the bottom of the grid are in front (bring to front/bring forward) the squares that are higher up in the grid. Basically, every row should be further back in the Z order than the row below it.

 

Now you might say well for a grid this is simple just select every object/square in the row and move them forward or back as needed. But in my case they are not actually arranged in a neat grid, they are pretty randomly thrown together. But the requirement is still the same, I want to take all of the objects and arrange them so the objects that are closer to the bottom of the art board are further forward in the Z order than the objects above them. Basically think of the bottom of the artboard as being the front most row of the Z order and the top of the art board as the furthest back in the Z order. I use this type of configuration to give the perception of depth and form. Below you can see an example of a cloud like graphic created using this technique by manually adjusting each individual object which takes forever on larger objects. I pick a point toward the bottom, and then I manually start adjusting Z order on each item until I get the effect I want. Having some way to pick a point on the art board and then arrange the objects above and below it on the Y axis by moving them forward or back in the Z order as needed would save me a ton of time. As you can see below, from about the 3rd or fourth row of squares from the bottom, I have brought those to the front, and each row above or below it has had it's Z order adjusted to give the impression of depth. Each consecutive row after the foreground row is progressively further back in the Z order. Can anyone think of a way to automate this so that I can atleast have a base to start with before I start doing my manual adjustments? Thanks!

 

Clouds3.png

 
Replies
  • Currently Being Moderated
    Jul 17, 2013 2:22 AM   in reply to BluePhaze

    Z-order??

    You mean stack or what?

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 17, 2013 9:36 AM   in reply to BluePhaze

    All the transformations in Illustrator, except for explicit send back/forward/front/rear and the Symbol Shifter, are about X/Y shifts. But that doesn't change the fact that everything in Illustrator still has a Z stacking order; it's just effectively "automatically asigned" by the creation order. Patterns, brushes, effects, even meshes and dashes auto-replicate things, but the copies do not occur at the same Z position; they still have a Z order.

     

    So simply use to advantage the tools which automate replication.

     

    Don't create a Group. Draw one object. Store it as a Symbol.

    Apply Transform Effect with copies to create a row; apply Transform Effect again to create a stack of rows.

    Do it again to create a stack of matrices.

    To impart a bit of random distribution, Expand Appearance, Ungroup; apply Transform Each with the Random option on.

     

     

     

     

     

    JET

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 18, 2013 6:31 AM   in reply to BluePhaze

    I am wondering if it may be easier if I want a more controled effect to create a custom action or macro...

    Easier? Using multiple applications of Transform Effect is easy:

     

    • The transformation parameters are still editable after-the-fact.
    • The transformation stack can be stored as a Graphic Style.
    • Using a Symbol lets you swap out the entire array using the Replace Symbol command.

     

    You can make a Graphic Style which results in a "one dimensional" array (a line of ordered duplicates), another Style for a "two dimensional array" (a grid of ordered duplicates), and another Style for a "three dimensional array" (an ordered stack of grids). That set of Styles, in combination with Symbols is quite versatile and re-usable. All four of the examples I depicted are re-applications of the same Style and/or minor tweaks of the parameters, and a Symbol replacement.

     

    The problem with Actions is the matter of "iteration through a large group." Actions (macros) are just dumb recordings of a sequence of standard interface commands. To iterate through a large group, you have to devise a means by which make the Action select the appropriate "next" object. There is no programmable aspect to Actions. So you would have to figure a way to "define" for the Action what "next" means in terms of standard commands. The regular Select>Next Object Above/Below won't do you any good, because they already refer to the existing stacking order (the very aspect you are trying to edit), not the merely visual arrangement (the X/Y positions of each). So devising a means that would work for all similar instances is unlikely and will be unwieldy.

     

    Scripting can be used, but it's certainly not "easier" to set up, and you have a similar problem in that you have to very explicitly work out exactly what you want to occur. You can't code human "fuzzy logic" like "the next object in this group" without defining exactly what "next" means. In other words, if "next" means to you the object merely visually located at a "higher" or "lower" or "left" or "right" position on the page, you have to explicitly code that so as to target the desired objects in the requred sequence. And once a script is run, it's done. You don't invoke the script to go back and "further" adjust what it's already done. The script is starting all over.

     

    For example, I have a set of scripts which I use to re-arrange the z-order of individual textFrames in correct reading order, so that the reading order is correct when the text is concatenated into a single textFrame. (A common problem when dealing with text in CAD imports.) But that's a repeatable algorithm for a repeatingly similar situation. The situation you are describing is not like that.

     

    So before you dismiss the suggestion already provided, try it.

     

    JET

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 18, 2013 6:11 PM   in reply to BluePhaze

    ...I need to change the stroke color on the parts that actually have a stroke showing...

    See the documentation for the several Select Same... commands. (Not nearly as powerful as select-by-attribute features in other programs, but will probably do what you describe, unless there are complicating issues you have not described.) Subselect (white pointer) one of the paths with the stroke. Select>Same>Stroke Color. Apply a different Swatch.

     

    Similar selections are possible (to select similar attributes within a tolerance range) with the Magic Wand selector.

     

    I have hundreds of copys of an object if there is a way to...convert all of them to instances of a symbol?

    That's something I use a script for; not because I fail to use Symbols from the start, but as a subroutine for more elaborate automation procedures that necessarily involve an intermediate step in which many non-Symbol objects are generated. It's a fairly simple thing to script, and is a good exercise to get acquainted with scripting.

     

    Get in the habit of always considering Symbols whenever you find yourself using multiple occurrances of the same graphic.

     

    JET

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points