嘉人
收藏本版 |订阅 | 回收站
搜索
嘉人美妆精英学院 达人馆 shopping秀 AutoCAD 2009 的一个 BUG
查看: 339|回复: 0
go

AutoCAD 2009 的一个 BUG [!copy_link!]

跳转到指定楼层
1#
发表于 2011-11-10 12:56:31 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
AcDbText text(position, _T("hello"), AcDbObjectId::kNull, 20);
    // now zoom extents to show where it was drawn
    //store the temporary lines
    m_tempExt.addPoint(startPoint);
    m_tempExt.addPoint(endPoint);
    if (mCurrentDwg->extmin().distanceTo(mCurrentDwg->extmax()) < 1e20)
    {
      m_tempExt.addPoint(mCurrentDwg->extmin());  
      m_tempExt.addPoint(mCurrentDwg->extmax());  
    }
    AcDbExtents viewExtents(m_tempExt);
    viewExtents.transformBy(m_viewMatrix);
    mPreviewCtrl.mpView->zoomExtents(viewExtents.minPoint(),viewExtents.maxPoint());
  // 测试代码开始
  CMyEntity* pMyEnt = new CMyEntity;
  pMyEnt->setDatabaseDefaults();
  // 测试代码结束
后来经由测试发现,这个问题仅在 AutoCAD 2009 下呈现,2002、2004、2005、2006、2007、2008、2010 均不会涌现。
AcDbRotatedDimension dimension(0, startPnt, endPnt, dimPnt);
text.setHorizontalMode(AcDb::kTextCenter);
text.setVerticalMode(AcDb::kTextVertMid);
text.setAlignmentPoint(position);
text.worldDraw(mode);
  text.setHorizontalMode(AcDb::kTextCenter);
  text.setVerticalMode(AcDb::kTextVertMid);
  text.setAlignmentPoint(position);
  text.worldDraw(mode);
}
Adesk::Boolean CMyEntity::worldDraw(AcGiWorldDraw* mode)
{
AcGePoint3d startPnt = AcGePoint3d::kOrigin;
AcGePoint3d endPnt = startPnt + AcGeVector3d::kXAxis * 200;
AcGePoint3d dimPnt = (startPnt + endPnt.asVector() / 2.0) + AcGeVector3d::kYAxis * 10;
AcGePoint3d position = (startPnt + endPnt.asVector() / 2.0);
return Adesk::kTrue;
}
return Adesk::kTrue;
}
  dimension.worldDraw(mode);
}
奇异的是假如在 worldDraw 中将 AcDbRotatedDimension、AcDbText 实体的相干代码放在一起,则不会崩溃,代码如下:
3.修正 void CBlockViewDlg::OnAddtempentity() 函数(增加的代码为红色),buy ralph lauren online,如下:
  // if we created it ok
  if (line ,air jordan!= NULL)
  {
    // add the newly created line to the AcGsView
    mPreviewCtrl.mpView->add (line, mPreviewCtrl.model());
    // next record the temporary entity so we can free it later
    mPreviewCtrl.addTempEntity(line);
void CBlockViewDlg::OnAddtempentity()
{
  AcGePoint3d startPoint (rand()/100,rand()/100,rand()/100);
  AcGePoint3d endPoint (rand()/100,rand()/100,rand()/100);
  // create a new line with random coords
  AcDbLine *line = new AcDbLine (startPoint,burberry sneakers, endPoint);
  line->setDatabaseDefaults();
Adesk::Boolean CMyEntity::worldDraw(AcGiWorldDraw* mode)
{
AcGePoint3d startPnt = AcGePoint3d::kOrigin;
AcGePoint3d endPnt = startPnt + AcGeVector3d::kXAxis * 200;
AcGePoint3d dimPnt = (startPnt + endPnt.asVector() / 2.0) + AcGeVector3d::kYAxis * 10;
AcGePoint3d position = (startPnt + endPnt.asVector() / 2.0);
    // 测试代码开端
    mPreviewCtrl.mpView->add (pMyEnt, mPreviewCtrl.model());
    mPreviewCtrl.addTempEntity(pMyEnt);
    // 测试代码停止
{
  AcDbText text(position,gianmarco lorenzi website, _T("hello"), AcDbObjectId::kNull, 20);
4.在 AutoCAD 2009 中加载 BlockView 程序,单击 Add Temp Entity,程序瓦解。
这一段在 AutoCAD 2009 版本下应用 BlockView 例程预览自定义实体时,发明 worldDraw 函数的某些代码会导致程序崩溃。重现步骤如下:
1.从 AcDbEntity 派生一个自定义实体 CMyEntity。
2.实现 worldDraw 函数,ugg boots clearance,代码如下:
dimension.worldDraw(mode);
mPreviewCtrl.SetFocus();
  }
}
{
  AcDbRotatedDimension dimension(0, startPnt, endPnt, dimPnt);
    // update the gsView
    refreshView(mPreviewCtrl.mpView);
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 转播转播 鲜花鲜花 鸡蛋鸡蛋
‹ 上一主题|下一主题

Archiver|嘉人网

GMT+8, 2025-5-1 05:58 , Processed in 0.025658 second(s), 14 queries .

Powered by Discuz! X3.2

© 2001-2010 Comsenz Inc.