Hi everyone, I’ trying to compile parameters from an excel file.
I’ve obtained two lists from the sheet, one with the parameters names, and one with the parameters values.
When i try to use Element.SetParameterByName I see that It works only for the type parameters, and gives me error for the instance ones, that actually are the ones I want to modify trough excel.
Is there any solution? Do I have to use a different type of node?
Be nice, I’m not an expert!
the warning says that It can’t found any parameter with the given name, but I see that It can do that for the type parameters, and not for the instance
Hi everyone, I’ trying to compile parameters from an excel file.
I’ve obtained two lists from the sheet, one with the parameters names, and one with the parameters values.
When i try to use Element.SetParameterByName I see that It works only for the type parameters, and gives me error for the instance ones, that actually are the ones I want to modify trough excel.
Is there any solution? Do I have to use a different type of node?
Be nice, I’m not an expert!
the warning says that It can’t found any parameter with the given name, but I see that It can do that for the type parameters, and not for the instance
Hi,
Can you try this out and see if it works?
- Add a custom Python script node
- Edit node and place this code:
import clr
# Add references for Revit API
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
# Add references for Dynamo
clr.AddReference('RevitNodes')
clr.AddReference('RevitServices')
import Revit
import RevitServices
from Revit.Elements import *
from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
# The input to this node should be the Floor Type you've fetched from another node.
input_floor_type = UnwrapElement(IN[0])
# Empty list to collect instances
floor_instances = []
# Get all the floor instances in the project
floors = FilteredElementCollector(doc).OfClass(Floor).WhereElementIsNotElementType().ToElements()
# Iterate through all the floors and check their types
for floor in floors:
if floor.FloorType.Id == input_floor_type.Id:
floor_instances.append(floor)
OUT = floor_instances
Connect the node as in the print screen (between Floor Types and Element.setparameterbyname):
Select Accept as Solution and Likes are always welcome.
Ralph den Haan, (Lazy) BIM Specialist
Hi,
Can you try this out and see if it works?
- Add a custom Python script node
- Edit node and place this code:
import clr
# Add references for Revit API
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
# Add references for Dynamo
clr.AddReference('RevitNodes')
clr.AddReference('RevitServices')
import Revit
import RevitServices
from Revit.Elements import *
from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
# The input to this node should be the Floor Type you've fetched from another node.
input_floor_type = UnwrapElement(IN[0])
# Empty list to collect instances
floor_instances = []
# Get all the floor instances in the project
floors = FilteredElementCollector(doc).OfClass(Floor).WhereElementIsNotElementType().ToElements()
# Iterate through all the floors and check their types
for floor in floors:
if floor.FloorType.Id == input_floor_type.Id:
floor_instances.append(floor)
OUT = floor_instances
Connect the node as in the print screen (between Floor Types and Element.setparameterbyname):
Select Accept as Solution and Likes are always welcome.
Ralph den Haan, (Lazy) BIM Specialist
You have to think where the information is available in the model. In your case you want to change the value of familyinstances (items placed in the model) but you are approaching the family type (the one in the family browser). So you do not want the floortype but the floor elements placed in the project.
Something like this:
If you have a mix of instance and type parameters you have to separate them and then send them to the instance elements or to the type elements.
Or you can use special nodes which have that functionality build in. (this one from the Rhythm package)
Louis
Please mention Revit version, especially when uploading Revit files.
You have to think where the information is available in the model. In your case you want to change the value of familyinstances (items placed in the model) but you are approaching the family type (the one in the family browser). So you do not want the floortype but the floor elements placed in the project.
Something like this:
If you have a mix of instance and type parameters you have to separate them and then send them to the instance elements or to the type elements.
Or you can use special nodes which have that functionality build in. (this one from the Rhythm package)
Louis
Please mention Revit version, especially when uploading Revit files.
@L.Maas I've tried to use the Rhythm node (i was looking for something like that but i didn't find it), but it gives me error maybe due to the element i linked, is it right if i link the "floor type" node or i have to link another element?
@ralphdenhaan I'll try the python script asap and i'll let you know, this is a master degree thesis so i'll try all the possible solutions to obtain an accurate study
@L.Maas I've tried to use the Rhythm node (i was looking for something like that but i didn't find it), but it gives me error maybe due to the element i linked, is it right if i link the "floor type" node or i have to link another element?
@ralphdenhaan I'll try the python script asap and i'll let you know, this is a master degree thesis so i'll try all the possible solutions to obtain an accurate study
We both (me and @L.Maas) give the same solution as you need to gather all instances of that type. But the python script will gather all instances from the type you already have set (so it's a kind of shortcut).
Select Accept as Solution and Likes are always welcome.
Ralph den Haan, (Lazy) BIM Specialist
We both (me and @L.Maas) give the same solution as you need to gather all instances of that type. But the python script will gather all instances from the type you already have set (so it's a kind of shortcut).
Select Accept as Solution and Likes are always welcome.
Ralph den Haan, (Lazy) BIM Specialist
As mentioned, you have to look where the information is stored.
Here a concept. Basically you collect the floor elements (placed instances) and then push the parameter values.
You can know that you have to find the placed instances (ELEMENTS) because the node tells you already.
What the node is basically doing is that he stores the values for the instance parameter and then looks up the associated family type and then stores the type parameter value.
This also would mean that if you have multiple instances of the same familytype in the project and you present every time different values for the type parameter only the last will stick (the previous values will be overwritten).
For example isntances 1 and 2 are both "Generic 150 mm" first it gets written Type Mark 2 then it gets Type Mark 3.
End result is that both those items will have type parameter Type Mark 3 (because it is the same familytype).
Louis
Please mention Revit version, especially when uploading Revit files.
As mentioned, you have to look where the information is stored.
Here a concept. Basically you collect the floor elements (placed instances) and then push the parameter values.
You can know that you have to find the placed instances (ELEMENTS) because the node tells you already.
What the node is basically doing is that he stores the values for the instance parameter and then looks up the associated family type and then stores the type parameter value.
This also would mean that if you have multiple instances of the same familytype in the project and you present every time different values for the type parameter only the last will stick (the previous values will be overwritten).
For example isntances 1 and 2 are both "Generic 150 mm" first it gets written Type Mark 2 then it gets Type Mark 3.
End result is that both those items will have type parameter Type Mark 3 (because it is the same familytype).
Louis
Please mention Revit version, especially when uploading Revit files.
Can't find what you're looking for? Ask the community or share your knowledge.