Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5892

Transform from curves from world XYZ to a surface space UVN

$
0
0

@Willem wrote:

Hi,

I'm looking for a way to transform curves from WorldXYZ to a Surface's UVN
i.e. script the ApplyCrv command

I'm scripting in Python and have not found anything yet in RhinoCommon. I try and dig deeper while waiting for someone to chime in here.

I have found a solution that seems to be what ApplyCrv does:

    # bbox is boundingbox from all iso_curves (these need to be morphed)
    Uplane_interval = Rhino.Geometry.Interval(bbox.Min[0], bbox.Max[0])
    Vplane_interval = Rhino.Geometry.Interval(bbox.Min[1], bbox.Max[1])
    # create a planar surface on XY plane around geometry to be morphed
    from_surface = Rhino.Geometry.PlaneSurface(Rhino.Geometry.Plane.WorldXY, Uplane_interval, Vplane_interval)
    
    # create SporphSpaceMorph instance (who's been drinking while making up these names?)
    # to_surface is NurbsSurface to 'Apply the curves to'
    Morph = Rhino.Geometry.Morphs.SporphSpaceMorph(from_surface,to_surface)

    # Morph the geometry one by one
    for crv in iso_curves:
        Morph.Morph(crv)

Thanks
-Willem

Posts: 6

Participants: 5

Read full topic


Viewing all articles
Browse latest Browse all 5892

Trending Articles