Placing Group Function keeps creating new instances in each run

Hello,

I’m placing model groups in Revit using doc.Create.PlaceGroup in Python but having an issue where the new elements are keep getting created at each run even when I’m not running through Dynamo Player. So whenever I add/change other nodes(not creating group node but nodes afterwards) and run to see their results, new elements are created which slows down my work.
I’ve tried adding DSType(False) too, but it’s just removing the elements created in the previous runs and creating new ones instead. :frowning: How can I keep the elements as they are?
Below is the code I’m using.
Any advice would help! Thanks.

import clr
clr.AddReference("RevitNodes")
import math
clr.AddReference("ProtoGeometry")
from Autodesk.DesignScript.Geometry import *

import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *

import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)

grouptype = UnwrapElement(IN[0])
location = UnwrapElement(IN[1])
a = []

TransactionManager.Instance.EnsureInTransaction(doc)

for l, g in zip(location, grouptype):
    a.append(doc.Create.PlaceGroup(l.ToRevitType(True), g))

TransactionManager.Instance.TransactionTaskDone()

OUT = a

Hey,

Just to clarify, sorry if I am misunderstanding…

So you run the graph > groups are created > you edit nodes downstream > new groups are created.

The problem is how Dynamo is executing nodes? Not the node itself? Is that right?

Did you try to freeze the node once it is run?

Thanks,

Mark

Yes, that’s correct!

So for example, it creates 10 groups at first run, and when I run it again (even with no node change downstream), it creates 10 more.
When I add DSType(False), it creates 10 groups at first run, and when I run it again, it removes that 10 groups and create 10 new groups.
So somehow the node doesn’t have any binding with the elements created.

If I freeze the node, it won’t create new elements of course, but can’t run nodes downstream so that can’t be a solution. I just want that node to work as other nodes - create elements and stay as it is.

Thanks,

This is an element binding issue. Basically Dynamo is preventing you from placing 100’s of duplicate instances on top of each other as you come up with the perfect input point.

This post has more info: Element Binding in Revit

The easiest fix is to remove any bindings from the graph, and then utilize Dynamo Player to place the items.

Hi Jacob,

Yeah, it is element binding issue but here I want the binding to happen, because at every run new elements are being created. I’ve already read your threads and also AU class. I read that the binding happens differently for the Standard node & Python code, and thought adding DSType(False) was what I need, but it didn’t help - maybe I’m missing something here. It just removed the elements created in the previous run and created new ones. Not sure why it’s not just keeping the elements created before even when it’s not run with Dynamo Player.

You likely have bindings in the file still - please post the DYN here and I’ll confirm and/or look into other solutions.

Thank you! Here’s the DYN file. Grouped the part where I need the binding to happen.

Creat Unit Groups.dyn (166.4 KB)