diff --git a/.gitignore b/.gitignore index 04eb9e4..6dcdf6d 100644 --- a/.gitignore +++ b/.gitignore @@ -63,6 +63,8 @@ env # Folder visual studio code .vscode/ +/venv + # Ignore files for local manifest manifest/local_*_properties.json \ No newline at end of file diff --git a/README.md b/README.md index 6907658..4f9cfe5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![](https://img.shields.io/badge/SDK-v13.0.0-blue) +![](https://img.shields.io/badge/SDK-v14.0.0-blue) # Creating and analyzing a SCIA model This sample app shows how a SCIA model can be created within VIKTOR, which can be used for analysis using an external coupling. diff --git a/app/foundation/controller.py b/app.py similarity index 85% rename from app/foundation/controller.py rename to app.py index 0fd718f..f3e0baa 100644 --- a/app/foundation/controller.py +++ b/app.py @@ -14,6 +14,50 @@ CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ + +from viktor import Color +from viktor.core import ViktorController +from viktor.external.scia import Model as SciaModel +from viktor.external.scia import Material as SciaMaterial +from viktor.external.scia import LineSupport, LoadCase, LoadCombination, LoadGroup, OutputFileParser, PointSupport, \ + SciaAnalysis, SurfaceLoad +from viktor.geometry import CircularExtrusion, Extrusion, Line, Material, Point, Sphere +from viktor.result import DownloadResult +from viktor.views import GeometryResult, GeometryView, GeometryAndDataView, DataGroup, GeometryAndDataResult, \ + DataItem +from viktor.parametrization import Parametrization as ParametrizationBaseClass +from viktor.parametrization import Tab, Section, NumberField, DownloadButton + +import itertools +from io import BytesIO +from pathlib import Path + +import numpy as np + + + + +class Parametrization(ParametrizationBaseClass): + geometry = Tab("Geometry") + geometry.slab = Section("Slab") + geometry.slab.width_x = NumberField("Width in x", suffix="mm", default=6000) + geometry.slab.width_y = NumberField("Width in y", suffix="mm", default=5000) + geometry.slab.thickness = NumberField("Thickness", suffix="mm", default=500) + + geometry.piles = Section("Piles") + geometry.piles.diameter = NumberField("Diameter", suffix="mm", default=500) + geometry.piles.length = NumberField("Length", suffix="m", default=7) + + loads = Tab("Loads") + loads.input = Section("Input") + loads.input.uniform_load = NumberField("Uniform load", suffix="kN/m2", default=1) + + scia = Tab("SCIA") + scia.downloads = Section("Downloads") + scia.downloads.input_xml_btn = DownloadButton("Input .xml", method="download_scia_input_xml") + scia.downloads.input_def_btn = DownloadButton("Input .def", method="download_scia_input_def") + scia.downloads.input_esa_btn = DownloadButton("Input .esa", method="download_scia_input_esa") + import itertools from io import BytesIO from pathlib import Path @@ -31,7 +75,7 @@ from viktor.views import GeometryResult, GeometryView, GeometryAndDataView, DataGroup, GeometryAndDataResult, \ DataItem -from .parametrization import Parametrization + class FoundationController(ViktorController): diff --git a/app/__init__.py b/app/__init__.py deleted file mode 100644 index 124af9a..0000000 --- a/app/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -""""Copyright (c) 2022 VIKTOR B.V. - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the -Software. - -VIKTOR B.V. PROVIDES THIS SOFTWARE ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT -NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF -CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" -from .foundation_folder.controller import FoundationFolderController -from .foundation.controller import FoundationController diff --git a/app/foundation/__init__.py b/app/foundation/__init__.py deleted file mode 100644 index 71cccdf..0000000 --- a/app/foundation/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -""""Copyright (c) 2022 VIKTOR B.V. - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the -Software. - -VIKTOR B.V. PROVIDES THIS SOFTWARE ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT -NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF -CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" \ No newline at end of file diff --git a/app/foundation/parametrization.py b/app/foundation/parametrization.py deleted file mode 100644 index ed00289..0000000 --- a/app/foundation/parametrization.py +++ /dev/null @@ -1,40 +0,0 @@ -""""Copyright (c) 2022 VIKTOR B.V. - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the -Software. - -VIKTOR B.V. PROVIDES THIS SOFTWARE ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT -NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF -CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" -from viktor.parametrization import Parametrization as ParametrizationBaseClass -from viktor.parametrization import Tab, Section, NumberField, DownloadButton - - -class Parametrization(ParametrizationBaseClass): - geometry = Tab("Geometry") - geometry.slab = Section("Slab") - geometry.slab.width_x = NumberField("Width in x", suffix="mm", default=6000) - geometry.slab.width_y = NumberField("Width in y", suffix="mm", default=5000) - geometry.slab.thickness = NumberField("Thickness", suffix="mm", default=500) - - geometry.piles = Section("Piles") - geometry.piles.diameter = NumberField("Diameter", suffix="mm", default=500) - geometry.piles.length = NumberField("Length", suffix="m", default=7) - - loads = Tab("Loads") - loads.input = Section("Input") - loads.input.uniform_load = NumberField("Uniform load", suffix="kN/m2", default=1) - - scia = Tab("SCIA") - scia.downloads = Section("Downloads") - scia.downloads.input_xml_btn = DownloadButton("Input .xml", method="download_scia_input_xml") - scia.downloads.input_def_btn = DownloadButton("Input .def", method="download_scia_input_def") - scia.downloads.input_esa_btn = DownloadButton("Input .esa", method="download_scia_input_esa") diff --git a/app/foundation/scia/model.esa b/app/foundation/scia/model.esa deleted file mode 100644 index 75f023e..0000000 Binary files a/app/foundation/scia/model.esa and /dev/null differ diff --git a/app/foundation_folder/__init__.py b/app/foundation_folder/__init__.py deleted file mode 100644 index 71cccdf..0000000 --- a/app/foundation_folder/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -""""Copyright (c) 2022 VIKTOR B.V. - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the -Software. - -VIKTOR B.V. PROVIDES THIS SOFTWARE ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT -NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF -CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" \ No newline at end of file diff --git a/app/foundation_folder/controller.py b/app/foundation_folder/controller.py deleted file mode 100644 index 4d0facf..0000000 --- a/app/foundation_folder/controller.py +++ /dev/null @@ -1,23 +0,0 @@ -""""Copyright (c) 2022 VIKTOR B.V. - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the -Software. - -VIKTOR B.V. PROVIDES THIS SOFTWARE ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT -NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF -CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" -from viktor.core import ViktorController - - -class FoundationFolderController(ViktorController): - label = 'Foundation Folder' - children = ['Foundation'] - show_children_as = 'Table' # or 'Cards' diff --git a/manifest/manifest.yml b/manifest/manifest.yml deleted file mode 100644 index 53d717f..0000000 --- a/manifest/manifest.yml +++ /dev/null @@ -1,16 +0,0 @@ -version: '1' -entity_types: - FoundationFolder: - has_designer: false - show_properties: false - Foundation: - has_designer: true - show_properties: false -entities: -- entity_type: FoundationFolder - properties: - name: Foundations - children: - - entity_type: Foundation - properties: - name: Example Foundation diff --git a/requirements.txt b/requirements.txt index 0270310..6cb3553 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -# viktor==13.0.0 +viktor==14.0.0 diff --git a/viktor.config.toml b/viktor.config.toml new file mode 100644 index 0000000..3b4ae8d --- /dev/null +++ b/viktor.config.toml @@ -0,0 +1 @@ +app_type = "editor" \ No newline at end of file