Create Parts of selection or result objects

Hey guys,

After creating walls by room boundaries using Modelicals “Wall finishes by room” node i convert these walls to parts and now want to further use these created elements.

sadly i’m not the best at using python and need help doing this. Output should be a list of the created parts for further use.

cheers and thanks.

import clr
from Autodesk.DesignScript.Geometry import *
# Import ToDSType(bool) extension method
import Revit
# Import geometry conversion extension methods
# Import DocumentManager and TransactionManager
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *
# Import RevitAPI
import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

#feed IN[0] with elements
elts = []
Ids = []
prt = []

for i in IN[0]:

for e in elts:
IDS = List[ElementId](Ids)

# Start Transaction tt

if PartUtils.AreElementsValidForCreateParts(doc, IDS):
	parts = PartUtils.CreateParts(doc, IDS)

#my nonsense trying to get These just created parts. or is there another way?
pid = PartUtils.GetAssociatedParts(doc, parts.GUID, false, false );

# End Transaction - by original script.

#This was originally IDS but just gave me a string list of the parents IDs.
OUT = pid

#wallfinish.dyn (11.1 KB)

1 Like

Hi @wunnenstein

Your getting empty values for wall finishes by room node. Make sure you have the wall types in your model. Watch this video

Hey Kulkul. The main part of the script works correctly. I had to translate Modelicals node for using the German words (see the other thread I replied to recently). Maybe that’s why it didn’t work for you.

I just need help with the last part, having the parts elements the script has created as an output list to set parameter values to them afterwards.