# Extracting Curves of Viewport

**URL:** <https://forum.dynamobim.com/t/extracting-curves-of-viewport/1148>\
**Category:** Packages\
**Created:** [March 3, 2015, 4:13pm UTC](https://forum.dynamobim.com/t/extracting-curves-of-viewport/1148 "2015-03-03T16:13:03Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![john\_pierson](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/john_pierson/32/191977_2.png) [@john\_pierson](https://forum.dynamobim.com/u/john_pierson)\
**Post date:** [March 3, 2015, 4:13pm UTC](https://forum.dynamobim.com/t/extracting-curves-of-viewport/1148/1 "2015-03-03T16:13:03Z")

</div>

Hey everyone,

&nbsp;

I was wanting to try to get the curves of a view port (crop region) of a view. Does this seem possible, currently I am unsure of how to achieve this.

&nbsp;

Thanks!

---

<div class="post-metadata">

**Author:** ![Zach\_Kron](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/zach_kron/32/349_2.png) [@Zach\_Kron](https://forum.dynamobim.com/u/Zach_Kron)\
**Post date:** [March 4, 2015, 1:28pm UTC](https://forum.dynamobim.com/t/extracting-curves-of-viewport/1148/2 "2015-03-04T13:28:19Z")

</div>

Hi John,

I’m pretty sure that we don’t expose anything in Dynamo to get these curves . . . not sure if it’s there in the Revit API. What are you trying to do?

&nbsp;

Thanks

Z

---

<div class="post-metadata">

**Author:** ![Konrad\_K\_Sobon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/konrad_k_sobon/32/8838_2.png) [@Konrad\_K\_Sobon](https://forum.dynamobim.com/u/Konrad_K_Sobon)\
**Post date:** [March 4, 2015, 2:09pm UTC](https://forum.dynamobim.com/t/extracting-curves-of-viewport/1148/3 "2015-03-04T14:09:19Z")

</div>

John,

You would want to get a CropBox of a given view. API method is View.CropBox and it will return a BoundingBoxXYZ object. You can then query that object for a min and max value. bbox.Min and bbox.Max and that will give you two points in the opposite corners. From there its straight forward. the two missing points of the rectangle (I am assuming you want to construct a polyline) would be:

XYZ(bbox.Max.X, bbox.Min.Y, bbox.Min.Z)

XYZ(bbox.Min.X, bbox.Max.Y, bbox.Max.Z)

That should work. I hope that should work.

If its a plan view then Z values should be zero.

Good luck!

---

<div class="post-metadata">

**Author:** ![john\_pierson](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/john_pierson/32/191977_2.png) [@john\_pierson](https://forum.dynamobim.com/u/john_pierson)\
**Post date:** [March 4, 2015, 2:49pm UTC](https://forum.dynamobim.com/t/extracting-curves-of-viewport/1148/4 "2015-03-04T14:49:49Z")

</div>

Thanks so much Konrad, I will check it out.

Zach- I am trying to extract the boundary of a viewport that is rotated on the sheet so I can then try to define a path that is orthagonal (stair stepped) rather than angular.

The reason for this effort is because of the issue when plotting a custom sketched crop region from Revit. When the crop region contains angles, the sheet files size becomes super bloated (1 sheet = 200 MB) [http://forums.autodesk.com/t5/revit-architecture/custom-crop-region-causes-super-slow-and-large-pdf-s-and-dwf-s/td-p/4914424/page/2](http://forums.autodesk.com/t5/revit-architecture/custom-crop-region-causes-super-slow-and-large-pdf-s-and-dwf-s/td-p/4914424/page/2)

This is a known issue and updated print drivers help compress the files but it still takes forever to print. (10 minutes per sheet) After some trial I found that if your crop region consists of verticals and horizontals, this is fixed.

That’s where the idea of using Dynamo to “sawtooth” the viewport came into play. That way I don’t have to manually draw every vertical and horizontal.

The picture on the left will actually result in a 200 MB file, the right will be roughly 600 KB

![2015-03-04_13h13_51](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/0/04cc644f0f909ccf2bfa94f68bf8c2691bc58270.png)

&nbsp;

---

<div class="post-metadata">

**Author:** ![Dimitar\_Venkov](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/dimitar_venkov/32/2068_2.png) [@Dimitar\_Venkov](https://forum.dynamobim.com/u/Dimitar_Venkov)\
**Post date:** [March 5, 2015, 12:34am UTC](https://forum.dynamobim.com/t/extracting-curves-of-viewport/1148/5 "2015-03-05T00:34:50Z")

</div>

Hi John,

I believe what you want is doable, however you’ll need to access the API.

If the view’s crop region has been changed by sketching, you can access the lines with the “View.GetCropRegionShapeManager()” and “ViewCropRegionShapeManager.GetCropRegionShape()” methods.

Interestingly there doesn’t seem to be a way to set the shape manger, once you have modified the geometry of the curves… A workaround would be to send the boundaries as model curves, manually select the model curves inside the Revit UI, cut them, enter the crop editing manager and paste the model curves as “Aligned to Current View”.

&nbsp;

---

<div class="post-metadata">

**Author:** ![john\_pierson](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/john_pierson/32/191977_2.png) [@john\_pierson](https://forum.dynamobim.com/u/john_pierson)\
**Post date:** [March 5, 2015, 9:09am UTC](https://forum.dynamobim.com/t/extracting-curves-of-viewport/1148/6 "2015-03-05T09:09:20Z")

</div>

Thanks Dimitar, I am working on that method now. I’ve just got to figure out how to define a “Stair” step through two points. I will let you know what I get.

---

<div class="post-metadata">

**Author:** ![Konrad\_K\_Sobon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/konrad_k_sobon/32/8838_2.png) [@Konrad\_K\_Sobon](https://forum.dynamobim.com/u/Konrad_K_Sobon)\
**Post date:** [March 5, 2015, 1:32pm UTC](https://forum.dynamobim.com/t/extracting-curves-of-viewport/1148/7 "2015-03-05T13:32:01Z")

</div>

John,

When you said 200MB vs. 600KB my ears perked up. I must have drawn some angled crop regions myself and never realized that this might cause a slow down. I am going to test it, and if that’s the case then it will be worthwhile to investigate further.

Very interesting.

&nbsp;

---

<div class="post-metadata">

**Author:** ![john\_pierson](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/john_pierson/32/191977_2.png) [@john\_pierson](https://forum.dynamobim.com/u/john_pierson)\
**Post date:** [March 5, 2015, 3:06pm UTC](https://forum.dynamobim.com/t/extracting-curves-of-viewport/1148/8 "2015-03-05T15:06:16Z")

</div>

Konrad, it is a know issue, and if you use a newer printer driver they typically compress it. The problem is the time to compress is terrible. I am going to make a video that demonstrates this soon.

I’ve mostly seen it on floor plans, where the crop is custom sketched with angular lines.

---

<div class="post-metadata">

**Author:** ![Phillip\_Steffy1](https://avatars.discourse-cdn.com/v4/letter/p/ec9cab/32.png) [@Phillip\_Steffy1](https://forum.dynamobim.com/u/Phillip_Steffy1)\
**Post date:** [May 14, 2015, 12:35pm UTC](https://forum.dynamobim.com/t/extracting-curves-of-viewport/1148/9 "2015-05-14T12:35:27Z")

</div>

Did you ever find a solution to this? I’m trying to do something similar and have hit some road blocks.

---

<div class="post-metadata">

**Author:** ![john\_pierson](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/john_pierson/32/191977_2.png) [@john\_pierson](https://forum.dynamobim.com/u/john_pierson)\
**Post date:** [May 15, 2015, 8:47am UTC](https://forum.dynamobim.com/t/extracting-curves-of-viewport/1148/10 "2015-05-15T08:47:39Z")

</div>

I haven’t had a chance to revisit this issue at this time. We implemented an internal workflow to have people stray away from angled custom crop regions. I do mean to get back into this soon though.

---

<div class="post-metadata">

**Author:** ![Giovanni\_Succi](https://avatars.discourse-cdn.com/v4/letter/g/dc4da7/32.png) [@Giovanni\_Succi](https://forum.dynamobim.com/u/Giovanni_Succi)\
**Post date:** [May 21, 2015, 1:07pm UTC](https://forum.dynamobim.com/t/extracting-curves-of-viewport/1148/11 "2015-05-21T13:07:56Z")

</div>

Will there be Dynamo nodes which work with Viewports and their boundaries / crops? We can’t just program the API…

We managed to find the cuboids of views on a sheet, but they are created at thee same scale as the real model, for example detail views at 3" scale are very small boxes.

We figured out that Viewports and Views are two very different things, so, is there an equivalent way to find the crop region of viewports on a sheet?

&nbsp;

Thank you!

Gio

---

<div class="post-metadata">

**Author:** ![Giovanni\_Succi](https://avatars.discourse-cdn.com/v4/letter/g/dc4da7/32.png) [@Giovanni\_Succi](https://forum.dynamobim.com/u/Giovanni_Succi)\
**Post date:** [May 21, 2015, 5:53pm UTC](https://forum.dynamobim.com/t/extracting-curves-of-viewport/1148/12 "2015-05-21T17:53:19Z")

</div>

&nbsp;

So, Viewport elements appear to have no geometry, or location in Dynamo…

What else can we try to see where these elements are on the sheet?

thank you

![Capture](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/a/ae8632c1f9d6dbe9f593dc72be23f7fc3ea07eed.png)

---

<div class="post-metadata">

**Author:** ![mohamedsafy](https://avatars.discourse-cdn.com/v4/letter/m/67e7ee/32.png) [@mohamedsafy](https://forum.dynamobim.com/u/mohamedsafy)\
**Post date:** [January 4, 2017, 8:19am UTC](https://forum.dynamobim.com/t/extracting-curves-of-viewport/1148/13 "2017-01-04T08:19:27Z")

</div>

can any one develop a custom node that can edit the location and the size of plan crop size

---

<div class="post-metadata">

**Author:** ![Kulkul](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kulkul/32/49801_2.png) [@Kulkul](https://forum.dynamobim.com/u/Kulkul)\
**Post date:** [January 4, 2017, 9:28am UTC](https://forum.dynamobim.com/t/extracting-curves-of-viewport/1148/14 "2017-01-04T09:28:38Z")

</div>

Hi @mohamedsafy

This is a help forum to ask for help with things that you cannot figure out on your own, but actually tried. Read this how to ask help [https://forum.dynamobim.com/t/how-to-get-help-on-the-dynamo-forums/46772](https://forum.dynamobim.com/t/how-to-get-help-on-the-dynamo-forums/46772)

Hope that make sense!

---

<div class="post-metadata">

**Author:** ![mohamedsafy](https://avatars.discourse-cdn.com/v4/letter/m/67e7ee/32.png) [@mohamedsafy](https://forum.dynamobim.com/u/mohamedsafy)\
**Post date:** [January 4, 2017, 2:40pm UTC](https://forum.dynamobim.com/t/extracting-curves-of-viewport/1148/15 "2017-01-04T14:40:15Z")

</div>

i tried and i already have a topic to discuss it  
i’m just checking with people if they have any newer achievement

> [@Edit crop region](https://forum.dynamobim.com/t/edit-crop-region/8323/12):
>
> Thank you T\_Pover can you make a screen about how it works ? i tried but i failed thank you in advance
