whoami 发表于 2004-7-31 12:32:00

好心人帮忙解释一下程序

<FONT face=宋体,verdana,arial,helvetica></B></FONT>       <INPUT class=btn style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体" onclick="text1.style.fontSize='12pt';" type=button value=12号字> <OPTION value="9pt">9pt</OPTION> <OPTION value="10pt" selected>10pt</OPTION> <OPTION value="11pt">11pt</OPTION> <OPTION value="12pt">12pt</OPTION> <OPTION value="13pt">13pt</OPTION> <OPTION value="15pt">15pt</OPTION> <FONT id=text1 style="FONT-SIZE: 10pt" face="宋体,verdana, arial, helvetica"><BR>void lwpoly()<BR>{<BR>AcDbDatabase *pCurDb;<BR>AcDbBlockTable *pBlkTable;<BR>AcDbBlockTableRecord *pBlkTableRecord;<BR>AcDbPolyline *pPolyEnt;<BR>AcDbObjectId polyId;<BR>AcGePoint2d pkPt;<BR>AcGePoint2dArray arPts;<BR>ads_point pick, lastpt;<BR>AcGeMatrix3d ucsMat;<BR>AcGeMatrix2d ucsMat2d;<BR><BR>int retCode;<BR>int numPts;<BR><BR>Adesk::Boolean keepPicking = Adesk::kTrue;<BR>Adesk::Boolean firstPick = Adesk::kTrue<BR><BR>acdbUcsMatrix(ucsMat);<BR><BR>ucsMat2d(0,0) = ucsMat(0,0);<BR>ucsMat2d(0,1) = ucsMat(0,1);<BR>ucsMat2d(0,2) = ucsMat(0,3);<BR>ucsMat2d(1,0) = ucsMat(1,0);<BR>ucsMat2d(1,1) = ucsMat(1,1);<BR>ucsMat2d(1,2) = ucsMat(1,3);<BR><BR>while(keepPicking)<BR>{<BR>if(firstPick)<BR>{<BR>retCode = acedGetPoint(NULL, "\nPick first point: ", pick);<BR>firstPick = Adesk::kFalse;<BR>}<BR>else<BR>{ <BR>acdbPointSet(pick, lastpt);<BR>retCode = acedGetPoint(pick, "\nPick another point - for no more: ", pick);<BR>acedGrDraw(lastpt, pick, 1, 0);<BR>}<BR>if(retCode != RTNORM)<BR>{<BR>keepPicking = Adesk::kFalse;<BR>break;<BR>}<BR><BR>pkPt.x = pick;<BR>pkPt.y = pick;<BR><BR>AcGePoint2dArray arPts.append(pkPt);<BR>}<BR>acedRedraw(NULL, 1);<BR>if(arPts.isEmpty())<BR>{<BR>acutPrintf("\nEmpty array.");<BR>return;<BR>}<BR><BR>if(arPts.length() &lt; 2)<BR>{<BR>acutPrintf("\nArray only contains one point.");<BR>return;<BR>}<BR><BR>numPts = arPts.length();<BR><BR>pCurDb = acdbHostApplicationServices()-&gt;workingDatabase();<BR>pCurDb-&gt;getBlockTable(pBlkTable, AcDb::kForRead);<BR>pBlkTable-&gt;getAt(ACDB_MODEL_SPACE, pBlkTableRecord, AcDb::kForWrite);<BR>pBlkTable-&gt;close();<BR><BR>pPolyEnt = new AcDbPolyline(numPts);<BR>for(int idx = 0; idx &lt; numPts; idx++)<BR>{<BR>pkPt = arPts.at(idx);<BR>pkPt.transformBy(ucsMat2d);<BR>pPolyEnt-&gt;addVertexAt(idx, pkPt);<BR>}<BR><BR>pBlkTableRecord-&gt;appendAcDbEntity(polyId, pPolyEnt);<BR>pBlkTableRecord-&gt;close();<BR>pPolyEnt-&gt;close();<BR>}<BR><BR><BR>主要是pPolyEnt = new AcDbPolyline(numPts)前的部分<BR>AcArray类模板不好理解<BR>最好能帮助帮助注释一下<BR>谢谢</FONT>
页: [1]
查看完整版本: 好心人帮忙解释一下程序