Control the Precision of the Generated Output
- Last UpdatedApr 27, 2023
- 2 minute read
The precision of both linear and angular data is controlled by the Precision Code (PCODE) attribute. PCODE is used primarily in Draw via the visual style elements. Historically it is also an attribute of the DEPT, REGI, DRWG, LIBY, SHLB, OVER and LAYE elements, with its value being cascaded down the database hierarchy. PCODE stores four values of precision for metric (decimal) values, Imperial decimal values, imperial fractional values, and angles. By default, these four values are 0 (mm dp), 1 (dp), 32nds and 1 (dp) respectively. (dp = decimal places.)
In addition, it is possible to control whether trailing zeros following the decimal point are included in the display, using the ‘TRAILING ZEROS’ syntax. The syntax applies to both metric and imperial linear precisions. The default is 'on'. Note that angles never display trailing zeros after the decimal point.
The examples indicate a setting PCODE:
|
PCODE LIN MM TO 2 DPLS |
Set linear (metric) precision to two decimal places |
|
PCODE LIN METRES TO 1 DPLS |
Set linear (metric) precision to one decimal place on metres |
|
PCODE LIN CM TO 2 DPLS |
Set linear (metric) precision to two decimal places on CM |
|
PCODE LIN IN TO 2 DPLS |
Set linear (Imperial, inch) precision to two decimal places (the feet precision will be 3 decimal places). |
|
PCODE LIN FRA TO 32 NDS |
Set linear (Imperial, fractional) precision to 32nds |
|
PCODE ANG DEG |
Set angular precision to nearest whole number of degrees |
|
PCODE ANG TO 2 DPLS |
Set linear angular precision to two decimal places |
|
PCODE TRAILING ZEROS ON |
Trailing zeros display. For example, 175.00 or 200.30 |
|
PCODE TRAILING ZEROS OFF |
Trailing zeros do not display. For example, 175 or 200.3 |
Angles output in degrees, minutes or seconds are in the standard format (for example, using °, ’ or "). Angles output in the decimal format have no symbols. If required a ° symbol can be accessed from Draw’s alternative character set by using the code ~0.
Data output in linear metric format (mm, cm, metres) is to the precision derived from the PCODE option currently in force. For example, if the METRE precision is set to 1, output is 1dp for metres, 3dp for cm and 4dp for mm. In order to control metres and mm independently (for example 1dp for metres and 2dp for mms) it is necessary to use two different PCODEs. In DRAW this can be achieved by having two different visual styles, one used for entities where distance is measured in metres, and one for entities where distance is measured in mm.
Four pseudo-attributes exist to allow the querying of the individual parts of the PCODE attribute:
|
Q PCODMms |
query metric (mm) precision |
|
Q PCODInches |
query Imperial (inch) precision |
|
Q PCODFractions |
query fraction precision |
|
Q PCODAngles |
query angle precision |