units
Unit conversion utilities for Revit.
Attributes
Functions
format_area(area_value, doc=None)
Return formatted area value in document units.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
area_value |
float
|
area value |
required |
doc |
Document
|
Revit document, defaults to current |
None
|
Returns:
Type | Description |
---|---|
str
|
formatted value |
Source code in pyrevitlib/pyrevit/revit/units.py
format_slope(slope_value, doc=None)
Return formatted slope value in document units.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
slope_value |
float
|
slope value |
required |
doc |
Document
|
Revit document, defaults to current |
None
|
Returns:
Type | Description |
---|---|
str
|
formatted value |
Source code in pyrevitlib/pyrevit/revit/units.py
project_to_viewport(xyz, view)
Project a point to viewport coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xyz |
XYZ
|
point to project |
required |
view |
View
|
target view |
required |
Returns:
Type | Description |
---|---|
UV
|
[description] |
Source code in pyrevitlib/pyrevit/revit/units.py
project_to_world(uv, view)
Get view-based point (UV) back to model coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uv |
UV
|
point on a view |
required |
view |
View
|
view to get coordinates from |
required |
Returns:
Type | Description |
---|---|
XYZ
|
point in world coordinates |
Source code in pyrevitlib/pyrevit/revit/units.py
get_spec_name(forge_id)
Returns the measurable spec name for the given unit id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
forge_id |
ForgeTypeId
|
Unit id |
required |
Returns:
Type | Description |
---|---|
str
|
Spec name |
Source code in pyrevitlib/pyrevit/revit/units.py
get_unit_name(forge_id)
Returns the unit name for the given unit id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
forge_id |
ForgeTypeId
|
Unit id |
required |
Returns:
Type | Description |
---|---|
str
|
Unit name |