Hello everyone; i Convert this Vb Script for Inset Mesh
(M+ plug-in) To c#
all is currect but the end of Mesh.face is missing (not inset) in c# (script)
Can anyone help me??
inset mesh-Vb.net To C#.gh (23.9 KB)
I was going to ask if you fell into one of the ‘Is this base 1 or base 0’ traps of VB (such as dim foo(5) giving you a six element array, 0 to 5).
I did notice
Private Function matchClr(ByVal a As list(Of Color), ByVal t As Integer)
Dim i,k As Integer
k = a.count()
For i = 0 To ((t + 1) - k) - 1 Step 1
a.add(a.item(k - 1))
Next
Return a
End Function\
vs
private List matchClr(List a, int t)
{
int k = a.Count;
for (int i = 0; i < ((t + 1) - k) - 1; i++)
{
a.Add(a[k - 1]);
}
return a;
}
The upper bound would be inclusive in VB and exclusive in C#:
for i = 0 to (someexpression) Step 1
next
will execute someexpression+1 times in VB
and
for (i=0;i<(someexpression);i++) {
}
will execute (someexpression) times in C# because it’s < instead of <=.
Thank s
@Nathan_Bossett
Yes your solution were right and the bug resolved by used i<=Count
in for Loop