clang-format on
| 255 | |
| 256 | // clang-format on |
| 257 | void SketchObject::buildShape() |
| 258 | { |
| 259 | // We use the following instead to map element names |
| 260 | |
| 261 | std::vector<Part::TopoShape> shapes; |
| 262 | std::vector<Part::TopoShape> vertices; |
| 263 | int geoId = 0; |
| 264 | |
| 265 | auto addVertex = [&vertices](auto vertex, auto name) { |
| 266 | if (!vertex.hasElementMap()) { |
| 267 | vertex.resetElementMap(std::make_shared<Data::ElementMap>()); |
| 268 | } |
| 269 | vertex.setElementName( |
| 270 | Data::IndexedName::fromConst("Vertex", 1), |
| 271 | Data::MappedName::fromRawData(name.c_str()), |
| 272 | 0L |
| 273 | ); |
| 274 | vertices.push_back(vertex); |
| 275 | vertices.back().copyElementMap(vertex, Part::OpCodes::Sketch); |
| 276 | }; |
| 277 | |
| 278 | auto addEdge = [this, &shapes](auto geo, auto indexedName) { |
| 279 | shapes.push_back(getEdge(geo, convertSubName(indexedName, false).c_str())); |
| 280 | if (checkSmallEdge(shapes.back())) { |
| 281 | FC_WARN("Edge too small: " << indexedName); |
| 282 | } |
| 283 | }; |
| 284 | |
| 285 | // get the geometry after running the solver |
| 286 | auto geometries = solvedSketch.extractGeometry(); |
| 287 | for (auto geo : geometries) { |
| 288 | ++geoId; |
| 289 | if (GeometryFacade::getConstruction(geo)) { |
| 290 | continue; |
| 291 | } |
| 292 | if (geo->isDerivedFrom<Part::GeomPoint>()) { |
| 293 | int idx = getVertexIndexGeoPos(geoId - 1, Sketcher::PointPos::start); |
| 294 | addVertex( |
| 295 | Part::TopoShape {TopoDS::Vertex(geo->toShape())}, |
| 296 | convertSubName(Data::IndexedName::fromConst("Vertex", idx + 1), false) |
| 297 | ); |
| 298 | } |
| 299 | else { |
| 300 | auto indexedName = Data::IndexedName::fromConst("Edge", geoId); |
| 301 | addEdge(geo, indexedName); |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | for (auto geo : geometries) { |
| 306 | delete geo; |
| 307 | } |
| 308 | |
| 309 | for (int i = 2; i < ExternalGeo.getSize(); ++i) { |
| 310 | auto geo = ExternalGeo[i]; |
| 311 | auto egf = ExternalGeometryFacade::getFacade(geo); |
| 312 | if (!egf->testFlag(ExternalGeometryExtension::Defining)) { |
| 313 | continue; |
| 314 | } |
nothing calls this directly
no test coverage detected