From e2ba9bdab0e9bd54eaf1dde3e41d95a8cdf2b3a4 Mon Sep 17 00:00:00 2001 From: Ricardo Maia Avelino Date: Tue, 18 Oct 2022 10:27:27 +0200 Subject: [PATCH] update requeriments --- docs/installation.rst | 6 ++-- examples/_tutorial/0_arch.py | 44 +++++++++++++++++++++++++ examples/tutorial/0_arch.py | 17 ---------- requirements-dev.txt | 15 +++++---- src/compas_tno/solvers/solver_MATLAB.py | 5 ++- src/compas_tno/utilities/blocks.py | 4 +-- src/compas_tno/utilities/form.py | 1 - src/compas_tno/viewers/viewer.py | 4 +-- 8 files changed, 63 insertions(+), 33 deletions(-) create mode 100644 examples/_tutorial/0_arch.py delete mode 100644 examples/tutorial/0_arch.py diff --git a/docs/installation.rst b/docs/installation.rst index 108c72de..7b9555dc 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -13,7 +13,7 @@ We highly recommend to install ``compas_tno`` and related packages in a separate In this guide, we will create and use an environmenment based on Python 3.8 with the name ``tno``. -Open your terminal and type the following to create a new environmenment and install the dependencies `COMPAS `_ and `triangle `_: +Open your terminal and type the following to create a new environmenment and install the dependencies `COMPAS `_, `triangle `_ and the COMPAS Standalone `Viewer `_: .. raw:: html @@ -37,7 +37,7 @@ Open your terminal and type the following to create a new environmenment and ins .. code-block:: bash - conda create -n tno -c conda-forge python=3.8 COMPAS triangle + conda create -n tno -c conda-forge python COMPAS triangle compas_view2 .. raw:: html @@ -46,7 +46,7 @@ Open your terminal and type the following to create a new environmenment and ins .. code-block:: bash - conda create -n tno -c conda-forge python=3.8 python.app COMPAS triangle + conda create -n tno -c conda-forge python python.app COMPAS triangle compas_view2 .. raw:: html diff --git a/examples/_tutorial/0_arch.py b/examples/_tutorial/0_arch.py new file mode 100644 index 00000000..8a823927 --- /dev/null +++ b/examples/_tutorial/0_arch.py @@ -0,0 +1,44 @@ +# from compas_tno.diagrams import FormDiagram +# from compas_tno.viewers import Viewer +# from compas_tno.shapes import Shape + +# H = 1.0 +# L = 2.0 +# b = 0.5 +# discr = 20 + +# arch = Shape.create_arch(H=H, L=L, b=b) + +# form = FormDiagram.create_arch(H=H, L=L, discretisation=discr) + +# view = Viewer(form, arch) +# view.draw_form() +# view.draw_shape() +# view.show() + + +import compas +from compas.datastructures import Mesh +from compas.geometry import Translation +from compas.geometry import Scale + +from compas_view2.app import App + +mesh = Mesh.from_obj(compas.get('faces.obj')) +mesh.transform(Translation.from_vector([0.5, 0, 0.1])) + +mesh2 = mesh.transformed(Translation.from_vector([-11, 0, 0])) + +# ============================================================================= +# Visualization +# ============================================================================= + +viewer = App(width=1600, height=900) +viewer.view.camera.rx = -60 +viewer.view.camera.rz = 0 +viewer.view.camera.ty = -2 +viewer.view.camera.distance = 10 + +viewer.add(mesh, hide_coplanaredges=False) +viewer.add(mesh2, hide_coplanaredges=True) +viewer.show() diff --git a/examples/tutorial/0_arch.py b/examples/tutorial/0_arch.py deleted file mode 100644 index 4910fa00..00000000 --- a/examples/tutorial/0_arch.py +++ /dev/null @@ -1,17 +0,0 @@ -from compas_tno.diagrams import FormDiagram -from compas_tno.viewers import Viewer -from compas_tno.shapes import Shape - -H = 1.0 -L = 2.0 -b = 0.5 -discr = 20 - -arch = Shape.create_arch(H=H, L=L, b=b) - -form = FormDiagram.create_arch(H=H, L=L, discretisation=discr) - -view = Viewer(form, arch) -view.draw_form() -view.draw_shape() -view.show() diff --git a/requirements-dev.txt b/requirements-dev.txt index f9c96553..2dfbfb66 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,6 +1,6 @@ -autopep8 +black attrs >=17.4 -bump2version >=0.5.11 +bump2version >=1.0.1 check-manifest >=0.36 doc8 flake8 @@ -9,12 +9,13 @@ invoke >=0.14 ipykernel ipython >=5.8 isort -m2r +m2r2 nbsphinx pydocstyle -pytest >=3.2 -sphinx_compas_theme >=0.13 -sphinx >=3.4 +pytest <7.1 +sphinx_compas_theme >=0.15.18 +sphinx ==4.5 twine -matplotlib +wheel +jinja2 >= 3.0 -e . diff --git a/src/compas_tno/solvers/solver_MATLAB.py b/src/compas_tno/solvers/solver_MATLAB.py index ef8f4656..4416cc58 100644 --- a/src/compas_tno/solvers/solver_MATLAB.py +++ b/src/compas_tno/solvers/solver_MATLAB.py @@ -1,6 +1,9 @@ from compas_tno.algorithms import xyz_from_q -import matlab.engine +try: + import matlab.engine +except: + print('matlab not available in the system') import time from numpy import array diff --git a/src/compas_tno/utilities/blocks.py b/src/compas_tno/utilities/blocks.py index 1d049940..12822715 100644 --- a/src/compas_tno/utilities/blocks.py +++ b/src/compas_tno/utilities/blocks.py @@ -2,8 +2,6 @@ from compas.datastructures import Mesh from compas.geometry import add_vectors, scale_vector -from compas_assembly.datastructures import Assembly - def extended_dual(form, cls=None): """Create the extended dual of the mesh, which is the centroid dual added with the faces in the boundary. @@ -58,6 +56,8 @@ def blocks_from_dual(dual, thk): idos = dual.copy() edos = dual.copy() + from compas_assembly.datastructures import Assembly + assembly = Assembly() for vertex in dual.vertices(): diff --git a/src/compas_tno/utilities/form.py b/src/compas_tno/utilities/form.py index 29a09c12..a54aa53e 100644 --- a/src/compas_tno/utilities/form.py +++ b/src/compas_tno/utilities/form.py @@ -1,5 +1,4 @@ # from compas_tno.diagrams import FormDiagram -from symbol import factor from compas.geometry import intersection_segment_segment_xy from compas.geometry import distance_point_point_xy from compas.geometry import Translation diff --git a/src/compas_tno/viewers/viewer.py b/src/compas_tno/viewers/viewer.py index f02fc5ce..7aad3cff 100644 --- a/src/compas_tno/viewers/viewer.py +++ b/src/compas_tno/viewers/viewer.py @@ -259,7 +259,7 @@ def draw_thrust(self, scale_width=True, absolute_scale=True, cull_negative=False Xi = [Xb[0] + (Xa[0] - Xb[0]) * coef, Xb[1] + (Xa[1] - Xb[1]) * coef, 0.0] line = Line(Xa, Xi) if not scale_width: - self.app.add(line, name=str((u, v)), linewidth=base_thick, color=self.settings['color.edges.thrust']) + self.app.add(line, name=str((u, v)), linewidth=base_thick, linecolor=self.settings['color.edges.thrust']) continue q = self.thrust.edge_attribute((u, v), 'q') length = self.thrust.edge_length(u, v) @@ -270,7 +270,7 @@ def draw_thrust(self, scale_width=True, absolute_scale=True, cull_negative=False forces.append(force) thks.append(thk) if force > self.settings['tol.forces'] * 2: - self.app.add(line, name=str((u, v)), linewidth=thk, color=self.settings['color.edges.thrust']) + self.app.add(line, name=str((u, v)), linewidth=thk, linecolor=self.settings['color.edges.thrust']) # print('Min / Max thks:', min(thks), max(thks)) # print('Min / Max forces:', min(forces), max(forces))