diff --git a/CHANGELOG.md b/CHANGELOG.md index f7c2f040..0448d503 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 `RobotModel` in context `Rhino`. + ### Removed 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 4c043dad..d20f7fdc 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,14 +1,10 @@ attrs >=17.4 -autopep8 +ruff black bump2version >=1.0.1 check-manifest >=0.36 -compas_invocations -doc8 -flake8 +compas_invocations2 invoke >=0.14 -isort -pydocstyle pytest >=3.2 sphinx_compas2_theme twine 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): 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 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(