| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| __title__ = "FreeCAD FEM material mechanical nonlinear document object" |
| __author__ = "Bernd Hahnebach" |
| __url__ = "https://www.freecad.org" |
|
|
| |
| |
| |
|
|
| from . import base_fempythonobject |
|
|
|
|
| class MaterialMechanicalNonlinear(base_fempythonobject.BaseFemPythonObject): |
| """ |
| The MaterialMechanicalNonlinear object |
| """ |
|
|
| Type = "Fem::MaterialMechanicalNonlinear" |
|
|
| def __init__(self, obj): |
| super().__init__(obj) |
| self.add_properties(obj) |
|
|
| obj.addExtension("App::SuppressibleExtensionPython") |
|
|
| def onDocumentRestored(self, obj): |
|
|
| |
| yield_points = [] |
| if hasattr(obj, "YieldPoint1"): |
| if obj.YieldPoint1: |
| yield_points.append(obj.YieldPoint1) |
| obj.removeProperty("YieldPoint1") |
| if hasattr(obj, "YieldPoint2"): |
| if obj.YieldPoint2: |
| yield_points.append(obj.YieldPoint2) |
| obj.removeProperty("YieldPoint2") |
| if hasattr(obj, "YieldPoint3"): |
| if obj.YieldPoint3: |
| yield_points.append(obj.YieldPoint3) |
| obj.removeProperty("YieldPoint3") |
|
|
| self.add_properties(obj) |
| if yield_points: |
| obj.YieldPoints = yield_points |
|
|
| if not obj.hasExtension("App::SuppressibleExtensionPython"): |
| obj.addExtension("App::SuppressibleExtensionPython") |
| |
|
|
| def add_properties(self, obj): |
|
|
| |
| |
| |
|
|
| if not hasattr(obj, "LinearBaseMaterial"): |
| obj.addProperty( |
| "App::PropertyLink", |
| "LinearBaseMaterial", |
| "Base", |
| "Set the linear material the nonlinear builds upon.", |
| ) |
| obj.setPropertyStatus("LinearBaseMaterial", "LockDynamic") |
|
|
| if not hasattr(obj, "MaterialModelNonlinearity"): |
| choices_nonlinear_material_models = ["isotropic hardening", "kinematic hardening"] |
| obj.addProperty( |
| "App::PropertyEnumeration", |
| "MaterialModelNonlinearity", |
| "Fem", |
| "Set the type on nonlinear material model", |
| ) |
| obj.setPropertyStatus("MaterialModelNonlinearity", "LockDynamic") |
| obj.MaterialModelNonlinearity = choices_nonlinear_material_models |
| obj.MaterialModelNonlinearity = choices_nonlinear_material_models[0] |
|
|
| if ( |
| hasattr(obj, "MaterialModelNonlinearity") |
| and obj.MaterialModelNonlinearity == "simple hardening" |
| ): |
| updated_choices_nonlinear_material_models = [ |
| "isotropic hardening", |
| "kinematic hardening", |
| ] |
| obj.MaterialModelNonlinearity = updated_choices_nonlinear_material_models |
| obj.MaterialModelNonlinearity = updated_choices_nonlinear_material_models[0] |
|
|
| if not hasattr(obj, "YieldPoints"): |
| obj.addProperty( |
| "App::PropertyStringList", |
| "YieldPoints", |
| "Fem", |
| "Set stress and strain for yield points as a list of strings, " |
| 'each point "stress, plastic strain"', |
| ) |
| obj.setPropertyStatus("YieldPoints", "LockDynamic") |
| obj.YieldPoints = [] |
|
|