Merge branch 'master' of ssh://free-cad.git.sourceforge.net/gitroot/free-cad/free-cad

This commit is contained in:
Yorik van Havre 2012-04-12 16:12:35 -03:00
commit e1c6afad78

View File

@ -59,6 +59,7 @@ void RuledSurface::onChanged(const App::Property* prop)
App::DocumentObjectExecReturn *RuledSurface::execute(void)
{
try {
App::DocumentObject* c1 = Curve1.getValue();
if (!(c1 && c1->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())))
return new App::DocumentObjectExecReturn("No shape linked.");
@ -72,15 +73,28 @@ App::DocumentObjectExecReturn *RuledSurface::execute(void)
if (element2.size() != 1)
return new App::DocumentObjectExecReturn("Not exactly one sub-shape linked.");
TopoDS_Shape curve1;
const Part::TopoShape& shape1 = static_cast<Part::Feature*>(c1)->Shape.getValue();
TopoDS_Shape curve1 = shape1.getSubShape(element1[0].c_str());
if (curve1.IsNull()) curve1 = shape1._Shape;
if (!shape1._Shape.IsNull()) {
if (shape1._Shape.ShapeType() == TopAbs_EDGE)
curve1 = shape1._Shape;
else if (shape1._Shape.ShapeType() == TopAbs_WIRE)
curve1 = shape1._Shape;
else
curve1 = shape1.getSubShape(element1[0].c_str());
}
TopoDS_Shape curve2;
const Part::TopoShape& shape2 = static_cast<Part::Feature*>(c2)->Shape.getValue();
TopoDS_Shape curve2 = shape2.getSubShape(element2[0].c_str());
if (curve2.IsNull()) curve2 = shape2._Shape;
if (!shape2._Shape.IsNull()) {
if (shape2._Shape.ShapeType() == TopAbs_EDGE)
curve2 = shape2._Shape;
else if (shape2._Shape.ShapeType() == TopAbs_WIRE)
curve2 = shape2._Shape;
else
curve2 = shape2.getSubShape(element2[0].c_str());
}
try {
if (curve1.IsNull() || curve2.IsNull())
return new App::DocumentObjectExecReturn("Linked shapes are empty.");
if (curve1.ShapeType() == TopAbs_EDGE && curve2.ShapeType() == TopAbs_EDGE) {