How to check for selected segments i splineShape
Hi there, i am a noob at maxscript, so hopefully someone can help me with my problem.
I am trying to assign materialID to a selection af segments, and this is where i am so fare:
on spn_segmentsId entered do -- set the material ID for the selected segment
(
num=spn_segmentsId.value
for i=1 to (numSplines $) do (
for j=1 to (numSegments $ i) do (
?- NEED TO TEST IF THE SEGMENT IS SELECTED -? setMaterialID $ i j num
)
)
updateShape $
)
Pleace help me am i on the right track, i cant seem to find any method for checking for selected segments.
Best regards
David
Comments
2D array
I´m back
This time it is the "reverse order". I need to grap segments by the materialId.
This is where i am so fare:
rollout test "select seg id"
(
spinner spn_selectID "select seg" type:#integer range:[1,3,1]
on spn_selectID entered do(
id = spn_selectID.value
obj = selection[1]
newSegSel = #()
for i=1 to (numSplines $) do if getMaterialID obj i j== id do
(
append newSegSel i
for j=1 to (numSegments $ i) do if getMaterialID obj i j== id do
(
append newSegSel j
)
setSegSelection obj i newSegSel
)
updateShape $
)
)
createDialog test 300 200
I am stuck at this point on how to make my array (newSegSel) a 2D array, and how to append the right numSplines and numSegments.
Is there anyone who will help me understand how this is done.
Best regards
David
...
Run this function first
Then to execute this function run separately line by line of code.
For example:
-- example
Select some spline first.
Run next line of code if you want to assigne id 2 (for example) to selected segments.
Run next line if you want to assigne random id's to any segments.
In this case you not need to select segments.
If you add id 5 then you will assigne random number from 1 to 5
Run next line if you want to assigne random id's to selected segments segments
Same rule, if you asigne id 10 you will assigne rundom numbers as id from 1 to 10
bga
So cool Branko Živković, i
So cool Branko Živković, i need to learn how to build functions :)
Thanks for your help.
I´m working on a couple of other small script´s, so i might be back for some more help :)
Best regards
David