366 lines
10 KiB
C
366 lines
10 KiB
C
#pragma once
|
|
|
|
#ifndef ZWCAD
|
|
|
|
#ifdef CMAKE
|
|
// ARX 从 cmake传入,不再使用toolset倒推
|
|
// 对 objectarx库文件的依赖再cmake中定义
|
|
#else
|
|
#if PTV == 80 // VC++2005
|
|
#define ADS 17
|
|
#elif PTV == 90 // VC++2008
|
|
#define ADS 18
|
|
#elif PTV == 100 // VC++2010
|
|
#define ADS 19
|
|
#elif PTV == 110 // VC++2012
|
|
#define ADS 20
|
|
#elif PTV == 140 && !defined(R22)// VC++2015
|
|
#define ADS 21
|
|
#elif PTV == 140 && defined(R22) // VC++2015
|
|
#define ADS 22
|
|
#elif PTV == 141 // VC++2017
|
|
#define ADS 23
|
|
#elif PTV == 142 // VC++2019
|
|
#define ADS 24
|
|
#elif PTV == 143 // VC++2022
|
|
#define ADS 25
|
|
|
|
// 注意,以下ARX不要再用此方式编译调试了,toolset已经不能倒推ARX了,所以,如果要编译R26,请使用 cmake,
|
|
//#elif PTV == 143 // VC++2022
|
|
// #define ADS 26
|
|
//#elif PTV == 143 // VC++2022
|
|
// #define ADS 27
|
|
#endif
|
|
|
|
#if ADS == 17
|
|
#pragma comment(lib, "acad.lib")
|
|
#pragma comment(lib, "rxapi.lib")
|
|
#pragma comment(lib, "acedapi.lib")
|
|
#pragma comment(lib, "acgiapi.lib")
|
|
#pragma comment(lib, "axdb.lib")
|
|
#pragma comment(lib, "acdb17.lib")
|
|
#pragma comment(lib, "acge17.lib")
|
|
#pragma comment(lib, "acISMobj17.lib")
|
|
#pragma comment(lib, "aecmodeler50.lib")
|
|
#pragma comment(lib, "adui17.lib")
|
|
#pragma comment(lib, "acui17.lib")
|
|
#pragma comment(lib, "acgex17.lib")
|
|
#pragma comment(lib, "acbr17.lib")
|
|
#endif // arx 17
|
|
#if ADS == 18
|
|
#pragma comment(lib, "acad.lib")
|
|
#pragma comment(lib, "rxapi.lib")
|
|
#pragma comment(lib, "acedapi.lib")
|
|
#pragma comment(lib, "acgiapi.lib")
|
|
#pragma comment(lib, "axdb.lib")
|
|
#pragma comment(lib, "acdb18.lib")
|
|
#pragma comment(lib, "acge18.lib")
|
|
#pragma comment(lib, "acISMobj18.lib")
|
|
#pragma comment(lib, "aecmodeler60.lib")
|
|
#pragma comment(lib, "adui18.lib")
|
|
#pragma comment(lib, "acui18.lib")
|
|
#pragma comment(lib, "acgex18.lib")
|
|
#pragma comment(lib, "acbr18.lib")
|
|
#endif // arx 18
|
|
|
|
#if ADS == 19
|
|
#pragma comment(lib, "acad.lib")
|
|
#pragma comment(lib, "accore.lib")
|
|
#pragma comment(lib, "rxapi.lib")
|
|
#pragma comment(lib, "acgiapi.lib")
|
|
#pragma comment(lib, "axdb.lib")
|
|
#pragma comment(lib, "acdb19.lib")
|
|
#pragma comment(lib, "acge19.lib")
|
|
#pragma comment(lib, "acISMobj19.lib")
|
|
#pragma comment(lib, "aecmodeler.lib")
|
|
#pragma comment(lib, "adui19.lib")
|
|
#pragma comment(lib, "acui19.lib")
|
|
#pragma comment(lib, "ac1st19.lib")
|
|
#pragma comment(lib, "acgex19.lib")
|
|
#pragma comment(lib, "acbr19.lib")
|
|
#endif // arx 19
|
|
|
|
#if ADS == 20
|
|
#pragma comment(lib, "acad.lib")
|
|
#pragma comment(lib, "accore.lib")
|
|
#pragma comment(lib, "rxapi.lib")
|
|
#pragma comment(lib, "acgiapi.lib")
|
|
#pragma comment(lib, "axdb.lib")
|
|
#pragma comment(lib, "acdb20.lib")
|
|
#pragma comment(lib, "acge20.lib")
|
|
#pragma comment(lib, "acISMobj20.lib")
|
|
#pragma comment(lib, "aecmodeler.lib")
|
|
#pragma comment(lib, "adui20.lib")
|
|
#pragma comment(lib, "acui20.lib")
|
|
#pragma comment(lib, "ac1st20.lib")
|
|
#pragma comment(lib, "acdrawbridge.lib")
|
|
#pragma comment(lib, "acgex20.lib")
|
|
#pragma comment(lib, "acbr20.lib")
|
|
#endif // arx 20
|
|
|
|
#if ADS == 21
|
|
#pragma comment(lib, "acad.lib")
|
|
#pragma comment(lib, "accore.lib")
|
|
#pragma comment(lib, "rxapi.lib")
|
|
#pragma comment(lib, "acgiapi.lib")
|
|
#pragma comment(lib, "axdb.lib")
|
|
#pragma comment(lib, "acdb21.lib")
|
|
#pragma comment(lib, "acge21.lib")
|
|
#pragma comment(lib, "aecmodeler.lib")
|
|
#pragma comment(lib, "acISMobj21.lib")
|
|
#pragma comment(lib, "adui21.lib")
|
|
#pragma comment(lib, "acui21.lib")
|
|
#pragma comment(lib, "ac1st21.lib")
|
|
#pragma comment(lib, "acdrawbridge.lib")
|
|
#pragma comment(lib, "acgex21.lib")
|
|
#pragma comment(lib, "acbr21.lib")
|
|
#endif // arx 21
|
|
|
|
#if ADS == 22
|
|
#pragma comment(lib, "acad.lib")
|
|
#pragma comment(lib, "accore.lib")
|
|
#pragma comment(lib, "rxapi.lib")
|
|
#pragma comment(lib, "acgiapi.lib")
|
|
#pragma comment(lib, "axdb.lib")
|
|
#pragma comment(lib, "acdb22.lib")
|
|
#pragma comment(lib, "acge22.lib")
|
|
#pragma comment(lib, "aecmodeler.lib")
|
|
#pragma comment(lib, "acISMobj22.lib")
|
|
#pragma comment(lib, "adui22.lib")
|
|
#pragma comment(lib, "acui22.lib")
|
|
#pragma comment(lib, "ac1st22.lib")
|
|
#pragma comment(lib, "acdrawbridge.lib")
|
|
#pragma comment(lib, "acgex22.lib")
|
|
#pragma comment(lib, "acbr22.lib")
|
|
#endif // arx 22
|
|
|
|
#if ADS == 23
|
|
#pragma comment(lib, "acad.lib")
|
|
#pragma comment(lib, "accore.lib")
|
|
#pragma comment(lib, "rxapi.lib")
|
|
#pragma comment(lib, "acgiapi.lib")
|
|
#pragma comment(lib, "axdb.lib")
|
|
#pragma comment(lib, "acdb23.lib")
|
|
#pragma comment(lib, "acge23.lib")
|
|
#pragma comment(lib, "aecmodeler.lib")
|
|
#pragma comment(lib, "acISMobj23.lib")
|
|
#pragma comment(lib, "adui23.lib")
|
|
#pragma comment(lib, "acui23.lib")
|
|
#pragma comment(lib, "ac1st23.lib")
|
|
#pragma comment(lib, "acdrawbridge.lib")
|
|
#pragma comment(lib, "acgex23.lib")
|
|
#pragma comment(lib, "acbr23.lib")
|
|
#endif // arx 23
|
|
|
|
#if ADS == 24
|
|
#pragma comment(lib, "acpal.lib")
|
|
#pragma comment(lib, "ac1st24.lib")
|
|
#pragma comment(lib, "acdb24.lib")
|
|
#pragma comment(lib, "acge24.lib")
|
|
#pragma comment(lib, "acgiapi.lib")
|
|
#pragma comment(lib, "acISMobj24.lib")
|
|
#pragma comment(lib, "rxapi.lib")
|
|
#pragma comment(lib, "acad.lib")
|
|
#pragma comment(lib, "accore.lib")
|
|
#pragma comment(lib, "axdb.lib")
|
|
#pragma comment(lib, "aecmodeler.lib")
|
|
#pragma comment(lib, "adui24.lib")
|
|
#pragma comment(lib, "acui24.lib")
|
|
#pragma comment(lib, "acdrawbridge.lib")
|
|
#pragma comment(lib, "acgex24.lib")
|
|
#pragma comment(lib, "acbr24.lib")
|
|
#pragma comment(lib, "acgeoment.lib")
|
|
#endif // arx 24
|
|
|
|
#if ADS == 25
|
|
#pragma comment(lib, "acpal.lib")
|
|
#pragma comment(lib, "ac1st25.lib")
|
|
#pragma comment(lib, "acdb25.lib")
|
|
#pragma comment(lib, "acge25.lib")
|
|
#pragma comment(lib, "acgiapi.lib")
|
|
#pragma comment(lib, "acISMobj25.lib")
|
|
#pragma comment(lib, "rxapi.lib")
|
|
#pragma comment(lib, "acad.lib")
|
|
#pragma comment(lib, "accore.lib")
|
|
#pragma comment(lib, "axdb.lib")
|
|
#pragma comment(lib, "aecmodeler.lib")
|
|
#pragma comment(lib, "adui25.lib")
|
|
#pragma comment(lib, "acui25.lib")
|
|
#pragma comment(lib, "acdrawbridge.lib")
|
|
#pragma comment(lib, "acgex25.lib")
|
|
#pragma comment(lib, "acbr25.lib")
|
|
#pragma comment(lib, "acgeoment.lib")
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#ifdef CMAKE
|
|
#else
|
|
|
|
#if PTV == 141 // VC++2017
|
|
#ifdef R24
|
|
#define ADS 24
|
|
#pragma message("Automatically linking with ZRX 2024.")
|
|
#elif defined(R25)
|
|
#define ADS 25
|
|
#pragma message("Automatically linking with ZRX 2025.")
|
|
#elif defined(R26)
|
|
#define ADS 26
|
|
#pragma message("Automatically linking with ZRX 2026.")
|
|
#endif
|
|
#endif
|
|
#pragma comment(lib, "ZwBase.lib")
|
|
#pragma comment(lib, "ZWCAD.lib")
|
|
#pragma comment(lib, "ZwAuto.lib")
|
|
#pragma comment(lib, "ZwRx.lib")
|
|
#pragma comment(lib, "ZwZrx.lib")
|
|
#pragma comment(lib, "ZwGeometry.lib")
|
|
#pragma comment(lib, "ZwDatabase.lib")
|
|
#pragma comment(lib, "ZwDatabaseMgd.lib")
|
|
#pragma comment(lib, "ZwdUI.lib")
|
|
#pragma comment(lib, "ZwGs.lib")
|
|
#pragma comment(lib, "ZwTc.lib")
|
|
#pragma comment(lib, "ZwUI.lib")
|
|
#pragma comment(lib, "ZwBrep.lib")
|
|
#pragma comment(lib, "ZwAECModeler.lib")
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#if ADS > 18
|
|
#include "acedads.h"
|
|
#include "adsmigr.h"
|
|
#endif
|
|
|
|
#ifndef ZWCAD
|
|
#if ADS > 19
|
|
#if defined(acedCommand)
|
|
#undef acedCommand
|
|
#endif
|
|
#define acedCommand Old_Function_Must_Switch_To_SHacedCommand
|
|
|
|
#if defined(ads_command)
|
|
#undef ads_command
|
|
#endif
|
|
#define ads_command Old_Function_Must_Switch_To_SHads_command
|
|
|
|
#if defined(acedCmd)
|
|
#undef acedCmd
|
|
#endif
|
|
#define acedCmd Old_Function_Must_Switch_To_SHacedCmd
|
|
|
|
#define SHacedCommand(rtype, ...) acedCommandS((rtype), __VA_ARGS__)
|
|
#define SHacedCmd(rb) acedCmdS((rb))
|
|
#define SHads_command SHacedCommand
|
|
#else
|
|
#define SHacedCommand(rtype, ...) acedCommand((rtype), __VA_ARGS__)
|
|
#define SHacedCmd(rb) acedCmd((rb))
|
|
#define SHads_command SHacedCommand
|
|
#endif
|
|
#else
|
|
#define SHacedCommand(rtype, ...) acedCommand((rtype), __VA_ARGS__)
|
|
#define SHacedCmd(rb) acedCmd((rb))
|
|
#define SHads_command SHacedCommand
|
|
|
|
extern void zrxPostCommand(wchar_t const *);
|
|
|
|
#ifndef acrxEntryPoint
|
|
#define acrxEntryPoint zcrxEntryPoint
|
|
#endif
|
|
|
|
#ifndef acedPostCommand
|
|
#define acedPostCommand zrxPostCommand
|
|
#endif
|
|
|
|
#ifndef fromAcDbTextStyle
|
|
#define fromAcDbTextStyle fromZcDbTextStyle
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#if (ADS > 19)
|
|
|
|
#include "acdb.h" // acdb definitions
|
|
#include "aced.h" // aced stuff
|
|
#include "adscodes.h"
|
|
#include "acedCmdNF.h"
|
|
#include "gs.h"
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
typedef int (*p2argF) (TCHAR *psz, size_t len);
|
|
typedef int (*p3argF) (const TCHAR *psz1, TCHAR *psz, size_t len);
|
|
|
|
#define BUFFER_LEN 1024
|
|
|
|
inline int procsess2arg(p2argF fun, TCHAR *psz)
|
|
{
|
|
if (!psz) return RTERROR;
|
|
TCHAR pBuf[BUFFER_LEN] = {0,};
|
|
int nret = fun(pBuf, 512);
|
|
// 此处可能崩溃,注意长度
|
|
_tcscpy(psz, pBuf);
|
|
return nret;
|
|
}
|
|
|
|
inline int procsess3arg(p3argF fun, const TCHAR *psz1, TCHAR *psz)
|
|
{
|
|
if (!psz) return RTERROR;
|
|
TCHAR pBuf[BUFFER_LEN] = {0,};
|
|
int nret = fun(psz1, pBuf, 512);
|
|
// 此处可能崩溃,注意长度
|
|
_tcscpy(psz, pBuf);
|
|
return nret;
|
|
}
|
|
|
|
|
|
#ifdef ads_getinput
|
|
#undef ads_getinput
|
|
#endif
|
|
|
|
inline AcGsView* acgsGetGsView(int viewportNumber, bool bCreateIfNone) { return NULL; }
|
|
inline int ads_getinput(TCHAR *psz) { return procsess2arg(::acedGetInput, psz); }
|
|
inline int acedGetInput(TCHAR *psz) {return procsess2arg(::acedGetInput, psz);}
|
|
inline int acedFindFile(const TCHAR *pfname, TCHAR *psz) { return procsess3arg(::acedFindFile, pfname, psz); }
|
|
inline int acedGetKword(const TCHAR *prompt, TCHAR *psz) { return procsess3arg(::acedGetKword, prompt, psz); }
|
|
inline int acedGetString(int cronly, const TCHAR *prompt, TCHAR *psz)
|
|
{
|
|
if (!prompt) return RTERROR;
|
|
TCHAR pBuf[512] = {0,};
|
|
int nRet = ::acedGetString(cronly, prompt, pBuf, 512);
|
|
_tcscpy(psz, pBuf);
|
|
return nRet;
|
|
}
|
|
|
|
inline int acdbAngToS(ads_real v, int unit, int prec, TCHAR *psz)
|
|
{
|
|
if (!psz) return RTERROR;
|
|
TCHAR pBuf[512];
|
|
int nRet = ::acdbAngToS(v, unit, prec, pBuf, 512);
|
|
_tcscpy(psz, pBuf);
|
|
return nRet;
|
|
}
|
|
|
|
#ifdef acedPostCommand
|
|
#undef acedPostCommand
|
|
#endif
|
|
#define acedPostCommand acedPostCommandR20
|
|
inline Adesk::Boolean acedPostCommandR20(const TCHAR * cmd)
|
|
{
|
|
if (curDoc() && acDocManager)
|
|
acDocManager->sendStringToExecute(curDoc(), cmd);
|
|
return Adesk::kTrue;
|
|
}
|
|
#else
|
|
#include "adesk.h"
|
|
Adesk::Boolean acedPostCommand( const TCHAR * );
|
|
#endif
|
|
|
|
#if !defined(_WIN64) && !defined (_AC64) && ADS >= 21
|
|
//static_assert(sizeof(void *) == 4, "ptr size in 32-bit windows build?");
|
|
#define TLong_ptr int32_t
|
|
#else
|
|
#define TLong_ptr LONG_PTR
|
|
#endif
|