# Create cropped surface C3D - Dynamo/ Python

**URL:** <https://forum.dynamobim.com/t/create-cropped-surface-c3d-dynamo-python/108913>\
**Category:** Civil 3D\
**Tags:** python, dynamo\
**Created:** [March 20, 2025, 12:24pm UTC](https://forum.dynamobim.com/t/create-cropped-surface-c3d-dynamo-python/108913 "2025-03-20T12:24:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![e.rincon](https://avatars.discourse-cdn.com/v4/letter/e/65b543/32.png) [@e.rincon](https://forum.dynamobim.com/u/e.rincon)\
**Post date:** [March 20, 2025, 12:24pm UTC](https://forum.dynamobim.com/t/create-cropped-surface-c3d-dynamo-python/108913/1 "2025-03-20T12:24:19Z")

</div>

Hello there, I’m trying to develop a Dynamo and Python code to create a cropped surface within the same file as the source surface.  
Due to my workflow it’s a waste of time do the same process over and over again (save file, select boundary, select existing/ create new file/ name/ etc). So, I’m developing a Python code based on the C3D 2025 API’s **TinSurface.CreateByCropping(Database, String, ObjectId, ObjectIdCollection, Point2d) Method**

So far I have written the following Pyhton code:

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

However, after executing it, Dynamo retrieves the following message:

"Warning: PyhtonEvaluator.Evaluate operation failed.IdentationError : (‘expected an indeted block’,(',35,17,‘src\_surface = tr.GetObject (srcSurfaceId)\n’)).

Has anyone tried this before?. Can anyone please help me to troubleshoot this?

---

<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 20, 2025, 12:55pm UTC](https://forum.dynamobim.com/t/create-cropped-surface-c3d-dynamo-python/108913/2 "2025-03-20T12:55:48Z")

</div>

Try  
Add to line 35  
ArcSurfaceId.InternalObjectId

---

<div class="post-metadata">

**Author:** ![geert.drijfhout](https://avatars.discourse-cdn.com/v4/letter/g/a4c791/32.png) [@geert.drijfhout](https://forum.dynamobim.com/u/geert.drijfhout)\
**Post date:** [March 20, 2025, 1:59pm UTC](https://forum.dynamobim.com/t/create-cropped-surface-c3d-dynamo-python/108913/3 "2025-03-20T13:59:31Z")

</div>

`with` statements need an indent ([see python syntax](https://www.geeksforgeeks.org/with-statement-in-python/))

---

<div class="post-metadata">

**Author:** ![e.rincon](https://avatars.discourse-cdn.com/v4/letter/e/65b543/32.png) [@e.rincon](https://forum.dynamobim.com/u/e.rincon)\
**Post date:** [March 20, 2025, 5:54pm UTC](https://forum.dynamobim.com/t/create-cropped-surface-c3d-dynamo-python/108913/4 "2025-03-20T17:54:54Z")

</div>

Thanks for your answers. I have tried them and modified the code; however, it still doesn’t work. I have also verified the structure based on the guide [Python and Civil 3D | Dynamo](https://primer2.dynamobim.org/dynamo-for-civil-3d/advanced-topics/python-and-civil-3d)

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

Now, it retrieves the following message:  
**Warning: PyhtonEvaluator.Evaluate operation failed.IdentationError : (‘unindent does not match any outer indentation level; (‘’,45,31,’ t.Commit ()\n’))**

[Cropped\_Surface.dyn](https://forum.dynamobim.com/uploads/short-url/btDrLoWGGJaRjqBsum662QwfYq3.dyn) (12.7 KB)

¿Any ideas?

---

<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 22, 2025, 7:22am UTC](https://forum.dynamobim.com/t/create-cropped-surface-c3d-dynamo-python/108913/5 "2025-03-22T07:22:20Z")

</div>

CHECK Parameters Method WELL

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

> **[Help](https://help.autodesk.com/view/CIV3D/2025/ENU/?guid=ee26b10f-b5df-7cf2-ddc4-0d101fcc460d)**
