Notifications
Clear all

[Closed] Generating non-uniform Road Linemarking

Hi

I am writing a script to automate the generation of road marking (lane lines) from splines. I have it working fine with uniform markings (eg – 1 metre of line, 1 metre gap), but I am hitting a brick wall when I try to put in non-uniform spacings.

In my case, I need to get my head around the maths involved to have a 1 metre line, 3 metre gap repeating:

so far for my uniform marking I have the following (simplified) script:

addmodifier $ (Normalize_Spl())
$.Normalize_Spl.Length = 1
collapsestack $

SegmentCount = numsegments $ 1

select $
subobjectlevel = 2
SplineArray = #()
for SelSet = 1 to (SegmentCount/2) do
(
setsegselection $ 1 #(Selset*2)
CurrentSelectedSegment = getsegselection $ 1
join SplineArray CurrentSelectedSegment
)

setsegselection $ 1 SplineArray
splineops.delete $
updateshape $
subobjectlevel = 0

Can anyone offer any suggestions as to how I would implement a 1 on, 3 off line?

Thanks a lot

3 Replies

Stright off the top of my head, if the knots are evenly distributed, could you skip every n-th knot in the loop statement??

Shane

Thats a great question, I forgot to add that this is my first script and my knowledge of maxscript is extremely limited.

So basically, your way sounds very efficient but I don’t know what the syntax is:sad:

Thanks, I shall go back to the trusty help!

I’d imagin it would run something like:

SelSet = 1
while SelSet <= (SegmentCount/2) do 
(
setsegselection $ 1 #(Selset*2)
  CurrentSelectedSegment = getsegselection $ 1
  join SplineArray CurrentSelectedSegment

-- Skip the next 2 knots...may need to play with this value...
SelSet += 2
  )

I’m only guessing here so you might need to play around with it a bit, but see how you go.

Shane