Thanks a lot for your help.
Please tell me, how can I get the access to separate (specific) curve in code (in the same function)?
How can I identify specific curves in my curves array?
Identify specific curves and then immediately work with these individual curves in code (in the same function).
I have 1000 breps (surface or polysurface) in my array.
After these 1000 surfaces will processed with long method, I need to get access to each individual result of method with which each brep was processed.
Let’s say a function converted 1000 separate surfaces using one algorithm in a for loop.
After the for loop has performed a function with all 1000 separate surfaces, I need to access to the result of a specific surface (let say 394, 256 and 579).
I’d define a class that would hold the results of the edge duplication. The class could also store an index, a reference to the Brep, and the face index or component index. Then build an array or list of these class objects.
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
var go = new GetObject();
go.SetCommandPrompt("Select surface and polysurface to duplicate edge curves");
go.GeometryFilter = ObjectType.Surface | ObjectType.PolysrfFilter;
go.SubObjectSelect = false;
go.GetMultiple(1, 0);
if (go.CommandResult() != Result.Success)
return go.CommandResult();
// Create a list that contains lists of curves
var curve_lists = new List<List<Curve>>();
for (var i = 0; i < go.ObjectCount; i++)
{
var objref = go.Object(i);
var brep = objref.Brep();
if (null != brep)
{
var curves = brep.DuplicateEdgeCurves();
if (null != curves)
curve_lists.Add(curves.ToList());
}
}
for (var i = 0; i < curve_lists.Count; i++)
{
var curves = curve_lists[i];
foreach (var curve in curves)
{
var obj_id = doc.Objects.AddCurve(curve);
if (obj_id != Guid.Empty)
{
var rh_obj = doc.Objects.Find(obj_id);
if (null != rh_obj)
rh_obj.Select(true);
}
}
}
doc.Views.Redraw();
return Result.Success;
}