Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Changing the slope parameter in Floors in Revit 2023

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
ahmadkhalaf7892
532 Views, 6 Replies

Changing the slope parameter in Floors in Revit 2023

ahmadkhalaf7892
Advocate
Advocate

1.PNG

2.PNG

  Hi Guys I wanted to ask how can I change the slope arrow in the floor From "Slope" to "height At Tail", if that is possible how can I edit the parameters "Height offset at tail" && "height offset at Head" . 
Keep in mind that the floor is alread created and I have the slopearrow also created . 
Floor floor = Floor.Create(doc, new List<CurveLoop> { c1 }, floortype.Id, lev.Id, true, Slopearrow, 0)

0 Likes

Changing the slope parameter in Floors in Revit 2023

1.PNG

2.PNG

  Hi Guys I wanted to ask how can I change the slope arrow in the floor From "Slope" to "height At Tail", if that is possible how can I edit the parameters "Height offset at tail" && "height offset at Head" . 
Keep in mind that the floor is alread created and I have the slopearrow also created . 
Floor floor = Floor.Create(doc, new List<CurveLoop> { c1 }, floortype.Id, lev.Id, true, Slopearrow, 0)

6 REPLIES 6
Message 2 of 7

jeremy_tammik
Autodesk
Autodesk

I don't know whether this is possible programmatically, or how to achieve it in the UI either. One effective approach that you can take yourself to find out immediately is to perform the required modification manually in the end user interface and analyse the resulting API-accessible differences between the states before and after in the Revit database using RevitLookup and other database exploration tools:

  

https://thebuildingcoder.typepad.com/blog/2017/01/virtues-of-reproduction-research-mep-settings-onto...

  

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

I don't know whether this is possible programmatically, or how to achieve it in the UI either. One effective approach that you can take yourself to find out immediately is to perform the required modification manually in the end user interface and analyse the resulting API-accessible differences between the states before and after in the Revit database using RevitLookup and other database exploration tools:

  

https://thebuildingcoder.typepad.com/blog/2017/01/virtues-of-reproduction-research-mep-settings-onto...

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 3 of 7

ahmadkhalaf7892
Advocate
Advocate

Hi @jeremy_tammik , 
in the UI you just double click on the floor and select the slopearrow drawn inside the floor. I just want to change the Parameter Type "Slope" to "Height AT Tail" only and edit the parameters inside. are you sure there is no way to edit them ?
Thanks

 

0 Likes

Hi @jeremy_tammik , 
in the UI you just double click on the floor and select the slopearrow drawn inside the floor. I just want to change the Parameter Type "Slope" to "Height AT Tail" only and edit the parameters inside. are you sure there is no way to edit them ?
Thanks

 

Message 4 of 7

naveen.kumar.t
Autodesk Support
Autodesk Support
Accepted solution

Hi @ahmadkhalaf7892 ,

 

Hi,

Yes, editing the slope arrow after creating a floor element is possible via Revit API.

First, you need to tell Revit whether you want to use "Height at Tail" or "Slope".For this you need to use BuiltInParameter.SPECIFY_SLOPE_OR_OFFSET

 

slopeArrow.get_Parameter(BuiltInParameter.SPECIFY_SLOPE_OR_OFFSET);
//"0" means height at tail
//"1" means slope

 

Here is the sample code for Height at tail

 

Floor floorElement;            
Sketch sketch=doc.GetElement(floorElement.SketchId) as Sketch;
IList<ElementId> allElements = sketch.GetAllElements();
foreach(ElementId eid in allElements)
    {                   
       Element e = doc.GetElement(eid);
       if(e.Name.Contains("Slope Arrow"))
       {
           double startValue;
           double endValue;
           e.get_Parameter(BuiltInParameter.SPECIFY_SLOPE_OR_OFFSET).Set(0);
        e.get_Parameter(BuiltInParameter.SLOPE_START_HEIGHT).Set(startValue);
        e.get_Parameter(BuiltInParameter.SLOPE_END_HEIGHT).Set(endValue);                       
       }
     }

 


Here is the sample code for slope

 

e.get_Parameter(BuiltInParameter.SPECIFY_SLOPE_OR_OFFSET).Set(1);
double slopeValue = 45 * (Math.PI / 180); //45 degree
e.get_Parameter(BuiltInParameter.ROOF_SLOPE).Set(slopeValue);

 

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes

Hi @ahmadkhalaf7892 ,

 

Hi,

Yes, editing the slope arrow after creating a floor element is possible via Revit API.

First, you need to tell Revit whether you want to use "Height at Tail" or "Slope".For this you need to use BuiltInParameter.SPECIFY_SLOPE_OR_OFFSET

 

slopeArrow.get_Parameter(BuiltInParameter.SPECIFY_SLOPE_OR_OFFSET);
//"0" means height at tail
//"1" means slope

 

Here is the sample code for Height at tail

 

Floor floorElement;            
Sketch sketch=doc.GetElement(floorElement.SketchId) as Sketch;
IList<ElementId> allElements = sketch.GetAllElements();
foreach(ElementId eid in allElements)
    {                   
       Element e = doc.GetElement(eid);
       if(e.Name.Contains("Slope Arrow"))
       {
           double startValue;
           double endValue;
           e.get_Parameter(BuiltInParameter.SPECIFY_SLOPE_OR_OFFSET).Set(0);
        e.get_Parameter(BuiltInParameter.SLOPE_START_HEIGHT).Set(startValue);
        e.get_Parameter(BuiltInParameter.SLOPE_END_HEIGHT).Set(endValue);                       
       }
     }

 


Here is the sample code for slope

 

e.get_Parameter(BuiltInParameter.SPECIFY_SLOPE_OR_OFFSET).Set(1);
double slopeValue = 45 * (Math.PI / 180); //45 degree
e.get_Parameter(BuiltInParameter.ROOF_SLOPE).Set(slopeValue);

 

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 5 of 7

ahmadkhalaf7892
Advocate
Advocate

Thank you very much Dear

0 Likes

Thank you very much Dear

Message 6 of 7

jose_loaiza5W6L6
Contributor
Contributor

Hi, guys, I need something similar to pipe; I want to change the slope for a pipe. I'm using this code 

 

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

slopeParam.Set(0.01041667);

 

However, when executing the line slopeParam.Set(0.01041667) I get an error because slopeParam is readOnly, this operation Im doing when the user is drawing or updating a pipe, Have you any Idea how I can change the slope when is drawing?.

 

Thank you 

Best regards

 

 

0 Likes

Hi, guys, I need something similar to pipe; I want to change the slope for a pipe. I'm using this code 

 

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

slopeParam.Set(0.01041667);

 

However, when executing the line slopeParam.Set(0.01041667) I get an error because slopeParam is readOnly, this operation Im doing when the user is drawing or updating a pipe, Have you any Idea how I can change the slope when is drawing?.

 

Thank you 

Best regards

 

 

Message 7 of 7

jeremy_tammik
Autodesk
Autodesk

  

Moral: explore optimal workflows and best practices manually in the user interface first.

  

The API is mostly just a wrapper around UI functionality.

  

Afaict from the discussions above, the slope is a parameter of the system, not the individual element. That might explain why the element parameter is read-only.

   

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

  

Moral: explore optimal workflows and best practices manually in the user interface first.

  

The API is mostly just a wrapper around UI functionality.

  

Afaict from the discussions above, the slope is a parameter of the system, not the individual element. That might explain why the element parameter is read-only.

   

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report