ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Core.UnitFormats Namespace / DisplayUnitFormats Class / SetProjectUnitFormats Method
The list of unit formats to be set for the project
(optional) specifies a new default

In This Topic
    SetProjectUnitFormats Method (DisplayUnitFormats)
    In This Topic
    Sets the list of project unit formats for the current project for the given UnitFormatType. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public void SetProjectUnitFormats( 
       IList<DisplayUnitFormat> projectUnits,
       DisplayUnitFormat defaultUnit
    )
    Public Sub SetProjectUnitFormats( _
       ByVal projectUnits As IList(Of DisplayUnitFormat), _
       Optional ByVal defaultUnit As DisplayUnitFormat _
    ) 

    Parameters

    projectUnits
    The list of unit formats to be set for the project
    defaultUnit
    (optional) specifies a new default
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run
    projectUnits must have at least one entry
    project unit not of type 'unitFormat'
    default unit not of type 'unitFormat'
    units cannot be changed
    Remarks
    If there is no current project then attempting to set the project unit formats will be ignored (to include the default if one was specified).
    The projectUnits list must contain at least one entry
    All units in the projectUnits list must be of the same UnitFormatType or a System.ArgumentException will be thrown.
    .If a default value is specified that is not in the list of projectUnits, it will be added to the list.
    If no default value is specified then the current project default value is assumed and will be added to the list of projectUnits if it is not in the list.
    The following lists of project units cannot be changed:
    • UnitFormatType.Page
    • UnitFormatType.Symbol2D
    • UnitFormatType.Symbol3D
    Attempts to change available project units of these types will result in an System.InvalidOperationException.
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also