When I use Element Information (or Analyze Element), I can see each component of a cell highlighted as I select each component.
I can't figure out how to do this reliably programmatically.
In MicroStation 2004 I could use mdlElmdscr_display() with the component and it worked nicely.
In MicroStation XM through to Connect, I get the elementRef of the component and use mdlLocate_hiliteElement(). However much of the time this doesn't work. It either doesn't highlight at all, highlights the whole cell, or it highlights the component and then partially other components as well. It seems it isn't a reliable method to show just the one component.
I've tried using the old MS2004 way, as well as mdlElement_display() and a couple of other methods. I've also messed around with Transient Elements, but this seems to cause its own problems.
What is the correct way to handle this simple task? It seems like complex components aren't supported properly by the mdlLocate_hiliteElement() function.
Piers Porter said:What is the correct way to handle this simple task?
While the solution in the thread Jan linked is useful, it doesn't exactly answer your question...
The ElementAgenda.Hilight/ElementAgenda.ClearHilight is useful for multiple elements. Though I suppose you could populate an ElementAgenda with a single element and use those methods.
Regards, Jon Summers LA Solutions
Hi Jon / Jan,
I've also tried using ElementAgenda and once again it highlights the whole cell and not the component. I am using the ElementID to find the elementRef of the component and passing that into the ElementAgenda.Hilite() call. I've verified the component is valid. I created an empty design file from scratch, placed some elements and grouped them into an orphan cell, so there's little chance it is corrupted DGN data that causes it. It just seems to be a limitation in all of the public API's that they won't display complex components without displaying the whole cell. And yet, the standard MicroStation tool shows it is possible...
--Piers PorterAltiva Software
Piers Porter said:I've also tried using ElementAgenda and once again it highlights the whole cell and not the component.
Thanks for your, despite of "negative", confirmation. For me it's quite important information, because I have also couple of tools where the same functionality exists and some from them are planned to be migrated on CE platform too.
Piers Porter said:It just seems to be a limitation in all of the public API's
I hope Robert Hook or Brien Bastings will help. I'd like to see it will not end in API description, but in "how to highlight element best practice" that can be step by step extended for different scenarios both in terms of context (element location, where it's automatic, or explicitly like in the discussed case), element location (active model, reference) and element complexity (simple element, the whole complex element, one element from complex element...). It's what I am missing in API documentation more than lenghty description of particular classes and methods ... but it's for another discussion ;-)
Labyrinth Technology | dev.notes() | cad.point
Piers Porter said:It just seems to be a limitation in all of the public API's that they won't display complex components without displaying the whole cell
I offer those ideas as suggestions for investigation, not as an explicit solution to the problem of highlighting cell components.
It actually uses ElementHiliteState::Bold as element hilite state. But unfortunately corresponding API function (maybe elementRef_setHiliteState) isn't published due to some complicated reasons.