+ modified declaration of external geometry in setUpSketch
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5344 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
parent
137904c5a8
commit
40ebead233
|
@ -97,20 +97,19 @@ void Sketch::clear(void)
|
|||
}
|
||||
|
||||
int Sketch::setUpSketch(const std::vector<Part::Geometry *> &GeoList, const std::vector<Constraint *> &ConstraintList,
|
||||
bool withDiagnose)
|
||||
{
|
||||
return setUpSketch(GeoList, std::vector<Part::Geometry *>(0), ConstraintList);
|
||||
}
|
||||
|
||||
int Sketch::setUpSketch(const std::vector<Part::Geometry *> &GeoList, const std::vector<Part::Geometry *> &ExternalGeoList,
|
||||
const std::vector<Constraint *> &ConstraintList, bool withDiagnose)
|
||||
bool withDiagnose, int extGeoCount)
|
||||
{
|
||||
clear();
|
||||
|
||||
addGeometry(GeoList);
|
||||
std::vector<Part::Geometry *> intGeoList, extGeoList;
|
||||
for (int i=0; i < int(GeoList.size())-extGeoCount; i++)
|
||||
intGeoList.push_back(GeoList[i]);
|
||||
for (int i=int(GeoList.size())-extGeoCount; i < GeoList.size(); i++)
|
||||
extGeoList.push_back(GeoList[i]);
|
||||
|
||||
addGeometry(intGeoList);
|
||||
int extStart=Geoms.size();
|
||||
std::vector<Part::Geometry *> reversedExternalGeoList(ExternalGeoList.rbegin(),ExternalGeoList.rend());
|
||||
addGeometry(reversedExternalGeoList, true);
|
||||
addGeometry(extGeoList, true);
|
||||
int extEnd=Geoms.size()-1;
|
||||
for (int i=extStart; i <= extEnd; i++)
|
||||
Geoms[i].external = true;
|
||||
|
|
|
@ -55,9 +55,7 @@ public:
|
|||
void clear(void);
|
||||
/// set the sketch up with geoms and constraints
|
||||
int setUpSketch(const std::vector<Part::Geometry *> &GeoList, const std::vector<Constraint *> &ConstraintList,
|
||||
bool withDiagnose=true);
|
||||
int setUpSketch(const std::vector<Part::Geometry *> &GeoList, const std::vector<Part::Geometry *> &ExternalGeoList,
|
||||
const std::vector<Constraint *> &ConstraintList, bool withDiagnose=true);
|
||||
bool withDiagnose=true, int extGeoCount=0);
|
||||
/// return the actual geometry of the sketch a TopoShape
|
||||
Part::TopoShape toShape(void) const;
|
||||
/// add unspecified geometry
|
||||
|
|
|
@ -92,7 +92,8 @@ App::DocumentObjectExecReturn *SketchObject::execute(void)
|
|||
// setup and diagnose the sketch
|
||||
rebuildExternalGeometry();
|
||||
Sketch sketch;
|
||||
int dofs = sketch.setUpSketch(getInternalGeometry(), getExternalGeometry(), Constraints.getValues());
|
||||
int dofs = sketch.setUpSketch(getCompleteGeometry(), Constraints.getValues(),
|
||||
true, getExternalGeometryCount());
|
||||
if (dofs < 0) { // over-constrained sketch
|
||||
std::string msg="Over-constrained sketch\n";
|
||||
appendConflictMsg(sketch.getConflicting(), msg);
|
||||
|
@ -122,7 +123,8 @@ int SketchObject::hasConflicts(void) const
|
|||
{
|
||||
// set up a sketch (including dofs counting and diagnosing of conflicts)
|
||||
Sketch sketch;
|
||||
int dofs = sketch.setUpSketch(getInternalGeometry(), getExternalGeometry(), Constraints.getValues());
|
||||
int dofs = sketch.setUpSketch(getCompleteGeometry(), Constraints.getValues(),
|
||||
true, getExternalGeometryCount());
|
||||
if (dofs < 0) // over-constrained sketch
|
||||
return -2;
|
||||
if (sketch.hasConflicts()) // conflicting constraints
|
||||
|
@ -159,7 +161,8 @@ int SketchObject::setDatum(int ConstrId, double Datum)
|
|||
|
||||
// set up a sketch (including dofs counting and diagnosing of conflicts)
|
||||
Sketch sketch;
|
||||
int dofs = sketch.setUpSketch(getInternalGeometry(), getExternalGeometry(), Constraints.getValues());
|
||||
int dofs = sketch.setUpSketch(getCompleteGeometry(), Constraints.getValues(),
|
||||
true, getExternalGeometryCount());
|
||||
int err=0;
|
||||
if (dofs < 0) // over-constrained sketch
|
||||
err = -3;
|
||||
|
@ -184,7 +187,8 @@ int SketchObject::setDatum(int ConstrId, double Datum)
|
|||
int SketchObject::movePoint(int GeoId, PointPos PosId, const Base::Vector3d& toPoint, bool relative)
|
||||
{
|
||||
Sketch sketch;
|
||||
int dofs = sketch.setUpSketch(getInternalGeometry(), getExternalGeometry(), Constraints.getValues());
|
||||
int dofs = sketch.setUpSketch(getCompleteGeometry(), Constraints.getValues(),
|
||||
true, getExternalGeometryCount());
|
||||
if (dofs < 0) // over-constrained sketch
|
||||
return -1;
|
||||
if (sketch.hasConflicts()) // conflicting constraints
|
||||
|
@ -1176,7 +1180,7 @@ void SketchObject::rebuildExternalGeometry(void)
|
|||
|
||||
}
|
||||
|
||||
std::vector<Part::Geometry*> SketchObject::getCompleteGeometry(void)
|
||||
std::vector<Part::Geometry*> SketchObject::getCompleteGeometry(void) const
|
||||
{
|
||||
std::vector<Part::Geometry*> vals=getInternalGeometry();
|
||||
vals.insert(vals.end(), ExternalGeo.rbegin(), ExternalGeo.rend()); // in reverse order
|
||||
|
|
|
@ -96,7 +96,7 @@ public:
|
|||
int getExternalGeometryCount(void) const { return ExternalGeo.size(); }
|
||||
|
||||
/// retrieves a vector containing both normal and external Geometry (including the sketch axes)
|
||||
std::vector<Part::Geometry*> getCompleteGeometry(void);
|
||||
std::vector<Part::Geometry*> getCompleteGeometry(void) const;
|
||||
|
||||
/// returns non zero if the sketch contains conflicting constraints
|
||||
int hasConflicts(void) const;
|
||||
|
|
Loading…
Reference in New Issue
Block a user