home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2001 December
/
pcwk12201b.iso
/
Reklamy
/
CAD-Projekt
/
MegaCAD-4_5
/
CC
/
DIMENS.C_
/
DIMENS.C
Wrap
C/C++ Source or Header
|
1995-03-21
|
2KB
|
60 lines
/**********************************************************************/
#include "std.h"
#include "megatyp.h"
#include "megacad.h"
/**********************************************************************/
short main(
char *filename,
char *args )
{
double y;
t_entity ent;
t_dimension dim;
char str[255];
// set function text and mouse help
SetFuncText("dimensioning line horizontal");
MouseHelp("select line","again",HLP_INV(RED,WHITE,0));
// select element to dimens, only lines are detected
while(ClickEntity((1<<E_LINE),&dim.x1,&ent,NULL,0))
{
// start point of line = first dim. point
dim.x1 = ent.data.lin.x1;
// ev. rotate start point dim. shall always be
// on top of the line
y = ent.data.lin.y2;
if(ent.data.lin.y1 > ent.data.lin.y2)
y = ent.data.lin.y1;
dim.y1 = y;
// end point of line = second dim. point
// but modified, only hor. dimensioning
dim.x2 = ent.data.lin.x2;
dim.y2 = y;
// set the points for the dim. text
// the help line is simply pos. 5 units higher
dim.x3 = dim.x1;
dim.y3 = dim.y1 + 5;
dim.x4 = dim.x2;
dim.y4 = dim.y1 + 5;
// calculate the dim. value
dim.value = fabs(dim.x2 - dim.x1);
// transfer the value into the text buffer
dim.str = str;
PrintDimVal(dim.value,str,"","");
// get all dim. values from MegaCAD
// calculate the text box and place the
// dim. text wu'ith the preinstalled values
// for horizontal dim.
GetDimVal(E_H_DIM,7,&dim);
// save element
CreateEntity(E_H_DIM,NULL,&dim);
// ... and insert into the UNDO / REDO list
savecount();
}
}
/**********************************************************************/