PartDesign: modernize type checking
This commit is contained in:
@@ -104,7 +104,7 @@ const std::list<gp_Trsf> PolarPattern::getTransformations(const std::vector<App:
|
||||
|
||||
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")
|
||||
@@ -121,19 +121,19 @@ const std::list<gp_Trsf> PolarPattern::getTransformations(const std::vector<App:
|
||||
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::Line::getClassTypeId())) {
|
||||
} else if (refObject->isDerivedFrom<PartDesign::Line>()) {
|
||||
PartDesign::Line* line = static_cast<PartDesign::Line*>(refObject);
|
||||
Base::Vector3d base = line->getBasePoint();
|
||||
axbase = gp_Pnt(base.x, base.y, base.z);
|
||||
Base::Vector3d dir = line->getDirection();
|
||||
axdir = gp_Dir(dir.x, dir.y, dir.z);
|
||||
} else if (refObject->getTypeId().isDerivedFrom(App::Line::getClassTypeId())) {
|
||||
} else if (refObject->isDerivedFrom<App::Line>()) {
|
||||
App::Line* line = static_cast<App::Line*>(refObject);
|
||||
Base::Rotation rot = line->Placement.getValue().getRotation();
|
||||
Base::Vector3d d(1,0,0);
|
||||
rot.multVec(d, d);
|
||||
axdir = gp_Dir(d.x, d.y, d.z);
|
||||
} else if (refObject->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
} else if (refObject->isDerivedFrom<Part::Feature>()) {
|
||||
if (subStrings[0].empty())
|
||||
throw Base::ValueError("No axis reference specified");
|
||||
Part::Feature* refFeature = static_cast<Part::Feature*>(refObject);
|
||||
|
||||
Reference in New Issue
Block a user