Placing model group by name?

Hi, I am trying to place different model groups (Floors with different inner wall-layouts) via Dynamo. Is it possible to place those model groups on given coordinates and select the ones I want by filtering by name of the model group? If yes, what nodes should I be looking at?

Thanks in advance,

Selim

I gave it a little try, I selected the model group I wanted by string. How do I continue from here?Place%20selected%20group%20test

Hi,

It works smoothly on me. The only thing you need is Xyz, the dots and the rest of the code. Previously @Konrad_K_Sobon had done a study on this. I’m adding it to the council to give the acclaimed.How to create a Detail Group in specific View?
Also to see what is needed to create the API
https://www.revitapidocs.com/2017/586d4f2e-0985-2d0b-dbb7-ea6d2f704336.htm ekliyorum.
1

import clr
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

# 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])

TransactionManager.Instance.EnsureInTransaction(doc)

groups = doc.Create.PlaceGroup(location,grouptype)

TransactionManager.Instance.TransactionTaskDone()

OUT = groups

The example I mentioned above is only for 1 group. However, you can use this code when you need to move multiple groups to the desired point.
2

import clr
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

# 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 in location:
	
	groups = doc.Create.PlaceGroup(l,grouptype)
	a.append(groups.ToDSType(True))
TransactionManager.Instance.TransactionTaskDone()

OUT = a

Durmus

1 Like

You’re a freaking hero Durmus. Thank you a lot! :smiley: selamlar :slight_smile:

  • Selim

Hi,

You’re welcome.:partying_face:

One more thing though (if you have the time), in order to make this script user-friendly for other engineers, I will need to be able to select the model group based on Type Name. Is there a way to use the list with “element.name” to select the element in the list of “all elements of type”?

Hi,

Of course there’s a way, but I don’t have the time to print a fictitious scenario right now. If you have a new topic about this, maybe our other friends can help you with this.

But briefly:
You find all the elements and then synchronize the desired elements with "=/String. Contains ".
You may still need to see your code exactly.

Hi Dursun,

In case you might be wondering what I have done with your help, well your Python script helped me to finish the prototype of a script I was working on a few days ago.
I made a script which allows me to pick certain types for the inner layouts of each floor, the type of model group walls on the left and right side of the building and the height of the roof. After pressing ‘run’ a pop-up comes up asking the preferred roof type.

Here’s a video for a small demonstration:

The script is specifically meant for a template that contains a specific type of model groups, since the script is filtering model groups by strings. The idea is to automate the process for the company I’m an intern at, they are using a standardized library.

how did you get the drop down list selector node?