Blenderproc: How to set category_id?

Created on 4 Apr 2021  路  2Comments  路  Source: DLR-RM/BlenderProc

Hi,

I am using BlenderProc for the model that generated with my addon. However, it always ouputs the error Exception: The obj: 5555_Bottom does not have the attribute: cp_category_id, striped: category_id. Maybe try a default value. Because the model is automatic generated with code, I want to ask if there is any possibility to add this cp_category_id property using python?

Thank you!

question first answer provided

Most helpful comment

Hey,

you can easily set the custom property cp_category_id via a module:

       {
          "module": "manipulators.EntityManipulator",
          "config": {
            "selector": {
              "provider": "getter.Entity",
              "conditions": {
                "name": '5555_Bottom',
                "type": "MESH"
              }
            },
            "cp_category_id": 10 # here you should use the correct value
          }
        },
````   

If you want to do it in your own module, you can always just do: 

```python
obj = bpy.data.objects["5555_Bottom"]
obj["category_id"] = 10

Best,
Max

All 2 comments

Hey,

you can easily set the custom property cp_category_id via a module:

       {
          "module": "manipulators.EntityManipulator",
          "config": {
            "selector": {
              "provider": "getter.Entity",
              "conditions": {
                "name": '5555_Bottom',
                "type": "MESH"
              }
            },
            "cp_category_id": 10 # here you should use the correct value
          }
        },
````   

If you want to do it in your own module, you can always just do: 

```python
obj = bpy.data.objects["5555_Bottom"]
obj["category_id"] = 10

Best,
Max

Thanks! I understand

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wangg12 picture wangg12  路  3Comments

ttsesm picture ttsesm  路  3Comments

mikkeljakobsen picture mikkeljakobsen  路  6Comments

soans1994 picture soans1994  路  3Comments

chrisxu1995 picture chrisxu1995  路  5Comments