home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2001 December
/
pcwk12201b.iso
/
Reklamy
/
CAD-Projekt
/
MegaCAD-4_5
/
CC
/
MEGATYP.H_
/
MEGATYP.H
Wrap
Text File
|
1996-09-18
|
14KB
|
411 lines
/**********************************************************************/
/* MegaCAD entity types. */
/**********************************************************************/
/**********************************************************************/
/* This is the version number of the MegaCAD interface! */
/* Structure members that are new to version 1 are commented '// !..' */
/**********************************************************************/
#define MI_VERSION 3
/**********************************************************************/
#define E_TXTLIN 1
#define E_POINT 2
#define E_LINE 3
#define E_CIRCLE 4
#define E_C_ARC 5
#define E_H_DIM 6
#define E_V_DIM 7
#define E_P_DIM 8
#define E_A_DIM 9
#define E_D_DIM 10
#define E_R_DIM 11
#define E_T_DIM 12
#define E_SPLINE 13
#define E_TXTBLK 15
#define E_MACRO 16
#define E_XHATCH 18
#define E_ELLIPS 19
#define E_E_ARC 20
#define E_POLYLN 22
#define E_BITMAP 23
#define E_MIDLIN 24
/**********************************************************************/
#define POLYLN_MAX 1300
#define POLYGON_MAX 1900
// text font 'System' values
#define GT_TRUETYPE 0
#define GT_VECTOR 1
// text font 'PitchAndFamily' values
#define GT_FFDONTCARE 0x00
#define GT_ROMAN 0x10
#define GT_SWISS 0x20
#define GT_MODERN 0x30
#define GT_SCRIPT 0x40
#define GT_DECORATIVE 0x50
#define GT_FIXED 0x01
#define GT_VARIABLE 0x02
// text font 'CharSet' values
#define GT_ANSI 0
#define GT_SYMBOL 2
#define GT_ASIAN 3
#define GT_OEM 255
// text font 'Attribs' bits
#define GT_ITALIC (1<<0)
#define GT_STRIKEOUT (1<<1)
#define GT_UNDERLINE (1<<2)
#define GT_BOLD (1<<3)
#define GT_ISDOWN (1<<4)
/**********************************************************************/
#if !defined (MEGATECH_C)
#pragma pack (2) // set packing to 2 Byte boundaries
#endif
/**********************************************************************/
/* Data-types common to all entity-types. */
/**********************************************************************/
typedef struct _attribs
{
uchar stl; // linestyle (1 - 14)
uchar pen; // pen (0 - 15) user sees (1 - 16) !!!
uchar col; // colour (1 - 15)
uchar wid; // linewidth (1 - 8)
uchar lay; // layer (0 - 255)
uchar grp; // group (0 - 255)
ushort iID; // ! id of entity info
} t_attribs;
/**********************************************************************/
/* Subtypes of MegaCAD-entities. */
/**********************************************************************/
typedef struct _txtval
{
double w1; // Text-Angle
double w2; // Direction
double dx; // char-width
double dy; // char-height
double sx; // space between two chars
double ld; // line distance, relative to char-height
} t_txtval;
typedef struct _txtfnt
{
uchar name[32]; // facename with TRUETYPE, filename with vector
uchar CharSet; // values see above
uchar PitchAndFamily; // values see above
uchar System; // values see above
uchar Attribs; // values see above
} t_txtfnt;
typedef struct _polypt
{
double mpd; // signed distance of vertex
double px; // x-coordinate of point
double py; // y-coordinate of point
} t_polypt;
/**********************************************************************/
/* The types of the MegaCAD-entities. */
/**********************************************************************/
typedef struct _text
{
t_txtval val; // text attributes (see above)
t_txtfnt fnt; // text font (see above)
double tx; // x-coordinate of text start point
double ty; // y-coordinate of text start point
double dx1; // baseline vector x-value
double dy1; // baseline vector y-value
double dx2; // leftside vector x-value
double dy2; // leftside vector y-value
ushort numl; // number of lines
char _far *str; // char - string
} t_text; // programmer has to set tx, ty, numl (if E_TXTBLK) and str
// other members are obtained by GetTxtVal
typedef struct _point
{
double x; // x-coordinate of point
double y; // y-coordinate of point
} t_point;
typedef struct _line
{
double x1; // x-coordinate of start point
double y1; // y-coordinate of start point
double x2; // x-coordinate of end point
double y2; // y-coordinate of end point
} t_line;
typedef struct _circle
{
double xm; // x-coordinate of mid point
double ym; // y-coordinate of mid point
double rd; // radius
} t_circle;
typedef struct _c_arc
{
double xm; // x-coordinate of mid point
double ym; // y-coordinate of mid point
double rd; // radius
double a1; // start angle
double a2; // end angle
} t_c_arc;
typedef struct _ellipse
{
double xm; // x-coordinate of mid point
double ym; // y-coordinate of mid point
double ra; // 1st half axis
double rb; // 2nd half axis
double an; // rotation angle
} t_ellipse;
typedef struct _e_arc
{
double xm; // x-coordinate of mid point
double ym; // y-coordinate of mid point
double ra; // 1st half axis
double rb; // 2nd half axis
double an; // rotation angle
double a1; // start angle (relative to rotation angle)
double a2; // end angle (relative to rotation angle)
} t_e_arc;
typedef struct _polyln
{
ushort num; // number of polyline points
uchar atype; // ! arrow type (1 - 6) (0 => no arrow)
uchar afill; // ! arrow filled ?
double a_hig; // ! arrow height
double a_wid; // ! arrow width
double a_qud; // ! arrow quad
double a_rad; // ! arrow radius
t_polypt _far *ppt; // array of polyline points
} t_polyln;
typedef struct _pattern
{
double rec[4]; // surrounding rectangle
double vec[2]; // alignment vector
double fac; // factor
double phi; // rotation angle
char nam[8]; // cross-hatch name ('xhatch.ini')
ushort num; // number of polyline points
t_polypt _far *ppt; // array of polyline points
} t_pattern;
typedef struct _polygon
{
ushort num; // number of points
t_point _far *pnt; // array of points
} t_polygon;
typedef struct _dimension
{
t_txtval val; // text attributes (see above)
t_txtfnt fnt; // text font (see above)
double tx; // x-coordinate of text start point
double ty; // y-coordinate of text start point
double dx1; // baseline vector x-value
double dy1; // baseline vector y-value
double dx2; // leftside vector x-value
double dy2; // leftside vector y-value
double x1; //
double y1; // 1st point
double x2; //
double y2; // 2nd point
double x3; //
double y3; // 3rd point
double x4; //
double y4; // 4th point
double a_hig; // arrow height
double a_wid; // arrow width
double a_qud; // arrow quad
double a_rad; // arrow radius
double a_len; // arrow length
double value; // measured value
uchar tcol; // colour of dim. text
uchar twid; // linewidth of dim. text
uchar tpen; // pen number of dim. text
uchar vpos; // vertical pos. ( left, mid, right, free )
uchar hpos; // horizontal pos. ( under, above, mid )
uchar plft; // arrow type (1 - 7) of 1st arrow
uchar prgt; // arrow type (1 - 7) of 2nd arrow
uchar xyon; // coordinate dim. type no. (0-2)
uchar reli; // which arrows/dim.lines are to be drawn
uchar nins; // whether inner line of outward dim. is forbidden
uchar str2; // two tolerance text strings ?
uchar para; // is text parallel to dim. line ?
uchar edit; // has text been edited ?
uchar insd; // arrows inside ?
uchar mbox; // E_T_DIM with box ?
uchar arch; // architecture dimension ?
uchar fill; // ! fill arrow type 2 ?
uchar ncut; // ! don't cut off trailing zeroes
uchar comm; // ! 0-15 comma, 16-23 fractional, 24-31 foot/inch
uchar dummy;
char _far *str; // char - string
} t_dimension;
typedef struct _macro
{
char _far *name; // filename of macro file
ushort numl; // number of lines of macro info
char _far *info; // 'numl' lines of info
} t_macro;
typedef struct _midlin
{
double mpt[2], // ! center point
cLen, // ! length of cross line
sLen, // ! length of short line
lLen, // ! length of long line
rad, // ! radius
phi; // ! rotation angle
} t_midlin;
typedef struct _bitmap
{
double rec[4]; // ! rectangle
uchar fname[126]; // ! filename of bitmap file
ushort flags; // ! currently not used
} t_bitmap;
typedef union _en_data
{
t_text txt;
t_point pnt;
t_line lin;
t_circle cir;
t_c_arc arc;
t_ellipse elp;
t_e_arc ela;
t_polyln pol;
t_polygon spl;
t_dimension dim;
t_macro mac;
t_midlin mid;
t_bitmap bmp;
} t_en_data;
typedef struct _entity
{
ushort type;
ulong id;
t_attribs attr;
t_en_data data;
} t_entity;
/**********************************************************************/
/* Dialog field descriptor and field types. */
/**********************************************************************/
#define DLG_SHT 0 // = short integer value
#define DLG_LNG 1 // = long integer value
#define DLG_PHI 2 // = double value containing an angle
#define DLG_LEN 3 // = double value in user units
#define DLG_FAC 4 // = double value containing a factor
#define DLG_STR 5 // = char string
#define DLG_GRP 6 // = short integer with group number
#define DLG_LAY 7 // = short integer with layer number
#define DLG_PEN 8 // = short integer with pen number
#define DLG_WID 9 // = short integer with width number
#define DLG_STL 10 // = short integer with linestyle number
#define DLG_COL 11 // = short integer with colour number
#define DLG_BUT 12 // = button instead of input field
#define DLG_DEF 13 // = button as default button
#define NO_ATTRIB 32232
typedef struct _dlgdta
{
char text[26]; // text to the left of input field (or button)
uchar type; // field type
uchar slen; // size of char buffer with DLG_STR
void _far *val; // address of input value (NULL if button)
} t_dlgdta;
/**********************************************************************/
/* Several data types. */
/**********************************************************************/
typedef struct _entinfo
{
ushort id; // id
ushort numl; // number of lines of text
uchar info[15*1024]; // text
} t_entinfo;
typedef struct _laygrp
{
uchar names[256][64];
} t_laygrp; // the strlen of each must not be grater than 62!!
typedef struct _grid
{
double a1, a2, // angles (Cartesian: 0.0, PI/2)
dx, dy; // steps (in mm)
} t_grid; // for a polar grid only 'dx' is used
typedef struct _gridsets
{
t_grid DrawGrid; // draw grid
t_grid SnapGrid; // snap grid
t_point PtGrid; // reference point for grid
t_point PtKeybd; // reference point for keyboard input
double UnitFactor; // 1.0 for mm, 10.0 for cm, ...
ushort iUnit; // 0=inch,1=mm,2=foot,3=cm,4=yard,5=m,6=factor
uchar fCartesian; // cartesian vs. polar
uchar fDraw; // grid visible?
uchar fDrawVals; // values of 'DrawGrid' active?
uchar fSnapVals; // values of 'SnapGrid' active?
} t_gridsets;
typedef struct _mkmacro
{
t_attribs _far *attr; // entity attributes (may be NULL)
void _far *data; // entity data
ushort type; // entity type
} t_mkmacro;
#define FM_EXCLUSIVE 1
#define FM_TAKE_FAC 2
#define FM_TAKE_PHI 4
#define FM_TAKE_DPT 8
#define FM_ONLY1 16
typedef struct _placemac
{
double fac; // scaling factor
double phi; // rotation angle
double dpx;
double dpy; // destination point
ushort flags; // flags (see '#defines's above)
} t_placemac;
/**********************************************************************/
#if !defined (MEGATECH_C)
#pragma pack () // back to default
#endif
/**********************************************************************/