Hide Table of Contents
SetUnits Method (IDisplayDimension)

Sets the unit display characteristics of this display dimension.

.NET Syntax

Visual Basic (Declaration) 
Function SetUnits( _
   ByVal UseDoc As Boolean, _
   ByVal UType As Integer, _
   ByVal FractBase As Integer, _
   ByVal FractDenom As Integer, _
   ByVal RoundToFraction As Boolean _
) As Integer
Visual Basic (Usage) 
Dim instance As IDisplayDimension
Dim UseDoc As Boolean
Dim UType As Integer
Dim FractBase As Integer
Dim FractDenom As Integer
Dim RoundToFraction As Boolean
Dim value As Integer
 
value = instance.SetUnits(UseDoc, UType, FractBase, FractDenom, RoundToFraction)
C# 
int SetUnits( 
   bool UseDoc,
   int UType,
   int FractBase,
   int FractDenom,
   bool RoundToFraction
)
C++/CLI 
int SetUnits( 
&   bool UseDoc,
&   int UType,
&   int FractBase,
&   int FractDenom,
&   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 remainder of the 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, 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) 2011 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.