cant assign entities
-
Hello
I load some model and try to assign entities but get errors :Mesh2 = s4l.model.Import(r'C:\sintetic data\bones.stl')
see value in python :
Mesh2
(<XCoreModeling.TriangleMesh object at 0x000002199E6FA5B0>,)so now try to put entity
entities = model.AllEntities() Mesh2 = entities['Mesh2']
and get this error
File "<string>", line 1, in <module>
File "C:\Program Files\Sim4Life_7.0.1.8169\Python\lib\site-packages\s4l_v1\model__model_impl.py", line 167, in getitem
raise KeyError("%s key is missing" % key)
KeyError: 'Mesh2 key is missing'i tried to put name but no success
-
Can't test at the moment but i'd suggest assigning a name yourself with Mesh2.Name = "Mesh 2" and make sure the name is unique.
If this still isn't helpful I'd suggest to iterate over entitites and print the names to see what it comes up as:
entities = model.AllEntities() for e in entities: print(e.Name)
-
really thanks this is direction of solution
what i did with friend- Mesh2 = s4l.model.Import(r'C:\sintetic data\bones.stl')[0]
so now Mesh2 is not tuple and has its own name bones - meanwhile i write all in one script without functions so i dont need realy the entities as in the example of 2 plates supplied with sim4life ...
- Mesh2 = s4l.model.Import(r'C:\sintetic data\bones.stl')[0]