Hello,
I have two questions.
1) How can I delete labels in the label manager by API? I would like to delete all defined supports, member types or sections which are not used in the current model.
2) How can I set new design code by API? Source code below sets new code only if this code is loaded from the database to the "current code list".
(Robot: Tools - Job Preferences - Design codes - Steel/Aluminum structures - More... -> Configuration of code list - and add to the current codes)
RobApp = New RobotApplication RobApp.Project.Preferences.SetActiveCode(IRobotCodeType.I_CT_STEEL_STRUCTURES, "XYZ Code") RobApp.Project.Preferences.Save()
Thanks in advance
Solved! Go to Solution.
Solved by Rafal.Gaweda. Go to Solution.
1) How can I delete labels in the label manager by API?
Use:
RobApp.Project.Structure.Labels.IsUsed
RobApp.Project.Structure.Labels.Delete
2) How can I set new design code by API?
See this thread:
I'm using this code:
Dim LabServ As IRobotLabelServer LabServ = RobApp.Project.Structure.Labels Dim LabCol As IRobotCollection LabCol = LabServ.GetAll Dim Label As IRobotLabel For j As Integer = 1 To LabCol.Count Label = LabCol.Get(j) If Label.Type = IRobotLabelType.I_LT_MEMBER_TYPE Then LabServ.Delete(IRobotLabelType.I_LT_MEMBER_TYPE, Label.Name) End If Next
but it deletes only member types which are used in the current model.
I want to do the same as when I click on the button below
For example I have 8 defined member types in the label manager/steel member types, but only 4 member types are used in the current model. If I understand it there is no way how to delete member types which are not used in the current model by API?
Dim LabServ As IRobotLabelServer Set LabServ = RobApp.Project.Structure.Labels Dim RNA As RobotNamesArray Set RNA = LabServ.GetAvailableNames(I_LT_MEMBER_TYPE) For I = 1 To RNA.Count If Not LabServ.IsUsed(I_LT_MEMBER_TYPE, RNA.Get(I)) Then LabServ.Delete I_LT_MEMBER_TYPE, RNA.Get(I) End If Next I