Need help about element descriptor!!!

Status
Not open for further replies.

foo

Usenet Archive
Joined
Sep 9, 2001
Messages
144
Reaction score
0
Hi, everyone

I encounter a trouble in my MDL code about element descriptor. My problem is as following:

I have two groups of cells and in each cell, its component elems are all closed elem(ellipse or complex shape). Now I want to difference one group cells to another group cells. I first want construct one group of closed elems into an element descriptor. I do it like the following but it is not right because I want the result structure like the following case 1 not case 2.

case 1 complexHdr--->linestring--->linestring--->nul | complexHdr--->linestring--->linestring--->nul | complexHdr--->linestring--->linestring--->nul | nul

case 2 complexHdr--->linestring--->linestring
|

complexHdr--->linestring--->linestring

|

complexHdr--->linestring--->linestring--->nul

MSElementDescr *edP, *resultEdP, *tmpEdP;
ULong readPos, filePos[1000]; // cells file position int i, num;

mdlElmdscr_read (&edP, filePos[0], 0, FALSE, &readPos); tmpEdP = edP->h.firstElem; // point to ellipse or complex header mdlElmdscr_new (&resultEdP, NULL, &tmpEdP->el); if (tmpEdP->h.isHeader) tmpEdP = tmpEdP->h.firstElem; else tmpEdP = tmpEdP->h.next; while (tmpEdP){ mdlElmdscr_appendElement (resultEdP, &tmpEdP->el); tmpEdP = tmpEdP->h.next; } mdlElmdscr_freeAll (&edP); for (i=1; i<num; i++){ mdlElmdscr_read (&edP, cutoutPos[i], 0, FALSE, &readPos); tmpEdP = edP->h.firstElem; mdlElmdscr_appendElement (cutoutEdP, &tmpEdP->el); if (tmpEdP->h.isHeader) tmpEdP = tmpEdP->h.firstElem; else tmpEdP = tmpEdP->h.next; while (tmpEdP){ mdlElmdscr_appendElement (resultEdP, &tmpEdP->el); tmpEdP = tmpEdP->h.next; } mdlElmdscr_freeAll (&edP); }

Sorry for my English.

Any help are appreciated!

Foo.
 
What if you do not try to get the elements by yourself, but let microstation do this for you? With mdlElmdscr_operation and the right parameters you can call a function for any included element (for example with ELMD_ALL_ONCE you will get everything). In this function you get the element itself, so you can do with that what you want (just check the elementtype to filter out cellheaders (type 2)) - used it often to give a whole descriptor (as complex as you like) a unique color or so.

Michael

"foo" schrieb im Newsbeitrag

Hi, everyone

I encounter a trouble in my MDL code about element descriptor. My problem is as following:

I have two groups of cells and in each cell, its component elems are all closed elem(ellipse or complex shape). Now I want to difference one group cells to another group cells. I first want construct one group of closed elems into an element descriptor. I do it like the following but it is not right because I want the result structure like the following case 1 not case 2.

...
 
Mr. Michael

Thank you for your kind response. But my task need me to separate an element descriptor chain to several element descriptors. 'mdlElmdscr_differenceShapes', 'mdlElmdscr_unionShapes' and 'mdlElmdscr_intersectShapes' fucntion's result are these element descriptor chain. The following snippet ahs accomplished this:

MSElement *insideEdP, *tmpHdrEdP, *tmpEdP, *newEdP[20]; MSElement cellHdr; int newEdNum = 0;

// create my cell header element 'cellHdr'
..........

tmpHdrEdP = insideEdP->h.next;
while (tmpHdrEdP){
if (mdlElmdscr_isGroupedHole (tmpHdrEdP)){
mdlElmdscr_duplicateSingle (&newEdP[newEdNum], tmpHdrEdP); mdlElmdscr_replaceElement (&newEdP[newEdNum], &cellHdr); }else{ mdlElmdscr_new (&newEdP[newEdNum], NULL, &cellHdr); mdlElmdscr_duplicateSingle (&tmpEdP, tmpHdrEdP); mdlElmdscr_appendDscr (newEdP[newEdNum], tmpEdP); } mdlElmdscr_validate (newEdP[newEdNum], 0); mdlCell_setRange (newEdP[newEdNum++]); tmpHdrEdP = tmpHdrEdP->h.next; } if (insideEdP) mdlElmdscr_freeAll (&insideEdP); if (tmpEdP)
mdlElmdscr_freeAll (&tmpEdP);

// continue process newEdP
Foo.
 
Status
Not open for further replies.

Latest threads

Back
Top