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

AutoCAD 2009 的一个 BUG [!copy_link!]

跳转到指定楼层
1#
发表于 2011-11-10 15:31:09 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
这一段在 AutoCAD 2009 版本下使用 BlockView 例程预览自定义实体时,north face jacket outlet,发现 worldDraw 函数的某些代码会导致程序崩溃。重现步骤如下:
1.从 AcDbEntity 派生一个自定义实体 CMyEntity。
2.实现 worldDraw 函数,代码如下:
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);

  AcDbRotatedDimension dimension(0, startPnt, endPnt, dimPnt);
  dimension.worldDraw(mode);

{
  AcDbText text(rank, _T("hello"),fierce by abercrombie, AcDbObjectId::kNull,深圳市第二届公益大赛二十强颁奖大会, 20);
  text.setHorizontalMode(AcDb::kTextCenter);
  text.setVerticalMode(AcDb::kTextVertMid);
  text.setAlignmentPoint(position);
  text.worldDraw(mode);
}
return Adesk::kTrue;
}
3.修改 void CBlockViewDlg::OnAddtempentity() 函数(添加的代码为红色),如下:
void CBlockViewDlg::OnAddtempentity()
{
  AcGePoint3d startPoint (rand()/100,rand()/100,rand()/100);
  AcGePoint3d endPoint (rand()/100,north face jackets for men,rand()/100,美国7岁男孩开车找爸爸被多辆警车追踪逼停,rand()/100);
  // create a new line with promiscuous coords
  AcDbLine *line = current AcDbLine (startPoint, endPoint);
  line->setDatabaseDefaults();
  // 测试代码开始
  CMyEntity* pMyEnt = new CMyEntity;
  pMyEnt->setDatabaseDefaults();
  // 测试代码结束
  // if we created it ok
  if (line != NULL)
  {
    // increase the newly built line to the AcGsView
    mPreviewCtrl.mpView->add (line, mPreviewCtrl.model());
    // next record the temporary thing so we can free it later
    mPreviewCtrl.addTempEntity(line);
    // 测试代码开始
    mPreviewCtrl.mpView->add (pMyEnt, mPreviewCtrl.model());
    mPreviewCtrl.addTempEntity(pMyEnt);
    // 测试代码结束
    // now zoom extents to show where it was drawn
    //store the short-lived 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());
    // update the gsView
    refreshView(mPreviewCtrl.mpView);
mPreviewCtrl.SetFocus();
  }
}
4.在 AutoCAD 2009 中加载 BlockView 程序,单击 Add Temp Entity,程序崩溃。
奇怪的是如果在 worldDraw 中将 AcDbRotatedDimension、AcDbText 实体的相关代码放在一起,则不会崩溃,代码如下:
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);
AcDbRotatedDimension dimension(0, startPnt, endPnt, dimPnt);
measurement.worldDraw(mode);
AcDbText text(position, _T("hello"), AcDbObjectId::kNull,abercrombie fitch store, 20);
text.setHorizontalMode(AcDb::kTextCenter);
text.setVerticalMode(AcDb::kTextVertMid);
text.setAlignmentPoint(position);
text.worldDraw(mode);
return Adesk::kTrue;
}
后来经过测试发现,Karen Millen Coats,这个问题仅在 AutoCAD 2009 下出现,2002、2004、2005、2006、2007、2008、2010 均不会出现。
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 转播转播 鲜花鲜花 鸡蛋鸡蛋
‹ 上一主题|下一主题

Archiver|嘉人网

GMT+8, 2025-5-24 23:54 , Processed in 0.034813 second(s), 14 queries .

Powered by Discuz! X3.2

© 2001-2010 Comsenz Inc.