|
早就想把PTOOL升级到支持CAD2015-2016了,几个月前安装了VS2012尝试过一次,但是有太多错误,加上当时很忙,所以就没有继续,今天一鼓作气,把一个个问题都给他解决了,并把问题和解决办法均记录了下来,详细列出如下:
1、GsPreviewCtrl出现了很多问题
解决办法:
GsPreviewCtrl.h中进行如下修改:
修改A
#if _MSC_VER <= 1600
virtual void setGsNode (AcGsNode * gsnode)
{
m_pNode = gsnode;
}
virtual AcGsNode* gsNode (void) const
{
return m_pNode;
}
#endif
修改B
#if _MSC_VER <= 1600
AcGsClassFactory *mpFactory;
#else
AcGsGraphicsKernel *mpFactory;
#endif
GsPreviewCtrl.cpp中进行如下修改:
#if _MSC_VER <= 1600
// get the GS class factory
mpFactory = mpManager->getGSClassFactory();
ASSERT(mpFactory);
#else
// get the Graphics Kernel
AcGsKernelDescriptor descriptor;
descriptor.addRequirement(AcGsKernelDescriptor::k3DDrawing);
mpFactory = AcGsManager::acquireGraphicsKernel(descriptor);
ASSERT(mpFactory);
#endif
#if _MSC_VER <= 1600
mpDevice = mpManager->createAutoCADDevice(m_hWnd);
#else
mpDevice = mpManager->createAutoCADDevice(*mpFactory, m_hWnd);
#endif
#if _MSC_VER <= 1600
mpModel = mpManager->createAutoCADModel();
#else
mpModel = mpManager->createAutoCADModel(*mpFactory);
#endif
另外,项目--》属性--》链接器--》输入--》附加依赖项里增加AcDrawBridge.lib
相关网站
Graphic changes in AutoCAD 2015:
Solved: Re: AcGsClassFactory replacement?
2、acedCommand不能用了
写一个通用的函数
.h
static void SendCmd(CString strCmd);
.cpp
#if defined(_MSC_VER) && (_MSC_VER > 1500) // VS2010, VS2012
#include "acedCmdNF.h"
#endif
void CDwgDatabaseUtil::SendCmd(CString strCmd)
{
#if defined(_MSC_VER) && (_MSC_VER == 1500) // VS2008
acedCommand(RTSTR, strCmd, RTNONE);
#elif defined(_MSC_VER) && (_MSC_VER > 1500) // VS2010, VS2012
acedCommandS(RTSTR, strCmd, RTNONE);
#endif
}
相关网站:
acedCommand 2015
3、acedGetString定义换了
老版定义
int acedGetString(
int cronly,
const ACHAR * prompt,
ACHAR * result
);
新版定义
int acedGetString(
int cronly,
const ACHAR * prompt,
ACHAR * result,
size_t bufsize
);
#if _MSC_VER <= 1600
int rc = acedGetString(cronly, strPrompt, result);
#else
int intSize;
int rc = acedGetString(cronly, strPrompt, result, intSize);
#endif |
|