Make Open vertices detection routine accesible to Python
This commit is contained in:
@@ -105,7 +105,7 @@ SketchObject::SketchObject()
|
||||
ADD_PROPERTY_TYPE(ExternalGeometry,(0,0),"Sketch",(App::PropertyType)(App::Prop_None),"Sketch external geometry");
|
||||
|
||||
Geometry.setOrderRelevant(true);
|
||||
|
||||
|
||||
allowOtherBody = true;
|
||||
allowUnaligned = true;
|
||||
|
||||
@@ -1657,7 +1657,7 @@ int SketchObject::fillet(int GeoId1, int GeoId2,
|
||||
Base::Console().Log("offset int(%f,%f,0)\n",inter.first.x,inter.first.y);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int res = selectintersection(offsetintersectionpoints,filletcenterpoint,refPnt1, refPnt2);
|
||||
|
||||
if(res != 0)
|
||||
@@ -1665,8 +1665,8 @@ int SketchObject::fillet(int GeoId1, int GeoId2,
|
||||
|
||||
#ifdef DEBUG
|
||||
Base::Console().Log("selected offset int(%f,%f,0)\n",filletcenterpoint.first.x,filletcenterpoint.first.y);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
double refoparam1;
|
||||
double refoparam2;
|
||||
|
||||
@@ -1869,13 +1869,13 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
|
||||
std::swap(GeoId1,GeoId2);
|
||||
std::swap(point1,point2);
|
||||
}
|
||||
|
||||
|
||||
auto handlemultipleintersection = [this] (Constraint * constr, int GeoId, PointPos pos, PointPos & secondPos) {
|
||||
|
||||
|
||||
Base::Vector3d cp = getPoint(constr->First,constr->FirstPos);
|
||||
|
||||
|
||||
Base::Vector3d ee = getPoint(GeoId,pos);
|
||||
|
||||
|
||||
if( (ee-cp).Length() < Precision::Confusion() ) {
|
||||
secondPos = constr->FirstPos;
|
||||
}
|
||||
@@ -2080,8 +2080,8 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
|
||||
handlemultipleintersection(constr, GeoId, end, secondPos2);
|
||||
}
|
||||
}
|
||||
|
||||
if( (constrType1 == Sketcher::Coincident && secondPos1 == Sketcher::none) ||
|
||||
|
||||
if( (constrType1 == Sketcher::Coincident && secondPos1 == Sketcher::none) ||
|
||||
(constrType2 == Sketcher::Coincident && secondPos2 == Sketcher::none))
|
||||
THROWM(ValueError,"Invalid position Sketcher::none when creating a Coincident constraint")
|
||||
|
||||
@@ -2161,17 +2161,17 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
|
||||
delete geoNew;
|
||||
rebuildVertexIndex();
|
||||
|
||||
|
||||
|
||||
auto handleinternalalignment = [this] (Constraint * constr, int GeoId, PointPos & secondPos) {
|
||||
if( constr->Type == Sketcher::InternalAlignment &&
|
||||
( constr->AlignmentType == Sketcher::EllipseMajorDiameter ||
|
||||
if( constr->Type == Sketcher::InternalAlignment &&
|
||||
( constr->AlignmentType == Sketcher::EllipseMajorDiameter ||
|
||||
constr->AlignmentType == Sketcher::EllipseMinorDiameter ) ) {
|
||||
|
||||
|
||||
Base::Vector3d sp = getPoint(constr->First,start);
|
||||
Base::Vector3d ep = getPoint(constr->First,end);
|
||||
|
||||
|
||||
Base::Vector3d ee = getPoint(GeoId,start);
|
||||
|
||||
|
||||
if( (ee-sp).Length() < (ee-ep).Length() ) {
|
||||
secondPos = Sketcher::start;
|
||||
}
|
||||
@@ -2179,8 +2179,8 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
|
||||
secondPos = Sketcher::end;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
PointPos secondPos1 = Sketcher::none, secondPos2 = Sketcher::none;
|
||||
ConstraintType constrType1 = Sketcher::PointOnObject, constrType2 = Sketcher::PointOnObject;
|
||||
for (std::vector<Constraint *>::const_iterator it=constraints.begin();
|
||||
@@ -2194,10 +2194,10 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
|
||||
else {
|
||||
handlemultipleintersection(constr, GeoId, start, secondPos1);
|
||||
}
|
||||
|
||||
|
||||
} else if(secondPos2 == Sketcher::none && (constr->First == GeoId2 && constr->Second == GeoId)) {
|
||||
constrType2 = Sketcher::Coincident;
|
||||
|
||||
|
||||
if(constr->FirstPos == Sketcher::none){
|
||||
handleinternalalignment(constr, GeoId, secondPos2);
|
||||
}
|
||||
@@ -2206,8 +2206,8 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( (constrType1 == Sketcher::Coincident && secondPos1 == Sketcher::none) ||
|
||||
|
||||
if( (constrType1 == Sketcher::Coincident && secondPos1 == Sketcher::none) ||
|
||||
(constrType2 == Sketcher::Coincident && secondPos2 == Sketcher::none))
|
||||
THROWM(ValueError,"Invalid position Sketcher::none when creating a Coincident constraint")
|
||||
|
||||
@@ -6953,6 +6953,16 @@ int SketchObject::autoRemoveRedundants(bool updategeo)
|
||||
return redundants.size();
|
||||
}
|
||||
|
||||
std::vector<Base::Vector3d> SketchObject::getOpenVertices(void) const
|
||||
{
|
||||
std::vector<Base::Vector3d> points;
|
||||
|
||||
if(analyser)
|
||||
points = analyser->getOpenVertices();
|
||||
|
||||
return points;
|
||||
}
|
||||
|
||||
// Python Sketcher feature ---------------------------------------------------------
|
||||
|
||||
namespace App {
|
||||
|
||||
Reference in New Issue
Block a user