I’m not a python guy so I won’t weigh in on your code. You should be sure to use the ‘preformatted text’ option when sharing code in the forums.
Instead of testing every item in Dynamo, I would use the Bimorph node version to generate the list of intersecting elements. Then convert geometries and intersect the results then. Boolean operations are slow, and that wall which sits on top of the floor will return a surface which you don’t want. As such I would minimize their use in your case.
i believe you can achieve this by creating a 3D view in revit and set the element transparency. Whereas the solid will be imported from dynamo itself.
for your clash detection, i got a sample code for you
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
# Import RevitAPI
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# Import ToProtoType, ToRevitType geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)
# Import DSCore nodes in Dynamo
clr.AddReference('DSCoreNodes')
import DSCore
from DSCore import *
# Import python library
import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)
import os
import shutil
import math
# Import math library
from math import *
#Import Data and Time
from datetime import datetime
now = datetime.now()
#Import System Library
import System
from System.Collections.Generic import *
from System.IO import Directory, Path
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
#Preparing input from dynamo to revit
if isinstance(IN[0],list):
elements = UnwrapElement(IN[0])
else:
elements = [UnwrapElement(IN[0])]
#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
solids = []
for ele in elements:
#get all element id in List[Collection]
ids = List[ElementId]([ele1.Id for ele1 in elements if ele1.Name != ele.Name])
filter = ElementIntersectsElementFilter(ele)
intersect_eles = FilteredElementCollector(doc,ids).WherePasses(filter).WhereElementIsNotElementType().ToElements()
ele_solid = next(iter(ele.get_Geometry(Options())), None)
if intersect_eles:
for intersect_ele in intersect_eles:
intersect_solid = next(iter(intersect_ele.get_Geometry(Options())), None)
over_lap = next(iter(intersect_solid.ToProtoType().Intersect(ele_solid.ToProtoType())), None)
if not over_lap in solids:
solids.append(over_lap)
TransactionManager.Instance.TransactionTaskDone()
#Final output
OUT = solids
Thanks to your solution!! it’s perfect.
but i don’t know how to convert existing revit structure to half invisible structure.
And how can I solve Attribute error: ‘NoneType’ object has no attribute ‘intersect’ ?