compas icon indicating copy to clipboard operation
compas copied to clipboard

`compas_rhino.utilities.delete_layers` deletes whole tree when given dict as input.

Open tetov opened this issue 4 years ago • 2 comments

Describe the bug

Unexpected behavior when using a dict as parameter for compas_rhino.utilities.delete_layer.

(I might be misunderstanding though, let me know if so and I can probably updated docstring)

To Reproduce

Environment

Rhino Python Editor

Sample script

from compas_rhino.utilities import create_layers, delete_layers
layers = {'COMPAS': {'layers': {'Datastructures': {'layers': {'Mesh': {}, 'Network': {}}}}}, "SAPMOC": {}}
create_layers(layers)
delete_layers({'COMPAS': {'layers': {'Datastructures': {'layers': {'Network': {}}}}}})

Result

image

Expected result

image

Other environment details

Desktop (please complete the following information):

  • OS: Windows 10
  • Python version: 2.7.8 (IronPython 2.7.8 (2.7.8.0) on .NET 4.0.30319.42000 (64-bit))
  • Python package manager: conda

tetov avatar Dec 13 '20 14:12 tetov

perhaps we should provide the option to delete "endpoints" only?

tomvanmele avatar Dec 14 '20 08:12 tomvanmele

Maybe, but that can be done with "COMPAS::Datastructures::Network".. I think just making sure that the more specific the input is, the more specific the action is. If the dict given contains sublayers down to an endpoint only the endpoint is removed. If it stops before then the last points tree is removed.

tetov avatar Dec 14 '20 08:12 tetov