Question

using @UUID() as a published parameter

  • 2 August 2018
  • 2 replies
  • 26 views

Badge

Hello all,

I am trying to add one UUID for each CAD file entering the workbench. Is there a way to set a parameter so when a new filename enters the workbench, each feature with the same filename receives the same UUID character? I have tried using a the filenameextractor followed by the attributecreator and using the @uuid() function as the new attribute value. But that just gives each feature a different UUID instead of the same. Any assistance would be appreciated.

Thanks,

David


2 replies

Userlevel 2
Badge +17

Hi @david_prosack88, you can use the Creator (Number to Create: 1) and the UUIDGenerator to create a single feature containing a UUID as an attribute, then merge it to every feature unconditionally with a FeatureMerger. If you make the Creator to run at first, you can set Yes to the Supplier First parameter in the FeatureMerger to run it with better performance.

Instead of the FeatureMerger, you can also use the VariableSetter to store the UUID as a global variable after the UUIDGenerator, and get the value with the VariableRetriever on the main workflow. In this case, the Creator should be run at very first.

Alternatively, you can create a private parameter of Scripted (Python) type to make a single UUID.

import uuid
return uuid.uuid4()
See also here to learn more about the Python uuid module.
Userlevel 1
Badge +21

Create one UUID for each unique filename then merge this back to all features

Reply