| 412 | } |
| 413 | |
| 414 | DrawViewDimension* |
| 415 | DrawDimHelper::makeDistDim(DrawViewPart* dvp, std::string dimType, |
| 416 | Base::Vector3d inMin,//is this scaled or unscaled?? |
| 417 | Base::Vector3d inMax,//expects scaled from makeExtentDim |
| 418 | bool extent) |
| 419 | { |
| 420 | // Base::Console().message("DDH::makeDistDim() - inMin: %s inMax: %s\n", |
| 421 | // DrawUtil::formatVector(inMin).c_str(), |
| 422 | // DrawUtil::formatVector(inMax).c_str()); |
| 423 | TechDraw::DrawPage* page = dvp->findParentPage(); |
| 424 | std::string pageName = page->getNameInDocument(); |
| 425 | |
| 426 | TechDraw::DrawViewDimension* dim = nullptr; |
| 427 | App::Document* doc = dvp->getDocument(); |
| 428 | std::string dimName = doc->getUniqueObjectName("Dimension"); |
| 429 | if (extent) { |
| 430 | dimName = doc->getUniqueObjectName("DimExtent"); |
| 431 | } |
| 432 | |
| 433 | std::vector<TechDraw::VertexPtr> gVerts = dvp->getVertexGeometry(); |
| 434 | |
| 435 | // invert the point so the math works correctly |
| 436 | Base::Vector3d cleanMin = DrawUtil::invertY(inMin); |
| 437 | cleanMin = CosmeticVertex::makeCanonicalPoint(dvp, cleanMin); |
| 438 | std::string tag1 = dvp->addCosmeticVertex(cleanMin); |
| 439 | int iGV1 = dvp->add1CVToGV(tag1); |
| 440 | |
| 441 | Base::Vector3d cleanMax = DrawUtil::invertY(inMax); |
| 442 | cleanMax = CosmeticVertex::makeCanonicalPoint(dvp, cleanMax); |
| 443 | std::string tag2 = dvp->addCosmeticVertex(cleanMax); |
| 444 | int iGV2 = dvp->add1CVToGV(tag2); |
| 445 | |
| 446 | gVerts = dvp->getVertexGeometry(); |
| 447 | std::vector<App::DocumentObject*> objs; |
| 448 | std::vector<std::string> subs; |
| 449 | |
| 450 | std::stringstream ss; |
| 451 | ss << "Vertex" << iGV1; |
| 452 | std::string vertexName = ss.str(); |
| 453 | subs.push_back(vertexName); |
| 454 | objs.push_back(dvp); |
| 455 | |
| 456 | ss.clear(); |
| 457 | ss.str(std::string()); |
| 458 | ss << "Vertex" << iGV2; |
| 459 | vertexName = ss.str(); |
| 460 | subs.push_back(vertexName); |
| 461 | objs.push_back(dvp); |
| 462 | |
| 463 | if (extent) { |
| 464 | Base::Interpreter().runStringArg( |
| 465 | "App.activeDocument().addObject('TechDraw::DrawViewDimExtent', '%s')", dimName.c_str()); |
| 466 | Base::Interpreter().runStringArg( |
| 467 | "App.activeDocument().%s.translateLabel('DrawViewDimExtent', 'DimExtent', '%s')", |
| 468 | dimName.c_str(), dimName.c_str()); |
| 469 | } |
| 470 | else { |
| 471 | Base::Interpreter().runStringArg( |
nothing calls this directly
no test coverage detected