Adding a blend surface using rhinoscriptsyntax

How can I add a blend surface between two edges of two different surfaces using rhinoscriptsyntax module?

As far as I know it’s impossible to script BlendSurface command with rhinoscriptsynt, but You can use Brep.CreateBlendSurfe() from RhinoCommon.

Thank You for the information.

I went through the function prototype and saw that it accepts the arguments in brep format. Can you please suggest how can I convert surface objects and curve objects to brep format?

You can not convert a Curve to a Brep; But you can easily convert a Surface to a Brep like this:

brep = rs.coercebrep(srfGUID)

Here is a simple example of using Brep.CreateBlendSurfe():

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino

srf_A_GUID = rs.AddSrfPt(([-5,-5,0],[5,-5,0],[5,5,0],[-5,5,0]))
srf_B_GUID = rs.AddSrfPt(([15,5,5],[25,5,5],[25,-5,5],[15,-5,5]))

brep_A = rs.coercebrep(srf_A_GUID)
brep_B = rs.coercebrep(srf_B_GUID)

face_A = brep_A.Faces[0]
edge_A = brep_A.Edges[1]
ival_A = edge_A.ToNurbsCurve().Domain
cont_A = Rhino.Geometry.BlendContinuity.Curvature

face_B = brep_B.Faces[0]
edge_B = brep_B.Edges[2]
ival_B = edge_B.ToNurbsCurve().Domain
cont_B = Rhino.Geometry.BlendContinuity.Curvature

rcs = Rhino.Geometry.Brep.CreateBlendSurface(face_A, edge_A, ival_A, True, cont_A, face_B, edge_B, ival_B, True, cont_B)
for rc in rcs:
    sc.doc.Objects.AddBrep(rc)
sc.doc.Views.Redraw()

Sinha93.py (763 Bytes)

Thank You so much. This looks good for use.

Just one more query, how can I know the index number of a particular edge in brep.Edges?

Hi @satadeep.sinha93, try:

index = edge.EdgeIndex

_
c.

how to adjust the bulge of blendsurface, for example, i can adjust the value of blendsurface in rhino, but it is not this option in brep.createblendsurface. can you explain this problem , very very thank you!

Yes, it is. Look at the cont_a and cont_b parameters in @Mahdiyar’s script. Here are some other options you can set those to.

1 Like

Thanks, i know this options, however, blendsurface is not good, so we need bulge to adjust the blendsurface. Do you have idea?