Hello
I left a message to ask you a favor.
Grasshopper uses Python to work, and to reduce operating time, it wants to convert Python scripts into C# scripts.
If you don’t mind, can I ask for your code?
I will study hard with the content you answered.
Thank you.
import Rhino.Geometry as rh
tolerance = 0.001
count = 0
while count < 100:
count += 1
found = 0
for i, r1 in enumerate(regions):
for j, r2 in enumerate(regions):
if r1 == r2:
continue
int = rh.Curve.CreateBooleanIntersection(r1, r2, tolerance)
# intersection found
if len(int) > 0:
# move
p1 = rh.Point3d(x[i], y[i], 0)
p2 = rh.Point3d(x[j], y[j], 0)
vec = rh.Vector3d(p1) - rh.Vector3d(p2)
vec.Unitize()
vec *= d
x[i] += vec.X
y[i] += vec.Y
r1.Translate(vec)
found += 1
if found == 0:
break
print "Executed {} cycles".format(count)