Hide Table of Contents
SetUnits Method (IDisplayDimension)

Obsolete. Superseded by IDisplayDimension::SetUnits2.

.NET Syntax

Visual Basic (Declaration) 
Function SetUnits( _
   ByVal UseDoc As System.Boolean, _
   ByVal UType As System.Integer, _
   ByVal FractBase As System.Integer, _
   ByVal FractDenom As System.Integer, _
   ByVal RoundToFraction As System.Boolean _
) As System.Integer
Visual Basic (Usage) 
Dim instance As IDisplayDimension
Dim UseDoc As System.Boolean
Dim UType As System.Integer
Dim FractBase As System.Integer
Dim FractDenom As System.Integer
Dim RoundToFraction As System.Boolean
Dim value As System.Integer
 
value = instance.SetUnits(UseDoc, UType, FractBase, FractDenom, RoundToFraction)
C# 
System.int SetUnits( 
   System.bool UseDoc,
   System.int UType,
   System.int FractBase,
   System.int FractDenom,
   System.bool RoundToFraction
)
C++/CLI 
System.int SetUnits( 
&   System.bool UseDoc,
&   System.int UType,
&   System.int FractBase,
&   System.int FractDenom,
&   System.bool RoundToFraction
) 

Parameters

UseDoc

True uses the document settings for units, false uses the setting values passed to the arguments (see Remarks)

UType

Unit display setting as defined in swLengthUnits_e or swAngleUnits_e

FractBase

Decimal or fraction display setting as defined in swFractionDisplay_e

FractDenom

Denominator for fraction display

RoundToFraction

True rounds values to the nearest fraction, false displays fractions only if the values are exact

Return Value

Return status (see Remarks)

Remarks

The unit display settings of a display dimension are controlled by a value stored in one of two places: on the owning document, or on the individual display dimension. This method allows you to determine which setting to use, the document default or the values specified by UType, FractBase, FractDenom, and RoundToFraction.

If the UseDoc argument is true, then the display dimension unit information follows the document settings, and SOLIDWORKS ignores the remaining arguments. SOLIDWORKS also removes any local settings so that if you switch back to the local settings, they are set to default values.

The UType argument indicates the units. Depending on the type of dimension (angular or linear), this parameter takes a value from swLengthUnits_e or swAngleUnits_e. If the specified value is invalid, SOLIDWORKS does not change the existing setting and returns an error in the return value.

The FractBase argument indicates whether the dimension is displayed as a fraction or a decimal. This must take a value from swFractionDisplay_e. SOLIDWORKS displays this value as a fraction only if it can be precisely represented as a fraction based on the fraction denominator setting specified in FractDenom. However, if the RoundToFraction argument is true, then SOLIDWORKS forces fraction display by rounding the value to the nearest fraction.

The FractDenom argument indicates the fraction precision by specifying the largest fraction denominator used (for example, 4 for 1/4 or 32 for 1/32). Fraction display is valid only if UType is swINCHES or swFEETINCHES.

The return value indicates the success or failure of this function. It may take one of the following values:

-2

Command failed because UType is invalid

-1

Command failed for an unknown reason

 0

Command was successful

After using this method, use IModelDoc2::GraphicsRedraw2 to redraw the graphics window to see your changes.

 

See Also

Availability

SOLIDWORKS 99, datecode 1999207


Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   SetUnits Method (IDisplayDimension)
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:



x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2016 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.