Surface: modernize type checking
This commit is contained in:
@@ -63,7 +63,7 @@ App::DocumentObjectExecReturn* Cut::execute()
|
||||
Part::TopoShape ts2;
|
||||
|
||||
// Get first toposhape
|
||||
if (shapes[0]->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
if (shapes[0]->isDerivedFrom<Part::Feature>()) {
|
||||
ts1 = static_cast<Part::Feature*>(shapes[0])->Shape.getShape(); // Part::TopoShape 1
|
||||
}
|
||||
else {
|
||||
@@ -71,7 +71,7 @@ App::DocumentObjectExecReturn* Cut::execute()
|
||||
}
|
||||
|
||||
// Get second toposhape
|
||||
if (shapes[1]->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
if (shapes[1]->isDerivedFrom<Part::Feature>()) {
|
||||
ts2 = static_cast<Part::Feature*>(shapes[1])->Shape.getShape();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -95,7 +95,7 @@ short Extend::mustExecute() const
|
||||
App::DocumentObjectExecReturn* Extend::execute()
|
||||
{
|
||||
App::DocumentObject* part = Face.getValue();
|
||||
if (!part || !part->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
if (!part || !part->isDerivedFrom<Part::Feature>()) {
|
||||
return new App::DocumentObjectExecReturn("No shape linked.");
|
||||
}
|
||||
const auto& faces = Face.getSubValues();
|
||||
|
||||
@@ -141,7 +141,7 @@ void Filling::addConstraints(BRepFill_Filling& builder,
|
||||
App::DocumentObject* obj = edge_obj[index];
|
||||
const std::string& sub = edge_sub[index];
|
||||
|
||||
if (obj && obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
if (obj && obj->isDerivedFrom<Part::Feature>()) {
|
||||
// get the sub-edge of the part's shape
|
||||
const Part::TopoShape& shape = static_cast<Part::Feature*>(obj)->Shape.getShape();
|
||||
TopoDS_Shape edge = shape.getSubShape(sub.c_str());
|
||||
@@ -217,7 +217,7 @@ void Filling::addConstraints(BRepFill_Filling& builder,
|
||||
for (std::size_t index = 0; index < face_obj.size(); index++) {
|
||||
App::DocumentObject* obj = face_obj[index];
|
||||
const std::string& sub = face_sub[index];
|
||||
if (obj && obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
if (obj && obj->isDerivedFrom<Part::Feature>()) {
|
||||
const Part::TopoShape& shape = static_cast<Part::Feature*>(obj)->Shape.getShape();
|
||||
TopoDS_Shape face = shape.getSubShape(sub.c_str());
|
||||
if (!face.IsNull() && face.ShapeType() == TopAbs_FACE) {
|
||||
@@ -241,7 +241,7 @@ void Filling::addConstraints(BRepFill_Filling& builder, const App::PropertyLinkS
|
||||
for (const auto& it : points) {
|
||||
App::DocumentObject* obj = it.first;
|
||||
std::vector<std::string> sub = it.second;
|
||||
if (obj && obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
if (obj && obj->isDerivedFrom<Part::Feature>()) {
|
||||
const Part::TopoShape& shape = static_cast<Part::Feature*>(obj)->Shape.getShape();
|
||||
for (const auto& jt : sub) {
|
||||
TopoDS_Shape subShape = shape.getSubShape(jt.c_str());
|
||||
@@ -287,7 +287,7 @@ App::DocumentObjectExecReturn* Filling::execute()
|
||||
|
||||
// Load the initial surface if set
|
||||
App::DocumentObject* initFace = InitialFace.getValue();
|
||||
if (initFace && initFace->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
if (initFace && initFace->isDerivedFrom<Part::Feature>()) {
|
||||
const Part::TopoShape& shape = static_cast<Part::Feature*>(initFace)->Shape.getShape();
|
||||
std::vector<std::string> subNames = InitialFace.getSubValues();
|
||||
for (const auto& it : subNames) {
|
||||
|
||||
@@ -215,7 +215,7 @@ bool GeomFillSurface::getWire(TopoDS_Wire& aWire)
|
||||
|
||||
ShapeValidator validator;
|
||||
for (const auto& set : boundary) {
|
||||
if (set.first->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
if (set.first->isDerivedFrom<Part::Feature>()) {
|
||||
for (const auto& jt : set.second) {
|
||||
const Part::TopoShape& ts =
|
||||
static_cast<Part::Feature*>(set.first)->Shape.getShape();
|
||||
|
||||
@@ -56,7 +56,7 @@ App::DocumentObjectExecReturn* Sections::execute()
|
||||
// get the part object
|
||||
App::DocumentObject* obj = edge_obj[index];
|
||||
const std::string& sub = edge_sub[index];
|
||||
if (obj && obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
if (obj && obj->isDerivedFrom<Part::Feature>()) {
|
||||
// get the sub-edge of the part's shape
|
||||
const Part::TopoShape& shape = static_cast<Part::Feature*>(obj)->Shape.getShape();
|
||||
TopoDS_Shape edge = shape.getSubShape(sub.c_str());
|
||||
|
||||
@@ -81,7 +81,7 @@ App::DocumentObjectExecReturn* Sewing::execute()
|
||||
for (const auto& it : subset) {
|
||||
// the subset has the documentobject and the element name which belongs to it,
|
||||
// in our case for example the cube object and the "Edge1" string
|
||||
if (it.first->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
if (it.first->isDerivedFrom<Part::Feature>()) {
|
||||
// we get the shape of the document object which resemble the whole box
|
||||
Part::TopoShape ts = static_cast<Part::Feature*>(it.first)->Shape.getShape();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user