Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Passi10
413 Views, 5 Replies

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