# Delete all support labels by API

**URL:** <https://forum.dynamobim.com/t/delete-all-support-labels-by-api/56589>\
**Category:** Robot Structural Analysis\
**Tags:** dynamo\
**Created:** [October 26, 2020, 11:24am UTC](https://forum.dynamobim.com/t/delete-all-support-labels-by-api/56589 "2020-10-26T11:24:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![1234eddie](https://avatars.discourse-cdn.com/v4/letter/1/4da419/32.png) [@1234eddie](https://forum.dynamobim.com/u/1234eddie)\
**Post date:** [October 26, 2020, 11:24am UTC](https://forum.dynamobim.com/t/delete-all-support-labels-by-api/56589/1 "2020-10-26T11:24:56Z")

</div>

Hi all,

I’m currently working on a script that will remove all avaible supports that are defined in a project.(because it will be part of a bigger script that will run several times and everytime the supports will change.)

here is the list of the supports which are stored.  
 ![saved labels](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/a/2a6c5614c84a7cebe12a6dd8b3c25fe6a492bfc8.jpeg)  
this is the error i get when running the script.(but labels are deleted, not always. sometimes 1 remains)

 ![Error script](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/7/c771208077e3784247978784730726736ee007c2.png)  
_Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed._  
_Traceback (most recent call last):_  
_File “”, line 28, in_   
_EnvironmentError: System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E\_FAIL has been returned from a call to a COM component._  
_at Microsoft.Scripting.ComInterop.ComRuntimeHelpers.CheckThrowException(Int32 hresult, ExcepInfo& excepInfo, UInt32 argErr, String message)_  
_at CallSite.Target(Closure , CallSite , Object , Object )_  
_at lambda\_method(Closure , Object[] , StrongBox`1[] , InterpretedFrame )_  
_at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)_  
_at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)_  
_at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)_  
_at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)_  
_at DSIronPython.IronPythonEvaluator.EvaluateIronPythonScript(String code, IList bindingNames, IList bindingValues)_

this is the script which i use to delete the labels.

```auto
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

from System import Environment
user = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
clr.AddReferenceToFileAndPath(user +r"\Dynamo\Dynamo Core\1.3\packages\Structural Analysis for Dynamo\bin\RSA\Interop.RobotOM.dll")
from RobotOM import *
from System import Object
#The inputs to this node will be stored as a list in the IN variables.

start = IN[0]

application = RobotApplicationClass()
project = application.Project
structure = project.Structure
labels = structure.Labels
loads = structure.Cases

LabServ = IRobotLabelServer
LabServ = project.Structure.Labels

RNA = IRobotNamesArray
RNA = LabServ.GetAvailableNames(IRobotLabelType.I_LT_SUPPORT)
count = RNA.Count

for i in range(count+1)[::-1]:
	LabServ.Delete(IRobotLabelType.I_LT_SUPPORT, RNA.Get(i))

OUT = "gedaan", count

```

Does anyone of you know where/what i’m doiing wrong to get this working without any errors?

Thanks in advance

Gr Edward.  
Dyname file [Delete info 3.dyn](https://forum.dynamobim.com/uploads/short-url/2DJGveDC8T9h58moB5rAhUgBud4.dyn) (2.4 KB)  
for robot file with saved labels [see this link](https://forums.autodesk.com/t5/robot-structural-analysis-forum/delete-all-support-labels-by-api/td-p/9824224)

---

<div class="post-metadata">

**Author:** ![1234eddie](https://avatars.discourse-cdn.com/v4/letter/1/4da419/32.png) [@1234eddie](https://forum.dynamobim.com/u/1234eddie)\
**Post date:** [October 26, 2020, 1:50pm UTC](https://forum.dynamobim.com/t/delete-all-support-labels-by-api/56589/2 "2020-10-26T13:50:05Z")

</div>

Qeustion solved on the autodesk robot structural analysis forum.  
Had to change the range definition.
