1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How do I check if a configuration already exists?

Discussion in 'Alibre Script' started by albie0803, Dec 6, 2018.

  1. albie0803

    albie0803 Alibre Super User

    as it says
     
  2. idslk

    idslk Senior Member

    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: Dec 7, 2018
  3. albie0803

    albie0803 Alibre Super User

    Amazing! Thank you
     

Share This Page