Sketcher: small asserts cleanup

This commit is contained in:
DeepSOIC
2015-03-12 23:41:10 +03:00
committed by wmayer
parent 51eab4cd14
commit e4716e0e29
2 changed files with 15 additions and 23 deletions

View File

@@ -245,8 +245,9 @@ int SketchObject::movePoint(int GeoId, PointPos PosId, const Base::Vector3d& toP
Base::Vector3d SketchObject::getPoint(int GeoId, PointPos PosId) const
{
assert(GeoId == H_Axis || GeoId == V_Axis ||
(GeoId <= getHighestCurveIndex() && GeoId >= -getExternalGeometryCount()) );
if(!(GeoId == H_Axis || GeoId == V_Axis
|| (GeoId <= getHighestCurveIndex() && GeoId >= -getExternalGeometryCount()) ))
throw Base::Exception("SketchObject::getPoint. Invalid GeoId was supplied.");
const Part::Geometry *geo = getGeometry(GeoId);
if (geo->getTypeId() == Part::GeomPoint::getClassTypeId()) {
const Part::GeomPoint *p = dynamic_cast<const Part::GeomPoint*>(geo);
@@ -1731,7 +1732,7 @@ int SketchObject::delExternal(int ExtGeoId)
if (copiedConstr->Third < GeoId &&
copiedConstr->Third != Constraint::GeoUndef)
copiedConstr->Third += 1;
newConstraints.push_back(copiedConstr);
}
}
@@ -2638,7 +2639,7 @@ int SketchObject::port_reversedExternalArcs(bool justAnalyze)
bool SketchObject::AutoLockTangencyAndPerpty(Constraint *cstr, bool bForce, bool bLock)
{
try{
assert ( cstr->Type == Tangent || cstr->Type == Perpendicular);
//assert ( cstr->Type == Tangent || cstr->Type == Perpendicular);
if(cstr->Value != 0.0 && ! bForce) /*tangency type already set. If not bForce - don't touch.*/
return true;
if(!bLock){
@@ -2683,7 +2684,6 @@ bool SketchObject::AutoLockTangencyAndPerpty(Constraint *cstr, bool bForce, bool
}
} catch (Base::Exception& e){
//failure to determine tangency type is not a big deal, so a warning.
assert(0);//but it shouldn't happen (failure to determine tangency type)!
Base::Console().Warning("Error in AutoLockTangency. %s \n", e.what());
return false;
}