- 积分
- 426
- 明经币
- 个
- 注册时间
- 2004-7-22
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2004-7-24 21:47:00
|
显示全部楼层
<BR>BOOL CCurveHanlder::DrawLWPline(double lineWid/*实际的线宽,没有与比例尺运算*/,<BR> CString strLayerName,<BR> CString strCode,<BR> CString strLtypeName,<BR> AcDbObjectId &crvId)<BR>{ <BR> AcTransaction *pTran;<BR> AcDbPolyline *pLwPl;<BR> pLwPl=new AcDbPolyline;<BR> AcGePoint3d pickPnt;<BR> AcGePoint3dArray vtxArray;<BR> AcGePlane plane;<BR> if(acedGetPoint(NULL,"\n第一点:",asDblArray(pickPnt))!=RTNORM)<BR> return FALSE;<BR> vtxArray.append(pickPnt);<BR> pLwPl->addVertexAt(pLwPl->numVerts(),pickPnt.convert2d(plane));<BR> if(lineWid>0)<BR> pLwPl->setConstantWidth(lineWid);<BR> pLwPl->setPlinegen(TRUE);<BR> Acad::ErrorStatus es=pLwPl->setLinetype(strLtypeName);<BR> pTran=actrTransactionManager->startTransaction();<BR> AddToModalSpace (pLwPl,crvId);<BR> actrTransactionManager->addNewlyCreatedDBRObject(pLwPl);<BR> while(TRUE)<BR> {<BR> pLwPl->getPointAt(pLwPl->numVerts()-1,pickPnt);<BR> acedInitGet(NULL,"Undo Close Track GyClose Jgyd Wdx Yh");<BR> int rc=acedGetPoint(asDblArray(pickPnt),<BR> "\n下一点或[<U>回退/<C>闭合/<G>隔一闭合/<T>跟踪/<J>隔一点/<W>微导线/<Y>圆弧]:",<BR> asDblArray(pickPnt));<BR> <BR> if(rc!=RTNORM)<BR> {<BR> if(rc==RTKWORD)//回退一个点<BR> {<BR> char kw[10];<BR> acedGetInput(kw);<BR> if(strcmp(kw,"Undo")==0)//回退<BR> {<BR> if(pLwPl->numVerts()>0)<BR> {<BR> pLwPl->removeVertexAt(pLwPl->numVerts()-1);<BR> vtxArray.removeAt(vtxArray.length()-1);<BR> pLwPl->draw();<BR> actrTransactionManager->flushGraphics();<BR> }<BR> continue;<BR> }<BR> else if(strcmp(kw,"Close")==0)//闭合<BR> {<BR> pLwPl->setClosed(TRUE);<BR> break;<BR> }
.............
...............<BR> else<BR> {<BR> pLwPl->addVertexAt(pLwPl->numVerts(),pickPnt.convert2d(plane));<BR> vtxArray.append(pickPnt);<BR> }<BR> pLwPl->draw();<BR> actrTransactionManager->flushGraphics();<BR> }<BR> pLwPl->close();<BR> if(!strCode.IsEmpty ())<BR> SetCodeToEntity(crvId,strCode);<BR> SetEntLayer(crvId,strLayerName.GetBuffer (strLayerName.GetLength ()));<BR> actrTransactionManager->endTransaction();<BR> char kw[5]="No";<BR> acedInitGet(NULL,"Yes No");<BR> acedGetKword("\n是否拟合?[<Y>是/<N>否]<N>:",kw);<BR> if(strcmp(kw,"Yes")==0)<BR> {<BR> AcDbObjectId tmpId;<BR> if(SmoothCurve(vtxArray,crvId,lineWid,tmpId))<BR> {<BR> if(acdbOpenObject(pLwPl,crvId,AcDb::kForWrite)==Acad::eOk)<BR> {<BR> pLwPl->erase();<BR> pLwPl->close();<BR> crvId=tmpId;<BR> }<BR> }<BR> } <BR> return TRUE;<BR>}
给你一段代码,可以实现Pline命令相同的效果,中间的是我的专业用途,可能用不了,所以删了 |
|