From 694a65ff197bb34fcc84f2ebda58de6d7cb2cc03 Mon Sep 17 00:00:00 2001 From: Chen Kasirer Date: Tue, 1 Oct 2024 15:56:44 +0200 Subject: [PATCH 1/7] changed imports in RobotSceneObject to workin in Rhino 8 --- CHANGELOG.md | 2 ++ src/compas_robots/rhino/scene/robotmodelobject.py | 11 +++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7c2f040..b22090a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +* Fixed no scene object registered for `RobotModelObject` in context `Rhino`. + ### Removed diff --git a/src/compas_robots/rhino/scene/robotmodelobject.py b/src/compas_robots/rhino/scene/robotmodelobject.py index 40bc2bc1..c762eea7 100644 --- a/src/compas_robots/rhino/scene/robotmodelobject.py +++ b/src/compas_robots/rhino/scene/robotmodelobject.py @@ -10,9 +10,8 @@ import System.Drawing # type: ignore from compas_rhino.conversions import transformation_to_rhino from compas_rhino.scene import RhinoSceneObject -from Rhino.DocObjects.ObjectColorSource import ColorFromLayer # type: ignore -from Rhino.DocObjects.ObjectColorSource import ColorFromObject # type: ignore -from Rhino.DocObjects.ObjectMaterialSource import MaterialFromObject # type: ignore +from Rhino.DocObjects import ObjectColorSource # type: ignore +from Rhino.DocObjects import ObjectMaterialSource # type: ignore from compas_robots.scene import BaseRobotModelObject @@ -233,7 +232,7 @@ def _add_mesh_to_doc(self, mesh): if color: r, g, b, a = [i * 255 for i in color] attr.ObjectColor = System.Drawing.Color.FromArgb(a, r, g, b) - attr.ColorSource = ColorFromObject + attr.ColorSource = ObjectColorSource.ColorFromObject material_name = "robotmodelobject.{:.2f}_{:.2f}_{:.2f}_{:.2f}".format(r, g, b, a) material_index = sc.doc.Materials.Find(material_name, True) @@ -247,9 +246,9 @@ def _add_mesh_to_doc(self, mesh): material.CommitChanges() attr.MaterialIndex = material_index - attr.MaterialSource = MaterialFromObject + attr.MaterialSource = ObjectMaterialSource.MaterialFromObject else: - attr.ColorSource = ColorFromLayer + attr.ColorSource = ObjectColorSource.ColorFromLayer if name: attr.Name = name From 82afc6b6b5dfac1b1bfe53b2b20f14a97426fd43 Mon Sep 17 00:00:00 2001 From: Chen Kasirer Date: Tue, 1 Oct 2024 15:57:35 +0200 Subject: [PATCH 2/7] upgraded to compas_invocations2 --- requirements-dev.txt | 2 +- tasks.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 4c043dad..8a09abf6 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -3,7 +3,7 @@ autopep8 black bump2version >=1.0.1 check-manifest >=0.36 -compas_invocations +compas_invocations2 doc8 flake8 invoke >=0.14 diff --git a/tasks.py b/tasks.py index 6de15958..3e370327 100644 --- a/tasks.py +++ b/tasks.py @@ -2,10 +2,10 @@ import os -from compas_invocations import build -from compas_invocations import docs -from compas_invocations import style -from compas_invocations import tests +from compas_invocations2 import build +from compas_invocations2 import docs +from compas_invocations2 import style +from compas_invocations2 import tests from invoke import Collection ns = Collection( From 14e760819567e9c91cb8719e5ac84816aee1ecfb Mon Sep 17 00:00:00 2001 From: Chen Kasirer Date: Tue, 1 Oct 2024 16:15:16 +0200 Subject: [PATCH 3/7] replaced isort, flake8 and others with ruff --- pyproject.toml | 51 ++++++++++++++++++++++++++++++++------------ requirements-dev.txt | 5 ----- 2 files changed, 37 insertions(+), 19 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f63268d0..1d01a141 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,6 @@ -[tool.black] -line-length = 120 +# ============================================================================ +# Testing +# ============================================================================ [tool.pytest.ini_options] minversion = "6.0" @@ -12,16 +13,38 @@ addopts = "-ra --strict --doctest-modules --doctest-glob=*.rst --tb=short" doctest_optionflags= "NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL ALLOW_UNICODE ALLOW_BYTES NUMBER" filterwarnings = "ignore::DeprecationWarning" -[tool.isort] -line_length = 120 -multi_line_output = 3 -include_trailing_comma = true -force_grid_wrap = 0 -use_parentheses = true -force_single_line = true -ensure_newline_before_comments = true -known_first_party = "compas_robots" -default_section = "THIRDPARTY" -forced_separate = "test_compas_robots" -skip = [] +# ============================================================================ +# Linting and formatting +# ============================================================================ + +[tool.black] +line-length = 120 + +[tool.ruff.lint.isort] +force-single-line = true +known-first-party = [ + "compas_robots", +] + +[tool.ruff] +line-length = 179 +indent-width = 4 +target-version = "py39" + +[tool.ruff.lint] +select = ["E", "F", "I"] + +[tool.ruff.lint.per-file-ignores] +"__init__.py" = ["I001"] +"tests/*" = ["I001", "E501"] +"tasks.py" = ["I001"] + +[tool.ruff.lint.pydocstyle] +convention = "numpy" + +[tool.ruff.lint.pycodestyle] +max-doc-length = 179 +[tool.ruff.format] +docstring-code-format = true +docstring-code-line-length = "dynamic" diff --git a/requirements-dev.txt b/requirements-dev.txt index 8a09abf6..a0519478 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,14 +1,9 @@ attrs >=17.4 -autopep8 black bump2version >=1.0.1 check-manifest >=0.36 compas_invocations2 -doc8 -flake8 invoke >=0.14 -isort -pydocstyle pytest >=3.2 sphinx_compas2_theme twine From 3bd330e494ade3e054822ec03a82a05540e6276b Mon Sep 17 00:00:00 2001 From: Chen Kasirer Date: Tue, 1 Oct 2024 16:15:29 +0200 Subject: [PATCH 4/7] ran isort --- src/compas_robots/model/base.py | 4 ++-- src/compas_robots/resources/basic.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compas_robots/model/base.py b/src/compas_robots/model/base.py index bf25c153..8ad31773 100644 --- a/src/compas_robots/model/base.py +++ b/src/compas_robots/model/base.py @@ -2,14 +2,14 @@ from __future__ import division from __future__ import print_function +from copy import deepcopy + from compas.colors import Color from compas.geometry import Frame from compas_robots.files import URDFElement from compas_robots.files import URDFGenericElement -from copy import deepcopy - def _parse_floats(values): return [float(i) for i in values.split()] diff --git a/src/compas_robots/resources/basic.py b/src/compas_robots/resources/basic.py index 9cbecef2..cc0b44a7 100644 --- a/src/compas_robots/resources/basic.py +++ b/src/compas_robots/resources/basic.py @@ -9,8 +9,8 @@ except ImportError: from urlparse import urlparse -from .mesh_importer import mesh_import from .mesh_importer import get_file_format +from .mesh_importer import mesh_import class AbstractMeshLoader(object): From 82088f5a4885b420d4a7b8cc9914527b88a78a74 Mon Sep 17 00:00:00 2001 From: Chen Kasirer Date: Tue, 1 Oct 2024 16:28:02 +0200 Subject: [PATCH 5/7] added ruff, removed black --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index a0519478..f1452b56 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,5 +1,5 @@ attrs >=17.4 -black +ruff bump2version >=1.0.1 check-manifest >=0.36 compas_invocations2 From 6128892b396f6c691a57edbd92cbc07dad0eab01 Mon Sep 17 00:00:00 2001 From: Chen Kasirer Date: Tue, 1 Oct 2024 16:29:30 +0200 Subject: [PATCH 6/7] re-added black --- requirements-dev.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements-dev.txt b/requirements-dev.txt index f1452b56..d20f7fdc 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,5 +1,6 @@ attrs >=17.4 ruff +black bump2version >=1.0.1 check-manifest >=0.36 compas_invocations2 From e6fdef3a07e9fba13aa6e8bbf2aedc43ccb6f060 Mon Sep 17 00:00:00 2001 From: Chen Kasirer Date: Wed, 2 Oct 2024 11:27:04 +0200 Subject: [PATCH 7/7] better comment in changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b22090a3..0448d503 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -* Fixed no scene object registered for `RobotModelObject` in context `Rhino`. +* Fixed no scene object registered for `RobotModel` in context `Rhino`. ### Removed