With so many changes between V8i and Connect it’s been a lot of work to go through how we can have the same control over custom interfaces, especially when we want these customisations to be dynamic. One way in which we can create a dynamic Workflow is with the help of Named Expressions. If you’ve not used these before, then check out one of my earlier blogs:
With this in mind, say I want to set up a number of discipline Workflows that can be loaded and unloaded by users. The way we are going to do this is to build our expressions in the Named Expressions dialog. In this example I have set up one for a structural config variable. For things to work, the variable IsStr can be set to 1 or 0. 1 for the Workflow to show and 0 for it to be off.
With the named expression set I can use it with the workflow. To my structural workflow I set the Visibility to use the IsStr named expression in the Customize Ribbon dialog.
With the Named Expression now associated with our Workflow, we can test to see if the system works. We can do this to start with using keyins, the important thing here is that we need to reload our Workflow interface for the Worflows to load and unload. We do this by using the keyin <ribbon rebuild>.
Next, we need to be able to set our config variable to the correct value. To have our Workflow viewable we use the keyin:
expand setsave IsStr = 1;ribbon rebuild <this will save to the ucf>
To turn it off we use:
expand setsave IsStr = 0;ribbon rebuild
If you’re just setting up something for yourself, then this could be put on a keyin or even an AccuDraw shortcut. Remember that using ‘;’ in our keyins means that we can create keyin strings which is a series of keyins run at the same time. Each keyin is separated by ‘;’ to build the string.
The reality for bigger builds is that this is just not viable so we need to be able to find an easier way and that’s with the help of VB. That’s a lot easier than it sounds as we can set up a small VB that acts as a toggle by checking the variable first and then setting the variable to its opposite value. That looks like:
strmnu = ActiveWorkspace.ConfigurationVariableValue("IsStr")
If strmnu = 0 Then
CadInputQueue.SendKeyin "expand setsave IsStr = 1;ribbon rebuild"
CadInputQueue.SendKeyin "expand setsave IsStr = 0;ribbon rebuild"
There are a million different ways in which you can access this for a number of different Workflows so I won’t go through that here, but I hope this gives you a good insight into what can be done with the new interface and Named Expressions for dynamic results.
If there is anything else you’d like me to cover in future blogs, please don’t hesitate to drop me an email or message me via LinkedIn or the BeCommunities website.