PDA

View Full Version : Generating non-uniform Road Linemarking


MickyG
01-07-2008, 12:54 AM
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:

http://i219.photobucket.com/albums/cc295/mickyg_bucket/Lanes.jpg

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

RustyKnight
01-07-2008, 03:30 AM
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:

http://i219.photobucket.com/albums/cc295/mickyg_bucket/Lanes.jpg

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 lotStright off the top of my head, if the knots are evenly distributed, could you skip every n-th knot in the loop statement??

Shane

MickyG
01-07-2008, 03:50 AM
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!

RustyKnight
01-07-2008, 05:55 AM
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

CGTalk Moderation
01-07-2008, 05:55 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.