What's new

How do I check if a configuration already exists?

idslk

Alibre Super User
Hello Albie,

one possibility is:
Code:
#This is a snipped part of your keyway skript:
except:
    Hub = CurrentPart()

# from here the lines are inserted in your keyway skript...

for i in range(len(Hub.Configurations)):
  test = Hub.Configurations
  print test[i]
  if 'Finished' == str(test[i]):
    print 'is already in there'
  else:
    print 'is new'

# from her your skript can/will continue ...

another (directly usable ;-):

Code:
#This is a snipped part of your keyway skript:
except:
   Hub = CurrentPart()

# from here the lines are inserted in your keyway skript...

if 'Finished' not in str(Hub.Configurations):
  Finished = Hub.AddConfiguration('Finished')
  Finished.SetLocks(LockTypes.SuppressNewFeatures)
  Finished.Activate()
  print 'Finished created and activated'

# from her your skript can/will continue ...

Regards
Stefan
 
Last edited:
Top