Hi,
Sorry for my late reply but I was out of my office.
I understand what you mean exactly, but I'm a rookie in NXopen programming so the only way I found is I open all the part I have in my folder to change the attribute. To save time I used a different loadoption.
See below:
foreach (var item in files)
{
try
{
theSession.Parts.LoadOptions.ComponentsToLoad = NXOpen.LoadOptions.LoadComponents.None;
//theSession.Parts.LoadOptions.UsePartialLoading = false;
//theSession.Parts.LoadOptions.UseLightweightRepresentations = false;
theSession.Parts.LoadOptions.SetInterpartData(false, NXOpen.LoadOptions.Parent.All);
Part thePart = theSession.Parts.Open(item, out PartLoadStatus tyty);
thePart.SetUserAttribute("Folder_Attribute", -1, Folder, Update.Option.Now);
thePart.SetUserAttribute("Numero", -1, numero, Update.Option.Now);
thePart.Save(BasePart.SaveComponents.False, BasePart.CloseAfterSave.False);
Utilities.Echo("Fichiers modifiés " + item);
theSession.Parts.CloseAll(NXOpen.BasePart.CloseModified.CloseModified, null);
theSession.ApplicationSwitchImmediate("UG_APP_NOPART");
goto end;
}
}
catch (Exception exe)
{
//NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, exe.ToString());
}
}