# Adding a blend surface using rhinoscriptsyntax

**URL:** <https://discourse.mcneel.com/t/adding-a-blend-surface-using-rhinoscriptsyntax/78362>\
**Category:** Scripting\
**Created:** [February 6, 2019, 4:37am UTC](https://discourse.mcneel.com/t/adding-a-blend-surface-using-rhinoscriptsyntax/78362 "2019-02-06T04:37:49Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![satadeep.sinha93](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/satadeep.sinha93/32/135651_2.png) [@satadeep.sinha93](https://discourse.mcneel.com/u/satadeep.sinha93)\
**Post date:** [February 6, 2019, 4:37am UTC](https://discourse.mcneel.com/t/adding-a-blend-surface-using-rhinoscriptsyntax/78362/1 "2019-02-06T04:37:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mahdiyar](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/mahdiyar/32/472862_2.png) [@Mahdiyar](https://discourse.mcneel.com/u/Mahdiyar)\
**Post date:** [February 6, 2019, 5:05am UTC](https://discourse.mcneel.com/t/adding-a-blend-surface-using-rhinoscriptsyntax/78362/2 "2019-02-06T05:05:07Z")

</div>

As far as I know it’s impossible to script **BlendSurface** command with **rhinoscriptsynt** , but You can use [Brep.CreateBlendSurfe()](https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Brep_CreateBlendSurface.htm) from **RhinoCommon**.

---

<div class="post-metadata">

**Author:** ![satadeep.sinha93](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/satadeep.sinha93/32/135651_2.png) [@satadeep.sinha93](https://discourse.mcneel.com/u/satadeep.sinha93)\
**Post date:** [February 6, 2019, 5:09am UTC](https://discourse.mcneel.com/t/adding-a-blend-surface-using-rhinoscriptsyntax/78362/3 "2019-02-06T05:09:04Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Mahdiyar](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/mahdiyar/32/472862_2.png) [@Mahdiyar](https://discourse.mcneel.com/u/Mahdiyar)\
**Post date:** [February 6, 2019, 5:38am UTC](https://discourse.mcneel.com/t/adding-a-blend-surface-using-rhinoscriptsyntax/78362/4 "2019-02-06T05:38:51Z")

</div>

> [@satadeep.sinha93](#):
>
> 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()](https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Brep_CreateBlendSurface.htm):

```
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](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/3/b/3b014e725cfa510927e7229c3c8a6c98b867a84b.py) (763 Bytes)

---

<div class="post-metadata">

**Author:** ![satadeep.sinha93](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/satadeep.sinha93/32/135651_2.png) [@satadeep.sinha93](https://discourse.mcneel.com/u/satadeep.sinha93)\
**Post date:** [February 6, 2019, 5:49am UTC](https://discourse.mcneel.com/t/adding-a-blend-surface-using-rhinoscriptsyntax/78362/5 "2019-02-06T05:49:22Z")

</div>

Thank You so much. This looks good for use.

---

<div class="post-metadata">

**Author:** ![satadeep.sinha93](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/satadeep.sinha93/32/135651_2.png) [@satadeep.sinha93](https://discourse.mcneel.com/u/satadeep.sinha93)\
**Post date:** [February 6, 2019, 2:27pm UTC](https://discourse.mcneel.com/t/adding-a-blend-surface-using-rhinoscriptsyntax/78362/6 "2019-02-06T14:27:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![clement](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/clement/32/772979_2.png) [@clement](https://discourse.mcneel.com/u/clement)\
**Post date:** [February 25, 2019, 3:01pm UTC](https://discourse.mcneel.com/t/adding-a-blend-surface-using-rhinoscriptsyntax/78362/7 "2019-02-25T15:01:51Z")

</div>

Hi @satadeep.sinha93, try:

`index = edge.EdgeIndex`

\_  
c.

---

<div class="post-metadata">

**Author:** ![sunlightworking](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/sunlightworking/32/522914_2.png) [@sunlightworking](https://discourse.mcneel.com/u/sunlightworking)\
**Post date:** [September 28, 2021, 3:23pm UTC](https://discourse.mcneel.com/t/adding-a-blend-surface-using-rhinoscriptsyntax/78362/8 "2021-09-28T15:23:45Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![diff-arch](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/diff-arch/32/528268_2.png) [@diff-arch](https://discourse.mcneel.com/u/diff-arch)\
**Post date:** [September 29, 2021, 6:01am UTC](https://discourse.mcneel.com/t/adding-a-blend-surface-using-rhinoscriptsyntax/78362/9 "2021-09-29T06:01:42Z")

</div>

> [@sunlightworking](#):
>
> 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.

Yes, it is. Look at the `cont_a` and `cont_b` parameters in @Mahdiyar’s script. [Here](https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_Geometry_BlendContinuity.htm) are some other options you can set those to.

---

<div class="post-metadata">

**Author:** ![sunlightworking](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/sunlightworking/32/522914_2.png) [@sunlightworking](https://discourse.mcneel.com/u/sunlightworking)\
**Post date:** [September 29, 2021, 6:09am UTC](https://discourse.mcneel.com/t/adding-a-blend-surface-using-rhinoscriptsyntax/78362/10 "2021-09-29T06:09:34Z")

</div>

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