home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 January
/
Chip_1997-01_cd.bin
/
ms95
/
disk22
/
dir08
/
f013770.re_
/
f013770.re
Wrap
Text File
|
1996-04-02
|
3KB
|
83 lines
/*----------------------------------------------------------------------+
| |
| Copyright (1993-1995) Bentley Systems, Inc., All rights reserved. |
| |
| "MicroStation" is a registered trademark and "MDL" and "MicroCSL" |
| are trademarks of Bentley Systems, Inc. |
| |
| Limited permission is hereby granted to reproduce and modify this |
| copyrighted material provided that the resulting code is used only |
| in conjunction with Bentley Systems products under the terms of the |
| license agreement provided therein, and that this notice is retained |
| in its entirety in any such reproduction or modification. |
| |
+----------------------------------------------------------------------*/
/*----------------------------------------------------------------------+
| |
| $Logfile: J:/mdl/examples/clibmgr/utils.mcv $
| $Workfile: utils.mc $
| $Revision: 1.2 $
| $Date: 13 Jul 1995 12:52:50 $
| |
+----------------------------------------------------------------------*/
/*----------------------------------------------------------------------+
| |
| Function - |
| |
| This MC is an example of how to read a cell out of cell library |
| that is not attached to the Microstation session |
| |
+----------------------------------------------------------------------*/
#include <mdl.h>
#include <stdio.h>
#include <tcb.h>
#include <mscnv.fdf>
#include <mselmdsc.fdf>
#include <msfile.fdf>
Private int clibMgr_getCell
(
MSElementDescr **cellEdPP,
char *cellName
)
char patternSpec[MAXFILELENGTH], patternName[MAXFILELENGTH];
ULong rad50Name, filePos = 0L;
FILE *fp;
MSElementDescr *edP;
if (mdlFile_find (patternSpec, patternName, "MS_CELL", NULL) ||
(fp = fopen (patternSpec, "rb")) == NULL)
return UnableToOpenCellLib;
rad50Name = 0L;
mdlCnv_fromAsciiToR50 (strlen (cellName), cellName, &rad50Name);
while ((filePos = mdlWorkDgn_read (&edP, filePos, fp, -1, FALSE)))
{
if (edP->el.ehdr.type == CELL_LIB_ELM &&
edP->el.cell_lib_hdr.name == rad50Name)
{
if (tcb->ndices==3)
{
mdlElmdscr_convertTo3D (cellEdPP, edP,
FIXEDDEPTH, 0, NULL, 0);
mdlElmdscr_freeAll (&edP);
}
else
{
*cellEdPP = edP;
}
fclose (fp);
return SUCCESS;
}
else
{
mdlElmdscr_freeAll (&edP);
}
}
fclose (fp);
return CantFindCell;
}