Hi,
I'm developing a MDL programm in Microstation V8 XM edition(2D drawing), the purpose of this programm is to place a cell (not shared cell) in design file. The cell have a sub elements of some attributes(text element) and mask (filled shape element).
The cell already have the attributes but no mask, so before placing the cell I should add filled shapes as mask. Now the mask is also a sub element of the cell.
My problem is the attributes are hide behind the mask. It should be visible. I mean the attribute should order front.
This is the out put I got, here the attributes are hidden,
Below screen shot shows the expected output,
Kindly help me.
Advance Thanks,
Jeyan.
Hi Jeyan,
the most simple way is to assign higher element priority to text (e.g. +1) than to filled mask (e.g. -1). Is it acceptable for you?
To rely on the file element order only can be a tricky sometimes and in such case you should use MS_LEGACYDRAWORDER configuration variable to be sure MicroStation will really display elements based on their file order.
Have you checked how the cell and the elements are written in the file?
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Hi Jan,
How to prioritize like +1 for text and -1 for mask? if it will work then no problem for me.
I already set MS_LEGACYDRAWORDER as 1 in configuration variable.
How to check, how the cell and the elements are written in the file?
Thanks and Regards,
I have not used yet in MDL, but I suppose the function you need is mdlElmdscr_setDisplayPriority.
If you set MS_LEGACYDRAWORDER = 1, the display priority is ignored and the elements are displayed in an order as they are stored in DGN file (which is compatible with the older versions). So if you will try the MDL function mentioned above, you have to undefine the variable or set it to 0.
I think Element information dialog display elements inside cell in the order how they are stored in DGN file (it's default setting, you can change it and order elements e.g. by level). You can check it by an element number, which is displayed in Raw Data information, the elements when they are added to DGN receive growing numbers.
Why not experiment with priority settings manually? You can adjust transparency and priority (both new with XM) in the Element Information and the Change Attributes dialogs …
Either undefine MS_LEGACYDRAWORDER or assign it to zero to see the effect of changing priority.
Regards, Jon Summers LA Solutions
Thanks Jan,
The mdlElmdscr_setDisplayPriority() is working fine in V8 XM, but I need it to work both in V8 2004 edition and also V8 XM edition.
It is not working in V8 2004, because the mdlElmdscr_setDisplayPriority() is not available for V8 2004 edition.
Regards,
Element priority and transparency were introduced with MicroStation XM. Neither the MDL functions nor the user tools are available in MicroStation V8.5.
This article about element display order may help.
If you are only dealing with 2D files (this includes references and cells) and wireframe display, then display (file) order and the MS_LEGACYDRAWORDER=1 configuration variable in V8 XM (Wireframe with "Use File Order for Display" Display Style setting for >V8 XM) is your best bet. Currently this solution is the only one which will work using native MicroStation settings versions V8 2004 through V8 SS2.
Hi Roy,
Thanks for your reply, Could you please tell me what settings that I should do for V8 2004.
V8 2004 only uses the file order. It does not use z-ordering, this is why it is important the file is 2D as XM and above use Direct X to generate the order.
In V8 2004 I'm trying to use mdlInput_sendKeyin() function, in this I pass ORDER ELEMENT FRONT as a command.
Before that I select the cell sub elements (text elements).
mdlSelect_addElement(fpos,MASTERFILE,NULL,TRUE);
mdlInput_sendKeyin("order element front",1,1,NULL);
But still the text elements are hidden behind the shape.
What mistake I made?
Jeyan
You can't rewrite the components of a cell. Commands such as ORDER ELEMENT work on the complete cell. You should re-order the elements within the cell by manipulating the component element descriptors, then rewrite the cell. Put your text elements last in the cell, so they will have a higher file position once written to file.
The following functions will help you re-order the components of a cell …
You should implement an algorithm something like this …
MSElementDescr* pCell = // read cell from somewhere MSElementDescr* pComponent = pCell->h.firstElem; const int nComponents = mdlElement_getComplexElementCount (&pCell->el); int i; for (i = 0; i != nComponents && NULL != pComponent; ++i) { if (TEXT_ELM == mdlElement_getType (&pComponent->el)) { MSElementDescr* pText = NULL; if (SUCCESS == mdlElmdscr_duplicateSingle (&pText, pComponent)) { pComponent = mdlElmdscr_removeElement (pComponent); mdlElmdscr_appendDscr (pCell, pText); // Don't free pText } } else { pComponent = pComponent->h.next; } } mdlElmdscr_rewrite (pCell, NULL, filePos); mdlElmdscr_freeAll (&pCell);
Thanks Jon,
Its working.