I (Frank Warmerdam - warmerdam@pobox.com) took the document under my wing circa Nov/2000 converted to HTML (for readability), and started adding notes on reverse engineered portions of the format.
Type: Stores: 8. Digitizer setup Used only by IGDS; it is ignored by MicroStation. 9. Terminal Control Block Settings that are saved when FILEDESIGN is executed (File menu/Save Settings). See the appendix "Terminal Control Block (TCB). 10. Level symbology The symbology (color, line style, and line weight) that elements on a level display with in a view for which Level Symbology is on.
A complex element is a set of elements that logically forms a single entity.
Complex elements are stored in the design file as a header followed by the component elements. Text nodes, complex chains, and complex shapes are stored in the design file as shown in the illustration at right.
Other complex elements are cells, surfaces, solids, and B-splines. See the sections about those elements for information about how their headers and component elements are arranged in the design file.
The complex element header contains information about the entire set of elements, including the number of component elements. Word 19 of the header contains the total length in words of the component elements plus the number of words following word 19 in the header.
The maximum combined length of the header and all component elements cannot be greater than 65535 words.
Note: The in-memory format of elements on the Intergraph CLIPPER, Sun SPARC, and Hewlett Packard HP700 differs slightly from the figures in this appendix. Long integers always start on even word boundaries, and double-precision, floating point values always start on four-word boundaries in this format.
In design files:
Insert meaningful explanation of D-Float format here.
typedef struct { unsigned level:6 ; /* level element is on */ unsigned :1 ; /* reserved */ unsigned complex:1 ; /* component of complex elem.*/ unsigned type:7 ; /* type of element */ unsigned deleted:1 ; /* set if element is deleted */ unsigned short words ; /* words to follow in element */ unsigned long xlow ; /* element range - low */ unsigned long ylow ; unsigned long zlow ; unsigned long xhigh ; /* element range - high */ unsigned long yhigh ; unsigned long zhigh ; } Elm_hdr ;In addition, the next several components of all displayable elements are identical. This additional header is defined as follows:
typedef struct { unsigned short grphgrp ; /* graphic group number */ short attindx ; /* words between this and attribute linkage */ union { short s ; struct { unsigned class:4 ; /* class */ unsigned res:4 ; /* reserved by Intergraph */ unsigned l:1 ; /* locked */ unsigned n:1 ; /* new */ unsigned m:1 ; /* modified */ unsigned a:1 ; /* attributes present */ unsigned r:1 ; /* view independent */ unsigned p:1 ; /* planar */ unsigned s:1 ; /* 1=nonsnappable */ unsigned h:1 ; /* hole/solid (usually) */ } b ; } props ; union { short s ; Symbology b ; } symb ; } Disp_hdr ; Here, Symbology is defined as: typedef struct { unsigned style:3 ; /* line style */ unsigned weight:5 ; /* line weight */ unsigned color:8 ; /* color */ } Symbology ; /* element symbology word 652 */
The fields in the first word are:
U clear if element is active; set if the element is deleted Type number that denotes the element's type C set if the element is part of a complex element; otherwise clear R reserved (equals zero) Level number that indicates the element's level (0-63)
For complex elements, this defines the length of the header element only and does not include component elements.
All points in an element must be completely contained in the design plane.
Bit Indicates: H For closed element types (shape, complex shape, ellipse, cone, B-spline surface header, and closed B-spline curve header), the H-bit indicates whether the element is a solid or a hole. * 0 = Solid * 1 = Hole For a cell header (type 2), if the H-bit is: * 0 = Header for a cell * 1 = Header for an orphan cell (created by GROUP SELECTION or application) For a line, if the H-bit is: * 0 = Line segment * 1 = Infinite-length line For a point string element, if the H-bit is: * 0 = Continuous * 1 = Disjoint The H-bit has no meaning in other elements. S Whether the element is snappable. * 0 = Snappable * 1 = Not snappable P If a surface is planar or non-planar. * 0 = Planar * 1 = non-planar R Element orientation * 0 = Oriented relative to design file * 1 = Oriented relative to screen A Whether attribute data is present * 0 = Attribute data not present * 1 = Attribute data present M Whether the element has been graphically modified * 0 = Not modified * 1 = Has been modified N Whether the element is new * 0 = Not new * 1 = New (set to 1 when the element is placed) L Whether the element is locked. * 0 = Not locked * 1 = Locked 4-7 Reserved. Class Represented as follows: 0. Primary; 1. Pattern component; 2. Construction element; 3. Dimension element; 4. Primary rule element; 5. Linear patterned element; 6. Construction rule element.
Color Number (0-255) that indicates the element's color Weight Number (0-31) that indicates line weight Style The line style is represented as follows: * 0. Solid (SOL) * 1. Dotted (DOT) * 2. Medium dashed (MEDD) * 3. Long-dashed (LNGD) * 4. Dot-dashed (DOTD) * 5. Short-dashed (SHD) * 6. Dash double-dot (DADD) * 7. Long dash-short dash (LDSD)
typedef struct { long x ; long y ; } Point2d ; typedef struct { long x ; long y ; long z ; } Point3d ;Sometimes a point that is not within the design plane needs to be specified. For example, the center point for an arc may be far from the design plane, although the design plane must completely contain the arc. In these cases, points are specified as two or three double-precision (64-bit), floating point values:
typedef struct { double x ; double y ; } Dpoint2d ; typedef struct { double x ; double y ; double z ; } Dpoint3d ;
In 3D design files, an element's orientation is represented by the transformation matrix to design file coordinates. These transformations are stored in a compressed format called quaternions. Quaternions store a 3x3 ortho-normal transformation matrix as four values rather than nine.
The mdlRMatrix_toQuat function (MDL) and the trans_to_quat routine (MicroCSL) generate a quaternion from a transformation matrix. The mdlRMatrix_fromQuat function (MDL) and the quat_to_trans routine (MicroCSL) generate a transformation matrix from a quaternion. See the documentation for these functions for details.
Attribute data that is not associated with DMRS or a MicroStation-supported database such as Oracle is referred to as a user linkage. A user linkage can co-exist with a database linkage or other user linkages. MicroStation does not attempt to interpret user linkages; these linkages are, however, maintained when MicroStation modifies an element. When an element with a user linkage is copied, the linkage is also copied. Therefore, multiple linkages can occur.
The format of user linkages is described below. As with other linkages, when user linkages are present, the A-bit must be set in the properties word. Individual user linkages cannot exceed 256 words. Multiple user linkages can be attached to an element. The combined length of an element and its linkages must not be greater than 768 words. Considering worst-case element lengths, the length of the linkage area should not exceed 140 words.
User linkages consist of a header word, a user ID word, and user-defined data. The U-bit in the linkage header is set to indicate that the linkage is a user linkage. The ID word should be unique to the software package to which the linkage applies.
Based on reverse engineering selected user linkages I think the following is true of user linkages (see db_link.doc for details of database linkages):
Start Byte | # of Bytes | Format | Description |
---|---|---|---|
0 | 2 | LSB Int16 | Header word, always 0x1007. |
2 | 2 | LSB Int16 | ID code, always 0x0041. |
4 | 4 | unknown filler. | |
8 | 1 | byte | Fill color. |
9 | 7 | unknown filler. |
Most of the information in the TCB has not been decoded, but the following key fields are known. Raw integer coordinates in the file must be converted into master user units by dividing by the number of uors per subunit, and the number of master units per subunit.
Start Byte | # of Bytes | Format | Description |
---|---|---|---|
0 | 28 | Standard element header. | |
28 | 18 | various flags | |
46 | 1062 | 9 118 byte ViewInfo structures. | |
1108 | 4 | DGN Int32 | master units per design (?) |
1112 | 4 | DGN Int32 | Units of resolution per subunit. |
1116 | 4 | DGN Int32 | Subunits per master unit. |
1120 | 2 | char | Name of subunits. |
1122 | 2 | char | Name of master units. |
1124 | 90 | unknown | |
1214 | 1 | byte | The 0x40 bit of this byte is 1 if the file is 3D, otherwise 0. |
1215 | 25 | unknown | |
1240 | 8 | VAX Double | Global Origin (X) in UORs |
1248 | 8 | VAX Double | Global Origin (Y) in UORs |
1256 | 8 | VAX Double | Global Origin (Z) in UORs |
1264 | 272 | unknown |
The values of the range are zero.
If the high bit in the next-to-last word (yhigh?) of the range is set, then the low three bits are flags for selectively using the three components of the level symobology words.
The format of each level symbology word is the same as that for Element symbology.
Here, Symbology is defined as:
typedef struct { unsigned style:3; /* line style */ unsigned weight:5; /* line weight */ unsigned color:8; /* color */ } Symbology;
Start Byte | # of Bytes | Format | Description |
---|---|---|---|
0 | 28 | Standard element header (without Disp_hdr) | |
28 | 128 | UInt16 | 64 standard symbology words. |
The celltype member indicates the following types of cells:
0. Graphic cell 1. Command menu cell 2. Cursor button menu cell 3. Function key menu cell (not supported by MicroStation) 4. Matrix menu cell 5. Tutorial cell 6. Voice menu cell (not supported by MicroStation)The C definition is as follows:
typedef struct { Elm_hdr ehdr ; /* element header */ short celltype ; /* cell type */ short attindx ; /* attribute linkage */ long name ; /* Radix-50 cell name */ unsigned short numwords ; /* # of words in description */ short properties ; /* properties */ short dispsymb ; /* display symbology */ short class ; /* cell class (always 0) */ short levels[4] ; /* levels used in cell */ short descrip[9] ; /* cell description */ } Cell_Lib_Hdr ;
A cell definition can be nested -- included in another cell. A nested cell definition is stored as a cell header (type 2) that points to a library cell header (type 1). The component elements of a nested cell are not repeated.
When the user places a cell in the design file in IGDS and versions of MicroStation prior to Version 4.0, or as an unshared cell in MicroStation Version 4.0 or later versions, it is placed as a cell header (type 2) followed by its component elements. Each nested cell definition is placed with its cell header (type 2) followed by its component elements.
In MicroStation Version 4.0 or later versions, when the user places the cell in the design file as a shared cell:
typdef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ unsigned short totlength ; /* total length of cell */ long name ; /* Radix 50 name */ short class ; /* class bit map */ short levels[4] ; /* levels used in cell */ Point2d rnglow ; /* range block low */ Point2d rnghigh ; /* range block high */ Trans2d trans ; /* transformation matrix */ Point2d origin ; /* cell origin */ } Cell_2d; typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ unsigned short totlength ; /* total length of cell */ long name ; /* Radix 50 name */ short class ; /* class bit map */ short levels[4] ; /* levels used in cell */ Point3d rnglow ; /* range block low */ Point3d rnghigh ; /* range block high */ Trans3d trans ; /* transformation matrix */ Point3d origin ; /* cell origin */ } Cell_3d;Each cell header contains an origin (in design file coordinates) and a transformation matrix that describe all manipulations (rotation and scaling) from the cell library definition to the current design file orientation. The transformation matrix is a 2x2 or 3x3 matrix stored as a long integer with the lower-order bit equal to 4.6566E-6 (10,000231).
Note: Shared cells are stored in the design file as shared cell definition and shared cell instance elements. These elements are not described in this appendix. They cannot be manipulated directly and must be accessed with MDL built-in functions.
The radix 50 name field should be interpreted as two separate 16bit radix 50 values producing up to 6 output characters. Radix 50 information is available at various places on the web, and the conversion to ascii is found in dgnlib as the DGNRad50ToAscii() function.
The trans structures are defined as follows.
typedef struct { long t11; long t12; long t21; long t22; } Trans2d; typedef struct { long t11; long t12; long t13; long t21; long t22; long t23; long t31; long t32; long t33; } Trans3d;Corrupt table omitted in html conversion.
typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ Point2d start ; /* starting point */ Point2d end ; /* ending point */ } Line_2d; typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ Point3d start ; /* starting point */ Point3d end ; /* ending point */ } Line_3d;
typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ short numverts ; /* number of vertices */ Point2d vertice[1] ; /* points */ } Line_String_2d ; typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ short numverts ; /* number of vertices */ Point3d vertice[1] ; /* points */ } Line_String_3d ;The curve (type 11) element is a 2D or 3D parametric spline curve completely defined by a set of n points. The first two and last two points define endpoint derivatives and do not display. The interpolated curve passes through all other points.
A curve with n points defines n-1 line segments; interpolation occurs over the middle n-5 segments. Each segment has its own parametric cubic interpolation polynomial for the x and y (and z in 3D) dimensions. The parameter for each of these polynomials is the length along the line segment. Thus, for a segment k, the interpolated points P are expressed as a function of the distance d along the segment as follows:
Pk(d) = {Fk,x(d), Fk,y(d), Fk,z(d)} with 0 <= d <= DkFk,x, Fk,y, and Fk,z are cubic polynomials and Dk is the length of segment k. In addition, the polynomial coefficients are functions of the segment length and the endpoint derivatives of Fk,x, Fk,y, and Fk,z. The subscript k is merely a reminder that these functions depend on the segment.
The cubic polynomials are defined as follows:
Fk,x = axd3 + bxd2 + cxd + Xk cx = tk,x bx = [3(Xk+1-Xk)/Dk - 2tk,x - tk+1,x] / Dk ax = [tk,x + tk+1,x - 2(xk+1-xk)/Dk] / Dk2The m variable is analogous to the slope of the segment.
If (|mk+1,x-mk,x| + |mk-1,x-mk-2,x|) <> 0, then: tk,x = (mk-1,x|mk+1,x-mk,x| + mk,x|mk-1,x-mk-2,x|) / (|mk+1,x-mk,x| + |mk-1,x-mk-2,x|) else: tk,x = (mk,x+mk-1,x) / 2 mk,x = (Xk+1 - Xk) / Dk Fk,y(d) and Fk,z(d) are defined analogously.NOTE: The original document had else: tk,x = (mk+1,x+mk,x) / 2, which I believe to be in error, and have corrected. Caveat Emptor. See dgnstroke.cpp in the dgnlib distribution for an example of implementing the curve equations.
typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ unsigned short totwords ; /* total words following */ short numstrngs ; /* # of text strings */ short nodenumber ; /* text node number */ byte maxlngth ; /* maximum length allowed */ byte maxused ; /* maximum length used */ byte font ; /* text font used */ byte just ; /* justification type */ long linespc ; /* line spacing */ long lngthmult ; /* length multiplier */ long hghtmult ; /* height multiplier */ long rotation ; /* rotation angle */ Point2d origin ; /* origin */ } Text_node_2d ; typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ unsigned short totwords ; /* total words following */ short numstrngs ; /* # of text strings */ short nodenumber ; /* text node number */ byte maxlngth ; /* maximum length allowed */ byte maxused ; /* maximum length used */ byte font ; /* text font used */ byte just ; /* justification type */ long linespc ; /* line spacing */ long lngthmult ; /* length multiplier */ long hghtmult ; /* height multiplier */ long quat[4] ; /* quaternion rotations */ Point3d origin ; /* origin */ } Text_node_3d ;
Left/Top (0) Center/Top (6) Right margin/Top (9) Left/Center (1) Center/Center (7) Right margin/Center (10) Left/Bottom (2) Center/Bottom (8) Right margin/Bottom (11) Left margin/Top (3) Right/Top (12) Left margin/Center (4) Right/Center (13) Left margin/Bottom (5) Right/Bottom (14)
typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ unsigned short totlength ; /* total length of surface */ unsigned short numelems ; /* # of elements in surface */ short attributes[4] ; /* to reach min. element size */ } Complex_string ;Four words of attribute data are included in complex chains and shapes to ensure that they are at least 24 words long, which is the minimum element length required for some Intergraph file processors.
Note that the totlength field is the number of 2byte words following the totlength field to the end of the last shape that is a component in this complex group. It will be the sum of the sizes of the children and the header itself less the 19 words of the header up to the totlength value.
The actual attributes of the complex header can start at word 20, so the attributes[] portion is not necessarily unused. But if there are no real attributes, at least these four bytes of space will still be consumed.
Word Offset 0-17 Header 18 Words in Description complex_string.totlngth 19 Number of Elements complex_string.numelems 20 Four Byte complex_string.attributes 21 22 23 24 A Linkage
typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ double primary ; /* primary axis */ double secondary ; /* secondary axis */ long rotation ; /* rotation angle */ Dpoint2d origin ; /* origin */ } Ellipse_2d ; typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ double primary ; /* primary axis */ double secondary ; /* secondary axis */ long quat[4] ; /* quaternion rotations */ Dpoint3d origin ; /* origin */ } Ellipse_3d ;
typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ long startang ; /* start angle */ long sweepang ; /* sweep angle */ double primary ; /* primary axis */ double secondary ; /* secondary axis */ long rotation ; /* rotation angle */ Dpoint2d origin ; /* origin */ } Arc_2d ; typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ long startang ; /* start angle */ long sweepang ; /* sweep angle */ double primary ; /* primary axis */ double secondary ; /* secondary axis */ long quat[4] ; /* quaternion rotations */ Dpoint3d origin ; /* origin */ } Arc_3d ;
Parameter: Description Primary and Defined by two double-precision floating point values that specify the lengths secondary axes in UORs of the semi-major and semi-minor axes. The primary axis is not necessarily the longest (semi-major) axis, but the axis whose orientation is specified by the rotation angle or quaternion. Orientation Rotation angle or quaternion defines the orientation of the primary axis with respect to the design file coordinate system. Origin (center) Expressed as double-precision floating point coordinates. The center itself need not be within the design plane although the entire arc definition must be within the design plane. Start angle Expressed in the same format as a 2D rotation angle. It defines the counterclockwise angle in the plane of the arc from the primary axis to the starting point of the arc on a unit circle. Sweep angle Represents the sweep of the arc along a unit circle. It is in the same format as a 2D rotation angle except that the sign bit indicates the direction of sweep, 0=counterclockwise, 1=clockwise. Note that MicroStation interprets the special case of a 0d sweep angle as a 360d sweep angle.
typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ byte font ; /* text font used */ byte just ; /* justification type */ long lngthmult ; /* length multiplier */ long hghtmult ; /* height multiplier */ long rotation ; /* rotation angle */ Point2d origin ; /* origin */ byte numchars ; /* # of characters */ byte edflds ; /* # of enter data fields */ char string[1] ; /* characters */ } Text_2d ; typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ byte font ; /* text font used */ byte just ; /* justification type */ long lngthmult ; /* length multiplier */ long hghtmult ; /* height multiplier */ long quat[4] ; /* quaternion angle */ Point3d origin ; /* origin */ byte numchars ; /* # of characters */ byte edflds ; /* # of enter data fields */ char string[1] ; /* characters */ } Text_3d ;These parameters define the text.
Parameter: Description Font A single byte is used to store the font for a text element. This number corresponds to the appropriate font definition in the font library. Length and height The basic character size is 6 UORs wide and 6 UORs high (4 UORs of width multipliers and 2 of spacing). The length and height multipliers specify the scale factors to be applied to the basic character size to determine the true size of the text string. The multipliers are stored as long integers with the lower order bit set. Mirrored text is identified by a negative length multiplier. The maximum multiplier value is 2,147,483.648 (231/1000). The maximum text size is therefore 12,884,898 UORs (6 x 2,147,483.648). Orientation The rotation angle or quaternion defines the orientation of a text element relative to the design file coordinate system. Justification and At the time of placement, the active text justification determines how text origin is positioned about the user-defined origin. The origin stored in a text element is always the lower left of the text element. It is necessary to use the justification value to compute the user-defined origin. There are nine possible justifications for text elements: Enter data fields Areas within a text element that can be easily modified by the user. Each enter data field in a text string is specified by three bytes appended to the element. The first byte specifies the character number in the string (relative to 1) that is the first character in the enter data field. The second byte specifies the number of characters in the field. The third byte defines the justification of the non-blank characters within the field (-1=left, 0=center, +1=right). Note that if the number of characters is odd, the first enter data field specification does not lie on a word boundary, and if there are no enter data fields, there are no specification bytes. Left/Top (0) Center/Top (6) Right/Top (12) Left/Center(1) Center/Center (7) Right/Center (13) Left/Bottom(2) Center/Bottom (8) Right/Bottom (14)
A solid (type 19) is capped at both ends -- it encloses a volume. A surface (type 18) is not capped on the ends -- it encloses no volume. Surface and solid headers are identical except for their type number. The C definition is as follows:
typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ unsigned short totlength ; /* total length of surface */ unsigned short numelems ; /* # of elements in surface */ byte surftype ; /* surface type */ byte boundelms ; /* # of boundary elements-1 */ #ifdef unix short filler #endif short attributes[4] ; /* unknown attribute data */ } Surface ;
For surfaces, the following values are used. 0=Surface of projection 1=Bounded Plane 2=Bounded Plane 3=Right circular cylinder 4=Right circular cone 5=Tabulated cylinder 6=Tabulated cone 7=Convolute 8=Surface of revolution 9=Warped surface For solids (capped surfaces), the following values are used. 0=Volume of projection 1=Volume of revolution 2=Volume defined by boundary elements Word Offset 0-17 Header 18 Words in Description surface.totlngth 19 Number of Elements surface.numelems 20 Surface Type surface.type 21 A Linkage
Elements are stored in a surface or solid in a strict order. Boundary elements (class=0) appear first after the surface/solid header. The second boundary element immediately follows the first boundary and is followed by any rule lines connecting the first and second boundary. If additional boundary elements are included they should follow this same pattern with the boundary elements preceding the rule lines that connect it to the previous boundary.
Point strings can be defined as either contiguous or disjoint. Contiguous point strings are displayed with lines connecting the vertices. Disjoint point strings are displayed as a set of discrete points. Both types are placed and manipulated in the same way, but exhibit slightly different characteristics when snapping or locating.
It is impossible to define a point string structure in C because all point locations are stored before any of the orientations.
Description Range The range of the point string element is the range of the points. Properties The H-bit (bit 15) of the properties word indicates the type of point string (0 = continuous, 1 = disjoint) for display purposes. The setting of the planar bit indicates whether the points are coplanar. Number of points The maximum number of vertices allowed in a single point string is 48. A longer series of points is formed by combining multiple elements in a complex chain. Point coordinates An array contains the X and Y coordinates for 2D points or the X, Y, and Z coordinates for 3D points as integer values. Point orientations An array contains the rotation matrices (2D) or quaternions (3D) describing the points' orientations with respect to the drawing axes. The coefficients of the matrices, as well as the quaternions, lie within the range of -1 to 1. These values are stored as signed double-precision integers with the low-order bit equal to 1/(231-1). Therefore, to convert these coefficients to floating point, the integers must be divided by 231-1.
typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ short unknown ; /* unknown data */ long quat[4] ; /* orientation quaternion */ Dpoint3d center_1 ; /* center of first circle */ double radius_1 ; /* radius of first circle */ Dpoint3d center_2 ; /* center of second circle */ double radius_2 ; /* radius of second circle */ } Cone_3d ;
Parameters Description Orientation The orientation for both circles is defined by a single set of quaternions. Radii The radii for the circles are stored as double-precision floating point values. Either of these values may be zero to cause a pointed cone. Word Offset 0-17 Header 18 cone.rsrv 19 Quaternion cone.quat 20 21 Q1 22 23 Q2 24 25 Q3 26 27 X1 cone.center 1 28 29 30 31 Y1 32 33 34 35 Z1 36 37 38 39 R1 cone.radius 1 40 41 42 43 X2 cone.center 2 44 45 46 47 Y2 48 49 50 51 Z2 52 53 54 55 R2 cone.radius 2 56 57 58 59 A Linkage
type 24, 25, 25, 25, ... , 21, 21, 21... or type 24, 25, 25, 25, ... , 21, 28, 21, 28... or type 24, 26, 25, 25, 25, ... , 21, 21, 21... or type 24, 26, 25, 25, 25, ... , 21, 28, 21, 28...
typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ long desc_words ; /* # of words in descr. */ struct { unsigned order:4 ; /* B-spline order - 2 */ unsigned curve_display:1 ; /* curve display flag */ unsigned poly_display:1 ; /* polygon display flag */ unsigned rational:1 ; /* rationalization flag */ unsigned closed:1 ; /* closed curve flag */ unsigned curve_type:8 ; /* curve type */ } flags ; short num_poles ; /* number of poles */ short num_knots ; /* number of knots */ } Bspline_curve ;
#KNOTS = #POLES - ORDER (open curves) #KNOTS = #POLES -1 (closed curves) Word Offset 0-17 Header 18 Words in Description Bspline_curve.dhdr.totlngth 19 20 Bspline_curve.flags 21 Number of Poles Bspline_curve.num_poles 22 Number of Knots Bspline_curve.num_knots 23 A Linkage
typedef struct bspline_surface { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ long desc_words ; /* # words in description */ struct { unsigned order:4 ; /* B-spline U order - 2 */ unsigned curve_display:1 ; /* surface display flag */ unsigned poly_display:1 ; /* polygon display flag */ unsigned rational:1 ; /* rationalization flag */ unsigned closed:1 ; /* closed U surface flag*/ unsigned curve_type:8 ; /* surface type */ } flags ; short num_poles_u ; /* number of poles */ short num_knots_u ; /* number of knots */ short rule_lines_u ; /* number of rule lines */ struct { unsigned short v_order:4 ; /* B-spline order - 2 (v Direction) */ short reserved1:2 ; /* reserved */ unsigned short arcSpacing:1 ; /* rule lines spaced by arc length */ unsigned short v_closed:1 ; /*closed curve flag */ unsigned short reserved2:8 ; /* reserved */ } bsurf_flags ; short num_poles_v ; /* number of poles */ short num_knots_v ; /* number of knots */ short rule_lines_v ; /* number of rule lines */ short num_bounds ; /* number of boundaries */ } Bspline_surface ;
#KNOTS_U = #POLES_U - ORDER_U (surfaces open in U) #KNOTS_U = #POLES_U -1 (surfaces closed in U)
#KNOTS_V = #POLES_V - ORDER_V (surfaces open in V) #KNOTS_V = #POLES_V -1 (surfaces closed in V)
Word Offset 0-17 Header 18 Boundary Number Bsurf_boundary.number 19 Number of Vertices Bsurf_boundary.numverts 20 X1 Bsurf_boundary.vertices[0] 21 22 Y1 23 24 X2 25 26 Y2 27 XN Bsurf_boundary.vertices[n-1] YN A Linkage
typedef struct bsurf_boundary { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ short number ; /* boundary number */ short numverts ; /* number of boundary vertices */ Point2d vertices[1] ; /* boundary points (in UV space)*/ } Bsurf_boundary ;
Word Offset 0-17 Header 18 Boundary Number Bsurf_boundary.number 19 Number of Vertices Bsurf_boundary.numverts 20 X1 Bsurf_boundary.vertices[0] 21 22 Y1 23 24 X2 25 26 Y2 27 XN YN A Linkage
typedef struct bspline_knot { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ long knots[1] ; /* knots (variable length) */ } Bspline_knot;
Word Offset 0-17 Header 18 K1 Bspline_knot.knots[0] 19 20 K2 21 KN Bspline_knot.knots[n-1] A Linkage
typedef struct bspline_weight { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ long weights[1] ; /* weights (variable length) */ } Bspline_weight ;
Word Offset 0-17 Header 18 W1 Bspline_weight.weights[0] 19 20 W2 21 WN Bspline_weight.weights[n-1] A Linkage
Start Byte | # of Bytes | Format | Description |
---|---|---|---|
0 | 36 | Standard element header, including display parameters. | |
36 | 4 | LSB Int32 | tag value |
40 | 2 | LSB Int16 | version |
42 | 2 | LSB Int16 | flags |
44 | 24 | Not sure, perhaps 2 3d points for positioning? | |
68 | 4 | LSB Int32 | setDefId - Id for the tagset this tag is related to. |
72 | 2 | LSB Int16 | Tag id - used to find the entry in the tag list of a tag set definition. |
74 | 2 | LSB Int16 | dataType (1=string, 3=integer, 4=float, 5=attr (4bytes)) |
76 | 74 | unknown | |
150 | 2 | LSB Int16 | dataBytes |
152 | 2 | LSB Int16 | newDataBytes |
154 | variable | value |
typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ unsigned long totlength ; /* total length of cell */ Raster_flags flags ; /* misc. raster data*/ byte foreground ; byte background ; unsigned short xextent ; unsigned short yextent ; short reserved[2] ; double resolution ; double scale ; Point3d origin ; unsigned short numverts ; Point2d vert2d[1] ; } Raster_hdr2d; typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ unsigned long totlength ; /* total length of cell */ Raster_flags flags ; /* misc. raster data */ byte foreground ; byte background ; unsigned short xextent ; unsigned short yextent ; short reserved[2] ; double resolution ; /* currently unused */ double scale ; Point3d origin ; unsigned short numverts ; Point3d vert3d[1] ; } Raster_hdr3d ;The raster flags are described in a C structure as follows:
typedef struct { unsigned right:1 ; unsigned lower:1 ; unsigned horizontal:1 ; unsigned format:5 ; unsigned color:1 ; /* not used by MicroStation */ unsigned transparent:1 ; unsigned positive:1 ; /* not used by MicroStation */ unsigned unused:5 ; } Raster_flags ;
Word Offset 0-17 Header 18 Words in Description raster_hdr.totlngth 19 20 raster_hdr.raster_flags 21 raster_hdr.foreground.background 22 X Pixel Extent raster_hdr.xextent 23 Y Pixel Extent raster_hdr.yextent 24 Reserved raster_hdr.reserved 25 26 Resolution raster_hdr.resolution 27 28 29 30 Scale raster_hdr.scale 31 32 33 34 X Origin 35 36 Y Origin 37 38 Z Origin 39 40 Number of Vertices raster_hdr.numverts 41 X1 raster_hdr.vertice(0) 42 43 Y1 44 45 X2 46 47 Y2 48 XN YN A Linkage
typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ Raster_flags flags ; /* flags */ byte foreground ; byte background ; unsigned short xoffset ; unsigned short yoffset ; unsigned short numpixels ; byte pixel[1] ; } Raster_comp ;
Word Offset 0-17 Header 18 raster_comp.raster_flags 19 raster_comp.foreground.background 20 X Pixel Offset raster_comp.xoffset 21 Y Pixel Offset raster_comp.yoffset 22 Number of Pixels raster_comp.numpixels 23 raster_comp.pixel
typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /*display header */ short file_chars ; /* no. of chars. in file spec */ char file_spec[65] /*file specification */ byte file_num ; /* file number */ Fb_opts fb_opts ; /* file builder options mask */ Fd_opts fd_opts ; /* file displayer options mask*/ byte disp_flags[16] ; /* display flags */ short lev_flags[8][4] ; /* level on/off flags */ long ref_org[3] ; /* origin in ref file uors */ double trns_mtrx[9] ; /* transformation matrix */ double cnvrs_fact ; /* conversion factor */ long mast_org[3] ; /* origin in master file uors */ short log_chars ; /* characters in logical name */ char log_name[22] ; /* logical name (padded) */ short desc_chars ; /* characters in description */ char description[42] ; /* description (padded) */ short lev_sym_mask ; /* level symbology enable mask*/ short lev_sym[63] ; /* level symbology descriptor */ long z_delta ; /* Z-direction delta */ short clip_vertices ; /* clipping vertices */ Point2d clip_poly[1] ; /* clipping polygon */ } Ref_file_type5 ; typedef struct { unsigned multi_attach:1 ; /* multi-attach */ unsigned one_one_map:1 ; /* 1:1 mapping */ unsigned slot_in_use:1 ; /* slot in use */ unsigned upd_fildgn:1 ; /* update on file design */ unsigned db_diff_mf:1 ; /* database dif than mas file */ unsigned snap_lock:1 ; /* snap lock */ unsigned locate_lock:1 ; /* locate lock */ unsigned missing_file:1 ; /* missing file */ unsigned unused:8 ; /* unused */ } Fb_opts ; typedef struct { unsigned view_ovr:1 ; /* view override */ unsigned display:1 ; /* display */ unsigned line_width:1 ; /* lines with width */ unsigned unused:13 ; /* unused */ } Fd_opts ;For information about the MicroStation reference file attachment element (type 66, level 5) and when a reference file attachment must be stored as that type rather than a type 5, see MicroStation Application Elements (Type 66).
typedef struct { Elm_hdr ehdr ; /* element header */ short grphgrp ; /* graphics group number */ short attindx ; /* words between this and attributes */ short properties ; /* property bits (always same) */ unsigned num_views:3 ; /* number of views */ unsigned reserved:13 ; /* reserved for Intergraph */ char viewdef_descr[18] ; /* view definition descr. */ byte full_scr1 ; byte full_scr2 ; Viewinfo view[1] ; char rest_of_elem[1] ; /* record has variable len. */ }Named_view_type5 ; typedef struct { unsigned fast_curve:1 ; /* fast curve display */ unsigned fast_text:1 ; /* fast text */ unsigned fast_font:1 ; /* fast font text */ unsigned line_wghts:1 ; /* line weights */ unsigned patterns:1 ; /* pattern display */ unsigned text_nodes:1 ; /* text node display */ unsigned ed_fields:1 ; /* enter data field underlines */ unsigned on_off:1 ; /* view on or off */ unsigned delay:1 ; /* delay on */ unsigned grid:1 ; /* grid on */ unsigned lev_symb:1 ; /* level symbology */ unsigned points:1 ; /* points */ unsigned constructs:1 ; /* line constructs */ unsigned dimens:1 ; /* dimensioning */ unsigned fast_cell:1 ; /* fast cells */ unsigned def:1 ; } Viewflags ; typedef struct { Viewflags flags ; /* view flags */ short levels[4] ; /* active levels (64 bit array) */ Point3d origin ; /* origin (made up of longs) */ Upoint3d delta ; /* delta to other corner of view*/ double transmatrx[9] ; /* view transformation matrix */ double conversion ; /* conv. from digitizer to uors */ unsigned long activez ; /* view active z */ } Viewinfo ;
typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ short screen_flag ; /* screen flag */ byte color_info[256][3] ; /* color table info. */ } Color_table_type5 ;
Type 66 elements are not supported by IGDS. Early versions of IGDS may report that the type 66 elements are invalid when MicroStation design files are uploaded to a VAX. This problem was corrected in later versions. In MicroStation, type 66 elements can be deleted from a design file with one of the DELETE66ELEMENTS commands.
A reference file attachment must be stored as a type 66 element if any of the following are true:
typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ Uspoint2d extentlo ; /* bottom left of active area of tablet */ Uspoint2d extenthi ; /* top right of active area of tablet */ Uspoint2d origin ; /* origin for the screen-mapped portion */ Uspoint2d corner ; /* corner for the screen-mapped portion */ short defined ; /* TRUE = transform valid */ double trans[3][4] ; /* trans. from digitizer to dgn. file coords. */ double stream_delta ; /* sampling delta (UORs) */ double stream_tol ; /* shortest segment that must be saved */ double angle_tol ; /* angle above which point must be saved */ double area_tol ; /* area above which point must be saved */ short extrawords[8] ; /* currently unused */ } MicroStation_dig ;
typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ double axlock_angle ; /* axis lock angle */ double axlock_origin ; /* axis lock origin */ Ext_viewinfo ext_viewinfo[8] ; /* ext'd view info. strucs.*/ Ext_locks ext_locks ; /* extended lock bits */ long activecell ; /* active cell (Radix 50) */ double actpat_scale ; /* active patterning scale */ long activepat ; /* active patterning cell */ long actpat_rowspc ; /* active patterning row spacing */ double actpat_angle ; /* active patterning angle */ double actpat_angle2 ; /* active patterning angle */ long actpat_colspc ; /* active patterning column spacing */ long actpnt ; /* active point (Radix 50) */ double actterm_scale ; /* active line terminator scale */ long activeterm ; /* active line terminator */ short hilitecolor[2] ; /* hilite color for two screens */ short fullscreen_cursor ; /* keypoint snap flag */ short keypnt_divisor ; /* divisor for keypoint snapping */ char celfilenm[50] ; /* local cell lib. name */ short xorcolor[2] ; /* exclusive or color */ } Mstcb_elm ;The Ext_viewinfo and Ext_locks structures are defined as follows:
typedef struct ext_viewinfo { Ext_viewflags ext_flags ; /* extended flags */ short classmask ; /* class masks */ short unused ; /* reserved for future use */ double perspective ; /* perspective disappearing point */ short padding[52] ; /* reserved for future use */ } Ext_viewinfo ; typedef struct ext_viewflags { #ifndef (mc68000) unsigned fill:1 ; /* true if element fill enabled */ unsigned unused1:15 ; /* reserved for future use */ unsigned unused:16 ; /* reserved for future use */ #else unsigned unused:16 ; /* reserved for future use */ unsigned unused1:15 ; /* reserved for future use */ unsigned fill:1 ; /* true = element fill enabled */ #endif } Ext_viewflags ; typedef struct ext_locks { #ifndef mc68000 unsigned axis_lock:1 ; /* Axis Lock */ unsigned auxinp:1 ; /* auxiliary input device */ unsigned show_pos:1 ; /* continuous coordinate display */ unsigned autopan:1 ; /* automatic panning */ unsigned axis_override:1 ; /* override Axis Lock */ unsigned cell_stretch: 1 ; /* cell stretching */ unsigned iso_grid:1 ; /* isometric grid */ unsigned iso_cursor:1 ; /* isometric cursor */ unsigned full_cursor: 1 ; /* full screen cursor (PC only)*/ unsigned iso_plane:2 ; /* 0=Top, 1=Left, 2=Right, 3=ALL*/ unsigned selection_set:1 ; /* enable selection set */ unsigned auto_handles:1 ; /* select elements upon placement */ unsigned single_shot:1 ; /* single shot tool selection */ unsigned dont_restart:1 ; /* set if command doesn't want to be restarted */ unsigned view Single_shot:1 ; /* single shot view commands */ unsigned snapCnstplane:1 ; /* snap to construction plane */ unsigned cnstPlanePerp:1 ; /* snap perpendicular to construction plane */ unsigned fillMode:1 ; /* not currently used */ unsigned iso_lock:1 ; /* isometric lock */ unsigned unused2:12 ; /* reserved for future use */ #else unsigned unused2:12 ; /* reserved for future use */ unsigned iso_lock:1 ; /* isometric lock */ unsigned fillMode:1 ; /* not currently used */ unsigned cnstPlanePerp:1 ; /* snap perpendicular to construction plane */ unsigned snapCnstplane:1 ; /* snap to construction plane */ unsigned viewSingle_shot:1 ; /* single shot view commands */ unsigned dont_restart:1 ; /* set if command doesn't want to be restarted */ unsigned single_shot:1 ; /* single shot tool selection */ unsigned auto_handles:1 ; /* select elements when placed */ unsigned selection_set:1 ; /* enable selection set */ unsigned iso_plane:2 ; /* 0=Top, 1=Left, 2=Right, 3=ALL */ unsigned full_cursor: 1 ; /* full screen cursor (PC only)*/ unsigned iso_cursor:1 ; /* isometric cursor */ unsigned iso_grid:1 ; /* isometric grid */ unsigned cell_stretch: 1 ; /* cell stretching */ unsigned axis_override:1 ; /* override Axis Lock */ unsigned autopan:1 ; /* automatic panning */ unsigned show_pos:1 ; /* continuous coord. display*/ unsigned auxinp:1 ; /* auxiliary input device */ unsigned axis_lock:1 ; /* Axis Lock */ #endif } Ext_locks ;
typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ char startappcommand[256] ; /* app. command line */ short reserved[110] ; } MicroStation_Startapp ;
The general format is shown as a C structure below.,p>
typedef struct { Elm_hdr ehdr ; /* element header */ Disp_hdr dhdr ; /* display header */ short signature ; /* assigned signature */ . . /* application data */ . } Ms_appdata ;)
A tag set has a name, a few poorly understood flags, and a list of tag definitions. Each tag definition includes a name, type, prompt, default value and some flags.
Start Byte | # of Bytes | Format | Description |
---|---|---|---|
0 | 36 | Standard element header, including display parameters. | |
36 | 8 | unknown, usually 0x0100810F00000000. | |
44 | 2 | LSB Int16 | tag count |
46 | 2 | LSB Int16 | flags? |
48 | variable | string (zero term.) | tag set name. |
variable | 1 | zero byte, meaning unknown. |
This header section is followed by the following information for each tag defined.
Start Byte | # of Bytes | Format | Description |
---|---|---|---|
start+0 | variable | string (zero term.) | tag name. |
variable | 2 | LSB Int16 | Tag id. |
variable | variable | string (zero term.) | User Prompt |
variable | 2 | LSB Int16 | Tag type string (1=string, 3=integer, 4=float) |
variable | 5 | Five zero bytes, meaning unknown. | |
variable | variable | variable | Default value. If type is 1 this is a zero terminated string. If type is 3 this is an LSB Int32. If 4 it is an 8 byte Vax floating point value. |