Part, PartDesign, Attacher: fix a few problems with infinite shapes
To throw an error instead of returning a semi-infinite result that kills rendering. fixes #3439
This commit is contained in:
@@ -800,8 +800,9 @@ void AttachEngine::readLinks(const App::PropertyLinkSubList &references,
|
||||
geof->Placement.getValue().multVec(Base::Vector3d(),org);
|
||||
//make shape - an local-XY plane infinite face
|
||||
gp_Pln pl = gp_Pln(gp_Pnt(org.x, org.y, org.z), gp_Dir(norm.x, norm.y, norm.z));
|
||||
BRepBuilderAPI_MakeFace builder(pl);
|
||||
storage.push_back( builder.Shape() );
|
||||
TopoDS_Shape myShape = BRepBuilderAPI_MakeFace(pl).Shape();
|
||||
myShape.Infinite(true);
|
||||
storage.push_back(myShape);
|
||||
shapes[i] = &(storage[storage.size()-1]);
|
||||
} else if ( geof->isDerivedFrom(App::Line::getClassTypeId()) ){
|
||||
//obtain X axis and origin of placement
|
||||
@@ -812,8 +813,9 @@ void AttachEngine::readLinks(const App::PropertyLinkSubList &references,
|
||||
geof->Placement.getValue().multVec(Base::Vector3d(),org);
|
||||
//make shape - an infinite line along local X axis
|
||||
gp_Lin l = gp_Lin(gp_Pnt(org.x, org.y, org.z), gp_Dir(dir.x, dir.y, dir.z));
|
||||
BRepBuilderAPI_MakeEdge builder(l);
|
||||
storage.push_back( builder.Shape() );
|
||||
TopoDS_Shape myShape = BRepBuilderAPI_MakeEdge(l).Shape();
|
||||
myShape.Infinite(true);
|
||||
storage.push_back(myShape);
|
||||
shapes[i] = &(storage[storage.size()-1]);
|
||||
} else {
|
||||
Base::Console().Warning("Attacher: linked object %s is unexpected, assuming it has no shape.\n",geof->getNameInDocument());
|
||||
@@ -2011,7 +2013,10 @@ Base::Placement AttachEnginePoint::calculateAttachedPlacement(Base::Placement or
|
||||
} else if (sh.ShapeType() == TopAbs_EDGE) {
|
||||
const TopoDS_Edge &e = TopoDS::Edge(sh);
|
||||
BRepAdaptor_Curve crv(e);
|
||||
BasePoint = crv.Value(crv.FirstParameter());
|
||||
double u = crv.FirstParameter();
|
||||
if(Precision::IsInfinite(u))
|
||||
throw Base::ValueError("Edge is infinite");
|
||||
BasePoint = crv.Value(u);
|
||||
}
|
||||
|
||||
}break;
|
||||
|
||||
@@ -44,7 +44,9 @@ Line::Line()
|
||||
BRepBuilderAPI_MakeEdge builder(gp_Lin(gp_Pnt(0,0,0), gp_Dir(0,0,1)));
|
||||
if (!builder.IsDone())
|
||||
return;
|
||||
Shape.setValue(builder.Shape());
|
||||
TopoDS_Shape myShape = builder.Shape();
|
||||
myShape.Infinite(Standard_True);
|
||||
Shape.setValue(myShape);
|
||||
|
||||
Support.touch();
|
||||
}
|
||||
|
||||
@@ -60,7 +60,9 @@ Plane::Plane()
|
||||
BRepBuilderAPI_MakeFace builder(gp_Pln(gp_Pnt(0,0,0), gp_Dir(0,0,1)));
|
||||
if (!builder.IsDone())
|
||||
return;
|
||||
Shape.setValue(builder.Shape());
|
||||
TopoDS_Shape myShape = builder.Shape();
|
||||
myShape.Infinite(Standard_True);
|
||||
Shape.setValue(myShape);
|
||||
}
|
||||
|
||||
Plane::~Plane()
|
||||
|
||||
Reference in New Issue
Block a user