Chapter 2 -- Constants



This chapter describes the constants that are built into DCAL. They are pre-declared and can be used by your programs.

NOTE: The values of these constants may change in future releases of DCAL and DataCAD; therefore, your programs should never depend on the actual value that these constants represent.

I/O Constants

File Operation

These operation constants are used and returned by file handling procedures:

fl_access_denied

This error is returned when an attempt is made to access a file which cannot be accessed, such as attempting to write to a read only file.

fl_invalid_access_code

If this error occurs, please notify Technical Support.

fl_invalid_function

If this error occurs, please notify Technical Support.

fl_invalid_handle

An attempt was made to access a file using an improper file variable. Usually, this indicates an uninitialized file variable.

fl_no_handles_left

An attempt was made to open too many files at once. Some operating systems restrict the number of files that can be opened at one time. For MS-DOS, you can set this number in the config.sys file with the files= statement.

fl_not_found

An attempt was made to open a file that could not be found.

fl_ok

The file routines return this constant when they are successful.

fl_path_not_found

A pathname was specified which does not exist.

fmode_read

This constant specifies that a file is open for reading only.

fmode_read_write

This constant specifies a file that is open for both reading and writing.

fmode_write

This constant specifies a file that is open for writing only.

Pathnames

DataCAD defines a number of built-in pathnames, which you can access with the routines getpath and setpath. These routines take an integer constant which has one of the following values:

pathchr

The path where DataCAD looks when loading a character set. Changing this has no affect on any previously-loaded character sets.

pathdef

This is the path from which DataCAD loads default files, such as the default angles, scales, and distances.

pathdrv

This path indicates where driver files are loaded from. This path is not used once DataCAD is running.

pathdwg

The path where DataCAD looks for drawing files.

pathdxf

This is the index of the path where DataCAD reads and writes dxf files.

pathfrm

reports;This is the path where DataCAD looks for form files when executing the reports command.

pathlyr

pathlyr is the index of the path where DataCAD loads and stores layer files.

pathmcr

pathmcr is the index of the path where DataCAD looks when loading a new macro for execution. Changing this has no affect on an executing macro.

pathout

This determines where DataCAD sends text output files, such as output from the report command.

pathsup

pathsup is the index of the path where DataCAD looks for support files, such as message and label files. Do not change this pathname while DataCAD is running.

pathswp

pathswp is the path where DataCAD keeps virtual memory swap files. This may be changed while DataCAD is running without disturbing existing virtual address spaces.

pathsym

pathsym is the index of the pathname where DataCAD adds new symbol files. This is used when new symbol files are created. Once a symbol file exists in a template, the filename is stored in the template file.

pathtmp

This is the index of the path where temporary files are kept. It should be used for any temporary file that the macro needs.

pathtpl

The path where DataCAD looks for template files. This pathname may be changed while a template file is displayed on the screen. This does not affect any already-opened files.

Data Constants

Attributes

The following constants are used to create, examine, and modify attributes.

atr_addr

The value of this attribute is a logical address (lgl_addr). These are the addresses of layers, entities, attributes, symbols, etc.

atr_ang

The value of the attribute is a real number interpreted as an angle.

atr_dis

The value of the attribute is a real number interpreted as a distance.

atr_int

An attribute that is an integer.

atr_name_len

The maximum length of the name of an attribute, 12 bytes.

atr_pnt

The value of an attribute of this type is a point.

atr_rl

The value of the attribute is a real number.

atr_str

An attribute whose value is a string of up to 80 characters.

Colors

These constants refer to the standard colors used by DataCAD.

NOTE:

Because the value of these constants may change between versions of DataCAD, use the constant names.

Name Color

clrblue Blue

clrbrown Brown

clrcyan Cyan

clrdkgray Dark gray

clrgrn Green

clrltblue Light blue

clrltcyan Light cyan

clrltgray Light gray

clrltgrn Light green

clrltmgta Light magenta

clrltred Light red

clrmgta Magenta

clrred Red

clrwhite White

clryellow Yellow

Line Types

The constants in this section refer to DataCAD's built-in line types.

ltype_dashed

ltype_dashed is the dashed line type.

ltype_dotdash

ltype_dotdash is the dot-dash line type. The user-defined line types are identified by integer values starting at 4.

ltype_dotted

ltype_dotted is the dotted line type.

ltype_solid

ltype_solid refers to the line type solid.

Entities

These constants are used in some of the database routines to refer to the different types of entities that DataCAD supports:

entar3

entar3 is used for a 3D arc (an arc not in the x-y plane).

entarc

entarc indicates that the entity is a two- dimensional arc.

entbez

entbez refers to a Bezier curve entity.

entblk

entblk represents a block. A block is similar to a slab, but has only four sides.

entbsp

entbsp indicates an entity type of a b-spline.

entcnt

entcnt represents a three-dimensional contour curve.

entcon

entcon refers to a cone. See also enttrn.

entcrc

entcrc indicates a circle entity.

entcyl

entcyl refers to a cylinder.

entdim

entdim refers to the associative dimension.

entdom

entdom indicates a dome. A dome is any section of a sphere.

entell

entell indicates an ellipse.

entlin

entlin refers to a line, the most common entity.

entln3

entln3 refers to a three-dimensional line. This entity is a free vector in 3D space.

entmrk

entmrk is the point (marker) entity type.

entpln

entpln is the entity constant for a polyline.

entply

entply represents a polygon. A polygon is a flat, closed, three-dimensional entity.

entrev

entrev indicates a surface of revolution. Like polylines, this involves the copious data of polyverts.

entslb

entslb represents a slab. A slab is similar to a polygon, but has some specified thickness.

entsrf

entsrf refers to the three-dimensional mesh surface.

entsym

entsym refers to the insertion (an instance) of a symbol. Note that this is an instance of a symbol and does not describe its geometry.

enttor

enttor indicates the entity type torus, a doughnut shape.

enttrn

enttrn represents a truncated cone.

enttxt

enttxt refers to text strings.

Layer Mode

The constants in this section describe the mode that DataCAD uses to search for entities across layers. They are used with a mode_type variable.

lyr_all

Using this mode, all layers in the drawing are searched whether they are on or off.

lyr_curr

Using lyr_curr, only the current layer is searched.

lyr_on

Using lyr_on, all layers in the drawing that are turned on are searched.

Processing Constants

Entity Drawing

These constants are used when drawing entities on the screen. They are used by some of the routines which manipulate the screen.

drmode_black

When an entity is drawn with mode drmode_black, it is erased from the screen. This makes an entity vanish from the screen, but not from the database.

drmode_flip

With drmode_flip, the entity being drawn is XORed with what is currently on the screen. Notice that two consecutive XORs result in the restoration of the original image. By using drmode_flip twice in a row, you can make an entity blink.

drmode_white

Using drmode_white causes an entity to be drawn on the screen in whatever its color is. This is the opposite operation from drmode_black.

Function Key Return

The constants in this section are returned by the routines that detect function key presses, such as getchar, getpoint, and dgetint. Also, see the function FnKeyConv.

f1, f2, f3, f4, f5, f6, f7,f8, f9, f0

These constants are returned when any of the unshifted function keys are pressed. When function key (F10) is pressed, f0 is returned.

s1, s2, s3, s4, s5, s6, s7,s8, s9, s0

These constants are returned when the shifted function keys are pressed. When (S10) is pressed, s0 is the constant returned.

 

Hatching

The constants in this section are used for hatching.

See the "Processing Routines" chapter for more information.

htype_ignore

Indicates to procedure hatch_mode that all entities interior to the hatching boundary are ignored. In this case, each scan line creates one section of segments, at most.

htype_normal

Indicates that hatching should start and stop the hatching scan line as it crosses the edge of each entity in its path.

htype_outer

Indicates that no matter how many sections the scan line may be broken into, only the first and last section lying within the outer boundary will be drawn.

maxdash

Represents the maximum number of portions of dashes in a given scan line pattern. maxdash applies to portions of a broken scan line where the line is drawn and where the line is not drawn (the spaces). maxDash is equal to 6.

Object Snapping

Snap constants are used by the built-in variable osnap_mode, which controls the object snap mode. These constants can be added together.

For example, to set center, end point, and quick mode, use:

osnap_mode := osnap_center +

osnap_endpoint + osnap_quick;

osnap_center

This constant sets object snap to recognize the center of arcs and circles.

osnap_endpoint

osnap_endpoint sets object snap to snap to the end points of the nearest line, point, Bezier curve, b-spline, arc, or associative dimension.

osnap_intsect

Object snapping recognizes the intersections of lines, circles, and arcs. Although powerful, this may significantly slow down snapping operations.

osnap_midpoint

When osnap_midpoint is on, snapping recognizes the mid point of the nearest line, arc, or associative dimension.

osnap_nearest

When osnap_nearest is set, snapping recognizes the nearest point on the nearest line, point, Bezier curve, b-spline, circle, or arc. Bezier curves and b-splines use their control points.

osnap_npoint

osnap_npoint divides the nearest line or arc into osnap_num divisions, and snaps to one of these points.

osnap_perp

When object snap uses osnap_perp, points which are perpendicular to the nearest line, arc, or circle, and which pass through the last point entered are recognized.

osnap_quad

Object snapping snaps to the quadrant points of arcs and circles. Quadrant points are the points at 0, 90, 180, and 270 degrees. When an arc does not pass through one or more of these points, the points are not used.

osnap_quick

When osnap_quick is used and osnap_intsect is not, the search for the nearest entity is abandoned after an entity within the current miss distance is found.

osnap_tan

When object snap uses osnap_tan, if the point entered is within the miss distance of an arc or circle, a possible snapping point is considered at the point of tangency of a line passing through the last point entered and tangent to the arc or circle.

Polylines

The following constants are used in the polyline routines:

pv_bulge

pv_bulge represents a polyvert which is an arc segment between a polyvert and the next polyvert in the chain.

pv_vert

pv_vert represents a polyvert which is a straight line between a polyvert and the next polyvert in a chain.

Viewing

The following constants are used with the view management and calculation routines as well as with the function getpointp:

oblqelev

Represents an oblique projection calculated using the elevation oblique technique.

See view_calcoblq for more information.

oblqplan

Represents an oblique projection calculated using the plan oblique technique.

See view_calcoblq for more information.

vmode_all

Instructs DataCAD that any viewing projection is valid for a given function.

See view_checkmode, getpointp for more information.

vmode_edit

Represents a viewing projection that the user can edit, including orthographic and parallel views. In general, data may be entered into a drawing in either an orthographic or a parallel projection where object snapping and all selection functions work properly.

See getpointp for more information.

vmode_oblq

Represents oblique viewing projections.

vmode_orth

Represents orthographic viewing projections.

vmode_para

Represents parallel viewing projections.

vmode_pers

Represents perspective viewing projections.

Walls

These constants are used by some of the built- in variables to determine certain wall conditions:

wall_cap

The variable wallend is set to the constant wall_cap when the end condition of walls is to cap them.

wall_clip

wallend is set to wall_clip when the end condition for walls is to clip an intersecting wall, forming a T-intersection.

wall_none

wallend is set to wall_none when the end condition for a wall is to do nothing.

wall_off

The built-in variable wallson is set to wall_off when walls are not being drawn, in which case DataCAD draws simple lines.

wall_on

wallson is set to wall_on if DataCAD is drawing walls.

Miscellaneous Constants

ABSZero

This constant is equal to 1.OE-12. Useful for near zero tests.

halfpi

halfpi is defined as pi / 2.0.

maxpnts

maxpnts is the maximum number of points in a polygon, slab, or contour. 36 is the maximum number of points.

pi

pi is defined as 3.141592654. This value is useful in many mathematical computations, since angles are stored and manipulated in DataCAD in radians.

res_escape

res_escape is the counterpart to res_normal. It indicates that an entry was not completed correctly, but that a key (such as a function key) was pressed during input. See "getpoint" for more information.

res_normal

res_normal is returned by several of the input routines to indicate a valid entry.

SQRZero

This is equal to ABSZero * ABSZero.

twopi

twopi is defined as 2.0 * pi.

x

The constant x is used whenever the x coordinate of a point is needed, or the x axis is specified, such as in a rotation.

y

The constant y is the counterpart of x, and indicates the y coordinate or y axis.

z

The constant z is similar to x and y, and indicates the z coordinate or z axis.



Thank you for printing this page. Please feel free to contact us for further assistance. You can call our sales department at +1 (800) 394-2231, Monday through Friday from 8:00 a.m. to 5:00 p.m. Eastern time or send an e-mail message to info@datacad.com.