Replace "Object.UpdateProperty" by a quicker approach

Hi all,

I am using the node “Object.UpdateProperty” to update PSets of many polylines. Nothing is wrong with the functionality of the node, however, it takes a ridiculous amount of time to go through all polylines and update their PSets (Took around 26 minutes to run through 123 polylines, each having 30 fields of PSets, as you can see from the Tune Up screenshot)

I am looking for a quicker way to update the PSets fields, is there a better alternative to do this using other Dynamo Nodes or Python Code (My knowledge in Python is limited and dealing with PSets in Python is a bit complicated)

Many Thanks.

Looks like a lacing and list levels issue.

You indicated that you have 123 polylines and that each polyline has 30 fields in the Pset, so if I’m understanding you correctly that would be 30 properties to set 123 times, or 3690 properties to set in total.

You are somehow processing about half a million more objects than that (502086 objects are being returned by your Object.UpdateProperty node).

Dividing that 502086 by 123 objects, it would appear each object is having around 4082 properties set…

Best guess you actually want object to be @L1 and propertyName and propertyValue to be @L2 with longest lacing (assuming a single list of objects, a single list of property names, and a list of lists of property values).

Jacob,

Many thanks, and you’re absolutely right, an idiotic mistake by me when dealing with list levels and lacing. it processed all the PSets of polylines in 6 ms this time.

Don’t beat yourself up over it - I still make mistakes like that 1x a week.

My recommended best practice is to build and test your graphs in a dataset that’s small enough that you can track the output - something like 3 objects with 4 properties. Even if that means you aren’t “solving” the issue you’re automating right away and will have to ‘open and hit run’ a second time. The smaller verifiable dataset for initial and resulting state ensures your automation runs cleanly and scales correctly while reducing the calculation time every time you hit ‘run’ while authoring.

Totally agree, start small and then scale up.

Thanks again Jacob.