DiagramUnitEnvironmentHandler
- class planesections.environment.DiagramUnitEnvironmentHandler(envType='metric', fileName='')[source]
Bases:
objectCreates and manages the units in the diagrams. When a diagram goes to plot units, they will either be read from the active environment, or by reading from a specific set of units. The active environment can be modified using the ‘modifyActiveEnvironment’ method, and a new active environment can be set using the ‘setActiveEnvironment’ method.
By default, the active environment is used for all plots.
- activeEnv = None
- envPresetDict = {'imperial_ftkip': {'distForce': DiagramArgUnit(unit='kip/ft', scale=0.001, Ndecimal=0), 'distance': DiagramArgUnit(unit='ft', scale=1.0, Ndecimal=1), 'force': DiagramArgUnit(unit='kip', scale=0.001, Ndecimal=0), 'moment': DiagramArgUnit(unit='kip-ft', scale=0.001, Ndecimal=0)}, 'imperial_ftlb': {'distForce': DiagramArgUnit(unit='lb/ft', scale=1.0, Ndecimal=0), 'distance': DiagramArgUnit(unit='ft', scale=1.0, Ndecimal=1), 'force': DiagramArgUnit(unit='lb', scale=1.0, Ndecimal=0), 'moment': DiagramArgUnit(unit='lb-ft', scale=1.0, Ndecimal=0)}, 'metric': {'distForce': DiagramArgUnit(unit='kN/m', scale=0.001, Ndecimal=0), 'distance': DiagramArgUnit(unit='kN', scale=1.0, Ndecimal=1), 'force': DiagramArgUnit(unit='kN', scale=0.001, Ndecimal=0), 'moment': DiagramArgUnit(unit='kN-m', scale=0.001, Ndecimal=0)}, 'metric_Nm': {'distForce': DiagramArgUnit(unit='N/m', scale=1, Ndecimal=0), 'distance': DiagramArgUnit(unit='N', scale=1.0, Ndecimal=1), 'force': DiagramArgUnit(unit='N', scale=1, Ndecimal=0), 'moment': DiagramArgUnit(unit='N-m', scale=1, Ndecimal=0)}, 'metric_kNm': {'distForce': DiagramArgUnit(unit='kN/m', scale=0.001, Ndecimal=0), 'distance': DiagramArgUnit(unit='kN', scale=1.0, Ndecimal=1), 'force': DiagramArgUnit(unit='kN', scale=0.001, Ndecimal=0), 'moment': DiagramArgUnit(unit='kN-m', scale=0.001, Ndecimal=0)}}
- envTypes = ['metric', 'metric_kNm', 'metric_Nm', 'imperial_ftkip', 'imperial_ftlb', 'file']
- getActiveEnvironment()[source]
Returns an copy of the active environment.
- Returns:
A dictionary of the environment classes.
- Return type:
Environment Dict
- getEnvironment(envType: str)[source]
Returns a copy of the input environment type.
- Parameters:
envType (str) – The diagram unit environment to use. Custom values can be input via json file. Can have a value of: ‘metric’, ‘metric_kNm’, ‘metric_Nm’, ‘imperial_ftkip’, ‘imperial_ftlb’, ‘file’
- modifyActiveEnvironment(parameters, modDicts)[source]
Changes the current environment, modifying part of the units in the environment.
- Parameters:
parameters (str, or list of str) – The parameter to change, or a list of parmeters to change. Must have a value in [‘distance’, ‘force’, ‘moment’, ‘distForce’]
modDicts (dict, or list of dict) – The unit dictionary for the parameter in question. For each unit, the value must have one of: {“unit”: yourUnit, “scale”: yourscale, “Ndecimal”:yourDecimals}
- setActiveEnvironment(envType, fileName='')[source]
Sets the unit environment for diagrams. This manages the apperance of all units.
- Parameters:
envType (str) – The diagram unit environment to use. Custom values can be input via json file. Can have a value of: ‘metric’, ‘metric_kNm’, ‘metric_Nm’, ‘imperial_ftkip’, ‘imperial_ftlb’
fileName (str) – If a custom file is used, then environment to use. Custom values can be input via json file.