How I find a element with a mslink number?

Status
Not open for further replies.
Joined
Dec 3, 2001
Messages
6
Reaction score
0
I have a mslink number e want to find the correspondent graphic element? I use MicroStation Basic and I don't want scan de design file to find the element.
 
Luiz ...

I have a mslink number e want to find the correspondent graphic element? I use MicroStation Basic and I don't want scan de design file to find the element.

A file scan is the best way. Why don't you want to use this method: it's the computer that does the work, not you? 8-)
 
Hi Liuz,
The scanner is MDL is faster, but searching through each element in a design file (even really big ones) using MicroStation Basic is no slouch either. I have a macro that scans through all elements 5 times, and this only takes 15 seconds in a 3mb file (39,000 graphic elements). HTH, Simon

Luiz Fernando De Oliveira Silva wrote:
I have a mslink number e want to find the correspondent graphic element? I use MicroStation Basic and I don't want scan de design file to find the element.
 
Oops, that should be: "15 seconds in a 3mb file on a Pentium II 450."

Simon Wurster wrote:
Hi Liuz,
The scanner is MDL is faster, but searching through each element in a design file (even really big ones) using MicroStation Basic is no slouch either. I have a macro that scans through all elements 5 times, and this only takes 15 seconds in a 3mb file (39,000 graphic elements). HTH, Simon

Luiz Fernando De Oliveira Silva wrote:
>
> I have a mslink number e want to find the correspondent graphic element?
> I use MicroStation Basic and I don't want scan de design file to find the ...
 
Doesn't Select By have a mslink option?

"Simon Wurster" wrote:

Oops, that should be: "15 seconds in a 3mb file on a Pentium II 450."

Simon Wurster wrote:
>
> Hi Liuz,
> The scanner is MDL is faster, but searching through each element in a
> design file (even really big ones) using MicroStation Basic is no slouch
> either. I have a macro that scans through all elements 5 times, and this
> only takes 15 seconds in a 3mb file (39,000 graphic elements).
> HTH,
> Simon
>
...
element?
> > I use MicroStation Basic and I don't want scan de design file to find
the
> > element.
> >
> > --
> > Posted from [200.178.243.14]
> > via Mailgate.ORG Server - http://www.Mailgate.ORG
 
Hi Luiz!

Create a long-field in each databasetable which is filled with the filepos of the linked element. You can do this with a macro. If you create linkages by using macros yet, try to expand the functions in that way, that they also write the actual filepos into this special database field. Then you can directly refer to the searched element by using the value in this field.

Problems:
When you delete elements for example, the filepos does not change until you comprimate the file. The search works fine as long as you do not comprimate. After comprimation microstation changes the fileposes. So the only problem you have to solve: When you comprimate the file, you have to scan the whole file for elements with mslinks and then change the values of the field filepos in the database to the actual value. This can also be solved with a little macro, which comprimates and afterwards reculculates the databasefield. If you start this macro after you have opended the dgn and before you close it, the method is relative sure, when you don't comprimate "between" without recalculating.

If someone knows other actions as comprimation, which have influence to the filepos, please inform me!

Jo

"Luiz Fernando De Oliveira Silva" schrieb im
Newsbeitrag

I have a mslink number e want to find the correspondent graphic element? I use MicroStation Basic and I don't want scan de design file to find the element.
 
If someone knows other actions as comprimation, which have influence to the filepos, please inform me!

1. WSET ADD, WSET DROP
2. Edit->Group, Edit->Ungroup

/Chris

"jgroesbrink" wrote:
Hi Luiz!

Create a long-field in each databasetable which is filled with the filepos of the linked element. You can do this with a macro. If you create linkages by using macros yet, try to expand the functions in that way, that they also write the actual filepos into this special database field. Then you can directly refer to the searched element by using the value in this field.

Problems:
When you delete elements for example, the filepos does not change until you comprimate the file. The search works fine ...
 
Create a long-field in each databasetable which is filled with the filepos of the linked element.

Not a good idea: the file position may change for many reasons.

If you want a permanent ID that is not an MSLINK, you could try something like this:
1 For each element that you want to quick-find, create a unique association ID (in V7, you must use MDL to create this 32-bit ID; in V8 each element has a unique 64-bit ID assigned automatically) 2 Store the unique ID in the database table alongside the MSLINK 3 When you want to fast-find an element:
3.1 Look up its unique ID in the database
3.2 Use mdlAssoc_getElement to retrieve the element using its ID

The reason that this is faster than a file scan is that MicroStation maintains a cache of association IDs. Whether this will continue to be faster in V8, when the cache must include all elements, is another question.

Unfortunately, you need MDL code to perform these tasks. I wrote an article in the October 2001 issue of MicroStation Manager Magazine about this topic.
 
1 For each element that you want to quick-find, create a unique
association ID (in V7, you must use MDL to create this 32-bit ID; in V8 each element has a unique 64-bit ID assigned automatically)

I utilize MicroStation SE, there is some solution?

Thanks...
 
Luiz ...

1 For each element that you want to quick-find, create a unique
> association ID (in V7, you must use MDL to create this 32-bit ID; in
V8
> each element has a unique 64-bit ID assigned automatically)

I utilize MicroStation SE, there is some solution?

The mdlTag_xxx and mdlAssoc_xxx functions have been in MicroStation since v5, so the answer is 'yes'. MicroStation BASIC does not have the ability to create or retrieve an association ID; however, I wrote an article in October MSM (http://www.msmonline.com/oct01/solution.htm) together with an MDL helper application that lets you create and read that ID using BASIC.
 
if you just want to search for a mslink I seem to remember you can set up a fence selection Used to be a ucm called hilite.ucm that would hilite elements matching the selection in a fence.

The keyin was DS= I think. read your customisation manual and lock for Fence selection or DS=...

There should be a standard M$ help file. Do a find for *.hlp where you have installed ustation B)
Karsten

"Luiz Fernando De Oliveira Silva" wrote in
message
1 For each element that you want to quick-find, create a unique
> association ID (in V7, you must use MDL to create this 32-bit ID; in
V8
> each element has a unique 64-bit ID assigned automatically)

I utilize MicroStation SE, there is some solution?

Thanks...
 
I use this scan to find an element wich MSLINK i Know.
It's very fast.

/* Resalto el elemento cuyo MSLINK estoy pasando */
void MUESTRA_ELEMENTO (int MSlink, char *tabla, int color) { int status3; Scanlist scanList; ULong currAddr[100],filepos; int scanWords,numAddr; int status,i; MSElement elem; DatabaseLink *link; int linkCount;

printf ("\n Elemento incorrecto: MSLINK: %d, TABLA: %s, COLOR:
%d",MSlink, tabla, color);

/* INICIO EL SCAN */
mdlScan_initScanlist (&scanList);
mdlScan_noRangeCheck (&scanList);

/* Parametros de bsqueda */
scanList.scantype = ELEMTYPE|NESTCELL|ELEATTR;
scanList.extendedType = FILEPOS;
scanList.typmask[0] =
TMSK0_CELL_HEADER|TMSK0_LINE|TMSK0_LINE_STRING;

mdlScan_initialize (0, &scanList);

do
{

scanWords=sizeof(currAddr) / sizeof(short);
status=mdlScan_file (currAddr, &scanWords, sizeof(currAddr), &filepos); numAddr=scanWords / sizeof(short);

for(i=0;i<numAddr;i++)
{

mdlElement_read(&elem,0,currAddr[i]);

status3=mdlDB_extractLinkages (&link, &linkCount, &elem);

if (link[0].mslink == MSlink )
{
cambia_HILITE (color);
mdlElmdscr_displayFromFile(currAddr[i], 0,&elem, HILITE); } }

} while(status == BUFF_FULL);

/* Cambia el color de HILITE */
void cambia_HILITE (int color)
{
char texto[15];

sprintf (texto, "set hilite %d", color);

mdlInput_sendKeyin (texto, TRUE, INPUTQ_EOQ, NULL);
mdlInput_sendResume (INPUTQ_EOQ);
mdlInput_waitForMessage ;
}
 
Hello

This scan routine looks fast but there is even an faster solution Scanning on userdata

look at this example.

It scans on userdata on elements.
This example scans on all database linkages but DMRS, the binary structure is deferent. But also you can scan on DMRS but you have to change the attributes acording to them

Greetings Olaf Giezenaar

void scan_on_MSlink(ULong MSlink, int entity)
{
ULong elemAddr[50], eofPos, filePos;
int scanWords, status, i, numAddr;
ExtScanlist scanList;
ScanContext context;
ExtendedAttrBuf extAttrBuf;
mdlScan_initScanlist(&scanList);
mdlScan_noRangeCheck(&scanList);
mdlScan_setDrawnElements(&scanList);
scanList.scantype = ELEMTYPE | NESTCELL;
scanList.extendedType = FILEPOS | EXTATTR;
/* set extended attribute buffer and clear it */
scanList.extAttrBuf = &extAttrBuf;
memset (&extAttrBuf, 0, sizeof (ExtendedAttrBuf));
extAttrBuf.numWords = 8;

extAttrBuf.extAttData[0] = 0x1000; /* verify user bit is set */ extAttrBuf.extAttData[8] = 0x1000;

extAttrBuf.extAttData[1] = 0x0000; /* don't care about 2nd word */ extAttrBuf.extAttData[9] = 0x0000; / is the attr is */

extAttrBuf.extAttData[2] = 0xffff; /* secondary id van MSlink */ extAttrBuf.extAttData[10] = SECONDARY_ID;

extAttrBuf.extAttData[3] = 0xffff; /* want 4th word to be entity */ extAttrBuf.extAttData[11] = entity & 0xffff;

extAttrBuf.extAttData[4] = 0xffff; /* want 5th word to be mslink */ extAttrBuf.extAttData[12] = MSlink & 0xffff;

extAttrBuf.extAttData[5] = 0xffff; /* want 5th word to be mslink */ extAttrBuf.extAttData[13] = (MSlink >> 16) & 0xffff;

extAttrBuf.extAttData[6] = 0x0000; /* don't care about 7th word */ extAttrBuf.extAttData[14] = 0x0000;

extAttrBuf.extAttData[7] = 0x0000; /* don't care about 8th word */ extAttrBuf.extAttData[15] = 0x0000;

eofPos = mdlElement_getFilePos (FILEPOS_EOF, NULL);
filePos = 0L;
mdlScan_initialize (0, &scanList);
mdlScan_saveContext(&context);
do
{
scanWords = sizeof (elemAddr)/sizeof(short);
mdlScan_restoreContext(&context);
status = mdlScan_file (elemAddr, &scanWords, sizeof(elemAddr), &filePos); mdlScan_saveContext(&context); numAddr = scanWords / sizeof(short); for (i=0; i<numAddr; i++) { if (elemAddr[i] >= eofPos) break; } }while (status == BUFF_FULL); }

(Juan Miranda) wrote:
I use this scan to find an element wich MSLINK i Know.
It's very fast.

/* Resalto el elemento cuyo MSLINK estoy pasando */
void MUESTRA_ELEMENTO (int MSlink, char *tabla, int color) { int status3; Scanlist scanList; ULong currAddr[100],filepos; int scanWords,numAddr; int status,i; MSElement elem; ...
 
Status
Not open for further replies.

Latest threads

Back
Top