Overview
The Unit enumeration identifies common units encountered in STEP data. The zero value indicates an unrecognized unit, and the "as_is" value is used to signal access functions that no unit conversion is desired.
Unit Definition
class Unit(IntEnum):
UNKNOWN = 0
AS_IS # no conversion
# length
MM # millimeters
CM # centimeters
M # meters
IN # inches
INCH = IN # alias for convenience
FT # feet
MICROMETRE # millionth of a meter
NANOMETRE # billionth of a meter
MILLIINCH # thousandth of an inch
MICROINCH # millionth of an inch
# area
MM2 # square millimeters
CM2 # square centimeters
M2 # square meters
IN2 # square inches
FT2 # square feet
# volume
MM3 # cubic millimeters
CM3 # cubic centimeters
M3 # cubic meters
IN3 # cubic inches
FT3 # cubic feet
# angle
DEG # degrees
RAD # radians
# solid angle
STERADIAN # steradian
# time
SEC # seconds
MIN # minutes
HOUR # hours
# feedrates - linear speed
MMPS # millimeters per second
MMPM # millimeters per minute
CMPS # centimeters per second
MPS # meters per second
IPS # inches per second
IPM # inches per minute
FPS # feet per second
FPM # feet per minute
# feed per revolution
MMPREV # millimeters per revolution
IPREV # inches per revolution
# feed per tooth
MMPTOOTH # millimeters per tooth
IPTOOTH # inches per tooth
# spinspeeds - rotational speed
HERTZ # revolutions per second (hz)
RPM # revolutions per minute
# pressure
PA # pascals
KPA # kilopascal
MPA # megapascal
PSI # pounds per square inch
# force
NEWTON # newtons
LBF # pound force
# power
WATT # watts
KW # kilowatts
HP # horsepower
# torque - full names to avoid confusion
NEWTON_METER # newton meters
POUND_FOOT # pound foot
# temperature
CELSIUS # degree Celsius
KELVIN # degree Kelvin
FAHRENHEIT # degree Fahrenheit
RANKINE # degree Rankine
# symbolic units
COUNT
PARAMETER
RATIO
REVOLUTION
TOOTH
MAX_VALUE
find()
@classmethod def find(cls, name:str) -> Unit:
The find() function is a class method that returns the enum value for a given string. Both full and abbreviated names are recognized.
print ("FIND foot:", step.Unit.find("foot"))
----------
FIND foot: Unit.FT
fromstep()
@classmethod def fromstep(cls, obj:step.Object) -> Unit:
The fromstep() function is a class method that returns the enum value for a given STEP unit or measure object. It returns None if the STEP object does not have any unit information.
fullname()
def fullname(self) -> str:
The fullname() function returns the full descriptive name of a unit enum value.
# print full names for every enum value for nm in sorted(step.Unit.__members__.keys()): print (nm, step.Unit[nm].fullname()) ---------- AS_IS default CELSIUS celsius CM centimetre CM2 square centimetre CM3 cubic centimetre CMPS centimetre/second COUNT count DEG degree ... [and so on] ...