Hello All,
I’ve been using Dynamo for a while but this is my first post.
As I’m currently a new user I can’t currently upload an attachment - however I’ll upload the graph once I have the ability to. For now I’ll just describe the intended graph:
I’m looking to get two graphs we are using together frequently and combine them to speed things up.
The first takes a Revit floor’s footprint and applies it to a Revit Topo as a Subregion (using the following python script which I got from these forums (thanks to jbo)).
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Architecture import *
import System.Collections.Generic
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference('RevitServices')
from RevitServices.Transactions import TransactionManager
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
# Get input variables
subregions = IN[0]
host = UnwrapElement(IN[1])
# Init variables
curveLoops = []
createdSubRegions = []
error = []
TransactionManager.Instance.EnsureInTransaction(doc)
# Get groups of curves (exploded polycurves!) and creates per group a SubRegion
for i in subregions:
# Init CurveLoop for every curve group
x = CurveLoop()
# Iterate the seperate curves -> convert type to Revit Type -> add to CurveLoop
for j in i:
x.Append(j.ToRevitType())
curveLoops.append(x)
# Add layer to list
y = [x]
yI = List[CurveLoop](y)
if SiteSubRegion.IsValidBoundary(yI):
# Create SubRegion out of the CurveLoop group and add its to 'createdSubregions'
newSubRegion = SiteSubRegion.Create(doc, yI, host.Id)
createdSubRegions.append(newSubRegion)
TransactionManager.Instance.TransactionTaskDone()
# Output
OUT = createdSubRegions
The second takes a Revit Floor and shape edits it to follow a Topo Subregion.
I’m keen for our users to be able to simply select the Floor and Topo and have both the Subregion and the shape edit executed by the same graph.
The issue I’m having is that the python output won’t currently wire into the Topography.Points node. My Python experience is pretty limited - I’ve tried re-wrapping the SiteSubRegion with ToDSType(False) but I think I’m currently out of my depth.
I’m looking for a suggestion to modify the python script so that it can feed into a Topography.Points node - Thank you in advance for any help you can offer.