Torus part

I’m creating torus like this:
ON_Plane plane(ON_origin, ON_zaxis);
ON_Circle circle(plane, R);
ON_Torus torus(circle, r);
ON_Brep* brep = ON_BrepTorus(torus);
But I want just a part of it. Let’s say I have a span angle and I want just that part of the torus to get…How can I achieve this?
Please help, thanx

I suppose you have two options.

  1. Create the Torus and then trim away the excess.

  2. Create an arc with the given span angle. At the start and end create a circle of radius r perpendicular to the direction of the arc. Use Sweep1 to create a torus part over the arc (rail) using the circles as cross section curves.

My preference would be 2.

Thanx Menno, I’m trying the second…but I’m a little confused wit using RhinoSweep1()…

Maybe this example will help

Did you know how to create circle normal to the arc at start or end point?
Thanx for the previous answer, that was very helpful

I guess like this:

double r; // circle radius
ON_Arc a; // arc
double t0 = a.Domain().m_t[0];
double t1 = a.Domain().m_t[1];

ON_3dPoint o = a.PointAt(t0);
ON_3dVector n = a.TangentAt(t0);

ON_Plane p0(o, n);

o = a.PointAt(t1);
n = a.TangentAt(t1);
ON_Plane p1(o, n);

ON_Circle c0(p0, r);
ON_Circle c1(p1, r);

// sweep over a, using c0 and c1

I try like this
double teta = 3.14/2;

ON_Circle median_circle(ON_xy_plane, R);
ON_Arc arc(median_circle, ON_Interval(-teta/2, teta/2));

double t_s = ON_UNSET_VALUE;
double t_e = ON_UNSET_VALUE;
ON_3dVector tan_s = arc.TangentAt(t_s); 
ON_3dVector tan_e = arc.TangentAt(t_e);
ON_Plane p_s(arc.StartPoint(),tan_s);
ON_Plane p_e(arc.EndPoint(),tan_e);
ON_Circle circle_s(p_s, r);
ON_Circle circle_e(p_e, r);

but your solution is more elegant :smiley: Thank you a lot…best wishes