From e875704c2cb5f5c966eb15f3e2124c189745c2dd Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Mon, 21 Dec 2020 19:55:03 +0100 Subject: [PATCH] Sketcher: Support for defining point --- src/Mod/Sketcher/App/SketchObject.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index ae62a15c75..2c06b904ba 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -900,7 +900,12 @@ int SketchObject::addGeometry(const std::vector &geoList, bool for( auto & v : geoList) { Part::Geometry* copy = v->copy(); - if(construction && copy->getTypeId() != Part::GeomPoint::getClassTypeId()) { + if( copy->getTypeId() == Part::GeomPoint::getClassTypeId()) { + // creation mode for points is always construction not to + // break legacy code + GeometryFacade::setConstruction(copy, true); + } + else if(construction) { GeometryFacade::setConstruction(copy, construction); } @@ -928,8 +933,14 @@ int SketchObject::addGeometry(const Part::Geometry *geo, bool construction/*=fal Part::Geometry *geoNew = geo->copy(); - if(geoNew->getTypeId() != Part::GeomPoint::getClassTypeId()) + if( geoNew->getTypeId() == Part::GeomPoint::getClassTypeId()) { + // creation mode for points is always construction not to + // break legacy code + GeometryFacade::setConstruction(geoNew, true); + } + else if(construction) { GeometryFacade::setConstruction(geoNew, construction); + } newVals.push_back(geoNew); @@ -1129,7 +1140,7 @@ int SketchObject::toggleConstruction(int GeoId) if (GeoId < 0 || GeoId >= int(vals.size())) return -1; - if(vals[GeoId]->getTypeId() == Part::GeomPoint::getClassTypeId()) + if(getGeometryFacade(GeoId)->isInternalAligned()) return -1; std::vector< Part::Geometry * > newVals(vals); @@ -1139,7 +1150,8 @@ int SketchObject::toggleConstruction(int GeoId) newVals[i] = newVals[i]->clone(); if((int)i == GeoId) { - GeometryFacade::setConstruction(newVals[i], !GeometryFacade::getConstruction(newVals[i])); + auto gft = GeometryFacade::getFacade(newVals[i]); + gft->setConstruction(!gft->getConstruction()); } } @@ -1162,7 +1174,7 @@ int SketchObject::setConstruction(int GeoId, bool on) if (GeoId < 0 || GeoId >= int(vals.size())) return -1; - if(vals[GeoId]->getTypeId() == Part::GeomPoint::getClassTypeId()) + if(getGeometryFacade(GeoId)->isInternalAligned()) return -1; std::vector< Part::Geometry * > newVals(vals);