AcDbLine和AcDb2dPolyline怎么转换为AcDbPolyline?
AcDbLine和AcDb2dPolyline怎么转换为AcDbPolyline?谢谢! //我所编写的一部分,<b>AcDb2dPolyline转换重要的是BULG</b>
<b>//AcDbLine很简单,只是取两端点坐标,从略</b>
if (pobj->isKindOf(AcDb2dPolyline::desc()))<BR> {<BR> AcDb2dPolyline *pLy2d;<BR> AcDbObjectIterator *pVertIter;<BR> pLy2d=AcDb2dPolyline::cast(pobj);<BR> pVertIter=pLy2d->vertexIterator();<BR> AcDb2dVertex *pVertex;<BR> for(vertnum=0;!pVertIter->done();vertnum++,pVertIter->step())<BR> {<BR> vertId=pVertIter->objectId();<BR> acdbOpenObject(pVertex,vertId,AcDb::kForRead);<BR> pt=pVertex->position();<BR> if (vertnum==0) <BR> {<BR> linewidth=pVertex->endWidth();<BR> }<BR> mypt.append(pt);<BR> pVertex->close();<BR> }<BR> pLy2d->upgradeOpen();<BR> pLy2d->erase(Adesk::kTrue);<BR> pLy2d->close();<BR> delete pVertIter;<BR> }
for(i=0;i<vertnum;i++)<BR> {<BR> curpt=mypt.at(i);<BR> pkpt.x=curpt.x;<BR> pkpt.y=curpt.y;<BR> bg=0;<BR> if (i>0 && i<vertnum-1)<BR> {<BR>//bgstart bgend--BULG求法从略
}<BR> pPoly->addVertexAt(i,pkpt,bg);<BR> }<BR> if (vertnum>2)<BR> {<BR> pkpt.x=startpt.x;<BR> pkpt.y=startpt.y;<BR> pPoly->addVertexAt(0,pkpt);<BR> pPoly->setBulgeAt(1,bgstart);<BR> }<BR> <FONT color=#ff0000>2dPolyline->Polyline</FONT>
Acad::ErrorStatus CDbGeCurve::Poly2dToLWPoly(AcDb2dPolyline *pPoly,AcDbPolyline *& pLwpoly)<BR>{<BR> if (!pPoly)<BR> return Acad::eInvalidInput;
Acad::ErrorStatus ret;
AcDb::Poly2dType type;<BR> type=pPoly->polyType();<BR> if ((type==AcDb::k2dSimplePoly)||(type==AcDb::k2dFitCurvePoly)){<BR> pLwpoly=new AcDbPolyline;<BR> ret=pLwpoly->convertFrom((AcDbEntity *&)pPoly,Adesk::kFalse);<BR> if (ret!=Acad::eOk){<BR> delete pLwpoly;<BR> pLwpoly=NULL;<BR> return Acad::eNotImplementedYet;<BR> }<BR> }<BR> else{<BR> return Acad::eNotImplementedYet;<BR> }<BR> return Acad::eOk;<BR>} 谢谢受用
页:
[1]