Open new design file while seeing the actual one

  • Follow


Is posible to open a new file and work with it while still seing the
actual one in the workspace?.
I hope you understand me.

Thanks.

0
Reply grotero (2) 7/21/2006 7:41:46 AM

The only way to see multiple files in the view windows at the same time 
is to use refernce files.

Dan

grotero@telecable.es wrote:
> Is posible to open a new file and work with it while still seing the
> actual one in the workspace?.
> I hope you understand me.
> 
> Thanks.
> 
0
Reply Daniel 7/21/2006 12:29:57 PM


Can anybody tell me what's wrong in this code?
It fails when executing the line  "mdlElement_extractRange(&vector,
&elDP->el);". The error is "Cancelation of MDL in line......."
What this function is trying to do is to obtain the yMax (the maximum
value "y" of a extern file).

Private double calculateYMax
(
FILE *f
)
{

Scanlist    scanList;
ULong       elemAddr[50], filePos;
 int         fileNum, i, j, numAddr, scanWords, currFile, numPoints;
int         init_status, scan_status;
DPoint3d	origin, end;
MSElement el;
double yMax = 0.0;
Dvector3d vector;


/*-----------------------------------------------------+
|  initialize scan to start from begining of file      |
+-----------------------------------------------------*/
mdlScan_initScanlist (&scanList);
mdlScan_setDrawnElements(&scanList);
mdlScan_noRangeCheck(&scanList);

for (i=0; i<4; i++)
scanList.levmask[i] = 0x0000;

scanList.typmask[0] = TMSK0_LINE|TMSK0_LINE_STRING|TMSK0_SHAPE;

scanList.typmask[1] = 0x0000;
scanList.typmask[2] = 0x0000;
scanList.typmask[3] = 0x0000;
scanList.typmask[4] = 0x0000;
scanList.typmask[5] = 0x0000;
scanList.typmask[6] = 0x0000;
scanList.typmask[7] = 0x0000;

scanList.scantype = ELEMTYPE;
scanList.extendedType = FILEPOS;

if (f!=NULL)
{
     mdlScan_initOpenedFile (f, &scanList);
			  }
    filePos = 0L;
    fileNum = 0;
    scanWords = 0;

    if ((init_status = mdlScan_initialize (fileNum, &scanList)) ==
SUCCESS);
    {

         do
         {
             scan_status = mdlScan_file (elemAddr, &scanWords,
sizeof(elemAddr), &filePos);
             numAddr = scanWords / sizeof(short);

             for (i=0; i<numAddr; i++)
             {
                 MSElementDescr *elDP=NULL;

                 mdlWorkDgn_read(&elDP,elemAddr[i],f,NULL,0);
	 mdlElmdscr_read (&elDP, elemAddr[i], f, FALSE, NULL);


                 /* THIS LINE IS THE ONE WHICH IS FAILING */
			 mdlElement_extractRange(&vector, &elDP->el);

	 origin = vector.org;							 end = vector.end;														  if
(origin.y > yMax)
	              yMax = origin.y;            				  if (end.y > yMax)
       						              yMax = end.y;
	  if(elDP) mdlElmdscr_freeAll(&elDP);					}
           } while (scan_status == BUFF_FULL);

    }
         return yMax;
}


Daniel MacNeil wrote:
> The only way to see multiple files in the view windows at the same time
> is to use refernce files.
>
> Dan
>
> grotero@telecable.es wrote:
> > Is posible to open a new file and work with it while still seing the
> > actual one in the workspace?.
> > I hope you understand me.
> > 
> > Thanks.
> >

0
Reply grotero 7/24/2006 10:02:58 AM

I haven't used mdlScan_initOpenedFile(...) before, but looking at the 
help it says that it ZEROS out the scanlist. It looks like it works the 
same way as mdlScan_initScanlist(...) and should be used in its' place. 
When you use it later in the code you are setting everything back to 
default values.
In your _do loop_ check what element types are being returned.

Dan


grotero@telecable.es wrote:
> Can anybody tell me what's wrong in this code?
> It fails when executing the line  "mdlElement_extractRange(&vector,
> &elDP->el);". The error is "Cancelation of MDL in line......."
> What this function is trying to do is to obtain the yMax (the maximum
> value "y" of a extern file).
> 
> Private double calculateYMax
> (
> FILE *f
> )
> {
> 
> Scanlist    scanList;
> ULong       elemAddr[50], filePos;
>  int         fileNum, i, j, numAddr, scanWords, currFile, numPoints;
> int         init_status, scan_status;
> DPoint3d	origin, end;
> MSElement el;
> double yMax = 0.0;
> Dvector3d vector;
> 
> 
> /*-----------------------------------------------------+
> |  initialize scan to start from begining of file      |
> +-----------------------------------------------------*/
> mdlScan_initScanlist (&scanList);
> mdlScan_setDrawnElements(&scanList);
> mdlScan_noRangeCheck(&scanList);
> 
> for (i=0; i<4; i++)
> scanList.levmask[i] = 0x0000;
> 
> scanList.typmask[0] = TMSK0_LINE|TMSK0_LINE_STRING|TMSK0_SHAPE;
> 
> scanList.typmask[1] = 0x0000;
> scanList.typmask[2] = 0x0000;
> scanList.typmask[3] = 0x0000;
> scanList.typmask[4] = 0x0000;
> scanList.typmask[5] = 0x0000;
> scanList.typmask[6] = 0x0000;
> scanList.typmask[7] = 0x0000;
> 
> scanList.scantype = ELEMTYPE;
> scanList.extendedType = FILEPOS;
> 
> if (f!=NULL)
> {
>      mdlScan_initOpenedFile (f, &scanList);
> 			  }
>     filePos = 0L;
>     fileNum = 0;
>     scanWords = 0;
> 
>     if ((init_status = mdlScan_initialize (fileNum, &scanList)) ==
> SUCCESS);
>     {
> 
>          do
>          {
>              scan_status = mdlScan_file (elemAddr, &scanWords,
> sizeof(elemAddr), &filePos);
>              numAddr = scanWords / sizeof(short);
> 
>              for (i=0; i<numAddr; i++)
>              {
>                  MSElementDescr *elDP=NULL;
> 
>                  mdlWorkDgn_read(&elDP,elemAddr[i],f,NULL,0);
> 	 mdlElmdscr_read (&elDP, elemAddr[i], f, FALSE, NULL);
> 
> 
>                  /* THIS LINE IS THE ONE WHICH IS FAILING */
> 			 mdlElement_extractRange(&vector, &elDP->el);
> 
> 	 origin = vector.org;							 end = vector.end;														  if
> (origin.y > yMax)
> 	              yMax = origin.y;            				  if (end.y > yMax)
>        						              yMax = end.y;
> 	  if(elDP) mdlElmdscr_freeAll(&elDP);					}
>            } while (scan_status == BUFF_FULL);
> 
>     }
>          return yMax;
> }
> 
> 
> Daniel MacNeil wrote:
> 
>>The only way to see multiple files in the view windows at the same time
>>is to use refernce files.
>>
>>Dan
>>
>>grotero@telecable.es wrote:
>>
>>>Is posible to open a new file and work with it while still seing the
>>>actual one in the workspace?.
>>>I hope you understand me.
>>>
>>>Thanks.
>>>
> 
> 
0
Reply Daniel 7/24/2006 12:46:50 PM

Hello

If you scan a opened file, the file must be opened with f  =
fopen(fName,"rb+");

and the scanloop is not correct, you should replace
mdlScan_initialize (fileNum, &scanList) by
mdlScan_initOpenedFile (f, &scanList);

the rewst is ok in your program

Regards Olaf

Daniel MacNeil schreef:

> I haven't used mdlScan_initOpenedFile(...) before, but looking at the
> help it says that it ZEROS out the scanlist. It looks like it works the
> same way as mdlScan_initScanlist(...) and should be used in its' place.
> When you use it later in the code you are setting everything back to
> default values.
> In your _do loop_ check what element types are being returned.
>
> Dan
>
>
> grotero@telecable.es wrote:
> > Can anybody tell me what's wrong in this code?
> > It fails when executing the line  "mdlElement_extractRange(&vector,
> > &elDP->el);". The error is "Cancelation of MDL in line......."
> > What this function is trying to do is to obtain the yMax (the maximum
> > value "y" of a extern file).
> >
> > Private double calculateYMax
> > (
> > FILE *f
> > )
> > {
> >
> > Scanlist    scanList;
> > ULong       elemAddr[50], filePos;
> >  int         fileNum, i, j, numAddr, scanWords, currFile, numPoints;
> > int         init_status, scan_status;
> > DPoint3d	origin, end;
> > MSElement el;
> > double yMax = 0.0;
> > Dvector3d vector;
> >
> >
> > /*-----------------------------------------------------+
> > |  initialize scan to start from begining of file      |
> > +-----------------------------------------------------*/
> > mdlScan_initScanlist (&scanList);
> > mdlScan_setDrawnElements(&scanList);
> > mdlScan_noRangeCheck(&scanList);
> >
> > for (i=0; i<4; i++)
> > scanList.levmask[i] = 0x0000;
> >
> > scanList.typmask[0] = TMSK0_LINE|TMSK0_LINE_STRING|TMSK0_SHAPE;
> >
> > scanList.typmask[1] = 0x0000;
> > scanList.typmask[2] = 0x0000;
> > scanList.typmask[3] = 0x0000;
> > scanList.typmask[4] = 0x0000;
> > scanList.typmask[5] = 0x0000;
> > scanList.typmask[6] = 0x0000;
> > scanList.typmask[7] = 0x0000;
> >
> > scanList.scantype = ELEMTYPE;
> > scanList.extendedType = FILEPOS;
> >
> > if (f!=NULL)
> > {
> >      mdlScan_initOpenedFile (f, &scanList);
> > 			  }
> >     filePos = 0L;
> >     fileNum = 0;
> >     scanWords = 0;
> >
> >     if ((init_status = mdlScan_initialize (fileNum, &scanList)) ==
> > SUCCESS);
> >     {
> >
> >          do
> >          {
> >              scan_status = mdlScan_file (elemAddr, &scanWords,
> > sizeof(elemAddr), &filePos);
> >              numAddr = scanWords / sizeof(short);
> >
> >              for (i=0; i<numAddr; i++)
> >              {
> >                  MSElementDescr *elDP=NULL;
> >
> >                  mdlWorkDgn_read(&elDP,elemAddr[i],f,NULL,0);
> > 	 mdlElmdscr_read (&elDP, elemAddr[i], f, FALSE, NULL);
> >
> >
> >                  /* THIS LINE IS THE ONE WHICH IS FAILING */
> > 			 mdlElement_extractRange(&vector, &elDP->el);
> >
> > 	 origin = vector.org;							 end = vector.end;														  if
> > (origin.y > yMax)
> > 	              yMax = origin.y;            				  if (end.y > yMax)
> >        						              yMax = end.y;
> > 	  if(elDP) mdlElmdscr_freeAll(&elDP);					}
> >            } while (scan_status == BUFF_FULL);
> >
> >     }
> >          return yMax;
> > }
> >
> >
> > Daniel MacNeil wrote:
> >
> >>The only way to see multiple files in the view windows at the same time
> >>is to use refernce files.
> >>
> >>Dan
> >>
> >>grotero@telecable.es wrote:
> >>
> >>>Is posible to open a new file and work with it while still seing the
> >>>actual one in the workspace?.
> >>>I hope you understand me.
> >>>
> >>>Thanks.
> >>>
> > 
> >

0
Reply olaf 7/25/2006 6:04:36 AM

Why don't you open the model using mdlWorkDgn_openFile and then call 
mdlModelRef_getRange?

Saludos,
Juan

<grotero@telecable.es> escribi� en el mensaje 
news:1153735377.894867.57170@i42g2000cwa.googlegroups.com...
> Can anybody tell me what's wrong in this code?
> It fails when executing the line  "mdlElement_extractRange(&vector,
> &elDP->el);". The error is "Cancelation of MDL in line......."
> What this function is trying to do is to obtain the yMax (the maximum
> value "y" of a extern file).
>
> Private double calculateYMax
> (
> FILE *f
> )
> {
>
> Scanlist    scanList;
> ULong       elemAddr[50], filePos;
> int         fileNum, i, j, numAddr, scanWords, currFile, numPoints;
> int         init_status, scan_status;
> DPoint3d origin, end;
> MSElement el;
> double yMax = 0.0;
> Dvector3d vector;
>
>
> /*-----------------------------------------------------+
> |  initialize scan to start from begining of file      |
> +-----------------------------------------------------*/
> mdlScan_initScanlist (&scanList);
> mdlScan_setDrawnElements(&scanList);
> mdlScan_noRangeCheck(&scanList);
>
> for (i=0; i<4; i++)
> scanList.levmask[i] = 0x0000;
>
> scanList.typmask[0] = TMSK0_LINE|TMSK0_LINE_STRING|TMSK0_SHAPE;
>
> scanList.typmask[1] = 0x0000;
> scanList.typmask[2] = 0x0000;
> scanList.typmask[3] = 0x0000;
> scanList.typmask[4] = 0x0000;
> scanList.typmask[5] = 0x0000;
> scanList.typmask[6] = 0x0000;
> scanList.typmask[7] = 0x0000;
>
> scanList.scantype = ELEMTYPE;
> scanList.extendedType = FILEPOS;
>
> if (f!=NULL)
> {
>     mdlScan_initOpenedFile (f, &scanList);
>   }
>    filePos = 0L;
>    fileNum = 0;
>    scanWords = 0;
>
>    if ((init_status = mdlScan_initialize (fileNum, &scanList)) ==
> SUCCESS);
>    {
>
>         do
>         {
>             scan_status = mdlScan_file (elemAddr, &scanWords,
> sizeof(elemAddr), &filePos);
>             numAddr = scanWords / sizeof(short);
>
>             for (i=0; i<numAddr; i++)
>             {
>                 MSElementDescr *elDP=NULL;
>
>                 mdlWorkDgn_read(&elDP,elemAddr[i],f,NULL,0);
> mdlElmdscr_read (&elDP, elemAddr[i], f, FALSE, NULL);
>
>
>                 /* THIS LINE IS THE ONE WHICH IS FAILING */
> mdlElement_extractRange(&vector, &elDP->el);
>
> origin = vector.org; end = vector.end;   if
> (origin.y > yMax)
>               yMax = origin.y;              if (end.y > yMax)
>                     yMax = end.y;
>   if(elDP) mdlElmdscr_freeAll(&elDP); }
>           } while (scan_status == BUFF_FULL);
>
>    }
>         return yMax;
> }
>
>
> Daniel MacNeil wrote:
>> The only way to see multiple files in the view windows at the same time
>> is to use refernce files.
>>
>> Dan
>>
>> grotero@telecable.es wrote:
>> > Is posible to open a new file and work with it while still seing the
>> > actual one in the workspace?.
>> > I hope you understand me.
>> >
>> > Thanks.
>> >
> 


0
Reply Juan 7/25/2006 10:06:22 AM

Thanks all.

Here was the problem, I would pass as parameter a file or not pass, and
I needed to check it with a conditional sentence. I always was
executing the two lines.

if (f!=3DNULL)
     mdlScan_initOpenedFile (f, &scanList);
else
     init_status =3D mdlScan_initialize (fileNum, &scanList);



Juan Perea wrote:
> Why don't you open the model using mdlWorkDgn_openFile and then call
> mdlModelRef_getRange?
>
> Saludos,
> Juan
>
> <grotero@telecable.es> escribi=F3 en el mensaje
> news:1153735377.894867.57170@i42g2000cwa.googlegroups.com...
> > Can anybody tell me what's wrong in this code?
> > It fails when executing the line  "mdlElement_extractRange(&vector,
> > &elDP->el);". The error is "Cancelation of MDL in line......."
> > What this function is trying to do is to obtain the yMax (the maximum
> > value "y" of a extern file).
> >
> > Private double calculateYMax
> > (
> > FILE *f
> > )
> > {
> >
> > Scanlist    scanList;
> > ULong       elemAddr[50], filePos;
> > int         fileNum, i, j, numAddr, scanWords, currFile, numPoints;
> > int         init_status, scan_status;
> > DPoint3d origin, end;
> > MSElement el;
> > double yMax =3D 0.0;
> > Dvector3d vector;
> >
> >
> > /*-----------------------------------------------------+
> > |  initialize scan to start from begining of file      |
> > +-----------------------------------------------------*/
> > mdlScan_initScanlist (&scanList);
> > mdlScan_setDrawnElements(&scanList);
> > mdlScan_noRangeCheck(&scanList);
> >
> > for (i=3D0; i<4; i++)
> > scanList.levmask[i] =3D 0x0000;
> >
> > scanList.typmask[0] =3D TMSK0_LINE|TMSK0_LINE_STRING|TMSK0_SHAPE;
> >
> > scanList.typmask[1] =3D 0x0000;
> > scanList.typmask[2] =3D 0x0000;
> > scanList.typmask[3] =3D 0x0000;
> > scanList.typmask[4] =3D 0x0000;
> > scanList.typmask[5] =3D 0x0000;
> > scanList.typmask[6] =3D 0x0000;
> > scanList.typmask[7] =3D 0x0000;
> >
> > scanList.scantype =3D ELEMTYPE;
> > scanList.extendedType =3D FILEPOS;
> >
> > if (f!=3DNULL)
> > {
> >     mdlScan_initOpenedFile (f, &scanList);
> >   }
> >    filePos =3D 0L;
> >    fileNum =3D 0;
> >    scanWords =3D 0;
> >
> >    if ((init_status =3D mdlScan_initialize (fileNum, &scanList)) =3D=3D
> > SUCCESS);
> >    {
> >
> >         do
> >         {
> >             scan_status =3D mdlScan_file (elemAddr, &scanWords,
> > sizeof(elemAddr), &filePos);
> >             numAddr =3D scanWords / sizeof(short);
> >
> >             for (i=3D0; i<numAddr; i++)
> >             {
> >                 MSElementDescr *elDP=3DNULL;
> >
> >                 mdlWorkDgn_read(&elDP,elemAddr[i],f,NULL,0);
> > mdlElmdscr_read (&elDP, elemAddr[i], f, FALSE, NULL);
> >
> >
> >                 /* THIS LINE IS THE ONE WHICH IS FAILING */
> > mdlElement_extractRange(&vector, &elDP->el);
> >
> > origin =3D vector.org; end =3D vector.end;   if
> > (origin.y > yMax)
> >               yMax =3D origin.y;              if (end.y > yMax)
> >                     yMax =3D end.y;
> >   if(elDP) mdlElmdscr_freeAll(&elDP); }
> >           } while (scan_status =3D=3D BUFF_FULL);
> >
> >    }
> >         return yMax;
> > }
> >
> >
> > Daniel MacNeil wrote:
> >> The only way to see multiple files in the view windows at the same time
> >> is to use refernce files.
> >>
> >> Dan
> >>
> >> grotero@telecable.es wrote:
> >> > Is posible to open a new file and work with it while still seing the
> >> > actual one in the workspace?.
> >> > I hope you understand me.
> >> >
> >> > Thanks.
> >> >
> >

0
Reply grotero 7/26/2006 8:00:12 AM

That is V8, the call refers to older use of workdgn function in pre V8,
Microstation 4 to 7

Olaf

Juan Perea schreef:

> Why don't you open the model using mdlWorkDgn_openFile and then call
> mdlModelRef_getRange?
>
> Saludos,
> Juan
>
> <grotero@telecable.es> escribi=F3 en el mensaje
> news:1153735377.894867.57170@i42g2000cwa.googlegroups.com...
> > Can anybody tell me what's wrong in this code?
> > It fails when executing the line  "mdlElement_extractRange(&vector,
> > &elDP->el);". The error is "Cancelation of MDL in line......."
> > What this function is trying to do is to obtain the yMax (the maximum
> > value "y" of a extern file).
> >
> > Private double calculateYMax
> > (
> > FILE *f
> > )
> > {
> >
> > Scanlist    scanList;
> > ULong       elemAddr[50], filePos;
> > int         fileNum, i, j, numAddr, scanWords, currFile, numPoints;
> > int         init_status, scan_status;
> > DPoint3d origin, end;
> > MSElement el;
> > double yMax =3D 0.0;
> > Dvector3d vector;
> >
> >
> > /*-----------------------------------------------------+
> > |  initialize scan to start from begining of file      |
> > +-----------------------------------------------------*/
> > mdlScan_initScanlist (&scanList);
> > mdlScan_setDrawnElements(&scanList);
> > mdlScan_noRangeCheck(&scanList);
> >
> > for (i=3D0; i<4; i++)
> > scanList.levmask[i] =3D 0x0000;
> >
> > scanList.typmask[0] =3D TMSK0_LINE|TMSK0_LINE_STRING|TMSK0_SHAPE;
> >
> > scanList.typmask[1] =3D 0x0000;
> > scanList.typmask[2] =3D 0x0000;
> > scanList.typmask[3] =3D 0x0000;
> > scanList.typmask[4] =3D 0x0000;
> > scanList.typmask[5] =3D 0x0000;
> > scanList.typmask[6] =3D 0x0000;
> > scanList.typmask[7] =3D 0x0000;
> >
> > scanList.scantype =3D ELEMTYPE;
> > scanList.extendedType =3D FILEPOS;
> >
> > if (f!=3DNULL)
> > {
> >     mdlScan_initOpenedFile (f, &scanList);
> >   }
> >    filePos =3D 0L;
> >    fileNum =3D 0;
> >    scanWords =3D 0;
> >
> >    if ((init_status =3D mdlScan_initialize (fileNum, &scanList)) =3D=3D
> > SUCCESS);
> >    {
> >
> >         do
> >         {
> >             scan_status =3D mdlScan_file (elemAddr, &scanWords,
> > sizeof(elemAddr), &filePos);
> >             numAddr =3D scanWords / sizeof(short);
> >
> >             for (i=3D0; i<numAddr; i++)
> >             {
> >                 MSElementDescr *elDP=3DNULL;
> >
> >                 mdlWorkDgn_read(&elDP,elemAddr[i],f,NULL,0);
> > mdlElmdscr_read (&elDP, elemAddr[i], f, FALSE, NULL);
> >
> >
> >                 /* THIS LINE IS THE ONE WHICH IS FAILING */
> > mdlElement_extractRange(&vector, &elDP->el);
> >
> > origin =3D vector.org; end =3D vector.end;   if
> > (origin.y > yMax)
> >               yMax =3D origin.y;              if (end.y > yMax)
> >                     yMax =3D end.y;
> >   if(elDP) mdlElmdscr_freeAll(&elDP); }
> >           } while (scan_status =3D=3D BUFF_FULL);
> >
> >    }
> >         return yMax;
> > }
> >
> >
> > Daniel MacNeil wrote:
> >> The only way to see multiple files in the view windows at the same time
> >> is to use refernce files.
> >>
> >> Dan
> >>
> >> grotero@telecable.es wrote:
> >> > Is posible to open a new file and work with it while still seing the
> >> > actual one in the workspace?.
> >> > I hope you understand me.
> >> >
> >> > Thanks.
> >> >
> >

0
Reply olaf 7/26/2006 11:26:57 AM

7 Replies
586 Views

(page loaded in 0.184 seconds)

Similiar Articles:













7/24/2012 11:21:34 AM


Reply: