Setting Pipe Size

Setting Pipe Size

allan.moraes
Contributor Contributor
2,461 Views
5 Replies
Message 1 of 6

Setting Pipe Size

allan.moraes
Contributor
Contributor

Hello everyone!

Happy New Year to you all!

 

I'm trying to change a pipe size using a pre-defined array. Everything goes fine throughout the code, until when I try to set the size parameter's value to any of the pre-defined values, an exception is thrown saying that the parameter is read-only. I already tried using transactions and not using them as well, but no further progress was made.

I searched for any other way on doing it but wasn't successful.

Can anyone come up with an idea?

 

Thank you!

0 Likes
Accepted solutions (1)
2,462 Views
5 Replies
Replies (5)
Message 2 of 6

jeremytammik
Autodesk
Autodesk

Try it out in the user interface.

 

Can you change the pipe size for an individual element?

 

I don't think so.

 

You can only change it for the entire run.

 

The run controls the pipe size of its member elements.

 

Therefore, the pipe size of each individual element is read-only.

 

Use RevitLookup to explore the model and research where this setting is stored in the pipe run, and set it there to modify all its member elements.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 6

allan.moraes
Contributor
Contributor

I'm sorry Jeremy, maybe I didn't make myself clear.

I'm actually trying to change it's diameter, as it can be done by selecting a pipe in the project (as in the attached). Is that possible?

And you said about using a pipe run, how am I able to do that, I'm sorry for the newbie questions, but I've been facing real trouble to find information about Revit API.

 

Thank you for your time 😄

0 Likes
Message 4 of 6

architect.bim
Collaborator
Collaborator
Accepted solution

You should use this BuiltInParameter:

210104_2100_005.jpg

 

 In Python it looks like this:

 

 

parameter = element.Parameter[BuiltInParameter.RBS_PIPE_DIAMETER_PARAM]
with DB.Transaction(doc, 'Set Pipe Diameter') as t:
    t.Start()
    parameter.Set(value)
    t.Commit()

 

 


Maxim Stepannikov | Architect, BIM Manager, Instructor
Message 5 of 6

allan.moraes
Contributor
Contributor

Thank you guys. You helped a lot, now let me continue on my research here. By the way the code for that in C# @architect.bim was:


Element pipeElement = pipe as Element;
Transaction trans = new Transaction(document);
trans.Start("Pipe Resize By Size");
Parameter sizeParameter = pipeElement.get_Parameter(BuiltInParameter.RBS_PIPE_DIAMETER_PARAM);
sizeParameter.Set(size);
trans.Commit();

Message 6 of 6

jose_loaiza5W6L6
Contributor
Contributor

Hello Allan 

 

Do you was able to figure out the issue?, I have similar situation trying to update slope parameter

0 Likes