Apologies in advance - I am just starting to teach myself Python.
I would like to write a script to take an existing poly object (a road segment/section), and be able to duplicate it n times along either a x or y axis, but positioning each duplicate/copy so that the front of each duplicated road segment butts up against the rear of the prior road segment. (That is, if I have a single segment of a road model, I would like to duplicate it n times in order to make a longer stretch of road from the duplicated sections. I would like to be able to select either the x or the y axis for this process.) I constructed a standard road segment of exactly 12 meters, so I have a constant length for the poly object.
Would very much appreciate any help with this scripting task.
Trivial yeah, but not necessarily perfect for your need. took 8 minutes to write (i can read it form files timestamps) a few minutes to decide how to publish the options. Mainly I missed one step that took most f the time, i should refactor jooListMul and jooListSub to be calls to map instead but yeah no problem. Keeps my skill up.
So instead of:
def jooListMul(a, b):
ret = []
for i in range(len(a)):
ret.append(a[i]*b[i])
return ret
one should use:
from operator import mul, add
list(map(mul, [1,2,3], [0,0,1]))
Obviously with right lists, this should be a bit faster and more elegant