dim("...")
( Parametric )
Also see :
Units("...")
(affects how thedim("...")
function behaves)param
(module from whichdim
is imported)- Using a text editor
Try these examples at the Python Prompt with the primary dimension setup " Units " set to imperial. Note that you can use 'mm' with decimal millimeters, but not with a fraction.
>>> from param import Units, dim >>> Units("feet") >>> var = dim("1-2 1/2") # 1 foot, 2 1/2 inches >>> var 14.5 >>> from param import dim_print >>> dim_print(var) '1-2 1/2' >>> print(dim_print(var) 1-2 1/2) >>> dim("25.4mm") # 1 inch 1.0 >>> dim("25 4/10mm") # fractional mm NOT allowed DeprecationWarning: Invalid dimension string '25 4/10 mm'
>>> Units("metric") >>> var = dim("1-2 1/2") >>> var 368.2999999995 # millimeters >>> dim_print(var) '368' >>> print(dim_print(var) 368)