# Update Revision Cloud Sketch Curves

**URL:** <https://forum.dynamobim.com/t/update-revision-cloud-sketch-curves/105967>\
**Category:** Revit\
**Tags:** python\
**Created:** [November 19, 2024, 7:16pm UTC](https://forum.dynamobim.com/t/update-revision-cloud-sketch-curves/105967 "2024-11-19T19:16:05Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![patrick\_podeyn](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/patrick_podeyn/32/86368_2.png) [@patrick\_podeyn](https://forum.dynamobim.com/u/patrick_podeyn)\
**Post date:** [November 19, 2024, 7:16pm UTC](https://forum.dynamobim.com/t/update-revision-cloud-sketch-curves/105967/1 "2024-11-19T19:16:05Z")

</div>

I have been looking for a way to update a Revision Clouds sketch curves. I tried to get the sketch curves of the rev cloud and setting it to a new set of Revit lines, but I don’t think that’s how the method works. It lets me set the existing curves to the new list of curves but it doesn’t set them. Is it possible to update the cloud sketch curves?

This workflow is to make the cloud smaller on Revit Schedule rows by segmenting the existing curve so we don’t have to update the cloud size for the entire project. I have a process right now for making a new rev cloud with segmented curves, but I would like to update what is being used.

Screenshot of the Dynamo so far.

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

---

<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:** [November 20, 2024, 2:02pm UTC](https://forum.dynamobim.com/t/update-revision-cloud-sketch-curves/105967/2 "2024-11-20T14:02:59Z")

</div>

Hi

An example of modifying existing RevisionCloud geometry (each DetailLine)

Note : assuming that each `RevisionCloud` instance corresponds to a single cloud

![offset clouds2](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/5/f57ce42e6c6ece0b602e08bf5c61a35b4ce62bb6.gif)

```python
import clr
import sys
import System
#
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS

#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

#import net library
from System import Array
from System.Collections.Generic import List, IList, Dictionary

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

def toList(x):
    if isinstance(x, (list, dict)) or \
            (hasattr(x, "GetType") and x.GetType().GetInterface("ICollection") is not None):
        return x
    else : return [x]

#Preparing input from dynamo to revit
cloud_instances = toList(UnwrapElement(IN[0]))
offset = IN[1]

#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
for cloud_instance in cloud_instances:
    # must be run twice to keep the cloud oriented
    for i in range(2):
        iList_type = List[System.Type]([clr.GetClrType(DB.CurveElement)])
        class_filter = ElementMulticlassFilter(iList_type)
        details_lines_Ids = cloud_instance.GetDependentElements(class_filter)
        detail_lines = [doc.GetElement(xId) for xId in details_lines_Ids]
        poly_curve = DS.PolyCurve.ByJoinedCurves([x.GeometryCurve.ToProtoType() for x in detail_lines], 0.001, False, 0)
        # create offset only once
        if i == 0 :
            poly_curve = poly_curve.OffsetMany(offset, False, None)[0]
        # set new curves
        for idx, ds_line in enumerate(poly_curve.Curves()):
            new_line = ds_line.ToRevitType()
            rvt_detail_line = detail_lines[idx]
            rvt_detail_line.GeometryCurve = new_line
        doc.Regenerate()

TransactionManager.Instance.TransactionTaskDone()

OUT = cloud_instances

```

---

<div class="post-metadata">

**Author:** ![patrick\_podeyn](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/patrick_podeyn/32/86368_2.png) [@patrick\_podeyn](https://forum.dynamobim.com/u/patrick_podeyn)\
**Post date:** [November 20, 2024, 8:03pm UTC](https://forum.dynamobim.com/t/update-revision-cloud-sketch-curves/105967/3 "2024-11-20T20:03:06Z")

</div>

@c.poupin I appreciate this so much! I would like to ask if you could explain why it needs to be ran twice? I’m not totally clear on the cloud orientation piece.

---

<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:** [November 20, 2024, 8:10pm UTC](https://forum.dynamobim.com/t/update-revision-cloud-sketch-curves/105967/4 "2024-11-20T20:10:17Z")

</div>

> [@patrick\_podeyn](#):
>
> I’m not totally clear on the cloud orientation piece.

I haven’t totally demystified this workaroud yet 🧐

Just that during my tests I noticed that it took 2 runs for the cloud arcs to be in the same direction as the original, I’d have to look at it more closely (maybe it’s due to the clockwise or counter-clockwise direction of the detail lines, to be seen) .

---

<div class="post-metadata">

**Author:** ![patrick\_podeyn](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/patrick_podeyn/32/86368_2.png) [@patrick\_podeyn](https://forum.dynamobim.com/u/patrick_podeyn)\
**Post date:** [November 20, 2024, 8:13pm UTC](https://forum.dynamobim.com/t/update-revision-cloud-sketch-curves/105967/5 "2024-11-20T20:13:30Z")

</div>

I appreciate the response. The other thing I noticed is and I wasn’t aware you could do this, but you’re setting the exiting curves to the new curves and so does that mean you have the have the same number of new curves as there are existing? If so, is there a way to add new curves to the list existing geometry? The goal is the divide the length of the original curves so the cloud arcs are smaller. Is it as simple as adding new curves to that list of detail lines?

---

<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:** [November 20, 2024, 8:20pm UTC](https://forum.dynamobim.com/t/update-revision-cloud-sketch-curves/105967/6 "2024-11-20T20:20:17Z")

</div>

> [@patrick\_podeyn](#):
>
> If so, is there a way to add new curves to the list existing geometry?

Unfortunately, it’s not possible

---

<div class="post-metadata">

**Author:** ![patrick\_podeyn](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/patrick_podeyn/32/86368_2.png) [@patrick\_podeyn](https://forum.dynamobim.com/u/patrick_podeyn)\
**Post date:** [November 20, 2024, 8:32pm UTC](https://forum.dynamobim.com/t/update-revision-cloud-sketch-curves/105967/7 "2024-11-20T20:32:35Z")

</div>

is there a way to take the existing geometry and divide it?

---

<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:** [November 20, 2024, 8:53pm UTC](https://forum.dynamobim.com/t/update-revision-cloud-sketch-curves/105967/8 "2024-11-20T20:53:42Z")

</div>

The only solution in this case will be to re-create a RevisionCloud as you mentioned.

---

<div class="post-metadata">

**Author:** ![patrick\_podeyn](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/patrick_podeyn/32/86368_2.png) [@patrick\_podeyn](https://forum.dynamobim.com/u/patrick_podeyn)\
**Post date:** [November 20, 2024, 9:27pm UTC](https://forum.dynamobim.com/t/update-revision-cloud-sketch-curves/105967/9 "2024-11-20T21:27:54Z")

</div>

Ahhhh darn. I do appreciate the help! Can I ask you questions about parts and pieces of the code you supplied still?

---

<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:** [November 20, 2024, 9:29pm UTC](https://forum.dynamobim.com/t/update-revision-cloud-sketch-curves/105967/10 "2024-11-20T21:29:38Z")

</div>

yes

---

<div class="post-metadata">

**Author:** ![patrick\_podeyn](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/patrick_podeyn/32/86368_2.png) [@patrick\_podeyn](https://forum.dynamobim.com/u/patrick_podeyn)\
**Post date:** [November 20, 2024, 9:31pm UTC](https://forum.dynamobim.com/t/update-revision-cloud-sketch-curves/105967/11 "2024-11-20T21:31:36Z")

</div>

So these lines of code. [quote=“c.poupin, post:2, topic:105967”]

```auto
iList_type = List[System.Type]([clr.GetClrType(DB.CurveElement)])
        class_filter = ElementMulticlassFilter(iList_type)
        details_lines_Ids = cloud_instance.GetDependentElements(class_filter)

```

[/quote]

is this just to ensure you’re collecting the detail curves being used by the rev cloud?

---

<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:** [November 20, 2024, 9:52pm UTC](https://forum.dynamobim.com/t/update-revision-cloud-sketch-curves/105967/12 "2024-11-20T21:52:06Z")

</div>

yes, because a RevisionCloud depends on several types of elements

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/0/40da27b7269ca59872e5f1a16a1daf36223fb56e.png)

---

<div class="post-metadata">

**Author:** ![patrick\_podeyn](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/patrick_podeyn/32/86368_2.png) [@patrick\_podeyn](https://forum.dynamobim.com/u/patrick_podeyn)\
**Post date:** [November 20, 2024, 9:58pm UTC](https://forum.dynamobim.com/t/update-revision-cloud-sketch-curves/105967/13 "2024-11-20T21:58:36Z")

</div>

That makes sense, if you did a plain `cloud_instance.GetDependentElements()` you would collect all of those dependent items, right? So making an element multiclass filter ensures you only collect the detail lines.  
Sorry, I have so many questions. Would you be able to also break down the line where you make your IList?

---

<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:** [November 21, 2024, 8:13am UTC](https://forum.dynamobim.com/t/update-revision-cloud-sketch-curves/105967/14 "2024-11-21T08:13:41Z")

</div>

> [@patrick\_podeyn](#):
>
> if you did a plain `cloud_instance.GetDependentElements()` you would collect all of those dependent items, right? So making an element multiclass filter ensures you only collect the detail lines.

according to the documentation, need to set `None` (null) as parameter

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

---

<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:** [November 21, 2024, 8:32am UTC](https://forum.dynamobim.com/t/update-revision-cloud-sketch-curves/105967/15 "2024-11-21T08:32:37Z")

</div>

> [@patrick\_podeyn](#):
>
> Sorry, I have so many questions. Would you be able to also break down the line where you make your IList?

To sum up briefly, when working with CPython3 (PythonNet) you have 2 domains:

- Python
- .Net

when you call a .Net method, you need to ensure that the **types** of objects passed as arguments are correct

`ElementMulticlassFilter` needs an `IList<Type>` as parameter, so we convert (or cast) a python list to `List<Type>` (.Net)

conversion isn’t always compulsory, but it’s a good practice to have

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