Your graph image exports are illegible - zoom in so that node names are visible and then run the export tool - it’ll catch all nodes at the zoomed in resolution even those which are offscreen.
That said if you need to ‘automatically place a face-based Generic Model family on each curtain wall panel’ then you shouldn’t be ‘picking’ anything. Assuming all your panels are planar, this method should work well:
Get all the curtain panels using your method of choice.
Get the boundary curves of each panel using the CurtainPanel.Boundaries node.
Get the normal of the boundary loop using the Curve.Normal node.
Get the faces from the panels using the Element.Faces node.
Extract the normal of the faces using the Surface.NormalAtParameter node.
Get the angle from each curve normal to the associated surface normal using a Vector.AngleWithVector node.
Sort the surfaces in each sublist (step 4) by the angles (step 6) using a List.SortByKey node. Watch your list levels (should both be @L2<1>).
Depending on how your curtain panel is built, get the largest angle from the normal using List.LastItem or first item using List.FirstItem (One will be the inside face and one the outside face). Watch your lacing and list levels (likely @L2<1> is the fix)
Get the BoundingBox by minimum volume for each surface - again watch your list levels (@L1<1> is likley correct here).
Draw a line from the min point of each bounding box to the max point of each bounding box (or vice versa - depending on how your linear family is set up).
Create the family instances using the family type (select it in the drop down node Family Types), the faces (from step 8), and the lines (from step 10).
One of your elements isn’t returning a valid surface for a face. Could even be many faces or many elements. Try setting the list level to @L1 and see if that narrows down which element is failing.
I’m not sure what’s currently happening with Dynamo, but I’m getting errors that don’t seem normal. I’ve already tried switching projects and restarting my computer, but the error still persists.
I’ve also tried changing the list levels and selecting only a single element, but it still doesn’t work.
allright not really sure what goin on here, but you could try clean it up…thes 7 security devices or whatever have 3180 surfaces, not sure if it could work for you, if not i can try go deeper tomorrow, not at dyn more today…now there are Champions League, in telly
No, the geometry was not set to Medium, it was set to Large.
I changed it to Medium… the script works a bit better after changing the setting, but it still doesn’t work properly. I’ve also tried changing the list levels, but I still can’t find the problem.
So, that setting should always remain on medium. The issues partially going away is a good sign though. Try to identify which panel has the self intersecting face in medium (it would have a ‘null’ in the list of surfaces), take that out of the list or use SelectModelElement to work with just the one instance, and adjust geometry scaling a few more times to see if there is a scale at which it works. Also check if there is something off with the instance in Revit - a face with no geometry as the cutting object is flush with the face, or a geometry with no volume, or other issues.
Hello,
Your problematic panel is the one with ID 255449.
Why?
I don’t know.
Here’s a way to retrieve the face geometry:
The code to retrieve the geometry is by Mr. Poupin.
You’ll need to adapt it if you’re sending a list or a list of lists.
Have a good day.
Sincerely,
Christian Stan
import sys
import clr
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
cp=UnwrapElement(IN[0])
def getSolidfromGeo(elem):
opt = Options()
opt.ComputeReferences = True
opt.IncludeNonVisibleObjects = True
geoSet = elem.get_Geometry(opt)
#
for geo in geoSet:
if isinstance(geo,Solid) and geo.Volume > 0 :
return geo, "Geometry"
for geo in geoSet:
if isinstance(geo, GeometryInstance):
outSolid = []
geoSetInst = geo.GetInstanceGeometry()
for geoI in geoSetInst:
if isinstance(geoI,Solid) and geoI.Volume > 0:
outSolid.append(geoI)
# Order the list by ascending volume
outSolid.sort(key = lambda x : x.Volume )
print(len(outSolid))
#Retrieve the Revit faces of the largest [-1] of the volumes
lfr=outSolid[-1].Faces
#Transform the Revit faces To Faces Dynamo
lfd=[f.ToProtoType()[0] for f in lfr]
return lfr,lfd, "GeometryInstance",geoSetInst
return None, None
OUT = getSolidfromGeo(cp)