Jump to content
You must now use your email address to sign in [click for more info] ×

Field expression enhancements


Recommended Posts

I would like to propose a few extensions to the expressions that can be entered into fields such as those on the transform panel.

First a few "easy" ones: it would be nice if "right" and "bottom" transform variables (or maybe "xmax" or "ymax" or whatever you want to call them) were added to reference the right and bottom edges of a selected object as the current "x" and "y" variables refer to the left edge.  This is currently possible by using "x + w" or "y + h" but in conjunction with some of the other features listed below this would be a good shortcut to help reduce the length of some of the expressions, and thus the amount of typing when they are being used...

It might also be nice in some cases to have an "odd" function that would accept an integer argument and return 0 if the number is even, and 1 if it is odd.  Similarly "round" and "trunc"/"truncate" functions to round or truncate a value to an integer.

 

The rest of these deal with multiple objects being selected:

  • Entering a value into a transform field when multiple objects are selected should normally handle them "as a group" - so entering a value of "12mm" into the "x" field should shift the group such that the leftmost edge of the leftmost object was at position 12mm, and the others moved to maintain their distances from the leftmost object.  I believe this is existing behavior.
  • Preceding an expression with an "=" character should set all of the selected objects identically.  Entering "=12mm" into the "x" field should set the left edge of each individual object to be at 12mm, rather than maintaining their horizontal distances from each other.

 

When any of the following syntax is used, the objects should be examined individually in a specific order when applying the expression; the order would be determined by the field that was being used (ex. "x" or "width" fields would reference the objects from leftmost to rightmost as they are positioned horizontally; in the "y" or "height" fields, topmost to bottommost as positioned vertically):

  • Using "prev.variable" would give the value of variable as applied to the previous object in order (so when the expression is being evaluated for the second object, it would give the value for the first object).  If this syntax is used, the value for the first object would not be changed, as it would have no previous object to reference.
  • Special variables "i" and "n" would give an index of the object currently being evaluated into the number of objects selected; so if 5 objects are selected, the first one would have i=1 and n=5, while the second would have i=2 and n=5.

 

This could similarly be applied to the individual characters of selected text, so for example when entering an expression in a text size field, the selected range would be considered from the start of the selection to the end.

  • Normally, this would be applied to individual characters.
  • Adding syntax such as "by word" to the expression would cause each word to be considered in order instead of each character
  • Similarly "by line" to consider each line in order

 

A few examples of how this might be used:

(transform width): =100mm                                                make each selected object 100mm wide

(transform x): prev.right + 10mm                                        set the left edge of each object 10mm from the right edge of the previous one

(transform y): +=10mm * odd(i)                                          offset the vertical position of every other object by 10mm

(transform y): += 10mm * (1 - Clamp(IRem(i,3), 0, 1))     offset the vertical position of one in three objects by 10mm

(text size): +=5pt * i                                                               make size of selected text increase gradually from left to right

(text size): += sin(pi*i/n)*18pt                                             make text size arc upward and downward such that it is largest in the middle

(text size): += 15pt * odd(i) by word                                   make every other word larger by 15pt

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.