ZBrushCentral

I have multiple if conditions

I have multiple if conditions.
if SDiv=1,[ISet,Tool:Geometry:P.Loops,1]
if SDiv=2,[ISet,Tool:Geometry:P.Loops,2]
if SDiv=3,[ISet,Tool:Geometry:P.Loops,4]
if SDiv=4,[ISet,Tool:Geometry:P.Loops,8]
How to write this?
I’ll just say this, the code is not executed correctly.

[Loop,1,
	[If,[IGet,Tool:Geometry:SDiv]==1,[ISet,Tool:Geometry:P.Loops,1][LoopExit]]
	[If,[IGet,Tool:Geometry:SDiv]==2,[ISet,Tool:Geometry:P.Loops,2][LoopExit]]
	[If,[IGet,Tool:Geometry:SDiv]==3,[ISet,Tool:Geometry:P.Loops,4][LoopExit]]
	[If,[IGet,Tool:Geometry:SDiv]==4,[ISet,Tool:Geometry:P.Loops,8][LoopExit]]
]

Thank you for your answer,
I have encountered new problems, and I don’t know why.
This can only be used once, and the value of [ISet,Tool:Geometry:P.Loops] will not change the second time. I don’t know why.
[Loop,1,
[If,[IGet,Tool:Geometry:SDiv]==1,[ISet,Tool:Geometry:P.Loops,1][LoopExit]]
[If,[IGet,Tool:Geometry:SDiv]==2,[ISet,Tool:Geometry:P.Loops,2][LoopExit]]
[If,[IGet,Tool:Geometry:SDiv]==3,[ISet,Tool:Geometry:P.Loops,4][LoopExit]]
[If,[IGet,Tool:Geometry:SDiv]==4,[ISet,Tool:Geometry:P.Loops,8][LoopExit]]
]

Without knowing what you are trying to do I can’t say why the code is failing. If the subdivision level is changed and the code run again then it works for me.

Thank you, I have passed some tests to solve it.

1 Like