{ "cells": [ { "cell_type": "markdown", "id": "aececd27", "metadata": { "papermill": { "duration": 0.001703, "end_time": "2026-03-19T15:08:42.153780", "exception": false, "start_time": "2026-03-19T15:08:42.152077", "status": "completed" }, "tags": [] }, "source": [ "(material property datum example)=\n", "# Material Properties Datum Script Examples" ] }, { "cell_type": "markdown", "id": "8f03602b", "metadata": { "papermill": { "duration": 0.0011, "end_time": "2026-03-19T15:08:42.156680", "exception": false, "start_time": "2026-03-19T15:08:42.155580", "status": "completed" }, "tags": [] }, "source": [ "Download the [ExampleModel.fez](https://github.com/Rocscience/rs2-scripting/blob/main/docs/example_code/example_models/ExampleModel.fez) for this example." ] }, { "cell_type": "code", "execution_count": 1, "id": "efd68734", "metadata": { "execution": { "iopub.execute_input": "2026-03-19T15:08:42.161073Z", "iopub.status.busy": "2026-03-19T15:08:42.160791Z", "iopub.status.idle": "2026-03-19T15:08:53.309993Z", "shell.execute_reply": "2026-03-19T15:08:53.308606Z" }, "papermill": { "duration": 11.153476, "end_time": "2026-03-19T15:08:53.311282", "exception": false, "start_time": "2026-03-19T15:08:42.157806", "status": "completed" }, "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Youngs Modulus Datum Dependent Type:\n", "Datum Type = DatumType.DATUM_TYPE_RADIAL, Datum Value = 5.0, Center = (3.5, 2.0)\n", "Use Cutoff = True, Datum Change = 0.5, Cutoff = 0.8\n", "\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", "Friction Datum Dependent Type:\n", "Datum Type = DatumType.DATUM_TYPE_DEPTH, Datum Value = 5.0, Center = (5.0, 6.0)\n", "Use Peak Cutoff = True, Peak Change = 1.0, Peak Cutoff = 44.0\n", "Use Residual Cutoff = True, Residual Cutoff Value = 45.0\n", "\n", "\n", "Cohesion Datum Dependent Type:\n", "Datum Type = DatumType.DATUM_TYPE_RADIAL, Datum Value = 5.0, Center = (5.0, 6.0)\n", "Use Peak Cutoff = True, Peak Change = 1.0, Peak Cutoff = 44.0\n", "Use Residual Cutoff = True, Residual Cutoff Value = 45.0\n", "\n", "Change Factor = 0.2, Datum Factor Value= 3.0, Peak Cutoff Value Factor = 4.42\n" ] } ], "source": [ "from rs2.modeler.RS2Modeler import RS2Modeler\n", "from rs2.modeler.properties.PropertyEnums import *\n", "import os\n", "\n", "current_dir = os.path.dirname(os.path.abspath(\"\")) \n", "RS2Modeler.startApplication(port=60064)\n", "modeler = RS2Modeler(port=60064)\n", "model = modeler.openFile(rf\"{current_dir}\\example_models\\ExampleModel.fez\")\n", "\n", "material = model.getAllMaterialProperties()[0]\n", "\n", "# Make sure to set Material Stiffness Type to Isotropic before changing Datum Dependency Properties\n", "material.Stiffness.setElasticType(MaterialElasticityTypes.ISOTROPIC)\n", "material.Datum.setUsingDatum(True)\n", "\n", "youngDatum = material.Datum.getDatumYoungsModulus()\n", "youngDatum.setUsing(True)\n", "youngDatum.setType(DatumType.DATUM_TYPE_DEPTH)\n", "youngDatum.setDatum(5)\n", "youngDatum.setType(DatumType.DATUM_TYPE_RADIAL)\n", "youngDatum.setCenter(3.5,2)\n", "youngDatum.setUseCutoff(True)\n", "youngDatum.setChange(0.5)\n", "youngDatum.setCutoff(0.8)\n", "\n", "print(\"\\nYoungs Modulus Datum Dependent Type:\")\n", "print(f\"Datum Type = {youngDatum.getType()}, Datum Value = {youngDatum.getDatum()}, Center = {youngDatum.getCenter()}\")\n", "print(f\"Use Cutoff = {youngDatum.getUseCutoff()}, Datum Change = {youngDatum.getChange()}, Cutoff = {youngDatum.getCutoff()}\\n\")\n", "\n", "# Set Material Strength failure criterion to Mohr-Coulomb and material type to Plastic\n", "# This allows to specify properties for Friction and Cohesion Datum Dependent Types\n", "material.Strength.setFailureCriterion(StrengthCriteriaTypes.MOHR_COULOMB)\n", "material.Strength.MohrCoulombStrength.setMaterialType(MaterialType.PLASTIC)\n", "\n", "frictionDatum = material.Datum.getDatumFrictionAngle()\n", "frictionDatum.setUsing(True)\n", "frictionDatum.setType(DatumType.DATUM_TYPE_DEPTH)\n", "frictionDatum.setDatum(5)\n", "frictionDatum.setType(DatumType.DATUM_TYPE_DEPTH)\n", "frictionDatum.setCenter(5, 6)\n", "frictionDatum.setPeakChange(1)\n", "frictionDatum.setUsePeakCutoff(True)\n", "frictionDatum.setPeakCutoffValue(44)\n", "frictionDatum.setResidualChange(0.5)\n", "frictionDatum.setUseResidualCutoff(True)\n", "frictionDatum.setResidualCutoffValue(45)\n", "\n", "print(\"\\nFriction Datum Dependent Type:\")\n", "print(f\"Datum Type = {frictionDatum.getType()}, Datum Value = {frictionDatum.getDatum()}, Center = {frictionDatum.getCenter()}\")\n", "print(f\"Use Peak Cutoff = {frictionDatum.getUsePeakCutoff()}, Peak Change = {frictionDatum.getPeakChange()}, Peak Cutoff = {frictionDatum.getPeakCutoffValue()}\")\n", "print(f\"Use Residual Cutoff = {frictionDatum.getUseResidualCutoff()}, Residual Cutoff Value = {frictionDatum.getResidualCutoffValue()}\\n\")\n", "\n", "cohesion = material.Datum.getDatumCohesion()\n", "cohesion.setType(DatumType.DATUM_TYPE_DEPTH)\n", "cohesion.setDatum(5)\n", "cohesion.setType(DatumType.DATUM_TYPE_RADIAL)\n", "cohesion.setCenter(5, 6)\n", "cohesion.setPeakChange(1)\n", "cohesion.setUsePeakCutoff(True)\n", "cohesion.setPeakCutoffValue(44)\n", "cohesion.setResidualChange(0.5)\n", "cohesion.setUseResidualCutoff(True)\n", "cohesion.setResidualCutoffValue(45)\n", "\n", "print(\"\\nCohesion Datum Dependent Type:\")\n", "print(f\"Datum Type = {cohesion.getType()}, Datum Value = {cohesion.getDatum()}, Center = {cohesion.getCenter()}\")\n", "print(f\"Use Peak Cutoff = {cohesion.getUsePeakCutoff()}, Peak Change = {cohesion.getPeakChange()}, Peak Cutoff = {cohesion.getPeakCutoffValue()}\")\n", "print(f\"Use Residual Cutoff = {cohesion.getUseResidualCutoff()}, Residual Cutoff Value = {cohesion.getResidualCutoffValue()}\\n\")\n", "\n", "# Manipulation of Datum Stage Factor Properties for stage 2\n", "\n", "# Make sure to stage Datum Stage Factor option before manipulating any factor properties\n", "material.StageFactors.setStageDatumStageFactor(True)\n", "definedStageFactors = material.StageFactors.getDefinedStageFactors()\n", "newStageFactor = material.StageFactors.createStageFactor(2)\n", "definedStageFactors[2] = newStageFactor\n", "material.StageFactors.setDefinedStageFactors(definedStageFactors)\n", "datumStageFactor = material.Datum.stageFactorInterface.getDefinedStageFactors()[2]\n", "\n", "datumYoungStageFactor = datumStageFactor.getDatumYoungsStageFactor()\n", "datumYoungStageFactor.setChange(0.2)\n", "datumYoungStageFactor.setDatum(3)\n", "datumYoungStageFactor.setPeakCutoffValue(4.42)\n", "\n", "print(f\"Change Factor = {datumYoungStageFactor.getChange()}, Datum Factor Value= {datumYoungStageFactor.getDatum()}, Peak Cutoff Value Factor = {datumYoungStageFactor.getPeakCutoffValue()}\")\n", "\n", "model.close()\n", "modeler.closeProgram()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.0" }, "papermill": { "default_parameters": {}, "duration": 12.698346, "end_time": "2026-03-19T15:08:53.563269", "environment_variables": {}, "exception": null, "input_path": "C:\\Users\\GraceHu\\source\\repos\\RS2_Python_Client_Library\\docs\\example_code\\material\\material_datum_properties_script_examples.ipynb", "output_path": "C:\\Users\\GraceHu\\source\\repos\\RS2_Python_Client_Library\\docs\\example_code\\material\\material_datum_properties_script_examples.ipynb", "parameters": {}, "start_time": "2026-03-19T15:08:40.864923", "version": "2.6.0" } }, "nbformat": 4, "nbformat_minor": 5 }