PartDesign: modernize type checking
This commit is contained in:
@@ -68,7 +68,7 @@ const std::list<gp_Trsf> Mirrored::getTransformations(const std::vector<App::Doc
|
||||
|
||||
gp_Pnt axbase;
|
||||
gp_Dir axdir;
|
||||
if (refObject->getTypeId().isDerivedFrom(Part::Part2DObject::getClassTypeId())) {
|
||||
if (refObject->isDerivedFrom<Part::Part2DObject>()) {
|
||||
Part::Part2DObject* refSketch = static_cast<Part::Part2DObject*>(refObject);
|
||||
Base::Axis axis;
|
||||
if (subStrings[0] == "H_Axis")
|
||||
@@ -88,13 +88,13 @@ const std::list<gp_Trsf> Mirrored::getTransformations(const std::vector<App::Doc
|
||||
axis *= refSketch->Placement.getValue();
|
||||
axbase = gp_Pnt(axis.getBase().x, axis.getBase().y, axis.getBase().z);
|
||||
axdir = gp_Dir(axis.getDirection().x, axis.getDirection().y, axis.getDirection().z);
|
||||
} else if (refObject->getTypeId().isDerivedFrom(PartDesign::Plane::getClassTypeId())) {
|
||||
} else if (refObject->isDerivedFrom<PartDesign::Plane>()) {
|
||||
PartDesign::Plane* plane = static_cast<PartDesign::Plane*>(refObject);
|
||||
Base::Vector3d base = plane->getBasePoint();
|
||||
axbase = gp_Pnt(base.x, base.y, base.z);
|
||||
Base::Vector3d dir = plane->getNormal();
|
||||
axdir = gp_Dir(dir.x, dir.y, dir.z);
|
||||
} else if (refObject->getTypeId().isDerivedFrom(App::Plane::getClassTypeId())) {
|
||||
} else if (refObject->isDerivedFrom<App::Plane>()) {
|
||||
App::Plane* plane = static_cast<App::Plane*>(refObject);
|
||||
Base::Vector3d base = plane->Placement.getValue().getPosition();
|
||||
axbase = gp_Pnt(base.x, base.y, base.z);
|
||||
@@ -102,7 +102,7 @@ const std::list<gp_Trsf> Mirrored::getTransformations(const std::vector<App::Doc
|
||||
Base::Vector3d dir(0,0,1);
|
||||
rot.multVec(dir, dir);
|
||||
axdir = gp_Dir(dir.x, dir.y, dir.z);
|
||||
} else if (refObject->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
} else if (refObject->isDerivedFrom<Part::Feature>()) {
|
||||
if (subStrings[0].empty())
|
||||
throw Base::ValueError("No direction reference specified");
|
||||
Part::TopoShape baseShape = static_cast<Part::Feature*>(refObject)->Shape.getShape();
|
||||
|
||||
Reference in New Issue
Block a user