Rhino 7 and Sections through Mesh objects

Hi Dale,
I’ve noticed a change in behavior when creating contours/sections through mesh objects between Rhino 6 and 7. Below is a simple command that cuts 9 sections through a sample mesh. When I run this in Rhino 6 I get 9 closed curves and their direction (cw vs ccw) is consistent. When I run this in Rhino 7 with the same model I get some closed curves and lots of curve pieces. Also on the closed curves the orientation is not consistent. Do you have any thoughts on what might be the cause? The mesh is valid and I’ve tried it on a few meshes with similar results. Thanks



SampleMesh.3dm (246.6 KB)

public class SampleMeshSectionCommand : Command
{
	public SampleMeshSectionCommand()
	{
		Instance = this;
	}

	///<summary>The only instance of the CreateFloatPlaneCommand command.</summary>
	public static SampleMeshSectionCommand Instance { get; private set; }

	public override string EnglishName
	{
		get { return "SampleMeshSection"; }
	}

	protected override Result RunCommand(RhinoDoc doc, RunMode mode)
	{
		RhinoGet.GetOneObject("Select mesh object to section", false, ObjectType.Mesh, out ObjRef rhinoObj);

		double[] locs = new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
		foreach (var loc in locs)
		{
			var curves = Mesh.CreateContourCurves(rhinoObj.Mesh(), new Plane(new Point3d(loc, 0, 0), Vector3d.XAxis));
			if (null != curves)
			{
				foreach (var curve in curves)
					doc.Objects.AddCurve(curve);
			}
		}
		return Result.Success;
	}
}

@piac - is this something you can help with?

Hi @LarryL

I just want to let you know that I’ve debugged the origin of the problems, in fact, there are two:

  • some segments do not reconnect in the right order, and therefore a few pieces remain isolated. This is a problem of tolerances that are way too high when they arrive to the inner computations. RH-65835
  • the direction of the curves. Right now in V7, there was no convention for winding (ccw, right hand rule) and therefore the winding is accidental. RH-65833

I agree that the winding might be useful when intersecting planes, and therefore I am working on fixing it. Also, the tolerance issue can easily get fixed. I’m already working on these issues.

Thanks,

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

2 Likes

Hi @piac , Many thanks for looking into these. They are both quite important for Orca3D as they are used to compute the contained area of a planar intersection curve, and since the +/- sense of the area can be different (e.g., a closed area with a hole in it) the winding is also important. We’ll look forward to the update.

Kind regards,
Larry

A post was split to a new topic: Brep.CreateContourCurves issue

I don’t know how that function is implemented. Let’s ask @dale to please chime in.

RH-65835 is fixed in Rhino 7 Service Release 13

RH-65833 is fixed in Rhino 7 Service Release 15