fpgzs 发表于 2006-9-1 12:37:00

[ARX]关于自定义实体显示三维图形,不知是方法不对还是代码有问题!

<P>请教大家一下,在自定义实体中,显示三维图形,该怎么做?我的代码如下,是代码有问题还是实现方法不对?<BR>下面这个函数在自定义实体的worldDraw(AcGiWorldDraw* mode)中调用</P>
<P>//显示梁<BR>void MGUnit::ShowBeam(AcGiWorldDraw* mode)<BR>{<BR>&nbsp;// 创建一个圆对对象,以此生成面域<BR>&nbsp;AcGeVector3d vec = m_EndPoint - m_StartPoint;<BR>&nbsp;AcDbCircle *pCirc = new AcDbCircle(m_StartPoint, vec.normal(), 0.1);</P>
<P>&nbsp;// 生成面域<BR>&nbsp;AcDbVoidPtrArray arrayCirc, arrayRegions;<BR>&nbsp;arrayCirc.append((void*)pCirc);<BR>&nbsp;AcDbRegion::createFromCurves(arrayCirc, arrayRegions);<BR>&nbsp;AcDbRegion *pRegion = AcDbRegion::cast((AcRxObject*)arrayRegions);</P>
<P>&nbsp;// 拉伸面域<BR>&nbsp;AcDb3dSolid *p3dSolid = new AcDb3dSolid;<BR>&nbsp;if (Acad::eOk == p3dSolid-&gt;extrude(pRegion, vec.length(), 0))<BR>&nbsp;{<BR>&nbsp;&nbsp;p3dSolid-&gt;worldDraw(mode);<BR>&nbsp;}<BR>&nbsp;delete p3dSolid;<BR>&nbsp;delete pCirc;<BR>&nbsp;delete pRegion;<BR>}</P>
<P>能够生成并显示三维实体,但只要进行任何操作(如单击一下或移动鼠标),就会弹出提示:<BR>AutoCAD错误中断<BR>内部错误:!U:\global\src\coreacad\CORESRC\scandr.cpp@773:eAtMaxReaders</P>
<P>根本就没做什么打开操作,怎么提示eAtMaxReaders错误呢???</P>

popol 发表于 2010-11-26 14:05:00

你不应该delete p3dSolid;
页: [1]
查看完整版本: [ARX]关于自定义实体显示三维图形,不知是方法不对还是代码有问题!