Create uv curves in Rhino common


#1

Hi all,

I assume the method isnt public?
I cant imagine how it works, first I thought it is just the borders of the unrolled srf, but it seems to be different.

May someone point out how it is done?Is it difficult?

Thanks!


#2

Ok, I think I got it:

    BrepFace bf = source.Faces[0];
    NurbsSurface ns = source.Faces[0].ToNurbsSurface();

    //Get size to build Srf in XY
    double w; double h;
    bf.GetSurfaceSize(out w, out h);
    Rectangle3d rect = new Rectangle3d(Plane.WorldXY, new Interval(w / 2, -w / 2), new Interval(h / 2, -h / 2));
    Brep[] aimSrf = Brep.CreatePlanarBreps(rect.ToNurbsCurve());



    //CopyTrim
    Brep brep = Brep.CopyTrimCurves(bf, aimSrf[0].Faces[0].ToNurbsSurface(), Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance);
    Curve[] joined = Curve.JoinCurves(brep.Curves3D);

    //Add to tree path(0)= trimCrvs, path(1)= boundary
    var crvs = new DataTree<Curve>();
    crvs.AddRange(joined, new GH_Path(0));
    crvs.Add(rect.ToNurbsCurve(), new GH_Path(1));
    A = crvs;


Seems it can “unroll” what other unroller dont process:


Unroll Twilight Zone!
(Pfotiad0) #3

Wait a minute:

All that due to some unroll job? (if the things are developable) :


#4

Hi Peter,

yeah, for developable things the unroller works fine.I needed it for a cutted sphere. For that case the code posted above seems to work fine.