Set Room Limit Offset

Set Room Limit Offset

dhanait_ajay13
Enthusiast Enthusiast
418 Views
1 Reply
Message 1 of 2

Set Room Limit Offset

dhanait_ajay13
Enthusiast
Enthusiast

i want to set negative value to room Limit Offset and set room UpperLimit is upper level.

manually it getting negative value but through programming it throw error/warning.

 


Floor floor = doc.GetElement(elementId) as Floor;

Parameter upperlevel_floor_Thickness = floor.LookupParameter("Thickness");
FloorThickness_ = Convert.ToDouble(upperlevel_floor_Thickness.AsValueString());

Parameter para_room_LimitOffset = room.LookupParameter("Limit Offset");

room.UpperLimit = Upper_level;
para_room_LimitOffset.Set(-FloorThickness_);

0 Likes
Accepted solutions (1)
419 Views
1 Reply
Reply (1)
Message 2 of 2

jeremy_tammik
Alumni
Alumni
Accepted solution

The value of the Thickness parameter is a real number.

  

In the Revit database, all length values as stored in imperial feet units:

  

http://thebuildingcoder.typepad.com/blog/2011/03/internal-imperial-units.html

  

So, both Thickness and Limit Offset need to be specified in feet.

  

AsValueString is converting it to a string, possibly returning it formatted as it would be displayed in the end user interface, possibly applying a conversion from the internal imperial units to something else, e.g., meters or millimetres or something.

  

Therefore, your code may be using some totally weird value when setting the Limit Offset.

  

I suggest that you eliminate the use of AsValueString and Convert.ToDouble.

  

Use AsDouble instead, and no conversion will be needed.

  

I mostly avoid using AsValueString myself.

  

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