Pull to Underlying Untrimmed Surface

Does anyone have an existing script to pull a curve to the underlying untrimmed version of a surface? In this case, the surafce is mainly for reference

This would save copying the trimmed surface, untrimming it, running pull, deleting the untrimmed surface.

I did start trying to make a DupSrf command which would make an untrimmed copy of a surface - possibly also extracting from a polysurface at the same time intelligently.

PullToUnderlyingUntrimmed.3dm (342.7 KB)

Hi Jonathan,

I was in a hurry but maybe this will suffice:

import rhinoscriptsyntax as rs
import scriptcontext as sc

def pull_curve_to_untrimmed():
    curve_id = rs.GetObject('select curve', filter = rs.filter.curve)
    srf_id = rs.GetObject('select surface', filter = rs.filter.surface)
    curve =  rs.coercecurve(curve_id)
    brep = rs.coercebrep(srf_id)
    surface = brep.Faces[0].UnderlyingSurface()
    surface_brep = surface.ToBrep()
    new_curves = list(curve.PullToBrepFace(surface_brep.Faces[0], sc.doc.ModelAbsoluteTolerance))
    if not new_curves : 
        print 'Error: pull resulted in no curves'
    if len(new_curves) > 1: 
        print 'Error: pull resulted in multiple curves'
    sc.doc.Objects.Replace(curve_id , new_curves[0])

Does that work for you?

Works nicely. I will try and update it so it works a little more like pull, with the option for multiple curves and subsurfaces from a polysurface.

Although that could maybe be messy output wise if you pull to two different untrimmed surfaces… so simpler is probably better, with just multiple curves at least.


Let us know if you run into issues.


Will do! I think it’s a neat little thing to have.


Do you think it would be feasible to do something similar with Project?

I might have to try and look at it also. Pull to Untrimmed has been nice for me. So thank you!