Python Help

I am trying to retrieve parameters using python for some fabrication parts in Revit. I cannot access these parameters through the user interface or dynamo (that I know of) and that is my reasoning for using Python. Please see what is wrong with the script below. It is throwing error that is also posted.


image

I watched the course that was suggested at [https://www.lynda.com/Dynamo-Studio-tutorials/Dynamo-Revit-Python-Scripting/647661-2.html]. It was great. Thanks.

1 Like

you are trying to use “for” in something that is not a list, is an “FabricationPart” object…

Ok. So I have changed the element’s and got rid of the collector. So now I should have a list.

image
image

@coastguard09 Built In Parameters and other API references are case-sensitive, try changing “Fabrication_Part_Length” to uppercase so that line 20 is
output.append(i.get_Parameter(BuiltInParameter.FABRICATION_PART_LENGTH))

That did the trick. Unfortunately, The results came back null. That means those parameters are empty?

Empty parameters show up as blanks, not nulls. In the Instance Properties of the parts you are inputting, do you see Length under the Dimensions parameter group? Its possible the Fabrication Parts you are inputting do not report Length.

Does querying the Size property give you the output you are seeking? (replace line 20 with the following line):

output.append(i.Size)

Length does not show up under the dimension parameter group which makes me think that they do not report the length.

When I replaced Line 20 they returned blank.

So is there no way to get to that length then?

Could you share a screenshot showing the Type Properties of one of the elements? It would help to see what your elements are :slight_smile: if they do not report length, perhaps there is another dimension parameter that will give you the output you are looking for

Hi @coastguard09

Is this length your trying to extract?

That’s the one. Those dims are what I want to get at.

I think you have used the “GetDimension” and “GetDimensionValue” methods. When I use the “GetDimensionValue” method it tells me an arguement is expected.

I am still looking for what I need. Just figured i’d give an update.

So I know need to input a “FabricationDimensionDefinition” but do not know where I can find this information. Could anybody point me in the right direction?

image

I think i am almost there. Any help?image

I have so many outs just to check myself.

today.dyn (2.1 KB)

@erfajo I will do this in the future. I have put the .dyn file on here.

@erfajo I am trying to access fabrication part dimensions. They don’t show up like your normal parameters on a revit element. Yes i can get some of them, but not the ones I want using your proposed method.

If you look at @Kulkul screenshot, that is what I am trying to achieve. I just figured it out though. I am going to mark this as solved and then when I put some finishing touches on it, I will post graph and script.

There are some fabrication parts that do not provide you the size or length or other such pertinent information. If you have a part based on CID pattern 159 for example. The diameter and length fields do not show anywhere so therefore cannot be scheduled. Now, what you’ve with the scripts and graphs is awesome, so thanks for that.

There is a new package called “Fabrication API”. It is the solution to what I needed.

Quick question, I am running into an issues where all my fabrication pipes,valves,coupling and elbows are being returned with a length. How can i sort have it only return pipe in length and everything else as quantity? any help would be greatly appreciated.