OliverEGreen / CodeSamples

Generally unorganised bits of code I'm posting online
7 stars 2 forks source link

Question on line 35 #1

Open swarochisa opened 2 years ago

swarochisa commented 2 years ago

Hello,

I'm trying to learn Revit API and I'm new to github and python. Purging through the API in Revit is something that i'm interested in and after spending lots of time I found your code here. Was able to understand most of it except for line 35.

I understand that this a list constructor List [PerformanceAdviserRuleId] () but I didn't understand why the parenthesis are at the end while the square brackets enclose the Performance class. Isn't this supposed to be like list ([PerformanceAdviserRuleId]) Also, is the "L" in the constructor supposed to be uppercase? my python editor gave me an error when I used upper case.

jmcouffin commented 2 years ago

It is a .NET List collection the [] content tells that the type of List is a list containing PerformanceAdviserRuleId https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1?view=net-6.0

swarochisa commented 2 years ago

Don't think I understand how this would work. I used your code in a python script node in dynamo but nothing seems to happen. Your code doesn't have any inputs so I assume it just runs when executed. Am I doing something wrong here?

Sorry about the questions, I'm unfamiliar with APIs and how to use them for my requirements through dynamo.

jmcouffin commented 2 years ago

I used your code in a python script node in dynamo but nothing seems to happen.

No input, you are right, The code itself does output purgeable elements and purgeable elements ids, if you want to delete it, you need to plug a element.delete node from that output

swarochisa commented 2 years ago

That makes sense , I was able to get it to run. However, when I was testing it on one of my projects I saw that this code didn't return the elements and element Ids of the "materials"? Is there any reason why these are not picked up? Can I make changes so that they get picked up?

image

image