void frgExtractTopologicalEntsFromLinesAlgm::_extract_vertices_from_lines(std::vector<Vertex2dsOnSegment2d> &seg_pnts_pairs, const AcDbObjectIdArray &ids) { AcDbEntity *entity = NULL; acedSetStatusBarProgressMeter(_T("正在提取每根线段上的节点..."), 0, ids.length()); for (int i = 0; i < ids.length(); i++) { acdbOpenAcDbEntity(entity, ids[i], AcDb::kForRead); if (entity == NULL) continue; if (entity->isA() != AcDbLine::desc()) { entity->close(); continue; } AcDbLine *line = (AcDbLine *)entity; Vertex2dsOnSegment2d stru; stru.seg.set(AcGePoint2d(line->startPoint().x, line->startPoint().y), AcGePoint2d(line->endPoint().x, line->endPoint().y)); entity->close(); _extract_from_seg(stru); seg_pnts_pairs.push_back(stru); acedSetStatusBarProgressMeterPos(i); } acedRestoreStatusBar(); }
void ArxDbgDbAdeskLogo::getReferenceAttachmentPoint(AcDbEntity* ent, AcGePoint3d& toPt) { AcDbCircle* circ; AcDbArc* arc; AcDbLine* line; AcDbPoint* point; AcDbBlockReference* blkRef; if ((circ = AcDbCircle::cast(ent)) != NULL) toPt = circ->center(); else if ((arc = AcDbArc::cast(ent)) != NULL) toPt = arc->center(); else if ((line = AcDbLine::cast(ent)) != NULL) toPt = line->startPoint(); else if ((point = AcDbPoint::cast(ent)) != NULL) toPt = point->position(); else if ((blkRef = AcDbBlockReference::cast(ent)) != NULL) toPt = blkRef->position(); else { // can't get anything better so just rely on the ECS. If the // raw AutoCAD entities would do this, we wouldn't need the above // switch statement. AcGeMatrix3d mat; ent->getEcs(mat); AcGeVector3d v1, v2, v3; mat.getCoordSystem(toPt, v1, v2, v3); } }