oyzhdmj 发表于 2009-3-27 22:43:00

遇到一个问题,请大家帮个忙,谢谢

我想画一个三维空间的线框,类似长方体的12条边组成的一个空间盒子,现在我已知该盒子的8个顶点坐标,请问操作才能画出该空间盒子,请大家指点,谢谢

cfu18 发表于 2009-3-28 10:50:00

<p>简单的写一下.取其中一个面的四点,厚度取四点以外的点到这个平面距离</p><p>AcDbObjectId AddEntity(AcDbEntity * pEnt)<br/>{<br/>&nbsp;AcDbBlockTable *pBlockTable = NULL;<br/>&nbsp;&nbsp;&nbsp; acdbHostApplicationServices()-&gt;workingDatabase()<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt;getSymbolTable(pBlockTable, AcDb::kForRead);<br/>&nbsp;assert(pBlockTable);<br/>&nbsp;&nbsp;&nbsp; AcDbBlockTableRecord *pBlockTableRecord = NULL;<br/>&nbsp;&nbsp;&nbsp; pBlockTable-&gt;getAt(ACDB_MODEL_SPACE, pBlockTableRecord,<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AcDb::kForWrite);<br/>&nbsp;assert(pBlockTableRecord);<br/>&nbsp;&nbsp;&nbsp; pBlockTable-&gt;close();</p><p>&nbsp;&nbsp;&nbsp; AcDbObjectId lineId;<br/>&nbsp;&nbsp;&nbsp; pBlockTableRecord-&gt;appendAcDbEntity(lineId, pEnt);</p><p>&nbsp;&nbsp;&nbsp; pBlockTableRecord-&gt;close();<br/>&nbsp;return lineId;<br/>}</p><p>void test()<br/>{<br/>&nbsp;AcGePoint3d pt1(0,0,0);<br/>&nbsp;AcGePoint3d pt2(100,0,0);<br/>&nbsp;AcGePoint3d pt3(0,100,0);<br/>&nbsp;AcGePoint3d pt4(100,100,0);</p><p>&nbsp;AcDbSolid *sold = new AcDbSolid(pt1,pt2,pt3,pt4);<br/>&nbsp;sold-&gt;setThickness(100);<br/>&nbsp;AddEntity(sold);<br/>&nbsp;sold-&gt;close();&nbsp;<br/>}</p>

oyzhdmj 发表于 2009-3-28 19:56:00

<p>谢谢,楼上,我再研究研究</p>
页: [1]
查看完整版本: 遇到一个问题,请大家帮个忙,谢谢