Why are all category Ids the same number?

Hello,

should they not have a uniqueId ?

import clr

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

# Code unterhalb dieser Linie platzieren
_allCats = doc.Settings.Categories
_Name = []
_Id = []

for n in _allCats:
	_Name.append(n.Name)

for i in _allCats:
	_Id.append(n.Id)
# Weisen Sie Ihre Ausgabe der OUT-Variablen zu.
OUT = _allCats, _Name, _Id

KR

Andreas

Can you try in the same loop?

for i in _allCats:
    _Name.append(i.Name)
    _Id.append(i.Id)

hello, at the end of the processing of the 1st loop your variable n is the last category
when you go to the second loop you increment on i but you don’t use it, so the n sent is always the same because the processing of the 1st loop is already done.

you put a print(n) in the 1st loop and a print(n) between the 2 loops and you look at the console

Cordially
christian.stan