TA的每日心情 | 开心 昨天 06:36 |
---|
签到天数: 15 天 [LV.4]偶尔看看III
管理员
- 积分
- 1308
|
- void cmdDispProperty()
- {
- ArxDbgUiPrEntity prEnt(采用T("请选择由 Pline组成的封闭多边形"), NULL);
- prEnt.addAllowedClass(AcDbPolyline::desc());
- if (prEnt.go() != ArxDbgUiPrBase::kOk)
- {
- return;
- }
- AcDbEntity* pEnt1 = NULL;
- acdbOpenObject(pEnt1,prEnt.objectId(),AcDb::kForRead);
- //获得封闭形顶点
- AcDbPolyline *Polygon = NULL ;
- Polygon = AcDbPolyline::cast(pEnt1);
- ASSERT( Polygon != NULL );
- if (Polygon == NULL)
- {
- AfxMessageBox(采用T("线型不为多义线"));
- pEnt1->close();
- return;
- }
- if( !Polygon->isClosed() )
- {
- Polygon->close();
- AfxMessageBox(采用T("外轮廓不封闭"));
- return;
- }
- AcGePoint3d *pPtArray;//记录外轮廓上的点
- int VertNum = (int)Polygon->numVerts() ;
- pPtArray = new AcGePoint3d[VertNum];
- int i;
- for( i = 0; i < VertNum; i ++ )
- {
- AcGePoint3d Temp;
- Polygon->getPointAt(i,Temp);
- pPtArray<i> = Temp;
- }
- pEnt1->close();
- AcGePoint3d centroid;
-
- GetCentroidPt(pPtArray, VertNum, centroid);
- TCHAR Text[132];
- 采用stprintf(Text, 采用T("%.3f"), centroid.y);
-
- DelGroupEnt(采用T("neuotrol"));
- DrawElevLine2(centroid,Text,采用T("Neuotrol"));
- }
复制代码 |
|