Error when intersecting in a specific coordinate

Hello all,
I’m working on a script that creates many vertical planes, intersect each of them with a surface, and then delete the part of the plane that is outside de surface, so the objective is to divide the internal part of the surface (for example an sphere) in many sections.
The script works properly, but if we want to create the vertical plane in the coordinate y = 2, it doesn’t work. It only happens with y = 2, for the rest of positions of “y”, it works correctly, and the code is exactly the same for each coordinate we introduce.
I think this is very very strange but, does anyone know which could be the problem? Thank you very much

I think the only way to effectively diagnose the problem would be to see the relevant portion of the code which creates the vertical planes and run it to see where the error is occurring.


Okay @Helvetosaur , this is the part of the code where the problem is supposed to be. It works with any “y” coordinate, but if we introduce “y = 2”, it creates the plane, makes the intersection, but it doesn’t create the planar surface “crv”. Thank you:

If Rhino.Islayer("121_GC") then
  Call Rhino.Addlayer("121_GC",RGB(0,255,0))
End if

p1 = Array(-50, 2, 2)
p2 = Array(-50, 2, 18)
p3 = Array(400, 2, 18)
p4 = Array(400, 2, 2)

Rhino.Addsrfpt(Array(p1, p2, p3, p4))
c1 = Rhino.ObjectsByLayer("Aux")
c2 = Rhino.ObjectsByLayer("111_GC")
c3 = Rhino.ObjectsByLayer("131_GC")
c4 = Rhino.ObjectsByLayer("113_GC")

a1 = Rhino.IntersectBreps(c1(0), c2(0))
a2 = Rhino.IntersectBreps(c3(0), c1(0))
a3 = Rhino.IntersectBreps(c4(0), c1(0))

crv = Rhino.ObjectsByLayer("Aux2")
If not isnull(crv) then
End if

So the intersection curve (variable “crv”) does get created when Y=2? Can you inspect the curve that’s created - you seem to be adding it to the document on layer “121_GC” - and see why it doesn’t make a planar surface?

If the intersection curve is not created however, there is another problem, and that probably depends on the object you’re intersecting the plane with.


When we introduce y=2, it creates de plane and intersect it (it makes the curve) but as it doesn’t create the planar surface, it delete all. It’s been working perfectly for weeks, but today it’s started giving this problem, and I observed that it only happens with that coordinate

I would comment out the part of the script that deletes the intersection curve and look at in Rhino it to see why the planar surface isn’t created - maybe it’s open, or self-intersecting or some other problem.

BTW, the intersection could create several curves - IntersectBreps creates an array that could contain one or more curves. Also, AddPlanarSrf should handle an array of curves, but is it possible some other non-curve element is on layer 121_GC? Personally I would not use ObjectsByLayer to collect my curves unless I was 100% sure there was nothing else on the layer, and even then… I would rather collect the results of the intersections in a separate array and feed that directly to AddPlanarSrf instead…


In the layer 121_GC there are the several “final planes” we are obtaining, but the “crv” is located into layer “Aux2”. In Aux2 there is only the curves resulting from the intersection of the plane and the surface

Right. Can you actually make a planar surface with Rhino’s normal command PlanarSrf from the intersection curve in Aux2 (the one that doesn’t work in the script) ? If the intersection curve has been produced but not the planar surface from it, then Rhino has a problem making the surface from the curve, and you need to find out why.