}
}
+ if (aSeqEdgesIn->IsEmpty()) {
+ Standard_ConstructionError::Raise("No edges given");
+ }
+
// 2. Connect edges to wires of maximum length
Handle(TopTools_HSequenceOfShape) aSeqWiresOut;
ShapeAnalysis_FreeBounds::ConnectEdgesToWires(aSeqEdgesIn, Precision::Confusion(),
}
}
- }
- else if (aType == SOLID_SHELL) {
- anExpectedType = TopAbs_SOLID;
-
- Handle(GEOM_Function) aRefShell = aCI.GetBase();
- TopoDS_Shape aShapeShell = aRefShell->GetValue();
- if (!aShapeShell.IsNull() && aShapeShell.ShapeType() == TopAbs_COMPOUND) {
- TopoDS_Iterator It (aShapeShell, Standard_True, Standard_True);
- if (It.More()) aShapeShell = It.Value();
- }
- if (aShapeShell.IsNull() || aShapeShell.ShapeType() != TopAbs_SHELL) {
- Standard_NullObject::Raise("Shape for solid construction is null or not a shell");
- }
-
- BRepCheck_Shell chkShell(TopoDS::Shell(aShapeShell));
- if (chkShell.Closed() == BRepCheck_NotClosed) return 0;
-
- TopoDS_Solid Sol;
- B.MakeSolid(Sol);
- B.Add(Sol, aShapeShell);
- BRepClass3d_SolidClassifier SC (Sol);
- SC.PerformInfinitePoint(Precision::Confusion());
- if (SC.State() == TopAbs_IN) {
- B.MakeSolid(Sol);
- B.Add(Sol, aShapeShell.Reversed());
- }
-
- aShape = Sol;
-
}
else if (aType == SOLID_SHELLS) {
anExpectedType = TopAbs_SOLID;
aShape = C;
}
- /*
- else if (aType == REVERSE_ORIENTATION) {
- Handle(GEOM_Function) aRefShape = aCI.GetBase();
- TopoDS_Shape aShape_i = aRefShape->GetValue();
- if (aShape_i.IsNull()) {
- Standard_NullObject::Raise("Shape for reverse is null");
- }
-
- BRepBuilderAPI_Copy Copy(aShape_i);
- if( Copy.IsDone() ) {
- TopoDS_Shape tds = Copy.Shape();
- if( tds.IsNull() ) {
- Standard_ConstructionError::Raise("Orientation aborted : Can not reverse the shape");
- }
-
- if( tds.Orientation() == TopAbs_FORWARD)
- tds.Orientation(TopAbs_REVERSED);
- else
- tds.Orientation(TopAbs_FORWARD);
-
- aShape = tds;
- }
- }
- */
else if (aType == EDGE_WIRE) {
anExpectedType = TopAbs_EDGE;
TColStd_SequenceOfReal TolSeq;
GeomAbs_CurveType CurType;
TopoDS_Vertex FirstVertex, LastVertex;
+ Standard_Real aPntShiftDist = 0.;
BRepTools_WireExplorer wexp(theWire) ;
for (; wexp.More(); wexp.Next())
gp_Pnt P2 = ElCLib::Value(lpar, aLine);
NewFpar = ElCLib::Parameter(PrevLine, P1);
NewLpar = ElCLib::Parameter(PrevLine, P2);
+
+ // Compute shift
+ if (ConnectByOrigin == TopAbs_FORWARD) {
+ gp_Pnt aNewP2 = ElCLib::Value(NewLpar, PrevLine);
+
+ aPntShiftDist += P2.Distance(aNewP2);
+ } else {
+ gp_Pnt aNewP1 = ElCLib::Value(NewFpar, PrevLine);
+
+ aPntShiftDist += P1.Distance(aNewP1);
+ }
+
if (NewLpar < NewFpar)
{
Standard_Real MemNewFpar = NewFpar;
Abs(aCircle.Radius() - PrevCircle.Radius()) <= LinTol &&
aCircle.Axis().IsParallel(PrevCircle.Axis(), AngTol))
{
+ const Standard_Boolean isFwd = ConnectByOrigin == TopAbs_FORWARD;
+
if (aCircle.Axis().Direction() * PrevCircle.Axis().Direction() < 0.)
{
Standard_Real memfpar = fpar;
gp_Pnt P2 = ElCLib::Value(lpar, aCircle);
NewFpar = ElCLib::Parameter(PrevCircle, P1);
NewLpar = ElCLib::Parameter(PrevCircle, P2);
+
+ // Compute shift
+ if (isFwd) {
+ gp_Pnt aNewP2 = ElCLib::Value(NewLpar, PrevCircle);
+
+ aPntShiftDist += P2.Distance(aNewP2);
+ } else {
+ gp_Pnt aNewP1 = ElCLib::Value(NewFpar, PrevCircle);
+
+ aPntShiftDist += P1.Distance(aNewP1);
+ }
+
if (NewLpar < NewFpar)
NewLpar += 2.*M_PI;
//Standard_Real MemNewFpar = NewFpar, MemNewLpar = NewLpar;
Abs(anEllipse.MinorRadius() - PrevEllipse.MinorRadius()) <= LinTol &&
anEllipse.Axis().IsParallel(PrevEllipse.Axis(), AngTol))
{
+ const Standard_Boolean isFwd = ConnectByOrigin == TopAbs_FORWARD;
+
if (anEllipse.Axis().Direction() * PrevEllipse.Axis().Direction() < 0.)
{
Standard_Real memfpar = fpar;
gp_Pnt P2 = ElCLib::Value(lpar, anEllipse);
NewFpar = ElCLib::Parameter(PrevEllipse, P1);
NewLpar = ElCLib::Parameter(PrevEllipse, P2);
+
+ // Compute shift
+ if (isFwd) {
+ gp_Pnt aNewP2 = ElCLib::Value(NewLpar, PrevEllipse);
+
+ aPntShiftDist += P2.Distance(aNewP2);
+ } else {
+ gp_Pnt aNewP1 = ElCLib::Value(NewFpar, PrevEllipse);
+
+ aPntShiftDist += P1.Distance(aNewP1);
+ }
+
if (NewLpar < NewFpar)
NewLpar += 2.*M_PI;
if (ConnectByOrigin == TopAbs_FORWARD)
gp_Pnt P2 = ElCLib::Value(lpar, aHypr);
NewFpar = ElCLib::Parameter(PrevHypr, P1);
NewLpar = ElCLib::Parameter(PrevHypr, P2);
+
+ // Compute shift
+ if (ConnectByOrigin == TopAbs_FORWARD) {
+ gp_Pnt aNewP2 = ElCLib::Value(NewLpar, PrevHypr);
+
+ aPntShiftDist += P2.Distance(aNewP2);
+ } else {
+ gp_Pnt aNewP1 = ElCLib::Value(NewFpar, PrevHypr);
+
+ aPntShiftDist += P1.Distance(aNewP1);
+ }
+
if (NewLpar < NewFpar)
{
Standard_Real MemNewFpar = NewFpar;
gp_Pnt P2 = ElCLib::Value(lpar, aParab);
NewFpar = ElCLib::Parameter(PrevParab, P1);
NewLpar = ElCLib::Parameter(PrevParab, P2);
+
+ // Compute shift
+ if (ConnectByOrigin == TopAbs_FORWARD) {
+ gp_Pnt aNewP2 = ElCLib::Value(NewLpar, PrevParab);
+
+ aPntShiftDist += P2.Distance(aNewP2);
+ } else {
+ gp_Pnt aNewP1 = ElCLib::Value(NewFpar, PrevParab);
+
+ aPntShiftDist += P1.Distance(aNewP1);
+ }
+
if (NewLpar < NewFpar)
{
Standard_Real MemNewFpar = NewFpar;
LocSeq.Append(aLocShape);
FparSeq.Append(fpar);
LparSeq.Append(lpar);
- TolSeq.Append(BRep_Tool::Tolerance(CurVertex));
+ TolSeq.Append(aPntShiftDist + BRep_Tool::Tolerance(CurVertex));
+ aPntShiftDist = 0.;
CurType = aType;
}
} // end of else (CurveSeq.IsEmpty()) -> not first time
} // end for (; wexp.More(); wexp.Next())
LastVertex = wexp.CurrentVertex();
- TolSeq.Append(BRep_Tool::Tolerance(LastVertex));
+ TolSeq.Append(aPntShiftDist + BRep_Tool::Tolerance(LastVertex));
FirstVertex.Orientation(TopAbs_FORWARD);
LastVertex.Orientation(TopAbs_REVERSED);
theOperationName = "SHELL";
AddParam( theParams, "Objects", aCI.GetShapes() );
break;
- case SOLID_SHELL:
case SOLID_SHELLS:
theOperationName = "SOLID";
AddParam( theParams, "Objects", aCI.GetShapes() );