I’m trying to use rs.ExplodeBlockInstance(object_id, explode_nested_instances=False) with this second argument to entirely flatten a block hierarchy. The documentation for this command is here in the API:
Message: 00000000-0000-0000-0000-000000000000 does not exist in ObjectTable
Traceback:
line 604, in coercerhinoobject, "C:\Users\TMGxbs\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\utility.py"
line 49, in RunCommand, "C:\Users\TMGxbs\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\PythonPlugins\Syse {863cf680-d131-479f-b639-5034403f3eea}\dev\BlocksToLayers_cmd.py"
line 68, in <module>, "C:\Users\TMGxbs\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\PythonPlugins\Syse {863cf680-d131-479f-b639-5034403f3eea}\dev\BlocksToLayers_cmd.py"
line 525, in ObjectLayer, "C:\Users\TMGxbs\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\object.py"
I tried manually exploding the object in question and checked all object id´s with What-command but none of them were 0:ed out.
If i pass the list of guids to eg. rs.SelectObjects(ids) i get the error you report in rs.coercerhinoobject() which is called from rs.SelectObjects(). One way to prevent the error is to filter out empty guids in the function like this:
import Rhino
import scriptcontext as sc
import rhinoscriptsyntax as rs
import System
def CustomExplodeBlockInstance(object_id, explode_nested=True, delete=True):
io = rs.coercerhinoobject(object_id, True, True)
rc = sc.doc.Objects.AddExplodedInstancePieces(io, explode_nested, delete)
if rc:
filtered_ids = filter(lambda id: id != System.Guid.Empty, rc)
return filtered_ids
else:
return
@dale, if you read this, should AddExplodedInstancePieces handle removal of empty guids ?
_
c.