THE BOTTOM LINEI need a Named Expression that will test whether Reference Slot Number "x" is occupied with an attachment in the active model, and if so, is it currently being displayed. If there is an attachment and it is displayed, it needs to evaluate as True by the named expression.
Alternatively, just see if Slot "x" has an attachment, whether displayed or not.
MORE INFORMATIONI have a custom toolbar that functions a little like the View Groups toolbar where the eight numbers toggle on and off views 1-8. But my toolbar displays not 1-8, but 0-20, and clicking a number (tool) would display only that ref file attachment. That is, say when I click "4", the tool would execute a command string "update file 4;selview 1" to temporarily display only reference attachment number 4 in View 1, if it exists. Just move or pan or zoom, and you are back to viewing normally.
In the interest of screen space, what I would like to do is limit the display of numbers on the custom toolbar to only the ref attach slots that really contain an attached file AND have their display turned on.
I think the technique is to add a Show/Hide test on the tool definition. I think the test will also require some Named Expression to be defined as well. I haven't figured how to write the Named Expression it will require. I think this is simple, but I don't have the skills to do it myself.
Where are some resources that can show me how to learn to make Named Expressions?
CONSIDERATIONSAssumptions - these events would/may trigger an immediate change in the toolbar:1. Moving from one model to another.2. Adding or deleting ref attachments.3. Toggling a ref Display On/Off.
Are these assumptions erroneous or good? I really don't want the toolbar expanding and contracting in size to mess up my docked arrangements.
Hi Patrick,
I am not quite sure whether MicroStation Programming forum is not a better to place such question, because it's the question "in a middle" between customization (administration) and programming, but bigger part seems to be about development.
At the same time I'd like to express my good feeling from your post, because rarely the questions are so well structured and provide good overall picture. Just one information is missing: What MicroStation version do you use? It can be deduced from the screen capture it's probably V8i, but it's recommended to specify it exactly.
Unknown said:I think the technique is to add a Show/Hide test on the tool definition.
In general yes, it's correct, but from reasons mentioned below I am not quite sure whether to use standard customization (custom toolbox + Named Expressions) is the best one.
Unknown said:I haven't figured how to write the Named Expression it will require. I think this is simple, but I don't have the skills to do it myself.
Well, if you are skilled C# developer and you know how Named Expressions work internally, it's not very difficult. But in this specific case it's a bit more complex, because I suppose the reference slot number is not accessible from VBA, which is equal to COM API used by V8i NET code. It means C# code has to call MDL C functions to get this information (I guess MDL would be enough for it, but not sure).
Unknown said:Where are some resources that can show me how to learn to make Named Expressions?
I recollect only one presentation from some BDN conference where it was explained how Named Expressions work internally and how own can be created. So the answer is "it's part of BDN resources", but I don't know whether these materials (presentations, examples, recordings...) are accessible as download even for BDN members.
Unknown said:I really don't want the toolbar expanding and contracting in size to mess up my docked arrangements.
It sounds like a contradiction to your idea to use Show/Hide test, because when these tests will be applied, the toolbox will grow and shrink.
Unknown said:Are these assumptions erroneous or good?
Mostly yes, but he problem is there is no such triggering in tool visbility test. If a tool should be displayed or not based on Named Expression test is evaluated when the toolbar is opened (once) and at every next opening, but not in any other case. But the events you mentioned can happen really often, especially number 3, because a reference can be displayed differently in different views, so e.g. a change of active view will produce a request to update the toolbar.
In conclusion:
It seems, using this way, you need:
All together it sounds like too complex solution (2 languages, 3 parts...), so maybe one MDL application that will create the toolbox programmatically is better solution. The code itself will be simpler (because no need for Symbol provider) and more complex (because of code responsible for the toolbox itself).
BTW In MicroStation CONNECT Edition the discussed event monitoring issue is solved, because ribbon customization (not old toolboxes) allows to choose what MicroStation event (fixed pre-defined list) should trigger reevaluation of show/hide and enable/disable tests used in ribbon tools definitions.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Answer Verified By: Patrick Coyne