Hello,
I'm looking for a way to show/hide tools in the ribbon based on the presence of specific (raster) attachments. Can this be done by Named Expressions and if so, does somebody has an example for me.
Paul
~~
Hi,
PH said:Can this be done by Named Expressions
No and yes: No, because there is no such symbol available by default; and Yes, because such symbol / symbol provider can be (probably) developed (there is no technical reason why not).
Probably the closest to your question can be an expression, testing whether a selected element is raster attachment (see IsRasterReference expression).
PH said:I'm looking for a way to show/hide tools in the ribbon based on the presence of specific (raster) attachments.
How it is expected to work? It's not clear to me:
When show/hide rule is defined for ribbon control (tool), always two things have to be specified:
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
I've made a button to attach a raster reference. Once this reference is attached I want go change the button and its appearance to detach the reference. I was hoping this could be done by the use of named expressions and the show/hide options in the ribbons.
thanks for the details, now the process is clearer.
PH said:Once this reference is attached I want go change the button and its appearance to detach the reference.
The process is quite complex at background, it's not (unfortunately) simple show/hide. Robust process should be:
PH said:I was hoping this could be done by the use of named expressions and the show/hide options in the ribbons.
When you ignore the robustness, which means to ignore whether the raster is really attached / detached, maybe it's possible (it's idea, not tested):
For attach icon the key-in can be something like "raster attach <raster to be attached>;expand set BTN_RASTER_ATTACHED = 1" and for detach button "raster detach <raster file name to be detached>;expand set BTN_RASTER_ATTACHED = 0".
Both icons have to set to use ModelChanged sync event (or explicit key-in "ribbon rebuild" has to be used) and also show/hide condition has to be set to evaluate BTN_RASTER_ATTACHED variable value.
This approach does not check whether the raster is really attached, so button can change even when raster is e.g. missing. But it should work I guess ;-)
Hi Jan,
I'm still working on this 'problem' and working more or less towards your last suggestion. However, on testing my named expression whether a variable exists or has a value other than '1' , the expression cannot be evaluated.
ConfigVar.GetExpandedConfigVar("BAG.XWMS")<>"1" OR NOT ConfigVar.IsConfigVarDefined("BAG.XWMS")
If I use one or the other expression before or after the OR operator it gets evaluated, but combined it doesn't work. Any suggestion on what's wrong in this expression?
Hi Paul,
the expression is wrong and does not work, because when the variable is not defined, GetExpandedConfigVar cannot be evaluated. The variable can be processed only when is defined (in my opinion this implementation is not good, but we have to live with that ;-)
At first, please defined the logic (expected results):
Regards,