Skip to content

QoL: uniqueName function always returns a name with count starting from 2 #840

Description

A small thing, but I was finding it really annoying when trying to write a definition.

unique_name = name
i = 1
while self.findContainersMetadata(id = unique_name, ignore_case = True) or self.findContainersMetadata(name = unique_name): #A container already has this name.
i += 1 #Try next numbering.
unique_name = "%s #%d" % (name, i) #Fill name like this: "Extruder #2".
return unique_name

Since the while loop adds one before the function generates a new name, if the loop is entered, it will never give a string with the value #1 at the end.

Fixed either by changing the initialisation on L718 to i = 0, or by swapping the order of lines 720 and 721; in this case, i will be raised after every test, but only compiled into the string with a new value if the first fails.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions