Select odd/Even Splines segment

Hi Guys, i know this might be maybe a line, but I cannot get it work, I need the code to select odd/even spline segement.

Per example I want to do a Road Paint, so I create a spline, then Divide it, and then I have to select manualy every line in between to delete it and make the white painting. I know there should be a pretty easy script to do that

Thanks a Lot!!
Tricota

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
titol's picture

Same but for vertices?

Can anyone explain how to do the same but for vertices? Cheers

barigazy's picture

...

You can use this fn (BTW works whit lines)
So select line and run the code

fn selectKnots spl which: = if isKindOf spl Line or isKindOf spl Splineshape do
(
	max create mode
	with redraw off for s = 1 to numSplines spl do
	(
		setKnotSelection spl s #()
		for k = 1 to numKnots spl s do
		(
			if which == #even then (if mod k 2 == 0 do setKnotSelection spl s #(k) keep:on)
			else (if mod k 2 != 0 do setKnotSelection spl s #(k) keep:on)
		)
	)
	max modify mode
	subobjectLevel = 1
)

After you run above function use next line

-- select all odd knots
selectKnots selection[1] which:#odd

or this line

-- select all odd knots
selectKnots selection[1] which:#even

bga

titol's picture

Thank you

YES! it works...seems to be a really long process to get it done by script but for what I need to do this is great!

Thank you very much for taking the time to reply with this!!!

Cheers

miauu's picture

.

There was Select Even/Odd tool in Polyboost(The Tools - Tools), but why it is not implemented in RIbbon i don't know.

barigazy's picture

...

For splines?

bga

miauu's picture

.

I doubt that it suports splines. Your snipped is more universal.
It is strange why AD not implemented all tools from PB?

barigazy's picture

...

I suppose they were busy with caddies :)

bga

miauu's picture
Christopher Grant's picture

Here's a quick script that

Here's a quick script that should do what you want assuming you only have 1 spline within your object (because it only works on the first spline sub object currently). In the example I tested I just created a quick line object, went to segment subobj and divided it, then ran the script.

To run this script, simply select your spline, and go to Maxscript / Run Script and run the attached file.

selsegs = #()
numsegs = (numSegments $ 1)
for i = 1 to numsegs do
	if (mod i 2) == 1 do append selsegs i --odd numbers only
 
setSegSelection $ 1 selsegs 
AttachmentSize
snippet-spline_select_OddSegments.ms 158 bytes

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.