diff --git a/PyRxCore/PyAcadApplicationImpl.cpp b/PyRxCore/PyAcadApplicationImpl.cpp index 69e9ac37..e386c8b7 100644 --- a/PyRxCore/PyAcadApplicationImpl.cpp +++ b/PyRxCore/PyAcadApplicationImpl.cpp @@ -16,7 +16,7 @@ void PyAcadApplicationImpl::Eval(const CString& csVal) const PyThrowBadHr(impObj()->Eval(bstrVal)); } -std::vector PyAcadApplicationImpl::ListArx() +wstringArray PyAcadApplicationImpl::ListArx() { VARIANT rtVal; VariantInit(&rtVal); @@ -38,11 +38,83 @@ std::vector PyAcadApplicationImpl::ListArx() return vec; } +void PyAcadApplicationImpl::LoadArx(const CString& csVal) +{ + _bstr_t bstrVal{ csVal }; +#if defined(_ZRXTARGET) + PyThrowBadHr(impObj()->LoadZrx(bstrVal)); +#elif defined(_GRXTARGET) + PyThrowBadHr(impObj()->LoadGrx(bstrVal)); +#else + PyThrowBadHr(impObj()->LoadArx(bstrVal)); +#endif +} + +void PyAcadApplicationImpl::LoadDVB(const CString& csVal) +{ +#if defined(_ZRXTARGET) + throw PyNotimplementedByHost(); +#else + _bstr_t bstrVal{ csVal }; + PyThrowBadHr(impObj()->LoadDVB(bstrVal)); +#endif +} + +void PyAcadApplicationImpl::Quit() +{ + PyThrowBadHr(impObj()->Quit()); +} + +void PyAcadApplicationImpl::RunMacro(const CString& csVal) +{ + _bstr_t bstrVal{ csVal }; + PyThrowBadHr(impObj()->RunMacro(bstrVal)); +} + +void PyAcadApplicationImpl::UnloadArx(const CString& csVal) +{ + _bstr_t bstrVal{ csVal }; +#if defined(_ZRXTARGET) + PyThrowBadHr(impObj()->UnloadZrx(bstrVal)); +#elif defined(_GRXTARGET) + PyThrowBadHr(impObj()->UnloadGrx(bstrVal)); +#else + PyThrowBadHr(impObj()->UnloadArx(bstrVal)); +#endif +} + +void PyAcadApplicationImpl::UnloadDVB(const CString& csVal) +{ +#if defined(_ZRXTARGET) + throw PyNotimplementedByHost(); +#else + _bstr_t bstrVal{ csVal }; + PyThrowBadHr(impObj()->UnloadDVB(bstrVal)); +#endif +} + +void PyAcadApplicationImpl::Update() +{ + PyThrowBadHr(impObj()->Update()); +} + +void PyAcadApplicationImpl::ZoomAll() +{ + PyThrowBadHr(impObj()->ZoomAll()); +} + +void PyAcadApplicationImpl::ZoomCenter(const AcGePoint3d& pnt, double magnify) +{ + VARIANT rtVal; + VariantInit(&rtVal); + InitVariantFromDoubleArray(asDblArray(pnt), 3, &rtVal); + PyThrowBadHr(impObj()->ZoomCenter(rtVal,magnify)); +} + bool PyAcadApplicationImpl::runTest() { PyAcadApplicationImpl app; - for (const auto& item : app.ListArx()) - acutPrintf(_T("\n%ls"), item.c_str()); + app.ZoomCenter(AcGePoint3d(0,0,0),10); return true; } diff --git a/PyRxCore/PyAcadApplicationImpl.h b/PyRxCore/PyAcadApplicationImpl.h index 570ec57e..57b9d582 100644 --- a/PyRxCore/PyAcadApplicationImpl.h +++ b/PyRxCore/PyAcadApplicationImpl.h @@ -2,6 +2,9 @@ #ifdef PYRXDEBUG +#include +#include + #pragma comment( lib , "propsys.lib" ) #if defined(_BRXTARGET) && (_BRXTARGET <= 250) @@ -49,16 +52,28 @@ #define IAcadDocument IGcadDocument #endif +using wstringArray = std::vector; + class PyAcadApplicationImpl { public: PyAcadApplicationImpl(); ~PyAcadApplicationImpl() = default; - void Eval(const CString& csVal) const; - //AcadState GetAcadState(); - std::vector ListArx(); - - + void Eval(const CString& csVal) const; + //AcadState GetAcadState(); + wstringArray ListArx(); + void LoadArx(const CString& csVal); + void LoadDVB(const CString& csVal); + void Quit(); + void RunMacro(const CString& csVal); + void UnloadArx(const CString& csVal); + void UnloadDVB(const CString& csVal); + void Update(); + //void Zoom(int ...); + void ZoomAll(); + void ZoomCenter(const AcGePoint3d& pnt, double magnify); + + static bool runTest(); public: IAcadApplication* impObj(const std::source_location& src = std::source_location::current()) const;