Chapter 3 -- Data Types



The types explained in this chapter are built into the DCAL compiler. There are standard types (like integers, booleans, and reals) and more complex types (like entity, mode_type, and file) that are used to communicate with the DataCAD database and to read and write to files.

Standard Types

atrname

atrname is a twelve-character string used for the name of an attribute.

atraddr

atraddr is the logical address of an attrib. atraddr has a base type of lgl_addr. This is used mainly in reading attributes. For more information, see the "Data Routines" chapter.

bezarr

bezarr is defined as:

bezarr = ARRAY [1..20] OF point;

bezarr is used in b-spline and Bezier curve entities to store the array of defining points, which is restricted to twenty points in these entities.

boolarr

boolarr is defined as:

boolarr = ARRAY [1..maxpnts] OF boolean;

boolarr is used in polygon and slab entities to determine which line segments are drawn and which are not.

boolean

The type boolean can have only true and false values. Booleans are used for logical operations.

char

The type char is an eight-bit (0-255) ASCII value that uses the IBM extended ASCII character set. Character literals are enclosed in double quotes (") and use the same backslash sequences as string literals (see string).

integer

DCAL supports the primitive type integer, with values ranging from -32768 to +32767.

lgl_addr

lgl_addr is the base type for several types that involve drawing database memory addresses, including entaddr, symaddr, atraddr, pvtaddr, and viewaddr. These address types are of the same size, and essentially interchangeable. It is in their semantic usage that the source or type of the address is crucial.

DCAL allows type conversion of equal size variables using type casting. The procedure setnil and the function isnil take parameters of type lgl_addr.

See "pvtaddr" or "viewaddr" for an example of

type casting using lgl_addr.

longint

The type longint is a four-byte long integer.

The operations currently allowed on a longint are to convert a real to a longint (round4 and trunc4) and to convert a string to and from a longint (cvlntst and cvstlnt).

Do not perform arithmetic operations on long integers.

modmat

modmat is the built-in type for a modeling matrix. This type is used for general three- dimensional manipulations. It is defined as:

modmat = ARRAY [1..4, 1..4] OF real;

For more information, see "Modeling Matrix Routines" in the "Data Routines" chapter.

plot_type

plot_type is the type used by the plotting system for storing information pertaining to a single call. This type may not be examined.

pnt4arr

This type is used to define an entity type block. pnt4arr is defined as:

pnt4arr = ARRAY [1..4] OF point;

pntarr

pntarr is used in polygons, slabs, and contours to store the array of defining vertices. This version restricts this to 36 points in any of these entities. pntarr is defined as:

pntarr = ARRAY [1..maxpnts] OF point;

pntmat

This type is used to define a mesh surface entity. This built-in type is defined as:

pntmat = ARRAY [1..4, 1..4] OF point;

point

A point is a built-in record of reals. It is defined as:

point = RECORD

x : real;

y : real;

z : real;

END;

The individual coordinates that make up a point are accessed by:

VAR

x1, y1, z1 : real;

pt : point;

BEGIN

x1 := pt.x;

y1 := pt.y;

z1 := pt.z;

pvtaddr

pvtaddr is the type of address used to access polyverts.

VAR

vaddr : pvtaddr;

...

setnil (lgl_addr (vaddr));

IF isnil (lgl_addr (vaddr) THEN

{ vaddr is equal to nil }

END;

The type pvtaddr has a base type of lgl_addr. DCAL allows for type conversion of variables of equal size with type casting.

The procedure setnil and the function isnil take parameters of type lgl_addr. They may be used with variables of type pvtaddr via type casting. In the above example, setnil and isnil are used on variables of type pvtaddr by the use of type casting to type lgl_addr.

real

The real type is an IEEE single precision, floating point number, having an approximate range of

+0.1E-63 to +0.999999E63

-0.1E-63 to -0.999999E63

Real number literals cannot begin with a period, they must begin with a number. Thus, you must write 0.4 instead of .4.

string

A string is a dynamic-length array of characters. Every string has two lengths associated with it, the maximum length (which is the length specified when the string is defined) and a current dynamic length. The built-in type string is not actually a type, but an operator that returns a string of a specified maximum length.

String literals are enclosed in single quotes ('). Inside a string literal the backslash (\) character is used to allow entry of control characters. The recognized sequences are:

\\Backslash character (\)

\eEscape character

\tTab character

\rCarriage return

\nNewline

\vVertical tab

\bBackspace

\fForm feed

\'Single quote

\"Double quote

\ddd ASCII character specified by octal ddd

\xdd ASCII character specified by hex dd

For example, declaring a variable str : string (30); creates a variable named str that has a maximum length of 30 characters. If we were to assign to that string str := 'Good morning'; then the current dynamic length of the string (as returned by the function strlen) would be 12.

Because a string is an array of characters, the individual characters of a string may be accessed through indices. If chr were of type char, then with chr := str [4]; the fourth character in str (d) would be assigned to chr. str [0] contains the dynamic length of the string and should not be changed. Accessing str [13] in the example returns either garbage or a run-time error, because the current dynamic length of the string is 12.

str8

str8 is a predefined string eight characters long. That is, str8 is the same as string (8).

str80

str80 is a predefined string 80 characters long.

str255

str255 is a predefined string 255 characters long.

symstr

symstr is a 63-character long string used for the internal name of a symbol.

symaddr

symaddr is the logical address of the definition of a symbol, similar to entaddr. symaddr has a base type of lgl_addr.

Complex Types

attrib

attrib is used for an attribute. An attribute can be attached to the drawing as a whole (system attribute), a layer, a symbol (the symbol definition), or to any entity (including an instance of a symbol). An attribute has a name and a value.

attrib is defined as:

attrib = RECORD

atrtype : integer;

name : atrname;

addr: atraddr;

visible : boolean;

positn : point;

txtcolor: integer;

txtsize : real;

txtang : real;

txtslant: real;

txtaspect : real;

CASE integer OF

atr_str : (str: str80);

atr_int : (int: integer);

atr_rl: (rl : real);

atr_dis : (dis: real);

atr_ang : (ang : real);

atr_pnt : (pnt: point);

atr_addr : (lgladdr : lgl_addr);

END

Like symbol and entity, there are other fields that are not accessible. The name of the attribute must be unique for any given entity, symbol, or layer.

* addr is the address of the attribute.

* When the attribute belongs to an entity and is to be drawn, the field visible is set to true.

* The value of the attribute is converted to a string (using atr_2str) and displayed at positn.

* The text color, size, etc., are given by the txtcolor, txtsize, txtang, txtslant, and txtaspect fields.

When the field name of the attribute is NOT visible, all the fields between positn and txtaspect, inclusive, are not saved in the database. You can change the type and visibility of an attribute with atr_update.

entity

The type entity is used to read and write from DataCAD's database. The DataCAD drawing database is a collection of entities on layers. Entities can be any of the DataCAD primitives: lines, arcs, circles, text, etc. entity is a complex case-variant record.

The description of entity follows. Notice that there is a variant for every type of entity. The description given here is NOT exact: other fields exist that are not given here; and fields may not overlap.

entity = RECORD

enttype : integer;

ltype   : integer;

width   : integer;

spacing : real;

ovrshut : real;

color   : integer;

attr    : integer;

addr    : entaddr;

lyr     : layer;

user0   : integer;

user1   : integer;

user2   : integer;

user3   : integer;

frstatr : atraddr;

lastatr : atraddr;

CASE integer OF

entLin:  (  linPt1  : point;
            linPt2  : point);


entLn3:  (  ln3Pt1  : point;
            ln3Pt2  : point);
 

entMrk : (  mrkPnt  : point;
            mrkVec  : point;
            mrkTyp  : integer;
            mrkSiz  : integer);

entArc : (  arcCent : point;
            arcRad  : real;
            arcBang : real;
            arcEang : real;
            arcBase : real;
            arcHite : real);

entCrc : (  crcCent : point;
            crcRad  : real;
            crcBase : real;
            crcHite : real);

entEll : (  ellCent : point;
            ellRadx : real;
            ellRady : real;
            ellBang : real;
            ellEang : real;
            ellAng  : real;
            ellBase : real;
            ellHite : real);

entTxt : (  txtPnt  : point;
            txtSize : real;
            txtAng  : real;
            txtSlant: real;
            txtAspect : real;
            txtStr  : str255;
            txtBase : real
            txtHite : real;
            txtFont : str8);

entBez : (  bezNpnt : integer;
            bezPnt  : bezarr;
            bezBase : real);

entBsp : (  bspNpnt : integer;
            bspPnt  : bezarr;
            bspBase : real);

entBlk : (  blkPnt  : pnt4arr);

entCnt : (  cntPnt  : pntarr;
            cntTanpnt1 : point;
            cntTanpnt2 : point;
            cntNpnt : integer;
            cntType : integer;
            cntDivs : integer;
            cntStiff: real);

entDim : (  dimPt1  : point;
            dimPt2  : point;
            dimPt3  : point;
            dimTxtpt: point;
            dimExo1 : real;
            dimExo2 : real;
            dimExe  : real;
            dimDli  : real;
            dimAng  : real;
            dimOvr  : real;
            dimTxtsize     : real;
            dimArrsize     : real;
            dimArratio     : real;
            dimTxtaspect  : real;
            dimTxtang      : real;
            dimBase        : real;
            dimTxtslant    : real;
            dimDis         : real;
            dimInc         : integer;
            dimNlpts       : integer;
            dimTxtweight  : integer;
            dimTictype     : integer;
            dimType        : integer;
            dimLeader      : boolean;
            dimTih         : boolean;
            dimToh         : boolean;
            dimSe1         : boolean;
            dimSe2         : boolean;
            dimMan         : boolean;
            dimTad         : boolean;
            dimNolftmrk    : boolean;
            dimNorhtmrk    : boolean;
            dimTicweight  : integer;
            dimDINstd      : boolean;
            dimTxtofs      : real;
            dimFont        : str8;
            dimLdrpnts     : ARRAY [1..9] OF point;
 

entPln : (  plnFrst : pvtaddr;
            plnLast : pvtaddr;
            plnClose: boolean;
            plnBase : real;
            plnHite : real);

entSym : (  symName : symstr;
            symAddr : symaddr;
            symMod  : modmat);

entPly : (  plyNpnt : integer;
            plyPnt  : pntarr;
            plyIsln : boolarr;
            plyFrstvoid : entaddr;
            plyLastvoid : entaddr);

entSlb : (  slbNpnt : integer;
            slbPnt  : pntarr;
            slbThick: point:
            slbIsln : boolarr;
            slbFrstvoid : entaddr;
            slbLastvoid : entaddr);

entAr3 : (  ar3Mod  : modmat;
            ar3Div  : integer;
            ar3Rad  : real;
            ar3Bang : real;
            ar3Eang : real;
            ar3Close: boolean);

entCon : (  conMod  : modmat;
            conDiv  : integer;
            conRad  : real;
            conCent : point;
            conBang : real;
            conEang : real;
            conClose: boolean);

entCyl : (  cylMod  : modmat;
            cylDiv  : integer;
            cylRad  : real;
            cylLen  : real;
            cylBang : real;
            cylEang : real;
            cylClose: boolean);

entTrn : (  trnMod  : modmat;
            trnDiv  : integer;
            trnCent : point;
            trnRad1 : real;
            trnRad2 : real;
            trnBang : real;
            trnEang : real;
            trnClose: boolean);

entDom : (  domMod  : modmat;
            domDiv1 : integer;
            domDiv2 : integer;
            domRad  : real;
            domBang1: real;
            domBang2: real;
            domEang1: real;
            domEang2: real;
            domClose: boolean);

entTor : (  torMod  : modmat;
            torDiv1 : integer;
            torDiv2 : integer;
            torRad1 : real;
            torRad2 : real;
            torBang1: real;
            torBang2: real;
            torEang1: real;
            torEang2: real;
            torClose: boolean);

entSrf : (  srfPnt  : pntmat;
            srfSdiv : integer;
            srfTdiv : integer);

entRev : (  revBang : real;
            revEang : real;
            revMod  : modmat;
            revDiv1 : integer;
            revDiv2 : integer;
            evFrst  : pvtaddr;
            revLast : pvtaddr;
            revType : integer);

END;

You can change all the fields except addr, which is the address of the entity in the database. Changing lyr and replacing the entity in the database moves the entity from one layer to another. See the "Data Routines" chapter for routines to manipulate the database. Each entity type is explained below:

* enttype is the type of the entity, such as

entlin, entcrc, etc. This determines which of the case-variant sections apply.

* ltype is the line type.

* width is the line weight, with the default single line being a weight of one.

* spacing is the distance over which the line type repeats itself. This is measured in world coordinates.

* ovrshut is the line overshoot distance, measured in world coordinates.

* color is the color of the entity, using the constants in the "Constants" chapter.

* attr is an integer used by DataCAD to determine what operation created the entity.

* lyr is the address of the layer that the entity is on.

* user0, user1, user2, and user3 are reserved for the use of the macro writer. DataCAD does not change or examine these.

* frstatr and lastatr are pointers to the list of attributes for this entity.

* For an entity of type entLin, linPt1 and linPt2 are the two end points of the line. The z values of these points are used as the base and height of the line. For entLn3, the points ln3Pt1 and ln3Pt2 are the end points of the line. The line is drawn from ln3Pt1 to ln3Pt2.

* An entity of type entMrk is the basic marker or point entity. The marker is drawn at mrkPnt. mrkVec is currently unused, and may be used by the macro. The type of the marker is given by mrkTyp, and is given in the following table:

1 square

2 "x"

3 diamond

4 dot

When mrkTyp is any other value, nothing is drawn. This is a valid condition. mrkSiz is the size of the marker in pixels.

* An entity of type entArc has its center at arcCent. The z value of arcCent is unused. The radius of the arc is arcRad. arcBang is the beginning angle of the arc. arcEang is the ending angle of the arc. Angles are measured in radians, with 0 to the right, increasing in a counterclockwise direction. The base of the arc is at arcBase and the height is at arcHite.

* All fields of the entCrc entity are similar to the fields for entArc, but starting and ending angles are not required.

* entEll is the entity for an ellipse. The center is at ellCent. The z value is ignored. The distance from the center to the edge of the ellipse in the x direction is given by ellRadx, and in the y direction by ellRady. The starting angle of the ellipse is ellBang and the ending angle ellEang. The entire ellipse is rotated at an angle of ellAng. The bottom of the ellipse is at elevation ellBase, and the top is at ellHite.

* The data for a text string is given in the entTxt case. The text is drawn with the lower left corner of the string at txtPnt. The height of the characters is given by txtSize, measured in drawing units. The text is rotated at an angle of txtAng. The angle of slant is txtSlant, with 0 being no slant. The aspect ratio is txtAspect: 1 is normal, 2 results in narrow characters (still txtSize tall). The characters themselves are in the string txtStr. The bottom of the text is at elevation txtBase and the top is at txtHite. The font name for the string is txtFont, note that txtFont does not contain a pathname or extension.

* entBez is a Bezier curve entity. Bezier curves are defined by an array of points. The number of points is given by bezNpnt. The array of points is bezPnt. The curve is drawn at a z height of bezBase.

* entBsp is a b-spline entity. B-splines are defined the same as Bezier curves.

* The block entity, entBlk, is similar to a cube, but can be sheared in all three directions. All four points in the array blkPnt must be defined. The first point (blkPnt [1]) is the corner vertex for the block. The other three points define the three adjacent vertices on the block in any order. Since opposite faces of the block are parallel, each face is a parallelogram.

* entCnt is the definition of a three- dimensional contour curve. The node points are stored in the array cntPnt. The number of points on the curve is cntNpnt. cntType specifies the type of curve: 0 is a natural curve, 1 is a cyclic curve, 2 is a tangent curve. When cntType is 2 cntTanpnt1 is the tangent point at the start of the curve and cntTanpnt2 is the tangent point at the end of the curve. cntDivs is the number of line segments to draw between successive points on the curve. This is slightly different from the divisions as defined in other entities. cntStiff determines how stiff the contour is at the node points; it should be between 0.5 and 2.0, with 1.0 being neutral.

* An associative dimension is of entity type entDim; the most complicated entity type. dimPt1 is the first point dimensioned to; dimPt2 is the second point dimensioned to; dimPt3 is the point that defines where the dimension line itself is drawn. dimPt3 is the third point entered at the DataCAD standard dimensioning menu. dimTxtpt is the point where the text is drawn; it is valid only when the text is manually placed, dimMan is true. dimExo1 is the offset from the first point, dimPt1, to the start of the first extension line; similarly, dimExo2 is the offset from the second point, dimPt2, to the start of the second extension line. dimExe is the extension line extension, the distance the extension line is drawn past the dimension line. dimDli is the dimension line increment and is the distance each dimension line is incremented in the baseline dimensioning case; it is used when FixdDis is turned on in the linear dimensioning DimStyle menu. dimAng is the angle of the dimension line and is only valid when the dimension style is rotated. dimOvr is the dimension line overrun distance; the distance the dimension line extends past the extension lines. dimTxtsize is the size of the text to draw. dimArrsize is the arrow size, relative to the dimTxtsize; when dimArrsize is 1.0, the arrow size is the same as the text size. dimArratio is the aspect ratio of the arrows. dimTxtaspect is the text aspect ratio. dimTxtang is the text angle, relative to the x axis, not relative to the dimension line. dimBase is the z coordinate at which the associative dimension is drawn. dimTxtslant is the text slant angle. dimDis is the distance to use when the dimension is drawn. It is calculated when the entity is read from the database by ent_get. dimInc is used when baseline dimensions are changed at the dimensioning change menu. dimInc is the number given to the dimension when it was entered; the first dimension has dimInc = 1, the second has dimInc = 2, etc. When dimDli is changed, the dimension line position is recalculated using dimInc. dimNlpts is the number of leader points defined in the field dimLdrpnts; the maximum number of leader points is 9. dimTxtweight is the weight of the text when it is drawn. dimTictype is the tic mark type: for 0 arrows are drawn, for 1 tic marks are drawn, and for 2 circles are drawn. dimType is the dimension orientation type: for 0 the dimension is horizontal, for 1 the dimension is vertical, for 2 the text is aligned with dimPt1 and dimPt2, for 3, the dimension is rotated at angle dimAng. dimLeader is true when a leader line is drawn (see dimNlpts and dimLdrpnts). dimTih is the text-inside- horizontal flag; when text is automatically placed and fits inside the extension lines, and dimTih is true, text is horizontal; otherwise text aligns with the dimension line. dimToh is the text-outside-horizontal flag, and is similar to dimTih but applies when a leader is drawn (dimLeader is true). dimSe1 (suppress extension line 1) is true when the first extension line (the one that comes from dimPt1) is NOT drawn. dimSe2 is the same for the second extension line. dimMan is true when text is placed manually. When this is the case, text is placed at dimTxtpt. dimTad is the text- above-dimension-line flag; it controls placing the dimension text inside the dimension line. When dimTad is true, text is placed above the dimension line; when it is false, the dimension line is broken into two lines and text is placed inside the dimension line. dimNolftmrk is a flag that controls the drawing of the left tic mark; when it is true, no left tic mark is drawn. dimNorhtmrk is a flag that controls the drawing of the right tic mark; when it it true, no right tic mark is drawn. dimTicweight is the weight used to draw tic marks. dimDINstd is true when text is entered with a European version of DataCAD. dimTxtofs is only used when dimMan is false and dimTad is true. When this is the case, dimTxtofs is the offset from the dimension line to the text string. dimFont is the font used to draw the text.

* entPln is a polyline consisting of a collection of polyverts. The address of the first polyvert is plnFrst. The polyverts are in a linked list structure (see the discussion in this chapter on polyvert). The last polyvert is pointed to by plnLast. When the polyline is closed (that is, there is a line between the last polyvert and the first polyvert), plnClose is true. The polyline is drawn at a z base of plnBase and a z height of plnHite.

* An instance of a symbol is an entity of type entSym. The symbol name is symName; in the DataCAD template system, this is the same as the file that the symbol came from, without the .sym extension. This is not necessarily the case in a macro, however. The modeling matrix governing the placement of this particular symbol is symMod. The field symAddr is the address of the symbol of which this is an instance; this field is valid only after reading an entity from the database. This field should NEVER be altered.

* A three-dimensional polygon is of type entPly. The number of points in a polygon is plyNpnt; this number must be between 3 and 36. The points themselves are contained in the array plyPnt, indexed from 1 to plyNpnt. The corresponding array plyIsln is used to determine if a line is actually drawn on every edge of the polygon. When plyIsln [1] is true, a line is drawn from plyPnt [1] to plyPnt [2], and so on for every vertex. This method can be used to simulate much larger polygons by joining polygons but not drawing their connecting edges. plyFrstvoid is the first void in the chain entities which are voids in the polygon. plyLastvoid is the last void entity in the chain. For more information, see the "Data Routines" chapter on manipulating voids.

* entSlb is similar to entPly. All of the corresponding fields have the same meaning. The additional field slbThick determines the thickness and shear of the slab. The distance and angle from slbPnt [1] to slbThick determine the overall thickness and shear of the entire slab. While slbThick is interpreted relative to the first point of the slab, its value is in absolute, not relative, coordinates.

* The general three-dimensional arc is of type entAr3. The modeling matrix for the arc is ar3Mod, which specifies all translations, rotations, and scalings for the arc. This allows you to have elliptical arcs. The number of divisions used when drawing the arc is ar3Div, with a maximum of 36. This number is based on a complete circle, so when 36 is specified and only one quarter of a circle is drawn, nine divisions are used. The radius of the arc is ar3Rad. The beginning and ending angles are ar3Bang and ar3Eang, respectively. When ar3Close is true, a line is drawn from the starting point to the ending point of the arc.

* entCon is the entity type for a cone. The modeling matrix attached to the cone is conMod. The number of divisions, conDiv, is similar to ar3Div. The radius of the base of the cone is conRad. The cone's center is at the origin of a local coordinate system. conTip is relative to the origin. conMat transforms the local coordinate system into world (drawing) coordinates. Note that this form of definition allows a skewed cone. The beginning and ending sweep angles are conBang and conEang, respectively. When conClose is true, the cone has a triangular polygon connecting the starting and ending sides. See also the entTrn description.

* The entity for a cylinder is described in the entCyl section. The modeling matrix is cylMod. The number of divisions used to draw the cylinder is cylDiv. The radius of the cylinder is cylRad. The length of the cylinder is cylLen. The center is at the origin of a local coordinate system. The beginning and ending sweep angle are cylBang and cylEang, respectively. When cylinder is closed, cylClose is true.

* The data for a truncated cone is listed in the entTrn section. The modeling matrix is trnMod. The number of divisions used to draw the truncated cone is trnDiv. This is similar to ar3Div. The center of the base of the cone is trnCent. The radius at the bottom is trnRad1, and at the top trnRad2. The beginning and ending sweep angles are trnBang and trnEang. When the truncated cone is closed, trnClose is true.

* entDom is the entity type used for a dome or sphere. domMod is the modeling matrix used to translate, rotate, and scale the dome. The suffix 1 on fields represents the sweep direction, and the suffix 2 represents the rise direction; domDiv1 is the number of divisions to use in the sweep direction, and domDiv2 is the number of divisions to use in the rise direction. The radius of the dome is domRad. The beginning and ending sweep angles are domBang1 and domEang1. The beginning and ending rise angles are domBang2 and domEang2, respectively. The range of values valid for domBang2 and domEang2 is from -halfpi to halfpi. To draw the top half of a dome, domBang2 would be 0, and domEang2 would be halfpi. When the dome is a closed figure domClose is true.

* The torus entity is entTor. The modeling matrix for this entity is torMod. Like the dome (entDom), the suffix 1 represents values for the sweep direction and the suffix 2 is used for values in the roll direction. torRad1 is the sweep radius, and torRad2 is the roll radius. When the torus is closed torClose is true.

* The mesh surface entity is described in the entSrf section. The matrix of points defining the mesh is contained in srfPnt. The number of divisions to divide the surface into in each direction is srfSdiv and srfTdiv.

* entRev is the definition for a surface of revolution entity. A surface of revolution consists of a profile made up of a collection of polyverts, and a collection of data defining the orientation, type, and angles of the surface. revFrst and revLast are the addresses of the first and last polyverts (copious data) which define the surface's profile. Only the x and y coordinates of the polyverts are used in the definition of the profile, the z coordinates are ignored. revMod is a modeling matrix which describes the local frame of reference of the surface. The x and y coordinates of the polyverts describe the surface profile in the local xz plane; defining the profile in an xy local coordinate system. The axis of sweep for the surface, however, remains the local z axis, and is thus consistent with other circular entities such as cylinders and tori. revBang and revEang are the beginning and ending angles of sweep, respectively. revDiv1 is the number of segment divisions in the sweep direction, and revDiv2 is the number of segment divisions in the roll direction for any profile vertices which are defined as bulges (similar to a torus). revType may take on one of the values, 1, 2, or 3 to determine whether or not the surface is a closed solid or an open surface: 1 indicates an open surface, 2 indicates closed at the ends, describing a solid object, and 3 indicates an entity is closed at the sides, describing a solid, doughnut-like object.

entaddr

Every entity has an address in the database associated with it. The address of the entity is of type entaddr. This address is used to read the entity from the database and to put the entity back into the database. entaddr has a base type of lgl_addr. An address which points to nothing is equal to nil. See the procedure isnil.

file

A file in DCAL represents a disk file, either a text or blocked data file. The file variable references a disk file. A filename can contain a drive and pathname. Use forward or backward slashes in the pathname. When backslashes are used, they must appear in the string as two backslashes, for example:

\\dcad\\dcad.exe or /dcad/dcad.exe

See "string" in this section for more information.

Note that any file or device can be opened as a file. This is how you can write to the console. Just put the screen into text mode, open a text file called CON:, and write to it. You can also write to the printer in this way.

polyvert

polyvert is the type used for the copious data associated with polylines and surfaces of revolution. Polyverts belong only to entities of type polyline or surface of revolution. In either case, the polyverts are arranged in a double-linked chain and the addresses of the first and last polyvert in the chain are stored with the entity. For an entity of type entpln, the fields containing these addresses are ent_plnfrst and ent_plnlast. For an entity of type entrev, the fields containing these addresses are ent_revfrst and ent_revlast.

For entities of type polyline (entpln) and surface of revolution (entrev), any number of polyverts may be added to the entity (up to the limit of the size of the drawing file). Unlike polygons, slabs, and contour curves where there is currently a limit of 36 vertices or knots, polylines, and surfaces of revolution may have any number of polyverts associated with them.

polyvert = RECORD

addr: pvtaddr;

next: pvtaddr;

prev: pvtaddr

shape : integer;

pnt : point;

bulge : real;

nextpnt : point;

last: boolean;

END;

Each entity type is explained below:

* addr is the address of this polyvert in the database. Of course, if the polyvert was not read out of the database, the value of this address is invalid. next is the address of the next polyvert in the chain and prev is the address of the previous polyvert in the chain. When next and/or prev are nil, they are the last or first polyverts in the chain respectively. shape may have one of two constant values: pv_vert and pv_bulge. The constant value pv_vert coincides with a polyvert which consists of a point and a straight line connected to the next polyvert in the list. The constant value pv_bulge coincides with a polyvert which consists of a point and an arc connected to the next polyvert in the list.

* nextPnt contains the x, y, and z coordinates of the next polyvert in the list. In this way a typical call to polyvert_get reads not only the contents of the polyvert indicated by the address passed in polyvert_get, but also the coordinates of the next polyvert in the list. The field last is true when the polyvert is the last polyvert in the list (the next field is equal to nil).

* When shape = pv_vert, the bulge field is ignored. When a polyvert has a shape of pv_bulge, bulge is a real number which may take on a value between minus infinity and plus infinity. When bulge is zero, the polyvert indicates a straight line between it and the next polyvert in the list (same as pv_vert). When bulge is equal to 1.0 the polyvert defines a semi-circle to the left side of a line between the polyvert and the next polyvert in the list. When bulge is equal to -1.0 the polyvert defines a semi- circle to the right side of a line between the polyvert and the next polyvert in the list.

As you can see, a single polyvert by itself is insufficient to describe a given line or arc segment, but requires information from the following polyvert to determine the complete geometry between any two vertices. The record structure of a polyvert and the routines for managing polyverts are designed to take this into account. A variable of type polyvert contains both the coordinates of the vertex belonging to the polyvert itself as well as the coordinates of the polyvert which follows it in the chain. For the last polyvert in the list, DataCAD's polyvert management routines circle back to the top of the list to the "following" polyvert.

mode_type

Use mode_type to read through DataCAD's drawing database. This variable is used by DataCAD to keep track of what type of entities you want to read from the database. You can read through the database in many ways by using the appropriate mode_type.

By setting a variable of mode_type while searching the drawing database, you effectively restrict the search to a subset of entities. You could restrict the search to a group, selection set, or symbol; to a subset of layers; to a subset of types of entities; or to a certain region in the drawing. These mode search restrictions can be built upon each other to further limit the reading of the database to an intersection of the above subsets of entities. This technique of reading the database is one of the most important and powerful concepts in DCAL.

scanLineType

The type scanLineType defines the pattern for the scan lines that generate a hatch pattern.

scanLineType = RECORD

ang : real;

origin : point;

delta : point;

numdash : integer;

dash : ARRAY [1..maxDash] OF real;

dashDraw: ARRAY [1..maxDash] OF boolean;

{ these fields do NOT need to be set }

dashPart : ARRAY [1..maxDash] OF point;

dashTotal : real;

END;

Each entity type is explained below:

* The angle of the hatch pattern is ang.

* The hatch pattern is calculated starting at origin.

* delta contains the x and y values of the hatch pattern delta values.

* The number of dashes in the hatch pattern is numdash.

* The dash lengths are stored in the array dash.

* dashDraw is a corresponding array that determines whether each dash pattern is drawn or if it is a 'skip' in the dash pattern.

* The last two fields, dashpart and dashtotal, are used internally and need not be set.

symbol

The definition of a symbol is represented by a variable of type symbol. This is the definition of the geometry of a symbol, not an instance of one.

symbol is defined as:

symbol = RECORD

name: symstr;

frstent : entaddr;

lastent : entaddr;

frstatr : atraddr;

lastatr : atraddr;

min : point;

max : point;

addr : symaddr;

refFlag : boolean;

num : integer;

END;

All of the fields, with the exception of refFlag, may be examined but not modified. refFlag may be modified. Each entity type is explained below:

 

* name is the unique symbol name.

* frstent and lastent are pointers to the first and last entities that define the geometry of the symbol.

* frstatr and lastatr are pointers to the first and last attributes assigned to the definition of the symbol.

* min and max are the minimum and maximum extents, respectively, of the untransformed symbol.

* addr is the address of the symbol.

* For a description of refFlag, see "sym_ref" in the "Data Routines" chapter.

* num is the number of instances of the symbol. This value is not constantly updated. See "sym_count". num may be read but never written to.

viewaddr

viewaddr is the type of address used to access saved views. The type viewaddr has a base type of lgl_addr. DCAL allows for type conversion of variables of equal size via type casting.

VAR

vaddr : viewaddr;

...

setnil (lgl_addr (vaddr));

IF isnil (lgl_addr (vaddr) THEN

{ vaddr is equal to nil }

END;

The procedure setnil and the function isnil take parameters of type lgl_addr. They may be used with variables of type viewaddr with type casting. In the above example, setnil and isnil are used on variables of type viewaddr using type casting to type lgl_addr.

view_type

Use variables of type view_type for two different purposes when working with the viewer and saved views. A view_type can be used to calculate, interrogate, and update the current view and projection throughout DataCAD. Secondly, a view_type represents the object which is stored and retrieved from a drawing database when using saved views. These two functions can be used with each other.

The information contained in a variable of view_type is not necessarily in a form which makes the physical interpretation of a view obvious. A view_type is designed for efficiency in performance and space requirements. Therefore, some of the fields in a view_type variable are used for more than one purpose depending upon the type of projection and the value of other fields in the view variable. Some of the fields of a view_type are derived so that changing them does not necessarily change the view directly. However, the parameters for manipulating views are flexible enough that you can create a wide variety of views including animated sequences, slide shows, and multiple viewport output displays.

view_type = RECORD

addr : viewaddr;

next : viewaddr;

prev : viewaddr;

projtype : integer;

viewmat : modmat;

clipmat : modmat;

editmat : modmat;

inptmat : modmat;

clipon : boolean;

name : str8;

clipmin : point;

clipmax : point;

windxmin : real;

windymin : real;

scale : real;

scalenum : integer;

viewcent : point;

perseye : point;

persdis : real;

togglelyr : boolean;

frstlyr : lgl_addr;

lastlyr : lgl_addr;

currlyr : lgl_addr;

flag1 : boolean

flag2 : boolean

END;

The meaning of the fields of a view_type are as follows:

* addr is the address of the view when the view is read from the chain of saved views in the database. addr is valid only when the view is read from the database using view_get, or added to the database using view_add. When the current viewing parameters were read into the view using view_getcurr, addr is undefined.

* next is the address of the next view in the chain of saved views. When the view variable is the last view in the chain of saved views, next is equal to nil. next is valid only when the view is read from the database using view_get, or added to the database using view_add. When the current viewing parameters were read into the view using view_getcurr, next is undefined.

* prev is the address of the previous view in the chain of saved views. When the view variable is the first view in the chain of saved views, prev is equal to nil. prev is valid only when the view is read from the database using view_get, or added to the database using view_add. When the current viewing parameters are read into the view using view_getcurr, prev is undefined.

* projtype is the type of projection which the view represents. projtype may take on one of the four constants: vmode_orth, vmode_para, vmode_pers, and vmode_oblq which represent orthographic, parallel, perspective, or oblique projections, respectively. The remaining fields in a view_type vary in their interpretation depending upon the value of projtype. Setting projtype to a value other than one these four constants causes an error. Never assign vmode_edit or vmode_all to projtype. Use these constants only with the function getpointp and the procedure view_checkmode.

* viewmat is the primary viewing matrix. The value and interpretation of viewmat depends upon the projection type and whether or not clipping cubes are turned on for the view. For orthographic, parallel, or oblique projections with clipping cubes off, viewmat contains the complete and general viewing transformation. For orthographic, parallel, or oblique projections with clipping cubes on, viewmat contains the portion of the viewing transformation prior to clipping to the three-dimensional cube. When clipping cubes are turned on for the view, viewmat is normally the identity matrix and clipmat contains the complete and general postclip viewing transformation. For perspective projections, viewmat contains the portion of the perspective transformation prior to frustum or hither clipping. Clipping cubes are always ignored for perspective projections.

* clipmat is the secondary viewing matrix. The value and interpretation of clipmat depends upon the projection type and whether or not clipping cubes are turned on for the view. For orthographic, parallel, or oblique projections with clipping cubes off, clipmat is ignored but typically set to the identity matrix. For orthographic, parallel, or oblique projections with clipping cubes on, clipmat contains the complete and general post-clip viewing transformation that would otherwise be stored in viewmat as described above. For perspective projections, clipmat contains the portion of the viewing transformation after frustum or hither clipping.

* editmat is the complete and general viewing transformation regardless of whether or not clipping cubes are in effect. When the effect of clipping cubes is not considered, editmat is the complete concatenated viewing transformation. editmat is usually used during input operations where the effects of clipping cubes need not be considered until an input operation is complete. For perspective projections, editmat is the concatenation of viewmat and clipmat.

* inptmat is the mathematical inverse of editmat. inptmat is used for reverse transformations, usually during input operations in parallel projections when the editing plane is not parallel with the xy-plane in the world coordinate system. inptmat is constantly updated by DataCAD so that upon any call to view_getcurr, you may be assured that inptmat is the correct and current inverse viewing transformation.

* clipon is a Boolean flag which is true when clipping cubes are on for the view, and false when clipping cubes are off. clipon is ignored for perspective projections. Frustum or hither clipping is always in effect for perspective projections. clipmin and clipmax contain the minimum and maximum extents of the clipping cube. You must ensure that the values of clipmin are less than the respective values of clipmax. DataCAD does not automatically ensure their order.

NOTE:

Simply toggling clipon on or off does not set the viewing matrices for clipping cubes in effect. viewmat and clipmat must also be adjusted accordingly.

* name is the name of the view which appears on the function keys in the GotoView menus. name may be up to eight characters long, may contain any number of spaces, or may be a null string.

* windlft, windbot, scalenum, and scale collectively define the current two- dimensional window to viewport transformation. DataCAD maintains a separate two-dimensional, world coordinate, window-to-viewport transformation distinct from the general three-dimensional transformation. This is necessary for handling features such as user-defined line types and weighted lines. These display attributes are always applied after the general three-dimensional viewing transformation.

* windlft is the position of the left edge of the viewing window in two-dimensional world coordinates.

* windbot is the position of the bottom edge of the viewing window in two-dimensional world coordinates.

* scalenum is an integer number between 1 and 18 inclusive, and indicates which of the 18 currently-loaded scales is the current window to viewport scaling of the drawing. Since the user may edit these scales, or may load different sets of scales into a drawing, scalenum is not necessarily unique in any given drawing database or across drawings. scale is the actual window-to- viewport ratio which scalenum represents. When the user changes the scale corresponding to a particular value of scalenum, scale is adjusted accordingly upon the next reading or updating of the view. scalenum always supercedes and controls the value of scale. scale is derived through a look-up table.

* The value of viewcent changes depending upon the projection type of the view. When the view is a perspective projection, viewcent is the point in the view at which the viewer is looking; in this case viewcent defines the location of the picture plane relative to the eye point. The picture plane is perpendicular to a line which passes from perseye to viewcent and through viewcent. When the view is a parallel projection, viewcent is the point about which the view is rotated during Control menu operations or by using the globe. For parallel projections, viewcent becomes the origin of the grid for that view. Therefore, the location of this point can be particularly important during editing operations in parallel projections. When the view is an oblique projection, viewcent is the center of the view, and determines the center of shear for the view. viewcent is ignored for orthographic projections.

* perseye is used only for perspective projections, and ignored for all other projection types. perseye is the location of the eye point of the viewer.

* persdis is the distance between the points viewcent and perseye, and is always derived. persdis is used only for perspective projections, and otherwise ignored. Setting the field persdis has no effect upon the view.

* togglelyr, frstlyr, lastlyr, and currlyr manage layers depending upon the state of the *LayrSet toggle on the 3D GotoView menu. Currently, you can't manipulate this aspect of saved views from within DCAL. Do not alter these fields of a view_type. However, each view which is added to the list of saved views using view_add remembers which layers are on or off so you can adjust which layers are on prior to adding a view to the database. Furthermore, a call to view_update resets the list of layers for the views which are on.

* flag1 and flag2 are general purpose Boolean flags which are stored, updated, and retrieved with saved views. You may set or clear these flags. flag1 and flag2 are not protected from use by other DCAL applications, so their values may not remain the same until you change them. DataCAD's standard user interface does not currently use these fields as they are primarily intended for DCAL applications.



SITE SEARCH