请帮忙解决一下区域填充AcDbHatch的问题,代码已完成,但显示不了?
<p>代码如下:</p><p> AcDbObjectIdArray dbObjIds;<br/> AcDbHatch* pHatch;<br/> AcGeVector3d normal(0.0 , 0.0 , 1.0 );<br/></p><p> dbObjIds.append(LineId);<br/> dbObjIds.append(LineId);<br/> dbObjIds.append(LineId);<br/> dbObjIds.append(LineId); //LineId是四边形的四条边的Id</p><p> pHatch = new AcDbHatch();<br/> pHatch -> setNormal(normal);<br/> pHatch -> setElevation(0.0);<br/> pHatch -> setAssociative(Adesk::kFalse);<br/> pHatch -> setColorIndex(162);<br/> pHatch -> setPatternScale(0.0);<br/> pHatch -> setPatternAngle(0.0);<br/> pHatch -> setPattern(AcDbHatch::kPreDefined, "ANSI31");<br/> pHatch -> setHatchStyle(AcDbHatch::kNormal);<br/> pHatch -> appendLoop(AcDbHatch::kExternal, dbObjIds);<br/> pHatch -> evaluateHatch();<br/> </p><p> AddEntityToDbs( pHatch ); // AddEntityToDbs()函数用于将填充加入到数据库,函数没有问题<br/> pHatch -> close();</p><p>代码是参考了网上的一些信息写的,程序在调试时填充显示不了,请问下是什么原因?谢谢!</p><p></p> <p>代码修改如下:可能是将比例设置为0.0导致的问题。</p><p> AcDbObjectIdArray dbObjIds;<br/> AcDbHatch* pHatch;<br/> AcGeVector3d normal(0.0 , 0.0 , 1.0 );<br/></p><p> dbObjIds.append(LineId);<br/> dbObjIds.append(LineId);<br/> dbObjIds.append(LineId);<br/> dbObjIds.append(LineId); //LineId是四边形的四条边的Id</p><p> pHatch = new AcDbHatch();<br/> pHatch -> setNormal(normal);<br/> pHatch -> setElevation(0.0);<br/> pHatch -> setAssociative(Adesk::kFalse);<br/> pHatch -> setColorIndex(162);<br/> <font color="#f70909"> pHatch -> setPatternScale(1.0);</font><br/> pHatch -> setPatternAngle(0.0);<br/> pHatch -> setPattern(AcDbHatch::kPreDefined, "ANSI31");<br/> pHatch -> setHatchStyle(AcDbHatch::kNormal);<br/> pHatch -> appendLoop(AcDbHatch::kExternal, dbObjIds);<br/> pHatch -> evaluateHatch();<br/> </p><p> AddEntityToDbs( pHatch ); // AddEntityToDbs()函数用于将填充加入到数据库,函数没有问题<br/> pHatch -> close();</p>
页:
[1]