Changing a Pipe's Slope?

Changing a Pipe's Slope?

truevis
Contributor Contributor
3,040 Views
6 Replies
Message 1 of 7

Changing a Pipe's Slope?

truevis
Contributor
Contributor
When a pipe is selected and is "element":
 
  element.get_Parameter(BuiltInParameter.RBS_PIPE_DIAMETER_PARAM).Set(0.55);
 
works, but
 
 element.get_Parameter(BuiltInParameter.RBS_PIPE_SLOPE).Set(0);
 
gets an error that it's read-only. 
 
Programmatically changing the endpoints of a Pipe does not update its Slope parameter. Anyone know how to set a Pipe's Slope parameter?
 
PS: The journal entry says "ID_RBS_EDIT_SLOPE" when I do it though Revit's UI.
0 Likes
3,041 Views
6 Replies
Replies (6)
Message 2 of 7

jeremytammik
Autodesk
Autodesk

Dear Eric,

 

Yes, indeed, the slope is read-only.

 

This is necessarily so, because changing the pipe slope will affect neighbouring connected pipes and the entire system, so you cannot just modify the parameter value to achieve that.

 

Here is a sequence of samples that explores several different ways to modify pipe start and end points and thus their slope:

 

http://thebuildingcoder.typepad.com/blog/2014/01/final-rolling-offset-using-pipecreate.html

 

Cheers

 

Jeremy



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

0 Likes
Message 3 of 7

truevis
Contributor
Contributor

Thanks for the CmdRollingOffset code. I do not see where an existing Slope paramter is changed, though. I will re-state the problem with an example:

 

Pipe Slope can be changed with the UI. If a pipe has a slope but its endpoints are changed with the API, the Slope parameter is not updated, so when the pipe is selected, the wrong end elevations and slope are displayed. If the pipe has been programmatically made horizontal (equal Z endpoints) it can be fixed by manually typing "0" into the slope input on the pipe while it's selected.

 

I would like to do that last step programmatically.

 

Example:

Take the MoveLinear API Sample and use this code where line endpoints are set. In this case equal Zs.

 

                   //get start point via "get_EndPoint(0)"
                    Autodesk.Revit.DB.XYZ newStart = new XYZ(
                        lineLoc.Curve.GetEndPoint(0).X,
                        lineLoc.Curve.GetEndPoint(0).Y,
                        lineLoc.Curve.GetEndPoint(0).Z);
                    //get end point via "get_EndPoint(1)"
                    Autodesk.Revit.DB.XYZ newEnd = new XYZ(
                        lineLoc.Curve.GetEndPoint(1).X,
                        lineLoc.Curve.GetEndPoint(1).Y,
                        lineLoc.Curve.GetEndPoint(0).Z);

 

It sets the pipe's Zs equal but the Slope parameter is not changed.

 

before
Screen Shot 10-01-15 at 10.20 PM.PNG

after
Screen Shot 10-01-15 at 10.27 PM.PNG

You can see it is horizontal but Slope parameter still shows non-zero.Screen Shot 10-01-15 at 10.27 PM 001.PNG

Manually setting its slope to 0 fixes how it's displayed.

Screen Shot 10-01-15 at 10.28 PM.PNG

 

Additional findings: Cut and paste-align of the pipe will also fix the Slope display. (But that doesn't help if the pipe is connected.) Opening the RVT with Audit doesn't fix it.

0 Likes
Message 4 of 7

jeremytammik
Autodesk
Autodesk

Dear Eric,

 

Happy New Year to you again, now through this public channel!

 

Thank you for confirming that the issue still persists, and for your patience.

 

I discussed with the development team, and they confirm that it looks like an issue that needs rectifying.

 

Accordingly, we filed a development database entry for it, REVIT-106354 [pipe slope does not update when modify the pipe curve location by api]. Please make a note of this number for future reference.

 

You are welcome to request an update on the status of this issue or to provide additional information on it at any time quoting this change request number.

 

This issue is important to me. What can I do to help?

 

This issue needs to be assessed by our engineering team, and prioritised against all other outstanding change requests. Any information that you can provide to influence this assessment will help. Please provide the following where possible:

 

  • Impact on your application and/or your development.
  • The number of users affected.
  • The potential revenue impact to you.
  • The potential revenue impact to Autodesk.
  • Realistic timescale over which a fix would help you.
  • In the case of a request for a new feature or a feature enhancement, please also provide detailed Use cases for the workflows that this change would address.

 

This information is extremely important. Our engineering team have limited resources, and so must focus their efforts on the highest impact items. We do understand that this will cause you delays and affect your development planning, and we appreciate your cooperation and patience.

 

Cheers

 

Jeremy



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

Message 5 of 7

jeremytammik
Autodesk
Autodesk

Workaround until fixed: recreate the pipe, as described in

 

http://forums.autodesk.com/t5/revit-api-forum/pipe-slope-not-updating/m-p/6781872

 

Cheers,

 

Jeremy



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

0 Likes
Message 6 of 7

jose_loaiza5W6L6
Contributor
Contributor

Hi Jeremy I hope you are very well

 

I wondering if this issue was fixed, I just trying to update the parameter slope for a pipe, but I get an error, This is the code that I'm using

 

// Get the pipe's parameter for slope
Parameter slopeParam = pipe.get_Parameter(BuiltInParameter.RBS_PIPE_SLOPE);

// Set the slope value

slopeParam.Set(0.01041667);

 

the error that I get is "slopeParam is readOnly" how I can update the slope for a pipe when is drawing?

 

thank you so much

Best regards

 

0 Likes
Message 7 of 7

jeremy_tammik
Alumni
Alumni

Dea Jose, re-reading the above discussion now, seven years later, I see that my replies back then are somewhat naive. The slope parameter on an individual; pipe element is read-only for good reason: it depends on the neighbouring pipes and on the entire pipe system. The example above, updating a disconnected pipe element end points, did not modify the slope value, because it is pointless in that disconnected situation. As a general rule, the Revit API is a wrapper around UI functionality. Therefore, it is often also pointless to blindly go ahead and attack something programmatically in Revit before understanding the optimal workflow and best practices working manually in the end user interface. So, my suggestion to the gentleman in the discussion above and to you both would be to research the optimal workflow and best practices working manually in the end user interface first, before looking further for an API solution. Here are the links that popped up in my initial research for you in my previous answer to your question  on Changing the slope parameter in Floors in Revit 2023:

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes