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

Try to update an Property via iLogic and Factory API

Passi10
Enthusiast

Try to update an Property via iLogic and Factory API

Passi10
Enthusiast
Enthusiast

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
0 Likes
Reply
417 Views
5 Replies
Replies (5)

CGBenner
Community Manager
Community Manager

@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
0 Likes

Passi10
Enthusiast
Enthusiast

Sadly not

0 Likes

lars.michels
Participant
Participant

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" ?

0 Likes

Passi10
Enthusiast
Enthusiast

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
Participant
Participant

Thank you!

0 Likes