How to use the Tuple method

Hi

If two Guids are defined in a Tuple method, what is the proper way to write the Guid so that only sampleB can be called and used in another method?
best regards.

 public static Tuple<Guid, Guid> Create(RhinoDoc doc, double Length, double Width)
 {
    var mesh = new Mesh();
    .
    .
    .
    Curve outLine = Curve.CreateInterpolatedCurve(vPointListAll, 3);

    Guid sampleA = doc.Objects.AddMesh(meshAll);
    Guid sampleB = doc.Objects.AddCurve(outLine);
    return new Tuple<Guid, Guid>(sampleA, sampleB);
 }

If I remember correctly you will access it by something like:

var sampleB = Create(…).Item2

So Tuple isn’t the method, but rather the type that is going to be returned by the Create() method.

Not a .NET expert, but I think this should help: Tuple Class (System) | Microsoft Docs

It does look like you access it with the dot notation like @w.radaczynski mentioned

Thank you for your precise answers to my questions.

I’m having trouble with other harmful effects of defining it in Tuple.

Is there any way to fix these errors?
I thought I needed to cast them…but I guess not.

best

mesh.Scale(length);
error1

doc.Objects.AddMesh(mesh);
error2

You need to Find the mesh from the document object table using the Guid you get from the Create function.


Tuple<Guid, Guid> thing = Create(doc, 5.0, 6.0);
Guid meshGuid = thing.Item1;
RhinoObject meshObject = doc.Objects.FindId(meshGuid);
if(meshObject!=null)
{
    Mesh actualMesh = meshObject.Geometry as Mesh;
    /* now you can use the mesh */
}
1 Like