I have followed a youtube from Bimorph Here to create a graph the report the point the ducts clashing with walls.
I have used “Arch Link Model” from “C:\Program Files\Autodesk\Revit 2021\Samples” and placed all the ducts at 1500mm elevation.
It seems to work in some of the areas, but not everywhere. I have highlighted the area that it has worked in yellow and put red circles where it has not worked.
Not sure where I have gone wrong, any help will be appreciated. Thanks
I have changed the code as follow, since I have the wall in the linked model and ducts in my current model and testing it in RevitPythonShell . I have only one linked model, so didn’t need to filter etc
import clr
from Autodesk.DesignScript.Geometry import *
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Mechanical import *
l_doc = ""
linked_docs = FilteredElementCollector(doc).OfClass(RevitLinkInstance)
for link in linked_docs:
l_doc = link.GetLinkDocument()
linked_walls = FilteredElementCollector(l_doc).OfClass(Wall)
ducts = FilteredElementCollector(doc).OfClass(Duct)
lstIntersect = []
for duct in ducts:
curvduct = duct.Location.Curve
for wall in linked_walls:
linkrefface = HostObjectUtils.GetSideFaces(wall, ShellLayerType.Interior)
intFace = wall.GetGeometryObjectFromReference(linkrefface[0])
interArRef = clr.Reference[IntersectionResultArray]()
if intFace.Intersect(curvduct, interArRef) == SetComparisonResult.Overlap:
pointIntersect = interArRef.Value[0].XYZPoint
lstIntersect.append([duct, pointIntersect.ToPoint() ])
OUT = lstIntersect
running it like this will give the error “‘NoneType’ object has no attribute ‘Intersect’”
so I change the line where I am collecting walls to
I have done some more testing and if I have all the walls and ducts in the same file, ie no linked model, then the script works and report the coordinated of all the intersection points.
So I guess I need to figure out how to transform the linked model so they are in the correct place
Hello @c.poupin
Firstly I would like to thank you for your help
For your information, I have the architect model linked to my MEP model. So walls are from linked model and ducts, pipes etc are in the current document.
When I try your script, I get this error
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File "<string>", line 45, in <module>
AttributeError: 'NoneType' object has no attribute 'Intersect'
Thank you very much for your help
I should have noticed that as I did print out the results from that line and I could see some null values
Thanks again