First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
1 | initial version |
It can be done using the sliderPy library
import sliderPy
def main():
mydoc = sliderPy.GetActiveDocument()
mydiagram = mydoc.GetDiagram()
mycomponents = mydiagram.GetComponents()
print str(len(mycomponents)) + " components found"
i = 0
for mycomponent in mycomponents:
if mycomponent.IsSelected() == True:
print 'Type: ' + str(mycomponent.GetComponentType())
mylabels = mycomponent.GetOwnedLabels()
print str(len(mylabels)) + ' labels found'
j = 1
for mylabel in mylabels:
print 'Label ' + str(j) + ': ' + mylabel.GetText()
print '\n'
j += 1
i += 1
#if i == 10: break
print str(i) + ' items searched'
if __name__ == '__main__':
main()