Rename 'OriginFeature' to 'DatumElement'

This commit is contained in:
PaddleStroke
2024-09-20 10:18:50 +02:00
parent 3c1358da10
commit 3e33cf61e5
14 changed files with 63 additions and 67 deletions

View File

@@ -65,7 +65,7 @@ const QString makeRefString(const App::DocumentObject* obj, const std::string& s
if (!obj)
return QObject::tr("No reference selected");
if (obj->isDerivedFrom<App::OriginFeature>() ||
if (obj->isDerivedFrom<App::DatumElement>() ||
obj->isDerivedFrom<Part::Datum>())
// App::Plane, Line or Datum feature
return QString::fromLatin1(obj->getNameInDocument());
@@ -374,7 +374,7 @@ void TaskAttacher::onSelectionChanged(const Gui::SelectionChanges& msg)
std::string subname = msg.pSubName;
// Remove subname for planes and datum features
if (selObj->isDerivedFrom<App::OriginFeature>() ||
if (selObj->isDerivedFrom<App::DatumElement>() ||
selObj->isDerivedFrom<Part::Datum>())
subname = "";

View File

@@ -350,7 +350,7 @@ PyObject* Feature::getPyObject()
bool Feature::isDatum(const App::DocumentObject* feature)
{
return feature->isDerivedFrom<App::OriginFeature>() ||
return feature->isDerivedFrom<App::DatumElement>() ||
feature->isDerivedFrom<Part::Datum>();
}

View File

@@ -68,7 +68,7 @@ bool ReferenceSelection::allow(App::Document* pDoc, App::DocumentObject* pObj, c
}
// Enable selection from origin of current part/
if (pObj->isDerivedFrom<App::OriginFeature>()) {
if (pObj->isDerivedFrom<App::DatumElement>()) {
return allowOrigin(body, originGroup, pObj);
}
@@ -301,7 +301,7 @@ bool getReferencedSelection(const App::DocumentObject* thisObj, const Gui::Selec
//of course only if thisObj is in a body, as otherwise the old workflow would not
//be supported
PartDesign::Body* body = PartDesignGui::getBodyFor(thisObj, false);
bool originfeature = selObj->isDerivedFrom(App::OriginFeature::getClassTypeId());
bool originfeature = selObj->isDerivedFrom(App::DatumElement::getClassTypeId());
if (!originfeature && body) {
PartDesign::Body* selBody = PartDesignGui::getBodyFor(selObj, false);
if (!selBody || body != selBody) {

View File

@@ -139,9 +139,9 @@ TaskFeaturePick::TaskFeaturePick(std::vector<App::DocumentObject*>& objects,
}
// check if we need to set any origin in temporary visibility mode
if (*statusIt != invalidShape
&& (*objIt)->isDerivedFrom(App::OriginFeature::getClassTypeId())) {
App::Origin* origin = static_cast<App::OriginFeature*>(*objIt)->getOrigin();
auto* datum = dynamic_cast<App::DatumElement*>(*objIt);
if (*statusIt != invalidShape && datum) {
App::Origin* origin = dynamic_cast<App::Origin*>(datum->getLCS());
if (origin) {
if ((*objIt)->isDerivedFrom(App::Plane::getClassTypeId())) {
originVisStatus[origin].set(planeBit, true);

View File

@@ -514,7 +514,7 @@ bool isFeatureMovable(App::DocumentObject* const feat)
if (feat->hasExtension(Part::AttachExtension::getExtensionClassTypeId())) {
auto attachable = feat->getExtensionByType<Part::AttachExtension>();
App::DocumentObject* support = attachable->AttachmentSupport.getValue();
if (support && !support->isDerivedFrom<App::OriginFeature>()) {
if (support && !support->isDerivedFrom<App::DatumElement>()) {
return false;
}
}
@@ -545,19 +545,19 @@ std::vector<App::DocumentObject*> collectMovableDependencies(std::vector<App::Do
}
if (auto prop = dynamic_cast<App::PropertyLinkSub*>(prim->getPropertyByName("ReferenceAxis"))) {
App::DocumentObject* axis = prop->getValue();
if (axis && !axis->isDerivedFrom<App::OriginFeature>()){
if (axis && !axis->isDerivedFrom<App::DatumElement>()){
unique_objs.insert(axis);
}
}
if (auto prop = dynamic_cast<App::PropertyLinkSub*>(prim->getPropertyByName("Spine"))) {
App::DocumentObject* axis = prop->getValue();
if (axis && !axis->isDerivedFrom<App::OriginFeature>()){
if (axis && !axis->isDerivedFrom<App::DatumElement>()){
unique_objs.insert(axis);
}
}
if (auto prop = dynamic_cast<App::PropertyLinkSub*>(prim->getPropertyByName("AuxillerySpine"))) {
App::DocumentObject* axis = prop->getValue();
if (axis && !axis->isDerivedFrom<App::OriginFeature>()){
if (axis && !axis->isDerivedFrom<App::DatumElement>()){
unique_objs.insert(axis);
}
}
@@ -576,9 +576,9 @@ void relinkToOrigin(App::DocumentObject* feat, PartDesign::Body* targetbody)
if (feat->hasExtension(Part::AttachExtension::getExtensionClassTypeId())) {
auto attachable = feat->getExtensionByType<Part::AttachExtension>();
App::DocumentObject* support = attachable->AttachmentSupport.getValue();
if (support && support->isDerivedFrom<App::OriginFeature>()) {
auto originfeat = static_cast<App::OriginFeature*>(support);
App::OriginFeature* targetOriginFeature = targetbody->getOrigin()->getOriginFeature(originfeat->Role.getValue());
if (support && support->isDerivedFrom<App::DatumElement>()) {
auto originfeat = static_cast<App::DatumElement*>(support);
App::DatumElement* targetOriginFeature = targetbody->getOrigin()->getDatumElement(originfeat->Role.getValue());
if (targetOriginFeature) {
attachable->AttachmentSupport.setValue(static_cast<App::DocumentObject*>(targetOriginFeature), "");
}
@@ -588,9 +588,9 @@ void relinkToOrigin(App::DocumentObject* feat, PartDesign::Body* targetbody)
auto prim = static_cast<PartDesign::ProfileBased*>(feat);
if (auto prop = static_cast<App::PropertyLinkSub*>(prim->getPropertyByName("ReferenceAxis"))) {
App::DocumentObject* axis = prop->getValue();
if (axis && axis->isDerivedFrom<App::OriginFeature>()){
auto originfeat = static_cast<App::OriginFeature*>(axis);
App::OriginFeature* targetOriginFeature = targetbody->getOrigin()->getOriginFeature(originfeat->Role.getValue());
if (axis && axis->isDerivedFrom<App::DatumElement>()){
auto originfeat = static_cast<App::DatumElement*>(axis);
App::DatumElement* targetOriginFeature = targetbody->getOrigin()->getDatumElement(originfeat->Role.getValue());
if (targetOriginFeature) {
prop->setValue(static_cast<App::DocumentObject*>(targetOriginFeature), std::vector<std::string>(0));
}