mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0026570: Crash on attempt to rotate a shape.
An extended draw-command trotate (ttranslate, tmirror, ...) by an additional parameter "-copy". New check of edge range is added in BRepCheck/BRepCheck_Edge.cxx The same checking is added in ShapeAnalysis_Edge.cxx Fixing this problem is added in ShapeFix_Wire.cxx GeomLib::SameRange(...) and BRepTools_TrsfModification::NewCurve2d(...) are modified to avoid exception in TrimmedCurve
This commit is contained in:
@@ -115,6 +115,13 @@ static Standard_Integer transform(Draw_Interpretor& ,Standard_Integer n,const ch
|
||||
const char* aName = a[0];
|
||||
|
||||
Standard_Boolean isBasic = Standard_False;
|
||||
Standard_Boolean isCopy = Standard_False;
|
||||
|
||||
// Check "copy" flag.
|
||||
if (!strcmp(a[n-1], "-copy")) {
|
||||
isCopy = Standard_True;
|
||||
last = --n;
|
||||
}
|
||||
|
||||
if (!strcmp(aName,"reset")) {
|
||||
}
|
||||
@@ -176,7 +183,7 @@ static Standard_Integer transform(Draw_Interpretor& ,Standard_Integer n,const ch
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
trf.Perform(S);
|
||||
trf.Perform(S, isCopy);
|
||||
if (!trf.IsDone())
|
||||
return 1;
|
||||
DBRep::Set(a[i],trf.Shape());
|
||||
@@ -1418,27 +1425,27 @@ void BRepTest::BasicCommands(Draw_Interpretor& theCommands)
|
||||
transform,g);
|
||||
|
||||
theCommands.Add("tmove",
|
||||
"tmove name1 name2 ... name, set location from name",
|
||||
"tmove name1 name2 ... name, set location from name [-copy]",
|
||||
__FILE__,
|
||||
transform,g);
|
||||
|
||||
theCommands.Add("ttranslate",
|
||||
"ttranslate name1 name2 ... dx dy dz",
|
||||
"ttranslate name1 name2 ... dx dy dz [-copy]",
|
||||
__FILE__,
|
||||
transform,g);
|
||||
|
||||
theCommands.Add("trotate",
|
||||
"trotate name1 name2 ... x y z dx dy dz angle",
|
||||
"trotate name1 name2 ... x y z dx dy dz angle [-copy]",
|
||||
__FILE__,
|
||||
transform,g);
|
||||
|
||||
theCommands.Add("tmirror",
|
||||
"tmirror name x y z dx dy dz",
|
||||
"tmirror name x y z dx dy dz [-copy]",
|
||||
__FILE__,
|
||||
transform,g);
|
||||
|
||||
theCommands.Add("tscale",
|
||||
"tscale name x y z scale",
|
||||
"tscale name x y z scale [-copy]",
|
||||
__FILE__,
|
||||
transform,g);
|
||||
|
||||
|
@@ -261,7 +261,24 @@ static Standard_Integer pcurve(Draw_Interpretor& , Standard_Integer n, const cha
|
||||
DrawTrSurf_CurveColor(col);
|
||||
|
||||
Sprintf(name,"%s_%d",a[1],i);
|
||||
DrawTrSurf::Set(name,new Geom2d_TrimmedCurve(c,f,l));
|
||||
Standard_Real fr = c->FirstParameter(), lr = c->LastParameter();
|
||||
Standard_Boolean IsPeriodic = c->IsPeriodic();
|
||||
if (c->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve))
|
||||
{
|
||||
const Handle(Geom2d_Curve)& aC = Handle(Geom2d_TrimmedCurve)::DownCast (c)->BasisCurve();
|
||||
IsPeriodic = aC->IsPeriodic();
|
||||
fr = aC->FirstParameter();
|
||||
lr = aC->LastParameter();
|
||||
}
|
||||
if(!IsPeriodic &&
|
||||
((fr - f > Precision::PConfusion()) || (l - lr > Precision::PConfusion())))
|
||||
{
|
||||
DrawTrSurf::Set(name, c);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawTrSurf::Set(name,new Geom2d_TrimmedCurve(c,f,l));
|
||||
}
|
||||
}
|
||||
DrawTrSurf_CurveColor(savecol);
|
||||
|
||||
@@ -276,10 +293,27 @@ static Standard_Integer pcurve(Draw_Interpretor& , Standard_Integer n, const cha
|
||||
Standard_Real f,l;
|
||||
const Handle(Geom2d_Curve) c = BRep_Tool::CurveOnSurface
|
||||
(TopoDS::Edge(SE),TopoDS::Face(SF),f,l);
|
||||
Standard_Real fr = c->FirstParameter(), lr = c->LastParameter();
|
||||
Standard_Boolean IsPeriodic = c->IsPeriodic();
|
||||
if (c->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve))
|
||||
{
|
||||
const Handle(Geom2d_Curve)& aC = Handle(Geom2d_TrimmedCurve)::DownCast (c)->BasisCurve();
|
||||
IsPeriodic = aC->IsPeriodic();
|
||||
fr = aC->FirstParameter();
|
||||
lr = aC->LastParameter();
|
||||
}
|
||||
|
||||
col = DBRep_ColorOrientation(SE.Orientation());
|
||||
DrawTrSurf_CurveColor(col);
|
||||
DrawTrSurf::Set(a[1],new Geom2d_TrimmedCurve(c,f,l));
|
||||
if(!IsPeriodic &&
|
||||
((fr - f > Precision::PConfusion()) || (l - lr > Precision::PConfusion())))
|
||||
{
|
||||
DrawTrSurf::Set(a[1], c);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawTrSurf::Set(a[1],new Geom2d_TrimmedCurve(c,f,l));
|
||||
}
|
||||
DrawTrSurf_CurveColor(savecol);
|
||||
}
|
||||
else {
|
||||
|
Reference in New Issue
Block a user