Skip to content

Commit

Permalink
Merge pull request #23 from compas-dev/robot_scene_rhino8
Browse files Browse the repository at this point in the history
Robot scene rhino8
  • Loading branch information
chenkasirer authored Oct 2, 2024
2 parents 5943e57 + e6fdef3 commit 13cff6a
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 33 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
51 changes: 37 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[tool.black]
line-length = 120
# ============================================================================
# Testing
# ============================================================================

[tool.pytest.ini_options]
minversion = "6.0"
Expand All @@ -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"
8 changes: 2 additions & 6 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/compas_robots/model/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()]
Expand Down
2 changes: 1 addition & 1 deletion src/compas_robots/resources/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
11 changes: 5 additions & 6 deletions src/compas_robots/rhino/scene/robotmodelobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 13cff6a

Please sign in to comment.