-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathCGetInputUtil.cpp
More file actions
71 lines (59 loc) · 1.41 KB
/
CGetInputUtil.cpp
File metadata and controls
71 lines (59 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include "stdafx.h"
#include "CGetInputUtil.h"
#include "geassign.h"
CGetInputUtil::CGetInputUtil()
{
}
CGetInputUtil::~CGetInputUtil()
{
}
AcGePoint3d CGetInputUtil::WcsToUcsPoint(const AcGePoint3d & point)
{
AcGePoint3d pt;
resbuf rbfrom, rbto;
rbfrom.restype = RTSHORT;
rbfrom.resval.rint = 0;//WCS
rbto.restype = RTSHORT;
rbto.resval.rint = 1;//UCS
acedTrans(asDblArray(point), &rbfrom, &rbto, Adesk::kFalse, asDblArray(pt));
return pt;
}
AcGePoint3d CGetInputUtil::UcsToWcsPoint(const AcGePoint3d & point)
{
AcGePoint3d pt;
resbuf rbfrom,rbto;
rbfrom.restype = RTSHORT;
rbfrom.resval.rint = 1;//UCS
rbto.restype = RTSHORT;
rbto.resval.rint = 0;//WCS
acedTrans(asDblArray(point), &rbfrom, &rbto, Adesk::kFalse, asDblArray(pt));
return pt;
}
bool CGetInputUtil::GetPoint(const AcGePoint3d & basePoint, const TCHAR * prompt, AcGePoint3d & point)
{
//acedGetPoint函数的几点参数和返回的失去点坐标都是UCS坐标,执行前需转换,之后在转回来
AcGePoint3d ucspoint = WcsToUcsPoint(basePoint);
int nReturn = acedGetPoint(asDblArray(ucspoint), prompt, asDblArray(point));
if (nReturn==RTNORM)
{
point = UcsToWcsPoint(point);
return true;
}
else
{
return false;
}
}
bool CGetInputUtil::GetPoint(const TCHAR * prompt, AcGePoint3d & point)
{
int nReturn = acedGetPoint(NULL, prompt, asDblArray(point));
if (nReturn==RTNORM)
{
point = UcsToWcsPoint(point);
return true;
}
else
{
return false;
}
}