高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】how to get the units of a drawing file
how to get the units of a drawing file
how to get the units of a drawing file
i'd like to get the linear, area, volume, and angular unit of a drawing file. which function would allow me to achieve this?
thanks,
-ky
oddbdatabse::getmeasurement() tells if the drawing is english or metric.
sergey slezkin
what i need are the values that the users can set through the drawing setup dialog in autocad (via 'units' command in autocad), in which the user can specify drawing units such as 'inches', 'feet', 'meters', 'centimeters', etc, and area units such as 'square feet', 'square meters', and so on. how should i get these settings through dd?
by the way, though this is not what i need right now, i cannot find oddbdatabase:getmeasurement(). i guess i'm missing some thing? i'm using version 1.11.01.00, 6/03/2004.
thanks for any further help.
-ky
oddbdatabase::getmeasurement() function prototype is generated from sysvardefs.h container so it do not present in oddbdatabase.h
measurement variable says if the drawing is english or metric.
starting with r14 insunits variable was introduced (millimeters, kilometers, microinches etc.) but it effects only scaling during drag-and-drop operations between 2 different drawings.
lunits and aunits variables effect only the displaying of linear and angular units in autocad.
aunits:
0 decimal degrees
1 degrees/minutes/seconds
2 gradians
3 radians
4 surveyor's units
lunits:
sets linear units.
1 scientific
2 decimal
3 engineering
4 architectural
5 fractional
they do not effect values stored in file and/or returned by api functions. for example angles are always stored and returned in radians.
sergey slezkin
what i need is quite straight forward. for example, if i have a value of 100 for the lengh of a line in the drawing, i would like to know if it represents 100 meters or 100 inches in the user's mind. the autocad user would have set it through the 'units' command in autocad with 'drawing units' combo box. i would think it would be a logical thing for the dd library to expose this information through dd apis.
if i understand you correctly, there is currently no way to get this information in a value of insunits (e.g. millimeters, kilometers, etc) from dd. is there any plan to implement a function that exposes this information?
(by the way, good to know how to use getmeasurement(). thanks.)
-ky
via dd api you have access to all autocad system variables stored in drawing.
autocad's "units" dialog displays and modifies values of
insunits, lunits, aunits
oddbdatabase::getinsunits() returns unitsvalue enum defined in dbdatabase.h
getlunits() and getaunits() return int values.
but insunits variable appeared in ac r14. so for r12, r13 drawings in will be set to inches or millimeters depending on measurement.
sergey slezkin
ok, now i understand. getinsunits is what i need and it works great. thank you so much!
-k
|