#Template
#DraxlA
#19.07.2023
import clr
import sys
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
import Autodesk.Revit.DB as DB
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
clr.AddReference('System')
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
def convert_f_to_m(value):
return DB.UnitUtils.Convert(value,UnitTypeId.Feet,UnitTypeId.Meters)
def convert_m_to_f(value):
return DB.UnitUtils.Convert(value,UnitTypeId.Meters,UnitTypeId.Feet)
DynamoPoints = IN[0]
points = []
for i in DynamoPoints:
p = DB.XYZ(convert_f_to_m(i.X),convert_f_to_m(i.Y),convert_f_to_m(i.Z))
points.append(p)
output = []
for i in points:
if doc.GetRoomAtPoint(i) == None:
output.append("No Room")
else:
output.append(doc.GetRoomAtPoint(i))
#for i in output:
#output.append(i.Id)
OUT = output
in some room there are 100 lights that can`t be it should be les …
Sharing a screenshot of your code would have been way faster and easier to troubleshoot but it looks like you’re collecting the LightingDevices instead of the LightingFixtures. Is that your issue?
But you’re claiming the issue is that you’re not returning as many lights as you’re expecting. Those nodes all deal with the points (light fixture locations) after they’ve already been determined. If the issue is missing fixtures then you should be looking at how you’re collecting those points.
The first node in your graph is the python node getting the elements (points) from the linked document. It sounds like you want light fixtures, but in your FilteredElementCollector you’re collecting the LightingDevices instead of the LightingFixtures.
You only have 3 FECs. If you want LightingDevices, ElectricalEquipment, andLightingFixtures then you need collectors for all 3.