while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr->IsCurve3D()) {
- Standard_Real first, last;
- TopLoc_Location L;
- const Handle(Geom_Curve)& C = BRep_Tool::Curve(E, L, first, last);
- if (!C.IsNull()) return Standard_True;
+ Handle(BRep_Curve3D) GC (Handle(BRep_Curve3D)::DownCast (cr));
+ if (! GC.IsNull() && ! GC->Curve3D().IsNull())
+ return Standard_True;
}
else if (cr->IsCurveOnSurface()) return Standard_True;
itcr.Next();
#include <BRepGProp_Sinert.hxx>
#include <BRepGProp_Vinert.hxx>
#include <BRepGProp_VinertGK.hxx>
+#include <GProp_PGProps.hxx>
#include <BRepGProp_Face.hxx>
#include <BRepGProp_Domain.hxx>
#include <TopoDS.hxx>
SProps = GProp_GProps(P);
BRepAdaptor_Curve BAC;
- // Standard_Integer n,i;
+ Standard_Real eps = Epsilon(1.);
TopExp_Explorer ex;
for (ex.Init(S,TopAbs_EDGE); ex.More(); ex.Next()) {
- BAC.Initialize(TopoDS::Edge(ex.Current()));
- BRepGProp_Cinert CG(BAC,P);
- SProps.Add(CG);
+ const TopoDS_Edge& aE = TopoDS::Edge(ex.Current());
+ if(!BRep_Tool::IsGeometric(aE))
+ {
+ GProp_PGProps aPProps;
+ TopoDS_Iterator anIter(aE);
+ for(; anIter.More(); anIter.Next())
+ {
+ const TopoDS_Vertex& aV = TopoDS::Vertex(anIter.Value());
+ aPProps.AddPoint(BRep_Tool::Pnt(aV), eps);
+ }
+ SProps.Add(aPProps);
+ }
+ else
+ {
+ BAC.Initialize(aE);
+ BRepGProp_Cinert CG(BAC,P);
+ SProps.Add(CG);
+ }
}
}
Mat Mp (XYZ (Ixx, Ixy, Ixz), XYZ (Ixy, Iyy, Iyz), XYZ (Ixz, Iyz, Izz));
if (dim == 0) {
dim = Density;
- g.SetXYZ (P.XYZ().Multiplied (Density));
+ g = P;
inertia = Mp * Density;
}
else {
--- /dev/null
+puts "============"
+puts "0027063: BRepGProps raises e x c e p t i o n on edge with no curves"
+puts "============"
+
+restore [locate_data_file bug27063_emptyedge.brep] result
+
+puts "Check that lprops does not crash on empty edge"
+lprops result