I was thinking Ill try get the vertical surfaces of the walls, either creating from the edge references or another means that processes ok and then merge them and try project as you have. Seems ok in my head but probably wont work
Thanks Vikram, I see you can also screen shot a view to with dynamo. So maybe it can all be done in one process. Could be deleted easy but I’ll try figure out a way to ignore shadows not related to buildings too.
I dont seem to have the module collections. Might be a dynamo 1.3 thing
So close! just need to get that perimeter of lines and remove the inside ones if thats possible? Starting to get a little slow too…
Joining projected curves of walls to make a surface then solid to get perimeter has worked pretty well almost.
I have had a look at embedding the creation of Bounding Boxes > Cuboid > Union to create simplified shadows all within Python, and it would seem that it runs a bit faster only outputting shadow edges.
Will give Dynamo 1.3 a go on Monday
## Import References
import clr
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference("RevitAPIUI")
from Autodesk.Revit.UI import *
doc = DocumentManager.Instance.CurrentDBDocument
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import collections
# Flattens lists in Python
def flatten(l):
for el in l:
if isinstance(el, collections.Iterable) and not isinstance(el, basestring):
for sub in flatten(el):
yield sub
else:
yield el
## Converts Dynamo Planes to Revit DB Planes
def getPlane(s):
s = UnwrapElement(s)
origin = s.Origin.ToXyz()
normal = XYZ.BasisZ
plane = Autodesk.Revit.DB.Plane.CreateByNormalAndOrigin(normal,origin)
return plane
## Input Revit Elements in Grouped Lists
elem = IN[0]
## Input Dynamo Plane
pl = getPlane(IN[1])
## Input Sunlight Vector
vec = IN[2].ToXyz()
result = []
for el in elem:
cL = []
surf = []
for e in el:
## Make Box Geometry
bB = e.BoundingBox
bC = bB.ToCuboid()
bS = bC.ToRevitType(TessellatedShapeBuilderTarget.Solid, TessellatedShapeBuilderFallback.Abort)
## Forget Geometry
bB.Dispose()
bC.Dispose()
## Create an ExtrusionAnalyser to make a Shadow
analyzer = ExtrusionAnalyzer.Create(bS[0],pl,vec)
## Get the Outline of the Shadow and convert to Dynamo Types
outL = analyzer.GetExtrusionBase()
eloops = outL.EdgeLoops
flatloop = flatten(eloops)
curves = []
for f in flatloop:
curves.append(f.AsCurve().ToProtoType())
## Forget Geometry
f.Dispose()
cL.append(curves)
## Create Shadows
for c in cL:
pC = PolyCurve.ByJoinedCurves(c)
sP = Surface.ByPatch(pC)
surf.append(sP)
refsurfs = flatten(surf)
sU = Surface.ByUnion(refsurfs)
pC = Surface.PerimeterCurves(sU)
result.append(pC)
## Output outline only
OUT = result
awesome, curiously. Does the bounding box only pick up the wall solid. Or will it be bigger for walls that have edited profiles to be smaller? I was trying bounding box to cuboid but ran into that issue. Might actually be a wall on another workset or something
Make sure one of those walls is off-axis before you get too far along the cuboid route.