#ifndef	_ENT_API
#define _ENT_API

#include "eb_const.h"
#include "dm.h"

_declspec(dllimport) EB_SELECT *DmEntityTop;

_declspec(dllimport) EB_NODE	ebGetNode(EB_POINT  p, UINT flag=0, EB_SELECT&  from=*DmEntityTop);
_declspec(dllimport) EB_NODE	ebBuildPoint(double x, double y);
_declspec(dllimport) EB_NODE	ebBuildLine(EB_POINT p1, EB_POINT p2);
_declspec(dllimport) EB_NODE	ebBuildPcRCircle(EB_POINT p_center, double r);
_declspec(dllimport) EB_NODE	ebBuildPsP2PeCircle(EB_POINT ps,EB_POINT p2,EB_POINT pe);
_declspec(dllimport) EB_NODE	ebBuildPcRAsAeArc(EB_POINT pc,double r,double as,double ae);
_declspec(dllimport) EB_NODE	ebBuildPsP2PeArc(EB_POINT ps,EB_POINT p2,EB_POINT pe);
_declspec(dllimport) EB_NODE	ebBuildPcPsPeArc(EB_POINT pc,EB_POINT ps,EB_POINT pe);
_declspec(dllimport) EB_NODE	ebBuildPsPeRArc(EB_POINT ps,EB_POINT pe,double r,BOOL IsLarge=FALSE);
_declspec(dllimport) EB_NODE	ebBuildPsPeAArc(EB_POINT ps,EB_POINT pe,double angle);

_declspec(dllimport) EB_NODE	ebBuildPolyline(EB_POINT*  array,int num);
_declspec(dllimport) EB_NODE	ebBuildEllipse(EB_POINT p_center, double length, double width, double angle_r=0.0, double angle_s=0.0, double angle_e=PI2);
_declspec(dllimport) EB_NODE	ebBuildText(EB_POINT  locate, char*  text,double high=3.5,double rotateang=0.0);
_declspec(dllimport) EB_NODE	ebBuildSpline(EB_POINT* array, int num, BOOL open=TRUE);
_declspec(dllimport) EB_NODE	ebBuildBlock(EB_POINT  locate, char*  name="");
_declspec(dllimport) EB_NODE	ebBuildArrow(EB_NODE  node, double  length, int  locate=0, double  angle=0.0);
_declspec(dllimport) EB_NODE	ebBuildHatch(EB_SELECT& select,EB_POINT *pickpt,int pt_num,double dist,double angle,char* pattern=NULL);
_declspec(dllimport) EB_NODE	ebBuildSolid(EB_SELECT&  select, EB_POINT pickpt);

_declspec(dllimport) BOOL		ebIfBlockEmpty(EB_NODE  block);
_declspec(dllimport) BOOL		ebIfObjectInBlk (EB_NODE  block, EB_NODE  node);
_declspec(dllimport) int		ebGetBlockLength(EB_NODE  block);
_declspec(dllimport) int		ebAddNodeToBlock (EB_NODE  block ,EB_NODE  node);
_declspec(dllimport) int		ebDelNodeFromBlock (EB_NODE  block ,EB_NODE  node);
_declspec(dllimport) int		ebAddSelectToBlock (EB_NODE  block ,EB_SELECT&  select, BOOL  remove=TRUE);
_declspec(dllimport) EB_NODE	ebGetNodeFromBlock (EB_NODE  block ,int  index);
_declspec(dllimport) int		ebFreeNode(EB_NODE  node);
_declspec(dllimport) int		ebDrawNode( EB_NODE node,  char 	color= DRAGING);
_declspec(dllimport) int		ebInsNodeToSys (EB_NODE  node, BOOL  draw=TRUE);
_declspec(dllimport) int		ebDelNodeFromSys (EB_NODE  node, BOOL  del=FALSE);
_declspec(dllimport) EB_BOX		ebGetNodeBox(EB_NODE  node);

_declspec(dllimport) EB_NODE	ebBuildLinearDim(int  dim_type,  EB_POINT  p1,  EB_POINT  p2,  EB_POINT  dim_loc,  int  txtdir=0,  char*  text=NULL);
_declspec(dllimport) EB_NODE	ebBuildRadiusDim(EB_NODE node,  EB_POINT  dim_loc,  int  txtdir=0,char*  text=NULL);
_declspec(dllimport) EB_NODE	ebBuildDiameterDim(EB_NODE node,  EB_POINT  dim_loc,  int  txtdir=0, char*  text=NULL);
_declspec(dllimport) EB_NODE	ebBuildTwoLAngDim(EB_NODE node1, EB_NODE node2, EB_POINT  dim_loc,  char*  text=NULL);
_declspec(dllimport) EB_NODE	ebBuildThreePAngDim(EB_POINT top, EB_POINT start, EB_POINT end, EB_POINT  dim_loc,  char*  text=NULL);
_declspec(dllimport) EB_NODE	ebBuildChamferAngDim(EB_NODE line, EB_POINT  dim_loc,  char*  text=NULL);
_declspec(dllimport) EB_NODE	ebModifyDimText(EB_NODE node, char *text,EB_POINT* pTxtmid=NULL,double* dTxtang=NULL,int* iLeader=NULL);

_declspec(dllimport) int		ebDrawLine( EB_POINT  p1,  EB_POINT  p2, char 	color= DRAGING);
_declspec(dllimport) int		ebDrawCircle(EB_POINT pC,double r,char color=DRAGING);
_declspec(dllimport) int		ebDrawArc(EB_POINT  pC,EB_POINT  pS,EB_POINT  pE,char 	color= DRAGING);
_declspec(dllimport) int		ebDrawPoint(EB_POINT  pL,char 	color= DRAGING);

#endif