Sketcher: Solver - add map for Internal Alignment geometry

This commit is contained in:
Abdullah Tahiri
2022-12-11 04:52:49 +01:00
committed by Chris Hennes
parent dd64ab8ea0
commit a199afad5f
2 changed files with 18 additions and 0 deletions

View File

@@ -111,6 +111,8 @@ void Sketch::clear()
pDependencyGroups.clear();
solverExtensions.clear();
internalAlignmentGeometryMap.clear();
// deleting the geometry copied into this sketch
for (std::vector<GeoDef>::iterator it = Geoms.begin(); it != Geoms.end(); ++it)
if (it->geo) delete it->geo;
@@ -230,6 +232,8 @@ int Sketch::setUpSketch(const std::vector<Part::Geometry *> &GeoList,
Base::Console().Log("\n");
#endif //DEBUG_BLOCK_CONSTRAINT
buildInternalAlignmentGeometryMap(ConstraintList);
addGeometry(intGeoList,onlyBlockedGeometry);
int extStart=Geoms.size();
addGeometry(extGeoList, true);
@@ -314,6 +318,15 @@ int Sketch::setUpSketch(const std::vector<Part::Geometry *> &GeoList,
return GCSsys.dofsNumber();
}
void Sketch::buildInternalAlignmentGeometryMap(const std::vector<Constraint *> &constraintList)
{
for(auto* c : constraintList) {
if(c->Type==InternalAlignment){
internalAlignmentGeometryMap[c->First]=c->Second;
}
}
}
void Sketch::fixParametersAndDiagnose(std::vector<double *> &params_to_block)
{
if(!params_to_block.empty()) { // only there are parameters to fix

View File

@@ -455,6 +455,9 @@ protected:
// map of geoIds to corresponding solverextensions. This is useful when solved geometry is NOT to be assigned to the SketchObject
std::vector<std::shared_ptr<SolverGeometryExtension>> solverExtensions;
// maps a geoid corresponding to an internalgeometry (focus,knot,pole) to the geometry it defines (ellipse, hyperbola, B-Spline)
std::map< int, int > internalAlignmentGeometryMap;
std::vector < std::set < std::pair< int, Sketcher::PointPos>>> pDependencyGroups;
// this map is intended to convert a parameter (double *) into a GeoId/PointPos and parameter number
@@ -520,6 +523,8 @@ private:
void clearTemporaryConstraints();
void buildInternalAlignmentGeometryMap(const std::vector<Constraint *> &constraintList);
int internalSolve(std::string & solvername, int level = 0);
/// checks if the index bounds and converts negative indices to positive