Share

acdbDisToF

C++

int acdbDisToF(
    const ACHAR * str, 
    int unit, 
    double * v
);

File

acedads.h

Description

Converts a string that displays a real (double-precision floating-point) value expressed in the specified display format into a real value.

The unit value should correspond to values allowed for the AutoCAD system variable LUNITS, as shown in the following table.

Linear units values:

1 Scientific
2 Decimal
3 Engineering (feet and decimal inches)
4 Architectural (feet and fractional inches)
5 Fractional

The string str must be a string that acdbDisToF() can parse correctly according to the mode specified by unit. It can be in the canonical form that acdbRToS() returns, or in a form that AutoCAD allows for keyboard entry. The acdbDisToF() and acdbRToS() functions are complementary. If you pass acdbDisToF() a string created by acdbRToS(), acdbDisToF() is guaranteed to return a valid value in v. The converse also applies, provided that the unit argument specifies the same mode in both calls; see the following note).

Note The acdbDisToF() function treats modes 3 and 4 the same. If unit specifies 3 (engineering) or 4 (architectural) units, and str is in either of these formats, acdbDisToF() sets v to the correct real value.

On success, returns RTNORM; otherwise, returns an error code.

Parameters

Parameters Description
str String to be converted
unit Units in which the string is formatted; if -1, uses the current value of LUNITS
v Pointer to the result of the conversion

Previous Declaration

AutoCAD 2024 and earlier

int acdbDisToF(const ACHAR *str, int unit, ads_real *v);

History

AutoCAD 2025

v argument changed from ads_real to double.

Was this information helpful?