# Dynamo Code Block Geometry() in python

**URL:** <https://forum.dynamobim.com/t/dynamo-code-block-geometry-in-python/88143>\
**Category:** Revit\
**Tags:** python\
**Created:** [April 3, 2023, 3:30pm UTC](https://forum.dynamobim.com/t/dynamo-code-block-geometry-in-python/88143 "2023-04-03T15:30:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Balazs.Endrodi83](https://avatars.discourse-cdn.com/v4/letter/b/71c47a/32.png) [@Balazs.Endrodi83](https://forum.dynamobim.com/u/Balazs.Endrodi83)\
**Post date:** [April 3, 2023, 3:30pm UTC](https://forum.dynamobim.com/t/dynamo-code-block-geometry-in-python/88143/1 "2023-04-03T15:30:28Z")

</div>

Hi,

Beginner here. I would like to get the geometry data out of scope boxes.  
Currently I have a script that picks up the scopebxes I want than have to output them so I can run Geometry() in CodeBlock then send that output back to a new Python script. Would be nice to keep it all together.  
Also, currently I am picking up he edge lines of the scopeboxes and then get the end and start points to determine all the corner points. Is there a quicker way to do this? (picking up only the corner points.  
Thank you!

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

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [April 3, 2023, 3:45pm UTC](https://forum.dynamobim.com/t/dynamo-code-block-geometry-in-python/88143/2 "2023-04-03T15:45:56Z")

</div>

@Balazs.Endrodi83 ,

what do you mean with “Scope Box” ? do you mean boundingBox?

so you can work with min/max point … you could create a cubid

> [@LocationPoint vs. BoundingBox, what do i call?](https://forum.dynamobim.com/t/locationpoint-vs-boundingbox-what-do-i-call/55579):
>
> Hello, I did compare dynamo Nodes vs. PythonCode, i recognized some differences: 1.) Location point Should be the values not identicaly? my code calles the center of boundingBox? And Element.Location+ which “points” get i here? elements = UnwrapElement(IN[0]) points =[] for e in elements: bb = e.get\_BoundingBox(None) if not bb is None: centre = bb.Min+(bb.Max-bb.Min)/2 points.append(centre) OUT = points 2.) BoundingBox: Her i can call sur…

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [April 3, 2023, 3:54pm UTC](https://forum.dynamobim.com/t/dynamo-code-block-geometry-in-python/88143/3 "2023-04-03T15:54:01Z")

</div>

Hello @Balazs.Endrodi83 and welcome

like this ?

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

---

<div class="post-metadata">

**Author:** ![Balazs.Endrodi83](https://avatars.discourse-cdn.com/v4/letter/b/71c47a/32.png) [@Balazs.Endrodi83](https://forum.dynamobim.com/u/Balazs.Endrodi83)\
**Post date:** [April 3, 2023, 4:09pm UTC](https://forum.dynamobim.com/t/dynamo-code-block-geometry-in-python/88143/4 "2023-04-03T16:09:29Z")

</div>

Exactly that. I tried with unwrap(IN[0]) maybe that was the problem…  
In any case, thank you very much. this was exactly what I was looking for.  
For bonus points, is it possible to get straight to the points or I have to pick up the lines then the start and end point, drop the duplicate points to have only the corner points?

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [April 3, 2023, 7:25pm UTC](https://forum.dynamobim.com/t/dynamo-code-block-geometry-in-python/88143/5 "2023-04-03T19:25:53Z")

</div>

here an example

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

```auto
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

scopeBox = IN[0]

lines = scopeBox.Geometry()

lst_points = sum([[l.StartPoint, l.EndPoint] for l in lines], [])

OUT= Point.PruneDuplicates(lst_points, 0.1)

```

you can find a good explanation of Unwrapping here

> **[Python 0.6.3 to 0.7.x Migration](https://github.com/DynamoDS/Dynamo/wiki/Python-0.6.3-to-0.7.x-Migration#unwrapping)**
>
> Open Source Graphical Programming for Design. Contribute to DynamoDS/Dynamo development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [April 5, 2023, 4:29am UTC](https://forum.dynamobim.com/t/dynamo-code-block-geometry-in-python/88143/6 "2023-04-05T04:29:56Z")

</div>

Pulling the verifies and getting the point geometry is likely more effective here, especially for more complex forms.
