# How to add TIN surface boundaries

**URL:** <https://forum.dynamobim.com/t/how-to-add-tin-surface-boundaries/66330>\
**Category:** Civil 3D\
**Tags:** dynamo, civil3d\
**Created:** [July 19, 2021, 12:33pm UTC](https://forum.dynamobim.com/t/how-to-add-tin-surface-boundaries/66330 "2021-07-19T12:33:18Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![anton.opanasenko](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@anton.opanasenko](https://forum.dynamobim.com/u/anton.opanasenko)\
**Post date:** [July 19, 2021, 12:33pm UTC](https://forum.dynamobim.com/t/how-to-add-tin-surface-boundaries/66330/1 "2021-07-19T12:33:18Z")

</div>

Hello everyone

I am new to dynamo, I wonder if there is a way to add tin Surface boundaries, to an existing surface.  
This is how it looks like and how i need it from dynamo skript:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/8/0832924c85fb1a9c0b1543b33b937f46bb576661.png)

Thanks in advance

---

<div class="post-metadata">

**Author:** ![hosneyalaa](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/hosneyalaa/32/100865_2.png) [@hosneyalaa](https://forum.dynamobim.com/u/hosneyalaa)\
**Post date:** [July 19, 2021, 2:36pm UTC](https://forum.dynamobim.com/t/how-to-add-tin-surface-boundaries/66330/2 "2021-07-19T14:36:22Z")

</div>

See this

> [@Surface.Boundaries node](https://forum.dynamobim.com/t/surface-boundaries-node/42003):
>
> Anyone have any luck using the Surface.Boundaries node. It only produces empty lists for me. Is there something that I’m missing? [image]

---

<div class="post-metadata">

**Author:** ![anton.opanasenko](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@anton.opanasenko](https://forum.dynamobim.com/u/anton.opanasenko)\
**Post date:** [July 20, 2021, 7:47am UTC](https://forum.dynamobim.com/t/how-to-add-tin-surface-boundaries/66330/3 "2021-07-20T07:47:52Z")

</div>

Hi hosneyalaa

Thank you for your answer, but this is not, what i am looking for.  
I need a use case, where my input is existing surface and 2D-polylines.  
With dynamo i need to cut out the holes in surface.  
So my first step was to add 2D-polylines as breaklines (it works), and next step should be add boundaries (boundary type: hide), but i can’t find node, where it would be possible.

---

<div class="post-metadata">

**Author:** ![hosneyalaa](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/hosneyalaa/32/100865_2.png) [@hosneyalaa](https://forum.dynamobim.com/u/hosneyalaa)\
**Post date:** [July 20, 2021, 11:47am UTC](https://forum.dynamobim.com/t/how-to-add-tin-surface-boundaries/66330/4 "2021-07-20T11:47:20Z")

</div>

I’m guessing you want

 ![AddContour](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/2/22cb30fe83ac0f56d9bf45cf0ae09ec0ee9e075a.jpeg)

Read this

> [@Creating a surface from a polyline](https://forum.dynamobim.com/t/creating-a-surface-from-a-polyline/56805/10):
>
> It is already possible.

---

<div class="post-metadata">

**Author:** ![hosneyalaa](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/hosneyalaa/32/100865_2.png) [@hosneyalaa](https://forum.dynamobim.com/u/hosneyalaa)\
**Post date:** [July 20, 2021, 12:04pm UTC](https://forum.dynamobim.com/t/how-to-add-tin-surface-boundaries/66330/5 "2021-07-20T12:04:23Z")

</div>

@anton.opanasenko  
Because I’m on vacation I can’t help you well but you need Make a new python script  
And add borders through the link

[http://docs.autodesk.com/CIV3D/2019/ENU/API\_Reference\_Guide/html/f0f1dedc-bae9-a2ed-a2ce-3aa457181755.htm](http://docs.autodesk.com/CIV3D/2019/ENU/API_Reference_Guide/html/f0f1dedc-bae9-a2ed-a2ce-3aa457181755.htm)

---

<div class="post-metadata">

**Author:** ![hosneyalaa](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/hosneyalaa/32/100865_2.png) [@hosneyalaa](https://forum.dynamobim.com/u/hosneyalaa)\
**Post date:** [July 20, 2021, 12:10pm UTC](https://forum.dynamobim.com/t/how-to-add-tin-surface-boundaries/66330/6 "2021-07-20T12:10:58Z")

</div>

Convert picture to python script

 ![Screenshot_20210720-150927](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/3/630470354ca9ab531e3c0f4880af61d42ab3c635.png)

---

<div class="post-metadata">

**Author:** ![anton.opanasenko](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@anton.opanasenko](https://forum.dynamobim.com/u/anton.opanasenko)\
**Post date:** [July 20, 2021, 2:34pm UTC](https://forum.dynamobim.com/t/how-to-add-tin-surface-boundaries/66330/7 "2021-07-20T14:34:57Z")

</div>

It looks like, it should be the right way, but to be honest, i never did anything in python.

---

<div class="post-metadata">

**Author:** ![mzjensen](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@mzjensen](https://forum.dynamobim.com/u/mzjensen)\
**Post date:** [July 20, 2021, 3:20pm UTC](https://forum.dynamobim.com/t/how-to-add-tin-surface-boundaries/66330/8 "2021-07-20T15:20:29Z")

</div>

Hi @anton.opanasenko,

Here’s a Python script for you to try. I did it quickly and did not do extensive testing, so use at your own risk.

IN[0] = surface  
IN[1] = boundary elements (e.g. Polylines)  
IN[2] = mid-ordinate distance for curves  
IN[3] = boundary type as a string, can be “Show”, “Hide”, “Outer”, or “DataClip”  
IN[4] = boolean for whether to use non-destructive breaklines or not

![SurfaceBoundary](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/d/8d9cc728ee2e56195a25aae8ef6ec824eb2ec22d.gif)

```auto
import System
import clr

clr.AddReference('AcMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AeccDbMgd')

from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.DatabaseServices import *

from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *
from Autodesk.Civil import *

adoc = Application.DocumentManager.MdiActiveDocument

def AddSurfaceBoundaries(surface, boundaries, midOrdinateDistance, boundaryType, useNonDestructiveBreakline):
	
	global adoc
	
	if not isinstance(boundaries, list):
		boundaries = [boundaries]
	
	with adoc.LockDocument():
	    with adoc.Database as db:
	        with db.TransactionManager.StartTransaction() as t:
	            surfId = surface.InternalObjectId
	            surf = surfId.GetObject(OpenMode.ForWrite)
	            surfBoundaries = surf.BoundariesDefinition
	            # Create collection of boundary entity IDs
	            boundaryEntities = ObjectIdCollection()
	            for object in boundaries:
	            	boundaryEntities.Add(object.InternalObjectId)
	            # Parse enumeration
	            boundaryType = System.Enum.Parse(SurfaceBoundaryType, boundaryType)
	            # Add boundary entities to surface boundary collection
	            surfBoundaries.AddBoundaries(boundaryEntities, midOrdinateDistance, boundaryType, useNonDestructiveBreakline)
	            surf.Rebuild()
	            t.Commit()
	            pass
	return surface

OUT = AddSurfaceBoundaries(IN[0], IN[1], IN[2], IN[3], IN[4])

```

---

<div class="post-metadata">

**Author:** ![hosneyalaa](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/hosneyalaa/32/100865_2.png) [@hosneyalaa](https://forum.dynamobim.com/u/hosneyalaa)\
**Post date:** [July 20, 2021, 3:20pm UTC](https://forum.dynamobim.com/t/how-to-add-tin-surface-boundaries/66330/9 "2021-07-20T15:20:40Z")

</div>

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/9/f9c5c20fc7678d73fb5d08181eca9880c3cc5141.png)

> [@Create Object ID Collection](https://forum.dynamobim.com/t/create-object-id-collection/49472):
>
> The AddBoundaries method for civil 3d surfaces requires an object ID collection of the polyline boundaries. How can I create an object id collection in python. In my case, there will only be 1 polyline in this collection. I’m using this example as a guide. [http://help.autodesk.com/view/CIV3D/2020/ENU/?guid=GUID-7C32E309-9B54-42A0-A4DC-C6FD592071F2](http://help.autodesk.com/view/CIV3D/2020/ENU/?guid=GUID-7C32E309-9B54-42A0-A4DC-C6FD592071F2)

---

<div class="post-metadata">

**Author:** ![hosneyalaa](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/hosneyalaa/32/100865_2.png) [@hosneyalaa](https://forum.dynamobim.com/u/hosneyalaa)\
**Post date:** [July 20, 2021, 3:23pm UTC](https://forum.dynamobim.com/t/how-to-add-tin-surface-boundaries/66330/10 "2021-07-20T15:23:44Z")

</div>

@zachri.jensen thanks

---

<div class="post-metadata">

**Author:** ![anton.opanasenko](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@anton.opanasenko](https://forum.dynamobim.com/u/anton.opanasenko)\
**Post date:** [July 20, 2021, 4:52pm UTC](https://forum.dynamobim.com/t/how-to-add-tin-surface-boundaries/66330/11 "2021-07-20T16:52:26Z")

</div>

Hi @zachri.jensen

I testes it a little bit more, and it works pretty well.

Thanks a lot

---

<div class="post-metadata">

**Author:** ![121madhu](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/121madhu/32/138360_2.png) [@121madhu](https://forum.dynamobim.com/u/121madhu)\
**Post date:** [March 31, 2022, 7:41am UTC](https://forum.dynamobim.com/t/how-to-add-tin-surface-boundaries/66330/12 "2022-03-31T07:41:29Z")

</div>

this option is very useful to me I am new to python & dynamo so kindly help me with How to load this python script.

I have pasted it directly in python script it is not working in my dynamo for civil3d

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/b/fbdea62ac317827c159e4733d0c6fd0d55ac9761.png)

---

<div class="post-metadata">

**Author:** ![hosneyalaa](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/hosneyalaa/32/100865_2.png) [@hosneyalaa](https://forum.dynamobim.com/u/hosneyalaa)\
**Post date:** [March 31, 2022, 8:05am UTC](https://forum.dynamobim.com/t/how-to-add-tin-surface-boundaries/66330/13 "2022-03-31T08:05:48Z")

</div>

hi  
The problem is in the word I put “Outer”

![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/f/cfb783b30a3578dfb73586dcb7f350bdeda8ec23.jpeg)

---

<div class="post-metadata">

**Author:** ![121madhu](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/121madhu/32/138360_2.png) [@121madhu](https://forum.dynamobim.com/u/121madhu)\
**Post date:** [March 31, 2022, 8:27am UTC](https://forum.dynamobim.com/t/how-to-add-tin-surface-boundaries/66330/14 "2022-03-31T08:27:48Z")

</div>

Could you please upload your .dyn file I think I am doing a mistake

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/4/84ee4119fd41817dcc8d87a59a7bf4e0fc3f59e0.png)

---

<div class="post-metadata">

**Author:** ![hosneyalaa](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/hosneyalaa/32/100865_2.png) [@hosneyalaa](https://forum.dynamobim.com/u/hosneyalaa)\
**Post date:** [March 31, 2022, 8:31am UTC](https://forum.dynamobim.com/t/how-to-add-tin-surface-boundaries/66330/15 "2022-03-31T08:31:24Z")

</div>

[How to add TIN surface boundaries test01.dyn](https://forum.dynamobim.com/uploads/short-url/wxgkid0EniTHWUSIQIRxsqNJepl.dyn) (10.3 KB)

---

<div class="post-metadata">

**Author:** ![121madhu](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/121madhu/32/138360_2.png) [@121madhu](https://forum.dynamobim.com/u/121madhu)\
**Post date:** [March 31, 2022, 8:34am UTC](https://forum.dynamobim.com/t/how-to-add-tin-surface-boundaries/66330/16 "2022-03-31T08:34:20Z")

</div>

error

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/7/e74e6e251f04b79a80f5b28c35a19147d3f0587a.png)

---

<div class="post-metadata">

**Author:** ![hosneyalaa](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/hosneyalaa/32/100865_2.png) [@hosneyalaa](https://forum.dynamobim.com/u/hosneyalaa)\
**Post date:** [March 31, 2022, 8:36am UTC](https://forum.dynamobim.com/t/how-to-add-tin-surface-boundaries/66330/17 "2022-03-31T08:36:23Z")

</div>

Could you please upload exp drawing file

---

<div class="post-metadata">

**Author:** ![hosneyalaa](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/hosneyalaa/32/100865_2.png) [@hosneyalaa](https://forum.dynamobim.com/u/hosneyalaa)\
**Post date:** [March 31, 2022, 8:37am UTC](https://forum.dynamobim.com/t/how-to-add-tin-surface-boundaries/66330/18 "2022-03-31T08:37:54Z")

</div>

![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/9/c96ed4592ad37790c1b6e754eea078fafd12e3e9.jpeg)  
no (3)

![Capture0](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/0/601c8bbb4b807448fd060f3f64690d83236a4a60.jpeg)

---

<div class="post-metadata">

**Author:** ![121madhu](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/121madhu/32/138360_2.png) [@121madhu](https://forum.dynamobim.com/u/121madhu)\
**Post date:** [March 31, 2022, 8:45am UTC](https://forum.dynamobim.com/t/how-to-add-tin-surface-boundaries/66330/20 "2022-03-31T08:45:36Z")

</div>

yes it is working changed 2 to 3 thank you

---

<div class="post-metadata">

**Author:** ![121madhu](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/121madhu/32/138360_2.png) [@121madhu](https://forum.dynamobim.com/u/121madhu)\
**Post date:** [March 31, 2022, 8:48am UTC](https://forum.dynamobim.com/t/how-to-add-tin-surface-boundaries/66330/21 "2022-03-31T08:48:47Z")

</div>

is there option for volume surface and quantity in dynamo for civil3d

[Next page](https://forum.dynamobim.com/t/how-to-add-tin-surface-boundaries/66330.md?page=2)
