hello
i wondering how to use a simple .cs script in a pushbutton of pyrevit, or maybe a larger extension with c# in pyrevit include wpf for UI and more .cs script
have anyone here try this ?
Thank you
@mbssss ,
my workflow is traduce c# to Python. If you not use c# as a blugin, you want get the advantages regarding perfomece… PyRevit is on the software not in the software → interpreting
here is an example:
traduced to python, and running well…
def get_document_shared_parameters(doc):
# 🎣 Collect all SharedParameterElement objects in the document
shared_params = FilteredElementCollector(doc).OfClass(SharedParameterElement).ToElements()
doc_params_ids = []
# 🎯 Get the parameter bindings and iterate through them
p_binding = doc.ParameterBindings
it = p_binding.ForwardIterator()
it.Reset()
while it.MoveNext():
doc_params_ids.append(it.Key.Id.IntegerValue)
# 🧪 Filter the shared parameters to include only those with IDs in doc_params_ids
doc_shared_params = [x for x in shared_params if x.GetDefinition().Id.IntegerValue in doc_params_ids]
return doc_shared_params
allSharedParameters = get_document_shared_parameters(doc)
for i in allSharedParameters:
print("{}".format(i.Name))