Wish: Retrim surface

In the example attached, I want to make the surface bigger at one corner. ReplaceEdge doesn’t help me and ExtendSrf doesn’t help me. Instead, right now I’d probably Dupborder, untrim the surface, and re-trim. If there were a faster way, that would be really helpful.

For instance, it would be great if there were a way to project a curve onto the untrimmed version of a surface (after which I could use ReplaceEdge), or if there were a way to use ReplaceEdge without the curves needing to be on the surface (like a Project option in ReplaceEdge?)

retrim surface bigger underlying.3dm (74.2 KB)

1 Like

Dear @phcreates
your surface in question is planar. that is a very simple case.
why don t you use _planarSrf or _curveBoolean to get what you need ?

I would recommend _curveBoolean with output = Surface and simplify = Yes.
make sure to start the command without preselection / start it without any selection.
_curveBoolean
… select curves (this will allow selecting edges)
Allregions
output = surfaces

done

1 Like

Oh, I meant to send an example with a non-planar surface. Here is a better example. Though it actually doesn’t matter much.

I’m aware how to use curveboolean and planarsrf. I’m looking to make this process happen more quickly. Actually, I think I’m specifically hoping for a tool or method to Project onto the untrimmed version of a surface, because I know there are other cases that I’m not thinking of right now where this would be super helpful.

To reiterate: I think the process of duplicating a border, untrimming and then re-trimming is tedious. I’m wondering if there is a better way.

retrim surface bigger underlying.3dm (74.2 KB)

1 Like

the unterlaying surface is not big enough to include the added region.

-_untrimall has option keepTrims = Yes

_Sellast and deselect the untrimmed surface might speed up things.

check this similar (identical ?) topic - my guess there is not exactly the workflow you re after:

1 Like

I’ll fix my example file & attach it here, along with another example. ReplaceEdge (as mentioned in my first post) is great and has helped a lot, but aren’t helpful afaik in this kind of case.

From that other thread you mentioned, [quote=“Gijs de Zwart, post:2, topic:135137, username:Gijs”]
In cases like that I’d do an _Untrim with keep trim objects, _Explode the curve, remove the parts you want to replace from the selection, add the new trim curve and _Trim again.
[/quote]

That’s the tedium I’m trying to find a way to make less tedious.

retrim surface 2.3dm (104.0 KB)

retrim surface bigger underlying.3dm (74.2 KB)

From another thread, @Willem created this script. If this could be adapted to use Project instead of Pull, this would be a step that would help. Anyone able to do that? Not as good as a full-on Retrim tool, but it might help.

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')
    return
if len(new_curves) > 1: 
    print ('Error: pull resulted in multiple curves')
    return

sc.doc.Objects.Replace(curve_id , new_curves[0])

pull_curve_to_untrimmed()

There is a ProjectToBrep method

You already have the brep, curve and tolerance all you need is to add a Vector3d,
You would probably want to use Rhino.Geometry.Vector3d.ZAxis

1 Like

This seems to work - at least it’s a step in the right direction. Still requires me to split edges and run ReplaceEdge to get what I want, but it’s a start.

import rhinoscriptsyntax as rs
import scriptcontext as sc

def project_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()
view_normal = rs.ViewCameraPlane(rs.CurrentView())[3]

new_curves = list(curve.ProjectToBrep(curve, surface_brep, view_normal, sc.doc.ModelAbsoluteTolerance))


if not new_curves : 
    print ('Error: project resulted in no curves')
    return
if len(new_curves) > 1: 
    print ('Error: project resulted in multiple curves')
    return

sc.doc.Objects.Replace(curve_id , new_curves[0])

project_curve_to_untrimmed()