I'm working on an application that uses Bentley Microstation for design purpose. So this application references the Microstation, and there is a program to start Bentley Microstation interface from the application.
I open a design file and i highlight few element in design file like shown in below code:
MicroStationDGN.Application app = _app; MicroStationDGN.ApplicationClass ustn = new MicroStationDGN.ApplicationClass (); Element ele = default(Element); //highlight for modified elements DLong Id=default(DLong); Id.High=0; Id.Low=Convert.ToInt32("35754");
//Change highlight colour to RED SendKeyIn("SET HILITE RED");
ele=(Element)(app.ActiveModelReference.GetElementByID (ref Id)); ele.IsHighlighted=true;
//Change highlight colour to BLUE SendKeyIn("SET HILITE BLUE");
Id=default(DLong); Id.High=0; Id.Low=Convert.ToInt32("37664");
So the few elements are highlighted in BLUE and few in RED.
When i zoom the design file to check the elements, all the highlighted elements are highlighted in one colour, in the above case BLUE.
I tried to lock each highlighted elements but it dint work as shown below:
SendKeyIn("change lock");
How can i retain both the colours in the design file?
You cannot highlight with different colors. This works only for a (very) short time, as the MicroStation views are 'selfhealing' which means they redraw the elements whenever the view has (even partial) invalid areas. Therefore all the elements become blue by design.
The only chance I see, are transient elements for the highlight purpose. Create a transient for each of the elements after changing the color to the desired one and take care to clear the transients when they are not longer needed. You might even need to hide your original elements, but that depends on the implementation of the transients for the COM (in MDL you can specify that transients overwrite all persisten geometry.
HTH Michael
Answer Verified By: praveen kp
Thanks Chris and Michael for your reply. This was informative.