Hi all.
This is the UV Curve of cylinder, which has a 60 mm in length.
In this example, there are three united groups inside the bounding boxes.
These groups need to be distributed at the same distance from each other.
In manual I make calculations as follows:
I use the addition operation, length of each BB group together (10.84 + 13.19 + 20.97 = 45), then the resulting value subtract from the length of UV curve (60 - 45 = 15).
The resulting difference (15) is divided into the number of objects or groups (3) 15/3 = 5
This value (5) will be the same distance between objects.
One of the distances (5) divide into 2. 5/2 = 2.5. The resulting value (2.5) will be the distance from the left and right sides of UV curve.
Don’t forget to calculate the height of the text too, to keep the same aspect ratio, to preserve the design’s look. To cram 19 capital letters into 60mm of length, I’m guessing each must be 2-3mm high, for the result to be legible (from close up).
It’s well worth checking nothing that does this already exists. It’s straightforward to produce a simple script. The padding calculation itself is only 1 line.
Will the text direction always be aligned with the x-axis?
Are the text objects always going to neatly start from the left edge?
Is the user going to select the text objects and containing box, or can the script work on all the text boxes and containers it finds?
It all depends how you’d like to run it too, e.g. from Rhinoscript or Grasshopper.
Hi James -
This is a small part of the jewelry ring, just the area of ​​the words.
As a rule, I make UV Crv. And I use flat elements in the group or separate curves.
It can be letters, markup for precious stones or seamless ornament.
Usually, the UV Crv is located the long side along the X axis.
I’m not interested in vertical distances, it is always handmade.
In the script I would like any objects that are grouped to be perceived as a single object.
There is no difference for me Rhinoscript or Python. But wouldn’t want from Grasshopper.
Maybe this pseudo code helps (not guaranteed error free):
#pseudo code:
words = [<objects>]
total_length = <float>
word_lengths = [<float>]
words_length =0
for wl in word_lengths:
words_length += wl
remainder = total_length-words_length
am = len(words)
increment = remainder / am
pos_x = increment/2
for i, word in enumerate(words):
if i = am-1:
break
word.xpos = pos_x
pox_x += increment
pos_x += word_lengths[i]