Is there a way to add subsets to a zone using flexscript? Instead of manually adding subsets using the UI I would like to do it using code if possible.
Is there a way to add subsets to a zone using flexscript? Instead of manually adding subsets using the UI I would like to do it using code if possible.
Hi @jane.t, was Felix Möhlmann's answer helpful? If so, please click the red "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.
If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.
Creating a new subset from scratch seems quite difficult. You might have to look at the module SDK for that.
Creating copies of an existing subset and modifying it is relatively easy however, as you can copy the relevant subnodes in the tree.
// Navigate to the subset treenode treenode Subsets = Model.find("/Tools/ProcessFlow/ProcessFlow/Zone>variables/subsets"); // Create a copy of the first subnode (subset) as a new subnode treenode NewSubset = createcopy(Subsets.first, Subsets, 0); // Edit the value for the criteria in the copy setsdtvalue(NewSubset, "subsetCriteria", "Type = 3");
This code will create a copy of the first defined subset for the zone and set its token selection criteria to "Type = 3". For other options have a look at the structure and contents of the zones tree.
Doing this while the model is running might have varying results. While I didn't get an error message when I tested it. The statistics for the zone broke though. But entering tokens got added to the new subset correctly.
15 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved