aljoshakoecher/STEP-to-JSON

Unique identifiers

ConstantinHildebrandt opened this issue · 0 comments

I would love to have the option to get unique identifiers for every appearance of a component. In most cases the name is enough to identify having the same thing.

So instead of only:
const assemblyStructure = parser.parse();
It would be nice to have:
const assemblyStructure = parser.parseUniqueId();

All you need to do is:
npm install uuid --save

And then add as a kind of post processing the following method:
`function createUniqueIds(stepJson) {

stepJson.id = uuid();

if (stepJson.contains.length != 0) {
    stepJson.contains.forEach(element => {
        createUniqueIds(element);
    });
}
return stepJson

}`

This method should be called after having created the json file.