I need help with how to exclude duplicate curves, which are exactly one on top of the other. I am programming in C #.
Thanks
Hello. To be clearer, I’ve put an example of what I need, that is, I need to blast this text and delete the duplicate lines and then join the remaining lines. If anyone can put an example in C #, it would help me a lot, as I am a newcomer in development for Rhino
Thanks
Example.3dm (38.1 KB)
In Rhino you could use the commands _SelDup and _Delete to get what you want. And using these commands from C# is perhaps (I use Python…) related to this.
Thank you very much.
I’ve found a way to make and function. If someone has something to complement or improve I will be grateful
Below is my code
Curve[] curveJoined;
var CurveToJoin = new List<Curve>();
var go = new Rhino.Input.Custom.GetObject();
go.SetCommandPrompt("Select objects");
go.EnablePreSelect(true, true);
go.EnablePostSelect(true);
go.GetMultiple(0, 0);
if (go.CommandResult() != Result.Success)
{
return go.CommandResult();
}
var selected_objects = go.Objects().ToList();
foreach (var obj in go.Objects())
{
PolyCurve poly_curve = obj.Curve() as PolyCurve;
Curve[] segments = poly_curve.Explode();
doc.Objects.Delete(obj, false);
foreach (Curve segment in segments)
{
if (segment.Domain.T0 % 2 == 0)
{
CurveToJoin.Add(segment);
}
}
}
curveJoined = Curve.JoinCurves(CurveToJoin, 0.01, false);
foreach (Curve cv in curveJoined)
{
doc.Objects.AddCurve(cv);
}
doc.Objects.UnselectAll();
doc.Views.Redraw();
return Result.Success;
Thanks
Did you convert to python code?
There is nothing to convert. In Python you can simply do this:
import rhinoscriptsyntax as rs
rs.Command('_SelDup _Delete')
But not same object ID it doesn’t delete.