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
CGBenner
in reply to: Passi10

@Passi10 

 

Hi, were you able to figure out this coding issue?


Chris Benner
Industry Community Manager – Design & Manufacturing


If a response answers your question, please use  ACCEPT SOLUTION  to assist other users later.


Also be generous with Likes!  Thank you and enjoy!


Become an Autodesk Fusion Insider
Inventor/Beta Feedback Project
Passi10
in reply to: CGBenner

Sadly not

lars.michels
in reply to: Passi10

Same problem here. If i log my Custom Factory Property in the rule it gets the correct new Value! But it does not change in the Asset. Is it not possible via ILogic or is it necessary to use an different Method than:

"prop.Value = NewValue" ?

Passi10
in reply to: lars.michels

I talked with Autodesk at the AU in New Orleans this year and they told me it's not possible to update the Factory iproperties. The only thing you can update are the parameters.

 

The values will differ between what is written inside of the file iproperties and the Factory Properties. For me, that was some sort of relief, because I do not have to search through the API and the iLogic documentation to find a solution. Currently there is none. But Autodesk is aware of that and maybe there comes something in the future.

lars.michels
in reply to: Passi10

Thank you!