* ARX data type conversion unit and

* ARX data type conversion unit and
the amount of steel per unit conversion function
file acad.unt AutoCAD software package, defines some common unit amount of steel conversion relation, for example, miles and kilometers, and the like Fahrenheit and Celsius. Function acutCvUnit () A unit for converting the value into a value of another unit. Units expressed in the form of a string, the string must be consistent with the use of the file acad.unt defined. If the current drawing units are engineering units or construction units (feet or inches), the distance specified in the program can convert the following values in meters:
ads_real eng_len, metric_len;
char * prmpt = "Please enter the distance:";
IF ( ! acedGetDist (NULL, prmpt, & eng_len) = RTNORM) return BAD;
acutCvUnit (eng_len, "inches", "meters", & metric_len);
[the I] Note: Do not use the function acutCvUnit () conversion does not match the unit, for example, can not inch conversion adult [/ I].
String conversion functions
functions acdbRToS () is used to convert a real number to a string value;
function acdbAngToS () is used to convert the value into a string value angle;
function acdbDisToF () is used to convert a string value to a real value ;
function acdbAngToF () is used to convert a string value into angular value.
[I] Note: The format string controlled by the system variable AutoCAD, for the real value, and precision units specified by the system variables and LUNITS IUPREC; angle values specified by the system units and precision variables and AUNITS AUPERC. Regardless of the angle or the real value denoted by the variable controls whether complement DIMZIN 0 [/ I] before and after the generation of the string.
The following procedure is a method call correspondence acdbRToS () is:
ads_real X = 17.5;
char fmtval [12 is];
// precision is the third parameter
acdbRToS (X, l, 4, fmtval);
acutPrintf ( "% s results in the form of \ n-", fmtval);
acdbRToS (X, 2,2 &, fmtval);
acutPrintf (" result in the form of S% \ n-", fmtval);
acdbRToS (X, 3,2-, fmtval);
acutPrintf (" result in the form of S% \ n-", fmtval);
acdbRToS (X, 4,2, fmtval);
acutPrintf (" result in the form of S% \ n-", fmtval);
acdbRToS (X, 5,2, fmtval);
acutPrintf (" results in the form of% s \ n ", fmtval) ;
assumed DIMZIN system variable to 0, displayed as text on the screen AutoCAD:
results form 1.7500E + 01
the results in the form of 17.50
the results in the form of 1'-5.50"
result in the form of 1 ' -5 1/2 "
results in the form of half 17
when the system UNITMODE variable is equal to 1, the output unit determined by the unit of the string of the input string, and therefore, the function acdbRToS () returns the value of the following modes in form different: Engineering units (mode 3), the building unit system (mode 4) and fractional (mode 5). When UNITMODE = 1 when in the above example, the output of the first two lines of the same form, the three lines becomes:
Results form 1'5.50 "
result in the form 1/2 1'5"
result in the form 1/2 17
opposite function acdbDisToF () and acdbRToS () function. The following example is a reference to a string value generated after the above program conversion, then come inverse transform, therefore, the value of the parameter restuil was 17.5.
acdbDisToF ( "1.7500E + 01",. 1, & resuil);
acdbDisToF ( "17.50", 2, & resuil);
acdbDisToF ( "of 1'-5.50 \" ",. 3, & resuil);
acdbDisToF (" of 1'-. 5. 1 / 2 \ "",. 4, & resuil);
acdbDisToF ( "1/2. 17",. 5, & resuil);
the following code calls the function acdbAngToS () method. Invoking acdbRToS () like:
ads_real Ang = 3.14159;
char fmtval [12 is];
acdbAngToS (Ang, 0,0, fmtval);
acutPrintf ( "in the form of an angle S% \ n-", fmtval);
acdbAngToS (Ang, l, 4, fmtval);
acutPrintf ( "form an angle of% s \ n", fmtval) ;
acdbAngToS (Ang, 2,4, fmtval);
acutPrintf ( "form an angle of% s \ n", fmtval) ;
acdbAngToS (ang, 3,4, fmtval) ;
acutPrintf ( "form an angle of% s \ n", fmtval) ;
acdbAngToS (Ang, 4,2, fmtval);
acutPrintf ( "form an angle of% s \ n", fmtval) ;
assumed DIMZIN system variable to 0, AutoCAD text displayed on the screen:
form an angle of 180
in the form of an angle 180d0'0 "
form an angle of 200.0000g
form an angle of 3.1416r
form an angle w is
a function of acdbAngToF () and acdbAngToS () function in the opposite. Example string reference value is generated after the conversion procedures above, and then come inverse transform, therefore, the value of the parameter restuil is 3.14159.
acdbAngToF ( "180 [", 0, & resuil);
acdbAngToF ( "180d0'0 \" " ,. 1, & resuil);
acdbAngToF ( "200.0000g" ", 2, & resuil);
acdbAngToF (" 3.1416r ",. 3, & resuil);
acdbAngToF (" W ",. 4, & resuil); *



Guess you like

Origin www.cnblogs.com/mjgw/p/12655835.html