Yeah, check your private messages.
So the issue appears to be this: when I set the PartStatus using my script, it returns correctly. Checking the value again afterwards with another debugging script, it retains the value & returns correctly. Then, if I modify the part at all, such as stretching it or adding a value to a parameter in the properties panel, the PartStatus reverts back to the default, which is 0 in our config.
If I use Evolve's 'Export MAJ' button and set the status using that tool, the status does not change after modifying the part, it retains the value.
Not sure what causes this. Here's the python script I'm running thru pyrevit, without the imports:
# Get the currently selected elements in the document
selection = uidoc.Selection.GetElementIds()
if selection:
# PartStatus index number
input_int = 1
# Start a new transaction in the Revit document
t = Transaction(doc, "Set PartStatus")
t.Start()
# Iterate through the selected elements
for element_id in selection:
# Get the element from the document using its ID
element = doc.GetElement(element_id)
# Check if the selected element is a FabricationPart
if isinstance(element, FabricationPart):
# Return current PartStatus
print(element.PartStatus)
# Set new PartStatus
element.PartStatus = input_int
# Return new PartStatus
print(element.PartStatus)
# Commit the transaction to apply the changes
t.Commit()