02-17-2022
01:28 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
02-17-2022
01:28 PM
Try to update an Property via iLogic and Factory API
I try to update the Factory Properties with the real values of the specific instance, but this code it not doing that job. I get no error message, but the Factory Property of the Comments does not contains the correct value (it still has the values of the basic asset fresh out of the asset browser).
So, there must be a mistake, but where....
Dim Instanz As ComponentOccurrence = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "Please select occurrence") Dim instancesToChange As New ArrayList For Each element In Autodesk.Factory.PublicAPI.API.Instance.GetAssetInstances(Layout) If element.InstanceName = Instanz.Name Then For Each grp In Element.PropertyGroups If (grp.Name = "Summary") Then For Each prop In grp.Properties If (prop.Name = "Comments") Then prop.Value = iProperties.Value(Instanz.Name, "Summary", "Comments").ToString End If Next End If Next instancesToChange.Add(Element) End If Next Dim arr2 = instancesToChange.ToArray(GetType(Autodesk.Factory.PublicAPI.Currency.v2.IAssetInstance)) Autodesk.Factory.PublicAPI.API.Instance.UpdateAssetInstances(Layout, arr2) iLogicVb.UpdateWhenDone = True