blender Robotmodelartist does not create collections correctly
See original GitHub issueThe function draw_geometry from the compas_blender.artists.RobotModelArtist creates a new collection every time it is called. Since the method create() of the base_artist calls draw_geometry for every mesh in the urdf file the blender artist creates a new collection each time (at least thats how I understand it). In addition: the mesh is also not put into the collection that was created.
Location of the draw_geometry call in the base artist: https://github.com/compas-dev/compas/blob/416e490caf4bfb11a47d8e208d19f04e1d76eb16/src/compas/robots/base_artist/_artist.py#L153
blender Robotmodelartist method: https://github.com/compas-dev/compas/blob/416e490caf4bfb11a47d8e208d19f04e1d76eb16/src/compas_blender/artists/robotmodelartist.py#L42-L44
A possible solution could be to simply check if a collection with the name defined in self.layer already exists and use that one instead of creating a new one.
It appears to me that the blender robotartist is at an early stage in the developement. I might implement a fix for this and create a pull request if a rewrite of the robotartist is not already under way.
example script tested in Blender 2.9.1 and compas 1.0.0 on Windows 10:
import compas
from compas.robots import GithubPackageMeshLoader
from compas.robots import RobotModel
import compas_blender
from compas_blender.artists import RobotModelArtist, BaseArtist
compas_blender.clear()
#compas_blender.draw()
compas.PRECISION = '12f'
github = GithubPackageMeshLoader('ros-industrial/abb', 'abb_irb6600_support', 'kinetic-devel')
model = RobotModel.from_urdf_file(github.load_urdf('irb6640.urdf'))
model.load_geometry(github)
artist = RobotModelArtist(model, layer='COMPAS FAB::Example')
artist.draw_visual()
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (13 by maintainers)
Top GitHub Comments
Thank you for your answer. I am currently familiarizing myself with the compas codebase. I will create a pull request once I created a solution to the problems.
the
draw_visual
- problem probably stems from the fact that any geometry loaded into Blender is displayed by default. I would check if the mesh has a colour and make it invisible if it doesnt. Currently, if color isNone
a white material with full alpha is created. However, Blender does not use the material for the normal display in the viewport, which is why it is visible.https://github.com/compas-dev/compas/blob/416e490caf4bfb11a47d8e208d19f04e1d76eb16/src/compas/robots/base_artist/_artist.py#L143
https://github.com/compas-dev/compas/blob/416e490caf4bfb11a47d8e208d19f04e1d76eb16/src/compas_blender/artists/robotmodelartist.py#L35-L40
yes you are right. i just noticed this as well. updated my comment on the PR. in the other artists, the base collection is named after the data or data structure name, with implicitly named sub-collections for the various components of the object.
perhaps we should add the option to give the parent collection a name explicitly via the
collection
parameter.but we don’t need to keep
layer
for consistency with Rhino because that is not really a goal anymore per se…