+ whitespace improvement
This commit is contained in:
parent
0950e1963a
commit
4fe99f2658
|
@ -1964,7 +1964,7 @@ TopoDS_Shape TopoShape::makeOffsetShape(double offset, double tol, bool intersec
|
|||
selfInter ? Standard_True : Standard_False,
|
||||
GeomAbs_JoinType(join));
|
||||
if (!mkOffset.IsDone())
|
||||
return TopoDS_Shape(); //maybe throw exception?
|
||||
return TopoDS_Shape(); //maybe throw exception?
|
||||
const TopoDS_Shape& res = mkOffset.Shape();
|
||||
if (!fill)
|
||||
return res;
|
||||
|
@ -1975,96 +1975,96 @@ TopoDS_Shape TopoShape::makeOffsetShape(double offset, double tol, bool intersec
|
|||
freeCheck.Perform();
|
||||
if (freeCheck.NbClosedFreeBounds() < 1)
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << "no closed bounds" << std::endl;
|
||||
Base::Console().Message(stream.str().c_str());
|
||||
return TopoDS_Shape(); //maybe throw exception?
|
||||
std::ostringstream stream;
|
||||
stream << "no closed bounds" << std::endl;
|
||||
Base::Console().Message(stream.str().c_str());
|
||||
return TopoDS_Shape(); //maybe throw exception?
|
||||
}
|
||||
|
||||
|
||||
BRep_Builder builder;
|
||||
TopoDS_Compound perimeterCompound;
|
||||
builder.MakeCompound(perimeterCompound);
|
||||
for (int index = 1; index <= freeCheck.NbClosedFreeBounds(); ++index)
|
||||
{
|
||||
TopoDS_Wire originalWire = freeCheck.ClosedFreeBound(index)->FreeBound();
|
||||
const BRepAlgo_Image& img = mkOffset.MakeOffset().OffsetEdgesFromShapes();
|
||||
|
||||
//build offset wire.
|
||||
TopoDS_Wire offsetWire;
|
||||
builder.MakeWire(offsetWire);
|
||||
TopExp_Explorer xp;
|
||||
for (xp.Init(originalWire, TopAbs_EDGE); xp.More(); xp.Next())
|
||||
{
|
||||
if (!img.HasImage(xp.Current()))
|
||||
TopoDS_Wire originalWire = freeCheck.ClosedFreeBound(index)->FreeBound();
|
||||
const BRepAlgo_Image& img = mkOffset.MakeOffset().OffsetEdgesFromShapes();
|
||||
|
||||
//build offset wire.
|
||||
TopoDS_Wire offsetWire;
|
||||
builder.MakeWire(offsetWire);
|
||||
TopExp_Explorer xp;
|
||||
for (xp.Init(originalWire, TopAbs_EDGE); xp.More(); xp.Next())
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << "no image for shape" << std::endl;
|
||||
Base::Console().Message(stream.str().c_str());
|
||||
return TopoDS_Shape();
|
||||
if (!img.HasImage(xp.Current()))
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << "no image for shape" << std::endl;
|
||||
Base::Console().Message(stream.str().c_str());
|
||||
return TopoDS_Shape();
|
||||
}
|
||||
const TopTools_ListOfShape& currentImage = img.Image(xp.Current());
|
||||
TopTools_ListIteratorOfListOfShape listIt;
|
||||
int edgeCount(0);
|
||||
TopoDS_Edge mappedEdge;
|
||||
for (listIt.Initialize(currentImage); listIt.More(); listIt.Next())
|
||||
{
|
||||
if (listIt.Value().ShapeType() != TopAbs_EDGE)
|
||||
continue;
|
||||
edgeCount++;
|
||||
mappedEdge = TopoDS::Edge(listIt.Value());
|
||||
}
|
||||
|
||||
if (edgeCount != 1)
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << "wrong edge count: " << edgeCount << std::endl;
|
||||
Base::Console().Message(stream.str().c_str());
|
||||
return TopoDS_Shape();
|
||||
}
|
||||
builder.Add(offsetWire, mappedEdge);
|
||||
}
|
||||
const TopTools_ListOfShape& currentImage = img.Image(xp.Current());
|
||||
TopTools_ListIteratorOfListOfShape listIt;
|
||||
int edgeCount(0);
|
||||
TopoDS_Edge mappedEdge;
|
||||
for (listIt.Initialize(currentImage); listIt.More(); listIt.Next())
|
||||
|
||||
//It would be nice if we could get thruSections to build planar faces
|
||||
//in all areas possible, so we could run through refine. I tried setting
|
||||
//ruled to standard_true, but that didn't have the desired affect.
|
||||
BRepOffsetAPI_ThruSections aGenerator;
|
||||
aGenerator.AddWire(originalWire);
|
||||
aGenerator.AddWire(offsetWire);
|
||||
aGenerator.Build();
|
||||
if (!aGenerator.IsDone())
|
||||
{
|
||||
if (listIt.Value().ShapeType() != TopAbs_EDGE)
|
||||
continue;
|
||||
edgeCount++;
|
||||
mappedEdge = TopoDS::Edge(listIt.Value());
|
||||
std::ostringstream stream;
|
||||
stream << "ThruSections failed" << std::endl;
|
||||
Base::Console().Message(stream.str().c_str());
|
||||
return TopoDS_Shape();
|
||||
}
|
||||
|
||||
if (edgeCount != 1)
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << "wrong edge count: " << edgeCount << std::endl;
|
||||
Base::Console().Message(stream.str().c_str());
|
||||
return TopoDS_Shape();
|
||||
}
|
||||
builder.Add(offsetWire, mappedEdge);
|
||||
}
|
||||
|
||||
//It would be nice if we could get thruSections to build planar faces
|
||||
//in all areas possible, so we could run through refine. I tried setting
|
||||
//ruled to standard_true, but that didn't have the desired affect.
|
||||
BRepOffsetAPI_ThruSections aGenerator;
|
||||
aGenerator.AddWire(originalWire);
|
||||
aGenerator.AddWire(offsetWire);
|
||||
aGenerator.Build();
|
||||
if (!aGenerator.IsDone())
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << "ThruSections failed" << std::endl;
|
||||
Base::Console().Message(stream.str().c_str());
|
||||
return TopoDS_Shape();
|
||||
}
|
||||
|
||||
builder.Add(perimeterCompound, aGenerator.Shape());
|
||||
|
||||
builder.Add(perimeterCompound, aGenerator.Shape());
|
||||
}
|
||||
|
||||
//still had to sew. not using the passed in parameter for sew.
|
||||
|
||||
//still had to sew. not using the passed in parameter for sew.
|
||||
//Sew has it's own default tolerance. Opinions?
|
||||
BRepBuilderAPI_Sewing sewTool;
|
||||
sewTool.Add(this->_Shape);
|
||||
sewTool.Add(perimeterCompound);
|
||||
sewTool.Add(res);
|
||||
sewTool.Perform(); //Perform Sewing
|
||||
|
||||
|
||||
TopoDS_Shape outputShape = sewTool.SewedShape();
|
||||
if ((outputShape.ShapeType() == TopAbs_SHELL) && (outputShape.Closed()))
|
||||
{
|
||||
BRepBuilderAPI_MakeSolid solidMaker(TopoDS::Shell(outputShape));
|
||||
if (solidMaker.IsDone())
|
||||
{
|
||||
TopoDS_Solid temp = solidMaker.Solid();
|
||||
//contrary to the occ docs the return value OrientCloseSolid doesn't
|
||||
//indicate whether the shell was open or not. It returns true with an
|
||||
//open shell and we end up with an invalid solid.
|
||||
if (BRepLib::OrientClosedSolid(temp))
|
||||
outputShape = temp;
|
||||
}
|
||||
BRepBuilderAPI_MakeSolid solidMaker(TopoDS::Shell(outputShape));
|
||||
if (solidMaker.IsDone())
|
||||
{
|
||||
TopoDS_Solid temp = solidMaker.Solid();
|
||||
//contrary to the occ docs the return value OrientCloseSolid doesn't
|
||||
//indicate whether the shell was open or not. It returns true with an
|
||||
//open shell and we end up with an invalid solid.
|
||||
if (BRepLib::OrientClosedSolid(temp))
|
||||
outputShape = temp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return outputShape;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user