dim("...") ( Parametric )

  • When Units ("inch") or Units("feet") is entered in the startup code , the dim("...") function converts any distance written with fractions or a hyphen that is inside the parentheses and quotes into the base units of inches and decimals.
  • If this convert function is not used, you will need to make the entry in inches and decimals.

Also see :


Examples :

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.

SDS2 Python Prompt

>>> 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'

SDS2 Python Prompt

>>> Units("metric") >>> var = dim("1-2 1/2") >>> var 368.2999999995 # millimeters >>> dim_print(var) '368' >>> print(dim_print(var) 368)