Skip to content

Commit 378af40

Browse files
committed
[#165] PyAcadApplicationImpl
1 parent 1c02b7e commit 378af40

File tree

2 files changed

+95
-8
lines changed

2 files changed

+95
-8
lines changed

PyRxCore/PyAcadApplicationImpl.cpp

+75-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ void PyAcadApplicationImpl::Eval(const CString& csVal) const
1616
PyThrowBadHr(impObj()->Eval(bstrVal));
1717
}
1818

19-
std::vector<std::wstring> PyAcadApplicationImpl::ListArx()
19+
wstringArray PyAcadApplicationImpl::ListArx()
2020
{
2121
VARIANT rtVal;
2222
VariantInit(&rtVal);
@@ -38,11 +38,83 @@ std::vector<std::wstring> PyAcadApplicationImpl::ListArx()
3838
return vec;
3939
}
4040

41+
void PyAcadApplicationImpl::LoadArx(const CString& csVal)
42+
{
43+
_bstr_t bstrVal{ csVal };
44+
#if defined(_ZRXTARGET)
45+
PyThrowBadHr(impObj()->LoadZrx(bstrVal));
46+
#elif defined(_GRXTARGET)
47+
PyThrowBadHr(impObj()->LoadGrx(bstrVal));
48+
#else
49+
PyThrowBadHr(impObj()->LoadArx(bstrVal));
50+
#endif
51+
}
52+
53+
void PyAcadApplicationImpl::LoadDVB(const CString& csVal)
54+
{
55+
#if defined(_ZRXTARGET)
56+
throw PyNotimplementedByHost();
57+
#else
58+
_bstr_t bstrVal{ csVal };
59+
PyThrowBadHr(impObj()->LoadDVB(bstrVal));
60+
#endif
61+
}
62+
63+
void PyAcadApplicationImpl::Quit()
64+
{
65+
PyThrowBadHr(impObj()->Quit());
66+
}
67+
68+
void PyAcadApplicationImpl::RunMacro(const CString& csVal)
69+
{
70+
_bstr_t bstrVal{ csVal };
71+
PyThrowBadHr(impObj()->RunMacro(bstrVal));
72+
}
73+
74+
void PyAcadApplicationImpl::UnloadArx(const CString& csVal)
75+
{
76+
_bstr_t bstrVal{ csVal };
77+
#if defined(_ZRXTARGET)
78+
PyThrowBadHr(impObj()->UnloadZrx(bstrVal));
79+
#elif defined(_GRXTARGET)
80+
PyThrowBadHr(impObj()->UnloadGrx(bstrVal));
81+
#else
82+
PyThrowBadHr(impObj()->UnloadArx(bstrVal));
83+
#endif
84+
}
85+
86+
void PyAcadApplicationImpl::UnloadDVB(const CString& csVal)
87+
{
88+
#if defined(_ZRXTARGET)
89+
throw PyNotimplementedByHost();
90+
#else
91+
_bstr_t bstrVal{ csVal };
92+
PyThrowBadHr(impObj()->UnloadDVB(bstrVal));
93+
#endif
94+
}
95+
96+
void PyAcadApplicationImpl::Update()
97+
{
98+
PyThrowBadHr(impObj()->Update());
99+
}
100+
101+
void PyAcadApplicationImpl::ZoomAll()
102+
{
103+
PyThrowBadHr(impObj()->ZoomAll());
104+
}
105+
106+
void PyAcadApplicationImpl::ZoomCenter(const AcGePoint3d& pnt, double magnify)
107+
{
108+
VARIANT rtVal;
109+
VariantInit(&rtVal);
110+
InitVariantFromDoubleArray(asDblArray(pnt), 3, &rtVal);
111+
PyThrowBadHr(impObj()->ZoomCenter(rtVal,magnify));
112+
}
113+
41114
bool PyAcadApplicationImpl::runTest()
42115
{
43116
PyAcadApplicationImpl app;
44-
for (const auto& item : app.ListArx())
45-
acutPrintf(_T("\n%ls"), item.c_str());
117+
app.ZoomCenter(AcGePoint3d(0,0,0),10);
46118
return true;
47119
}
48120

PyRxCore/PyAcadApplicationImpl.h

+20-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
#ifdef PYRXDEBUG
44

5+
#include <atlbase.h>
6+
#include <atlsafe.h>
7+
58
#pragma comment( lib , "propsys.lib" )
69

710
#if defined(_BRXTARGET) && (_BRXTARGET <= 250)
@@ -49,16 +52,28 @@
4952
#define IAcadDocument IGcadDocument
5053
#endif
5154

55+
using wstringArray = std::vector<std::wstring>;
56+
5257
class PyAcadApplicationImpl
5358
{
5459
public:
5560
PyAcadApplicationImpl();
5661
~PyAcadApplicationImpl() = default;
57-
void Eval(const CString& csVal) const;
58-
//AcadState GetAcadState();
59-
std::vector<std::wstring> ListArx();
60-
61-
62+
void Eval(const CString& csVal) const;
63+
//AcadState GetAcadState();
64+
wstringArray ListArx();
65+
void LoadArx(const CString& csVal);
66+
void LoadDVB(const CString& csVal);
67+
void Quit();
68+
void RunMacro(const CString& csVal);
69+
void UnloadArx(const CString& csVal);
70+
void UnloadDVB(const CString& csVal);
71+
void Update();
72+
//void Zoom(int ...);
73+
void ZoomAll();
74+
void ZoomCenter(const AcGePoint3d& pnt, double magnify);
75+
76+
6277
static bool runTest();
6378
public:
6479
IAcadApplication* impObj(const std::source_location& src = std::source_location::current()) const;

0 commit comments

Comments
 (0)